Skip to content

Commit

Permalink
gh-104146: Argument clinic: remove unused methods and variables (#107608
Browse files Browse the repository at this point in the history
)
  • Loading branch information
AlexWaygood authored Aug 4, 2023
1 parent 9e6590b commit ee78d01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
20 changes: 5 additions & 15 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,10 @@ def flush() -> None:
return tuple(version)

def version_comparitor(version1: str, version2: str) -> Literal[-1, 0, 1]:
iterator = itertools.zip_longest(version_splitter(version1), version_splitter(version2), fillvalue=0)
for i, (a, b) in enumerate(iterator):
iterator = itertools.zip_longest(
version_splitter(version1), version_splitter(version2), fillvalue=0
)
for a, b in iterator:
if a < b:
return -1
if a > b:
Expand Down Expand Up @@ -4368,19 +4370,11 @@ def depth(self) -> int:
"""
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:
"""
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
indent = self.indents[-1]
if not line.startswith(margin):
Expand Down Expand Up @@ -4641,10 +4635,6 @@ def valid_line(self, line: str) -> bool:

return True

@staticmethod
def calculate_indent(line: str) -> int:
return len(line) - len(line.strip())

def next(
self,
state: StateKeeper,
Expand Down
8 changes: 0 additions & 8 deletions Tools/clinic/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ def fail(self, *a: object) -> NoReturn:
print(" ", ' '.join(str(x) for x in a))
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:
self.line_number += 1
line = line.strip()
Expand Down

0 comments on commit ee78d01

Please sign in to comment.