(code)
| 883 | return lineno_width |
| 884 | |
| 885 | def _get_positions_width(code): |
| 886 | # Positions are formatted as 'LINE:COL-ENDLINE:ENDCOL ' (note trailing space). |
| 887 | # A missing component appears as '?', and when all components are None, we |
| 888 | # render '_NO_LINENO'. thus the minimum width is 1 + len(_NO_LINENO). |
| 889 | # |
| 890 | # If all values are missing, positions are not printed (i.e. positions_width = 0). |
| 891 | has_value = False |
| 892 | values_width = 0 |
| 893 | for positions in code.co_positions(): |
| 894 | has_value |= any(isinstance(p, int) for p in positions) |
| 895 | width = sum(1 if p is None else len(str(p)) for p in positions) |
| 896 | values_width = max(width, values_width) |
| 897 | if has_value: |
| 898 | # 3 = number of separators in a normal format |
| 899 | return 1 + max(len(_NO_LINENO), 3 + values_width) |
| 900 | return 0 |
| 901 | |
| 902 | def _disassemble_bytes(code, lasti=-1, linestarts=None, |
| 903 | *, line_offset=0, exception_entries=(), |
no test coverage detected
searching dependent graphs…