gh-104146: Argument clinic: remove unused methods and variables (#107608)

This commit is contained in:
Alex Waygood 2023-08-04 01:17:17 +01:00 committed by GitHub
parent 9e6590b097
commit ee78d01a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 23 deletions

View File

@ -377,8 +377,10 @@ def version_splitter(s: str) -> tuple[int, ...]:
return tuple(version) return tuple(version)
def version_comparitor(version1: str, version2: str) -> Literal[-1, 0, 1]: def version_comparitor(version1: str, version2: str) -> Literal[-1, 0, 1]:
iterator = itertools.zip_longest(version_splitter(version1), version_splitter(version2), fillvalue=0) iterator = itertools.zip_longest(
for i, (a, b) in enumerate(iterator): version_splitter(version1), version_splitter(version2), fillvalue=0
)
for a, b in iterator:
if a < b: if a < b:
return -1 return -1
if a > b: if a > b:
@ -4368,19 +4370,11 @@ class IndentStack:
""" """
return len(self.indents) return len(self.indents)
def indent(self, line: str) -> str:
"""
Indents a line by the currently defined margin.
"""
assert self.margin is not None, "Cannot call .indent() before calling .infer()"
return self.margin + line
def dedent(self, line: str) -> str: def dedent(self, line: str) -> str:
""" """
Dedents a line by the currently defined margin. Dedents a line by the currently defined margin.
(The inverse of 'indent'.)
""" """
assert self.margin is not None, "Cannot call .indent() before calling .infer()" assert self.margin is not None, "Cannot call .dedent() before calling .infer()"
margin = self.margin margin = self.margin
indent = self.indents[-1] indent = self.indents[-1]
if not line.startswith(margin): if not line.startswith(margin):
@ -4641,10 +4635,6 @@ class DSLParser:
return True return True
@staticmethod
def calculate_indent(line: str) -> int:
return len(line) - len(line.strip())
def next( def next(
self, self,
state: StateKeeper, state: StateKeeper,

View File

@ -65,14 +65,6 @@ class Monitor:
print(" ", ' '.join(str(x) for x in a)) print(" ", ' '.join(str(x) for x in a))
sys.exit(-1) sys.exit(-1)
def close(self) -> None:
if self.stack:
self.fail("Ended file while still in a preprocessor conditional block!")
def write(self, s: str) -> None:
for line in s.split("\n"):
self.writeline(line)
def writeline(self, line: str) -> None: def writeline(self, line: str) -> None:
self.line_number += 1 self.line_number += 1
line = line.strip() line = line.strip()