From 0b3e355460ce5db353bedf9aa9f35cdcc94862bf Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Thu, 3 Aug 2023 22:32:23 +0100 Subject: [PATCH] Argument clinic: remove unused methods and variables --- Tools/clinic/clinic.py | 20 +++++--------------- Tools/clinic/cpp.py | 8 -------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 1bcdb6b1c3640a..733a83ee58c0f4 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -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: @@ -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): @@ -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, diff --git a/Tools/clinic/cpp.py b/Tools/clinic/cpp.py index 5b7fa06494ad53..21a1b02e862c1c 100644 --- a/Tools/clinic/cpp.py +++ b/Tools/clinic/cpp.py @@ -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()