MCPcopy Index your code
hub / github.com/RustPython/RustPython / _get_positions_width

Function _get_positions_width

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

Source from the content-addressed store, hash-verified

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

Callers 2

disassembleFunction · 0.85
disMethod · 0.85

Calls 7

isinstanceFunction · 0.85
lenFunction · 0.85
strFunction · 0.85
maxFunction · 0.85
co_positionsMethod · 0.80
anyFunction · 0.70
sumFunction · 0.50

Tested by

no test coverage detected