MCPcopy Index your code
hub / github.com/RustPython/RustPython / findlinestarts

Function findlinestarts

Lib/dis.py:981–993  ·  view source on GitHub ↗

Find the offsets in a byte code which are start of lines in the source. Generate pairs (offset, lineno) lineno will be an integer or None the offset does not have a source line.

(code)

Source from the content-addressed store, hash-verified

979 return labels
980
981def findlinestarts(code):
982 """Find the offsets in a byte code which are start of lines in the source.
983
984 Generate pairs (offset, lineno)
985 lineno will be an integer or None the offset does not have a source line.
986 """
987
988 lastline = False # None is a valid line number
989 for start, end, line in code.co_lines():
990 if line is not lastline:
991 lastline = line
992 yield start, line
993 return
994
995def _find_imports(co):
996 """Find import statements in the code

Callers 3

get_instructionsFunction · 0.85
disassembleFunction · 0.85
__init__Method · 0.85

Calls 1

co_linesMethod · 0.80

Tested by

no test coverage detected