MCPcopy
hub / github.com/rocky/python-uncompyle6 / __init__

Method __init__

uncompyle6/scanner.py:114–137  ·  view source on GitHub ↗
(self, version: tuple, show_asm=None, is_pypy=False)

Source from the content-addressed store, hash-verified

112
113class Scanner(ABC):
114 def __init__(self, version: tuple, show_asm=None, is_pypy=False):
115 self.version = version
116 self.show_asm = show_asm
117 self.is_pypy = is_pypy
118
119 # Temporary initialization.
120 self.opc = ModuleType("uninitialized")
121
122 if version[:2] in PYTHON_VERSIONS:
123 v_str = f"""opcode_{version_tuple_to_str(version, start=0, end=2, delimiter="")}"""
124 module_name = f"xdis.opcodes.{v_str}"
125 if is_pypy:
126 module_name += "pypy"
127 self.opc = importlib.import_module(module_name)
128 else:
129 raise TypeError(
130 "%s is not a Python version I know about"
131 % version_tuple_to_str(version)
132 )
133
134 self.opname = self.opc.opname
135
136 # FIXME: This weird Python2 behavior is not Python3
137 self.resetTokenClass()
138
139 def bound_collection_from_tokens(self, tokens, t, i, collection_type):
140 count = t.attr

Callers

nothing calls this directly

Calls 1

resetTokenClassMethod · 0.95

Tested by

no test coverage detected