Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8a08ac

Browse files
duriantacocobaltt7
andauthored
Code Cleanup: removed dead code identified by Skylos (psf#5052)
Co-authored-by: cobalt <[email protected]>
1 parent 28686dc commit e8a08ac

3 files changed

Lines changed: 0 additions & 36 deletions

File tree

src/blib2to3/pgen2/pgen.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -225,29 +225,6 @@ def addclosure(state: NFAState, base: dict[NFAState, int]) -> None:
225225
state.addarc(st, label)
226226
return states # List of DFAState instances; first one is start
227227

228-
def dump_nfa(self, name: str, start: "NFAState", finish: "NFAState") -> None:
229-
print("Dump of NFA for", name)
230-
todo = [start]
231-
for i, state in enumerate(todo):
232-
print(" State", i, state is finish and "(final)" or "")
233-
for label, next in state.arcs:
234-
if next in todo:
235-
j = todo.index(next)
236-
else:
237-
j = len(todo)
238-
todo.append(next)
239-
if label is None:
240-
print(f" -> {j}")
241-
else:
242-
print(f" {label} -> {j}")
243-
244-
def dump_dfa(self, name: str, dfa: Sequence["DFAState"]) -> None:
245-
print("Dump of DFA for", name)
246-
for i, state in enumerate(dfa):
247-
print(" State", i, state.isfinal and "(final)" or "")
248-
for label, next in sorted(state.arcs.items()):
249-
print(f" {label} -> {dfa.index(next)}")
250-
251228
def simplify_dfa(self, dfa: list["DFAState"]) -> None:
252229
# This is not theoretically optimal, but works well enough.
253230
# Algorithm: repeatedly look for two states that have the same

src/blib2to3/pgen2/token.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,3 @@
8282
for _name, _value in list(globals().items()):
8383
if type(_value) is int:
8484
tok_name[_value] = _name
85-
86-
87-
def ISTERMINAL(x: int) -> bool:
88-
return x < NT_OFFSET
89-
90-
91-
def ISNONTERMINAL(x: int) -> bool:
92-
return x >= NT_OFFSET
93-
94-
95-
def ISEOF(x: int) -> bool:
96-
return x == ENDMARKER

src/blib2to3/pytree.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class Base:
6666
parent: Optional["Node"] = None # Parent node pointer, or None
6767
children: list[NL] # List of subnodes
6868
was_changed: bool = False
69-
was_checked: bool = False
7069

7170
def __new__(cls, *args, **kwds):
7271
"""Constructor that prevents Base from being instantiated."""

0 commit comments

Comments
 (0)