MCPcopy Create free account
hub / github.com/python/mypy / iterate_python_lines

Function iterate_python_lines

mypy/report.py:146–150  ·  view source on GitHub ↗

Return an iterator over (line number, line text) from a Python file.

(path: str)

Source from the content-addressed store, hash-verified

144
145
146def iterate_python_lines(path: str) -> Iterator[tuple[int, str]]:
147 """Return an iterator over (line number, line text) from a Python file."""
148 if not os.path.isdir(path): # can happen with namespace packages
149 with tokenize.open(path) as input_file:
150 yield from enumerate(input_file, 1)
151
152
153class FuncCounterVisitor(TraverserVisitor):

Callers 3

on_fileMethod · 0.85
on_fileMethod · 0.85
on_fileMethod · 0.85

Calls 2

enumerateFunction · 0.85
isdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…