You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Python flake8 crap
Was testing realgud's C-x!8 (goto flake8 warning/error)
This commit is contained in:
@@ -62,7 +62,6 @@ Type -h for for full help.""" % program
|
|||||||
print(Usage_short, file=sys.stderr)
|
print(Usage_short, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
if os.path.exists(files[0]):
|
if os.path.exists(files[0]):
|
||||||
disassemble_file(file, sys.stdout, native)
|
disassemble_file(file, sys.stdout, native)
|
||||||
|
@@ -224,7 +224,6 @@ def main_bin():
|
|||||||
except (KeyboardInterrupt, OSError):
|
except (KeyboardInterrupt, OSError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if timestamp:
|
if timestamp:
|
||||||
print(time.strftime(timestampfmt))
|
print(time.strftime(timestampfmt))
|
||||||
|
|
||||||
|
@@ -40,7 +40,6 @@ class Python25Parser(Python26Parser):
|
|||||||
if self.version == 2.5:
|
if self.version == 2.5:
|
||||||
self.check_reduce['tryelsestmt'] = 'tokens'
|
self.check_reduce['tryelsestmt'] = 'tokens'
|
||||||
|
|
||||||
|
|
||||||
def reduce_is_invalid(self, rule, ast, tokens, first, last):
|
def reduce_is_invalid(self, rule, ast, tokens, first, last):
|
||||||
super(Python25Parser, self).reduce_is_invalid(rule, ast, tokens, first, last)
|
super(Python25Parser, self).reduce_is_invalid(rule, ast, tokens, first, last)
|
||||||
|
|
||||||
|
@@ -115,8 +115,10 @@ if __name__ == '__main__':
|
|||||||
""".split()))
|
""".split()))
|
||||||
remain_tokens = set(tokens) - opcode_set
|
remain_tokens = set(tokens) - opcode_set
|
||||||
import re
|
import re
|
||||||
remain_tokens = set([re.sub('_\d+$','', t) for t in remain_tokens])
|
remain_tokens = set([re.sub('_\d+$', '', t)
|
||||||
remain_tokens = set([re.sub('_CONT$','', t) for t in remain_tokens])
|
for t in remain_tokens])
|
||||||
|
remain_tokens = set([re.sub('_CONT$', '', t)
|
||||||
|
for t in remain_tokens])
|
||||||
remain_tokens = set(remain_tokens) - opcode_set
|
remain_tokens = set(remain_tokens) - opcode_set
|
||||||
print(remain_tokens)
|
print(remain_tokens)
|
||||||
# p.dumpGrammar()
|
# p.dumpGrammar()
|
||||||
|
@@ -37,7 +37,7 @@ class Scanner2(scan.Scanner):
|
|||||||
self.jump_forward = frozenset([self.opc.JUMP_ABSOLUTE, self.opc.JUMP_FORWARD])
|
self.jump_forward = frozenset([self.opc.JUMP_ABSOLUTE, self.opc.JUMP_FORWARD])
|
||||||
# This is the 2.5+ default
|
# This is the 2.5+ default
|
||||||
# For <2.5 it is <generator expression>
|
# For <2.5 it is <generator expression>
|
||||||
self.genexpr_name = '<genexpr>';
|
self.genexpr_name = '<genexpr>'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def unmangle_name(name, classname):
|
def unmangle_name(name, classname):
|
||||||
@@ -68,7 +68,6 @@ class Scanner2(scan.Scanner):
|
|||||||
varnames = co.co_varnames
|
varnames = co.co_varnames
|
||||||
return free, names, varnames
|
return free, names, varnames
|
||||||
|
|
||||||
|
|
||||||
def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
def ingest(self, co, classname=None, code_objects={}, show_asm=None):
|
||||||
"""
|
"""
|
||||||
Pick out tokens from an uncompyle6 code object, and transform them,
|
Pick out tokens from an uncompyle6 code object, and transform them,
|
||||||
|
@@ -159,7 +159,7 @@ class Scanner3(Scanner):
|
|||||||
|
|
||||||
customize = {}
|
customize = {}
|
||||||
if self.is_pypy:
|
if self.is_pypy:
|
||||||
customize['PyPy'] = 1;
|
customize['PyPy'] = 1
|
||||||
|
|
||||||
self.code = array('B', co.co_code)
|
self.code = array('B', co.co_code)
|
||||||
self.build_lines_data(co)
|
self.build_lines_data(co)
|
||||||
@@ -699,9 +699,9 @@ class Scanner3(Scanner):
|
|||||||
# everything inside inner 'or' jumps and midline ifs
|
# everything inside inner 'or' jumps and midline ifs
|
||||||
match = self.rem_or(start, self.next_stmt[offset],
|
match = self.rem_or(start, self.next_stmt[offset],
|
||||||
self.opc.POP_JUMP_IF_FALSE, target)
|
self.opc.POP_JUMP_IF_FALSE, target)
|
||||||
## We can't remove mid-line ifs because line structures have changed
|
# We can't remove mid-line ifs because line structures have changed
|
||||||
## from restructBytecode().
|
# from restructBytecode().
|
||||||
## match = self.remove_mid_line_ifs(match)
|
# match = self.remove_mid_line_ifs(match)
|
||||||
|
|
||||||
# If we still have any offsets in set, start working on it
|
# If we still have any offsets in set, start working on it
|
||||||
if match:
|
if match:
|
||||||
|
Reference in New Issue
Block a user