]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104050: Argument Clinic: Annotate the IndentStack class (#106934)
authorErlend E. Aasland <erlend@python.org>
Thu, 20 Jul 2023 23:19:11 +0000 (01:19 +0200)
committerGitHub <noreply@github.com>
Thu, 20 Jul 2023 23:19:11 +0000 (23:19 +0000)
Tools/clinic/clinic.py

index 003ecf784d711edf7afbb34ce5cc7b5e374a15ce..a204c1dd0dc2d6cb4ae37e03dfdbf25eca799ba0 100755 (executable)
@@ -4284,7 +4284,7 @@ class IndentStack:
         if not self.indents:
             fail('IndentStack expected indents, but none are defined.')
 
-    def measure(self, line):
+    def measure(self, line: str) -> int:
         """
         Returns the length of the line's margin.
         """
@@ -4298,7 +4298,7 @@ class IndentStack:
             return self.indents[-1]
         return len(line) - len(stripped)
 
-    def infer(self, line):
+    def infer(self, line: str) -> int:
         """
         Infer what is now the current margin based on this line.
         Returns:
@@ -4331,19 +4331,19 @@ class IndentStack:
         return outdent_count
 
     @property
-    def depth(self):
+    def depth(self) -> int:
         """
         Returns how many margins are currently defined.
         """
         return len(self.indents)
 
-    def indent(self, line):
+    def indent(self, line: str) -> str:
         """
         Indents a line by the currently defined margin.
         """
         return self.margin + line
 
-    def dedent(self, line):
+    def dedent(self, line: str) -> str:
         """
         Dedents a line by the currently defined margin.
         (The inverse of 'indent'.)