MCPcopy Index your code
hub / github.com/python/cpython / measure

Method measure

Tools/clinic/libclinic/dsl_parser.py:181–193  ·  view source on GitHub ↗

Returns the length of the line's margin.

(self, line: str)

Source from the content-addressed store, hash-verified

179 fail('IndentStack expected indents, but none are defined.')
180
181 def measure(self, line: str) -> int:
182 """
183 Returns the length of the line's margin.
184 """
185 if '\t' in line:
186 fail('Tab characters are illegal in the Argument Clinic DSL.')
187 stripped = line.lstrip()
188 if not len(stripped):
189 # we can't tell anything from an empty line
190 # so just pretend it's indented like our current indent
191 self._ensure()
192 return self.indents[-1]
193 return len(line) - len(stripped)
194
195 def infer(self, line: str) -> int:
196 """

Callers 2

inferMethod · 0.95

Calls 3

_ensureMethod · 0.95
failFunction · 0.90
lstripMethod · 0.45

Tested by

no test coverage detected