summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-12-28 15:46:38 -0500
committerAndi Albrecht <albrecht.andi@gmail.com>2019-03-10 09:03:42 +0100
commitc9a490abf869eddf5b88de57c17d7a6c6c643ed8 (patch)
treeab03ed4e7fc2dc7ab8ec4207aef56062cfe2658d
parent9aab1d2fc5c1ea9435bec404fa33b844996f2a4b (diff)
downloadsqlparse-c9a490abf869eddf5b88de57c17d7a6c6c643ed8.tar.gz
Remove unnecessary compat shim for bytes
Both Python 2.7 and Python 3 have the type bytes. On Python 2.7, it is an alias of str, same as was previously defined in compat.py. Makes the code slightly more compatible with Python 3 style syntax. Observe: $ python2 >>> bytes <type 'str'>
-rw-r--r--sqlparse/compat.py2
-rw-r--r--sqlparse/lexer.py4
2 files changed, 2 insertions, 4 deletions
diff --git a/sqlparse/compat.py b/sqlparse/compat.py
index 4ca79a2..d2214be 100644
--- a/sqlparse/compat.py
+++ b/sqlparse/compat.py
@@ -27,7 +27,6 @@ if PY3:
def unicode_compatible(cls):
return cls
- bytes_type = bytes
text_type = str
string_types = (str,)
from io import StringIO
@@ -40,7 +39,6 @@ elif PY2:
cls.__str__ = lambda x: x.__unicode__().encode('utf-8')
return cls
- bytes_type = str
text_type = unicode
string_types = (str, unicode,)
from StringIO import StringIO
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py
index 66e0689..fd007a4 100644
--- a/sqlparse/lexer.py
+++ b/sqlparse/lexer.py
@@ -15,7 +15,7 @@
from sqlparse import tokens
from sqlparse.keywords import SQL_REGEX
-from sqlparse.compat import bytes_type, text_type, file_types
+from sqlparse.compat import text_type, file_types
from sqlparse.utils import consume
@@ -43,7 +43,7 @@ class Lexer(object):
if isinstance(text, text_type):
pass
- elif isinstance(text, bytes_type):
+ elif isinstance(text, bytes):
if encoding:
text = text.decode(encoding)
else: