summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/bncompleter.py21
-rw-r--r--python/compatibility.py10
-rw-r--r--python/downloadprovider.py2
-rwxr-xr-xpython/examples/export_svg.py10
-rw-r--r--python/examples/triage/byte.py6
-rw-r--r--python/websocketprovider.py5
6 files changed, 12 insertions, 42 deletions
diff --git a/python/bncompleter.py b/python/bncompleter.py
index ff093b9d..ef56fd3e 100644
--- a/python/bncompleter.py
+++ b/python/bncompleter.py
@@ -1,4 +1,4 @@
-""" This file is a modified version of rlcompleter.py from the Python
+sss This file is a modified version of rlcompleter.py from the Python
project under the Python Software Foundation License 2:
https://github.com/python/cpython/blob/master/Lib/rlcompleter.py
https://github.com/python/cpython/blob/master/LICENSE
@@ -50,20 +50,11 @@ __all__ = ["Completer"]
def fnsignature(obj):
- if sys.version_info[0:2] >= (3, 5):
- try:
- sig = str(inspect.signature(obj))
- except:
- sig = "()"
- return sig
- else:
- try:
- args = inspect.getargspec(obj).args
- args.remove('self')
- sig = "(" + ','.join(args) + ")"
- except:
- sig = "()"
- return sig
+ try:
+ sig = str(inspect.signature(obj))
+ except:
+ sig = "()"
+ return sig
class Completer:
diff --git a/python/compatibility.py b/python/compatibility.py
index fef7e49b..a19ba80a 100644
--- a/python/compatibility.py
+++ b/python/compatibility.py
@@ -29,11 +29,5 @@ def pyNativeStr(arg):
def valid_import(mod_name):
- if sys.version_info[0:2] >= (3, 4):
- import importlib.util
- return importlib.util.find_spec(mod_name) is not None
- else:
- import importlib
- mod_loader = importlib.find_loader(mod_name)
- found = mod_loader is not None
- return found
+ import importlib.util
+ return importlib.util.find_spec(mod_name) is not None
diff --git a/python/downloadprovider.py b/python/downloadprovider.py
index ed61136c..9223f2a5 100644
--- a/python/downloadprovider.py
+++ b/python/downloadprovider.py
@@ -438,7 +438,7 @@ try:
except ImportError:
pass
-if not _loaded and (sys.platform != "win32") and (sys.version_info >= (2, 7, 9)):
+if not _loaded and (sys.platform != "win32"):
try:
try:
from urllib.request import urlopen, build_opener, install_opener, ProxyHandler, Request
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)
diff --git a/python/websocketprovider.py b/python/websocketprovider.py
index c87cc384..2b453c35 100644
--- a/python/websocketprovider.py
+++ b/python/websocketprovider.py
@@ -24,10 +24,7 @@ from json import loads, dumps
import sys
import traceback
-if sys.version_info >= (3, 0, 0):
- from urllib.parse import urlencode
-else:
- from urllib import urlencode
+from urllib.parse import urlencode
# Binary Ninja Components
import binaryninja._binaryninjacore as core