summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-07-20 23:19:11 (GMT)
committerGitHub <noreply@github.com>2023-07-20 23:19:11 (GMT)
commitd81b4f8ff84311fa737e62f2883442ec06d7d5d8 (patch)
treeaad01c65e64f066be3102a20ba87be8cc5104c27 /Tools
parent12189108607a1d5d146f32094115297011c8b773 (diff)
downloadcpython-d81b4f8ff84311fa737e62f2883442ec06d7d5d8.zip
cpython-d81b4f8ff84311fa737e62f2883442ec06d7d5d8.tar.gz
cpython-d81b4f8ff84311fa737e62f2883442ec06d7d5d8.tar.bz2
gh-104050: Argument Clinic: Annotate the IndentStack class (#106934)
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/clinic/clinic.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 003ecf7..a204c1d 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -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'.)