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

Function _get_positions_width

Lib/dis.py:885–900  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

883 return lineno_width
884
885def _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
902def _disassemble_bytes(code, lasti=-1, linestarts=None,
903 *, line_offset=0, exception_entries=(),

Callers 2

disassembleFunction · 0.85
disMethod · 0.85

Calls 2

strFunction · 0.85
anyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…