Python flake8 crap

Was testing realgud's C-x!8 (goto flake8 warning/error)
This commit is contained in:
rocky
2016-12-18 20:18:19 -05:00
parent c7c0a98982
commit e6761e13bb
8 changed files with 11 additions and 13 deletions

View File

@@ -62,7 +62,6 @@ Type -h for for full help.""" % program
print(Usage_short, file=sys.stderr)
sys.exit(1)
for file in files:
if os.path.exists(files[0]):
disassemble_file(file, sys.stdout, native)

View File

@@ -224,7 +224,6 @@ def main_bin():
except (KeyboardInterrupt, OSError):
pass
if timestamp:
print(time.strftime(timestampfmt))

View File

@@ -272,7 +272,7 @@ class Python2Parser(PythonParser):
continue
elif opname_base in ('BUILD_LIST', 'BUILD_TUPLE', 'BUILD_SET'):
thousands = (v//1024)
thirty32s = ((v//32)%32)
thirty32s = ((v//32) % 32)
if thirty32s > 0:
rule = "expr32 ::=%s" % (' expr' * 32)
self.add_unique_rule(rule, opname_base, v, customize)

View File

@@ -40,7 +40,6 @@ class Python25Parser(Python26Parser):
if self.version == 2.5:
self.check_reduce['tryelsestmt'] = 'tokens'
def reduce_is_invalid(self, rule, ast, tokens, first, last):
super(Python25Parser, self).reduce_is_invalid(rule, ast, tokens, first, last)

View File

@@ -115,8 +115,10 @@ if __name__ == '__main__':
""".split()))
remain_tokens = set(tokens) - opcode_set
import re
remain_tokens = set([re.sub('_\d+$','', t) for t in remain_tokens])
remain_tokens = set([re.sub('_CONT$','', t) for t in remain_tokens])
remain_tokens = set([re.sub('_\d+$', '', t)
for t in remain_tokens])
remain_tokens = set([re.sub('_CONT$', '', t)
for t in remain_tokens])
remain_tokens = set(remain_tokens) - opcode_set
print(remain_tokens)
# p.dumpGrammar()

View File

@@ -550,7 +550,7 @@ class Python3Parser(PythonParser):
elif opname_base in ('BUILD_LIST', 'BUILD_TUPLE', 'BUILD_SET'):
v = token.attr
rule = ('build_list ::= ' + 'expr1024 ' * int(v//1024) +
'expr32 ' * int((v//32)%32) + 'expr '*(v%32) + opname)
'expr32 ' * int((v//32)%32) + 'expr '*(v % 32) + opname)
self.add_unique_rule(rule, opname, token.attr, customize)
if opname_base == 'BUILD_TUPLE':
rule = ('load_closure ::= %s%s' % (('LOAD_CLOSURE ' * v), opname))

View File

@@ -37,7 +37,7 @@ class Scanner2(scan.Scanner):
self.jump_forward = frozenset([self.opc.JUMP_ABSOLUTE, self.opc.JUMP_FORWARD])
# This is the 2.5+ default
# For <2.5 it is <generator expression>
self.genexpr_name = '<genexpr>';
self.genexpr_name = '<genexpr>'
@staticmethod
def unmangle_name(name, classname):
@@ -68,7 +68,6 @@ class Scanner2(scan.Scanner):
varnames = co.co_varnames
return free, names, varnames
def ingest(self, co, classname=None, code_objects={}, show_asm=None):
"""
Pick out tokens from an uncompyle6 code object, and transform them,

View File

@@ -159,7 +159,7 @@ class Scanner3(Scanner):
customize = {}
if self.is_pypy:
customize['PyPy'] = 1;
customize['PyPy'] = 1
self.code = array('B', co.co_code)
self.build_lines_data(co)
@@ -699,9 +699,9 @@ class Scanner3(Scanner):
# everything inside inner 'or' jumps and midline ifs
match = self.rem_or(start, self.next_stmt[offset],
self.opc.POP_JUMP_IF_FALSE, target)
## We can't remove mid-line ifs because line structures have changed
## from restructBytecode().
## match = self.remove_mid_line_ifs(match)
# We can't remove mid-line ifs because line structures have changed
# from restructBytecode().
# match = self.remove_mid_line_ifs(match)
# If we still have any offsets in set, start working on it
if match: