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)
| 979 | return labels |
| 980 | |
| 981 | def 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 | |
| 995 | def _find_imports(co): |
| 996 | """Find import statements in the code |
no test coverage detected