Closed cclauss closed 5 years ago
reload() was moved in Python 3 and file(), long, __raw_input(), and xrange() were removed and print()__ became a function. This PR proposes fixes that provide equivalent functionality in both Python 2 and Python 3.
Before this PR: flake8 testing of https://github.com/joxeankoret/pigaios on Python 3.7.1
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./sourceimp_core.py:24:3: F821 undefined name 'reload' reload(pigaios_ml) ^ ./sourceimp_core.py:383:10: F821 undefined name 'long' ea = long(bin_row["ea"]) ^ ./sourceimp_core.py:458:19: F821 undefined name 'long' func_ea = long(row[0]) ^ ./sourceimp_core.py:490:17: F821 undefined name 'long' func_ea = long(row[0]) ^ ./sourceimp_core.py:518:17: F821 undefined name 'long' func_ea = long(row[0]) ^ ./sourceimp_core.py:702:43: F821 undefined name 'long' log(msg % (call_type, src_id, long(bin_ea), row["name"], len(bin_rows) * len(src_rows))) ^ ./sourceimp_core.py:714:34: F821 undefined name 'long' self.add_match(long(src_row[call_type]), bin_row[call_type], ^ ./sourceimp_core.py:728:18: F821 undefined name 'long' bin_id = long(row["id"]) ^ ./sourceimp_core.py:819:46: F821 undefined name 'long' bin_func_name = self.get_function_name(long(ea)) ^ ./sourceimp_ida.py:21:1: F821 undefined name 'reload' reload(sourceimp_core) ^ ./exporters/SimpleEval.py:112:14: F821 undefined name 'long' tmp1 = long(val1) ^ ./exporters/SimpleEval.py:113:14: F821 undefined name 'long' tmp2 = long(val2) ^ ./exporters/SimpleEval.py:117:14: F821 undefined name 'long' tmp1 = long(val1) ^ ./exporters/SimpleEval.py:118:14: F821 undefined name 'long' tmp2 = long(val2) ^ ./exporters/SimpleEval.py:122:14: F821 undefined name 'long' tmp1 = long(val1) ^ ./exporters/SimpleEval.py:123:14: F821 undefined name 'long' tmp2 = long(val2) ^ ./exporters/SimpleEval.py:127:14: F821 undefined name 'long' tmp1 = long(val1) ^ ./exporters/SimpleEval.py:128:14: F821 undefined name 'long' tmp2 = long(val2) ^ ./exporters/SimpleEval.py:162:15: F821 undefined name 'long' token = long(token, 16) ^ ./exporters/SimpleEval.py:164:15: F821 undefined name 'long' token = long(token, 8) ^ ./exporters/SimpleEval.py:251:11: F821 undefined name 'raw_input' cmd = raw_input("C expr> ") ^ ./exporters/kfuzzy.py:278:77: E999 SyntaxError: invalid syntax print "Warning! Support for big files (%d MB > %d MB) is broken!" % (size/1024/1024, self.big_file_size / 1024 / 1024) ^ ./exporters/simple_macro_parser.py:107:33: E999 SyntaxError: invalid syntax print "Usage: %s <source file>" % sys.argv[0] ^ ./exporters/base_support.py:89:12: F821 undefined name 'xrange' for i in xrange(64): ^ 2 E999 SyntaxError: invalid syntax 22 F821 undefined name 'long' 24
reload() was moved in Python 3 and file(), long, __raw_input(), and xrange() were removed and print()__ became a function. This PR proposes fixes that provide equivalent functionality in both Python 2 and Python 3.
Before this PR: flake8 testing of https://github.com/joxeankoret/pigaios on Python 3.7.1
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics