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)
| 985 | return labels |
| 986 | |
| 987 | def 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 | |
| 1001 | def _find_imports(co): |
| 1002 | """Find import statements in the code |
no outgoing calls
no test coverage detected
searching dependent graphs…