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

Method dis

Lib/dis.py:1091–1128  ·  view source on GitHub ↗

Return a formatted view of the bytecode operations.

(self)

Source from the content-addressed store, hash-verified

1089 return _format_code_info(self.codeobj)
1090
1091 def dis(self):
1092 """Return a formatted view of the bytecode operations."""
1093 co = self.codeobj
1094 if self.current_offset is not None:
1095 offset = self.current_offset
1096 else:
1097 offset = -1
1098 with io.StringIO() as output:
1099 code = _get_code_array(co, self.adaptive)
1100 offset_width = len(str(max(len(code) - 2, 9999))) if self.show_offsets else 0
1101 if self.show_positions:
1102 lineno_width = _get_positions_width(co)
1103 else:
1104 lineno_width = _get_lineno_width(self._linestarts)
1105 labels_map = _make_labels_map(co.co_code, self.exception_entries)
1106 label_width = 4 + len(str(len(labels_map)))
1107 formatter = Formatter(file=output,
1108 lineno_width=lineno_width,
1109 offset_width=offset_width,
1110 label_width=label_width,
1111 line_offset=self._line_offset,
1112 show_caches=self.show_caches,
1113 show_positions=self.show_positions)
1114
1115 arg_resolver = ArgResolver(co_consts=co.co_consts,
1116 names=co.co_names,
1117 varname_from_oparg=co._varname_from_oparg,
1118 labels_map=labels_map)
1119 _disassemble_bytes(code,
1120 linestarts=self._linestarts,
1121 line_offset=self._line_offset,
1122 lasti=offset,
1123 exception_entries=self.exception_entries,
1124 co_positions=co.co_positions(),
1125 original_code=co.co_code,
1126 arg_resolver=arg_resolver,
1127 formatter=formatter)
1128 return output.getvalue()
1129
1130
1131def main(args=None):

Callers 15

test_exception_tableMethod · 0.80
check_stack_sizeFunction · 0.80
get_disassemblyMethod · 0.80
get_disassemblyMethod · 0.80
test_is_op_formatMethod · 0.80
test_disassembledMethod · 0.80
check_disMethod · 0.80

Calls 12

_get_code_arrayFunction · 0.85
lenFunction · 0.85
strFunction · 0.85
maxFunction · 0.85
_get_positions_widthFunction · 0.85
_get_lineno_widthFunction · 0.85
_make_labels_mapFunction · 0.85
ArgResolverClass · 0.85
_disassemble_bytesFunction · 0.85
co_positionsMethod · 0.80
FormatterClass · 0.70
getvalueMethod · 0.45

Tested by 13

test_exception_tableMethod · 0.64
check_stack_sizeFunction · 0.64
get_disassemblyMethod · 0.64
get_disassemblyMethod · 0.64
test_is_op_formatMethod · 0.64
test_disassembledMethod · 0.64
check_disMethod · 0.64