- Switch to 'in' which works in 2/3 instead of legacy '.has_key()'

- Renamed 'id' variable use (which is a built-in) to my_id.
- Small formatting changes to make it more PEP compliant.
This commit is contained in:
cforgeron 2016-01-31 17:01:14 -04:00
parent 44fa4e29e7
commit de224f1573

View File

@ -8,14 +8,6 @@ from unicorn.x86_const import *
import struct
import uuid
# Python 2/3 Compat without installing six
DEAD_PYTHON = False
import sys
if sys.version_info[0] < 3:
DEAD_PYTHON = True
print("Python 2.x is dead. Start thinking about migrating to 3.x. https://wiki.python.org/moin/Python2orPython3")
SIZE_REG = 4
SOCKETCALL_MAX_ARGS = 3
@ -105,11 +97,6 @@ class LogChain:
if fd in self.__chains:
return fd
if DEAD_PYTHON:
for orig_fd, links in self.__linking_fds.iteritems():
if fd in links:
return orig_fd
else:
for orig_fd, links in self.__linking_fds.items():
if fd in links:
return orig_fd
@ -122,12 +109,7 @@ class LogChain:
| START REPORT |
----------------
""")
if DEAD_PYTHON:
for my_id, logs in self.__chains.iteritems():
print("---- START FD(%d) ----" % my_id)
print("\n".join(logs))
print("---- END FD(%d) ----" % my_id)
else:
for my_id, logs in self.__chains.items():
print("---- START FD(%d) ----" % my_id)
print("\n".join(logs))