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

Method is_stop_line

Tools/clinic/libclinic/block_parser.py:178–190  ·  view source on GitHub ↗
(line: str)

Source from the content-addressed store, hash-verified

176 body_prefix = self.language.body_prefix.format(dsl_name=dsl_name)
177
178 def is_stop_line(line: str) -> bool:
179 # make sure to recognize stop line even if it
180 # doesn't end with EOL (it could be the very end of the file)
181 if line.startswith(stop_line):
182 remainder = line.removeprefix(stop_line)
183 if remainder and not remainder.isspace():
184 fail(f"Garbage after stop line: {remainder!r}")
185 return True
186 else:
187 # gh-92256: don't allow incorrectly formatted stop lines
188 if line.lstrip().startswith(stop_line):
189 fail(f"Whitespace is not allowed before the stop line: {line!r}")
190 return False
191
192 # consume body of program
193 while self.input:

Callers

nothing calls this directly

Calls 5

failFunction · 0.90
isspaceMethod · 0.80
startswithMethod · 0.45
removeprefixMethod · 0.45
lstripMethod · 0.45

Tested by

no test coverage detected