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

Function findlinestarts

Lib/dis.py:987–999  ·  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

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

Callers 3

get_instructionsFunction · 0.85
disassembleFunction · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…