You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Merge branch 'master' into python-3.3-to-3.5
This commit is contained in:
@@ -22,6 +22,7 @@ scanners, e.g. for Python 2.7 or 3.4.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from abc import ABC
|
||||
from array import array
|
||||
from collections import namedtuple
|
||||
|
||||
@@ -89,7 +90,7 @@ def long(num):
|
||||
CONST_COLLECTIONS = ("CONST_LIST", "CONST_SET", "CONST_DICT", "CONST_MAP")
|
||||
|
||||
|
||||
class Code(object):
|
||||
class Code:
|
||||
"""
|
||||
Class for representing code-objects.
|
||||
|
||||
@@ -108,7 +109,7 @@ class Code(object):
|
||||
self._tokens, self._customize = scanner.ingest(co, classname, show_asm=show_asm)
|
||||
|
||||
|
||||
class Scanner:
|
||||
class Scanner(ABC):
|
||||
def __init__(self, version: tuple, show_asm=None, is_pypy=False):
|
||||
self.version = version
|
||||
self.show_asm = show_asm
|
||||
@@ -292,7 +293,13 @@ class Scanner:
|
||||
return False
|
||||
return offset < self.get_target(offset)
|
||||
|
||||
def prev_offset(self, offset):
|
||||
def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
||||
"""
|
||||
Code to tokenize disassembly. Subclasses must implement this.
|
||||
"""
|
||||
raise NotImplementedError("This method should have been implemented")
|
||||
|
||||
def prev_offset(self, offset: int) -> int:
|
||||
return self.insts[self.offset2inst_index[offset] - 1].offset
|
||||
|
||||
def get_inst(self, offset):
|
||||
|
Reference in New Issue
Block a user