From 3c1c40158da1e2af9aced53056ad4c3aaafc0913 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Sat, 14 May 2022 02:22:35 -0400 Subject: remove more vestigal py2 code --- python/examples/export_svg.py | 10 ++-------- python/examples/triage/byte.py | 6 ------ 2 files changed, 2 insertions(+), 14 deletions(-) (limited to 'python/examples') diff --git a/python/examples/export_svg.py b/python/examples/export_svg.py index 8166b27a..62fc1045 100755 --- a/python/examples/export_svg.py +++ b/python/examples/export_svg.py @@ -25,10 +25,7 @@ def escape(toescape): # handle extended unicode toescape = toescape.encode('ascii', 'xmlcharrefreplace') # still escape the basics - if sys.version_info[0] == 3: - return ''.join(escape_table.get(chr(i), chr(i)) for i in toescape) - else: - return ''.join(escape_table.get(i, i) for i in toescape) + return ''.join(escape_table.get(chr(i), chr(i)) for i in toescape) def save_svg(bv, function): @@ -91,10 +88,7 @@ def instruction_data_flow(function, address): # TODO: Extract data flow information length = function.view.get_instruction_length(address) func_bytes = function.view.read(address, length) - if sys.version_info[0] == 3: - hex = func_bytes.hex() - else: - hex = func_bytes.encode('hex') + hex = func_bytes.hex() padded = ' '.join([hex[i:i + 2] for i in range(0, len(hex), 2)]) return 'Opcode: {bytes}'.format(bytes=padded) diff --git a/python/examples/triage/byte.py b/python/examples/triage/byte.py index 0cc00485..13e5d153 100644 --- a/python/examples/triage/byte.py +++ b/python/examples/triage/byte.py @@ -47,12 +47,6 @@ class ByteView(QAbstractScrollArea, View): u'≡', u'±', u'≥', u'≤', u'⌠', u'⌡', u'÷', u'≈', u'°', u'∙', u'·', u'√', u'ⁿ', u'²', u'■', u' ' ] - if sys.version_info.major == 2: - mapping = {} - for i in range(0, 256): - mapping[chr(i)] = self.byte_mapping[i] - self.byte_mapping = mapping - self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self.setFocusPolicy(Qt.StrongFocus) -- cgit v1.3.1