summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util/compat.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/util/compat.py')
-rw-r--r--lib/sqlalchemy/util/compat.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py
index 4eb915469..d00e3ab23 100644
--- a/lib/sqlalchemy/util/compat.py
+++ b/lib/sqlalchemy/util/compat.py
@@ -21,11 +21,8 @@ pypy = hasattr(sys, 'pypy_version_info')
win32 = sys.platform.startswith('win')
cpython = not pypy and not jython # TODO: something better for this ?
-if py3k_warning:
+if py3k:
set_types = set
-elif sys.version_info < (2, 6):
- import sets
- set_types = set, sets.Set
else:
# 2.6 deprecates sets.Set, but we still need to be able to detect them
# in user code and as return values from DB-APIs
@@ -46,7 +43,7 @@ if sys.version_info < (2, 6):
return iter.__next__()
else:
next = next
-if py3k_warning:
+if py3k:
import pickle
else:
try:
@@ -54,19 +51,21 @@ else:
except ImportError:
import pickle
-if sys.version_info < (2, 6):
- # emits a nasty deprecation warning
- # in newer pythons
- from cgi import parse_qsl
+from urllib.parse import parse_qsl
+
+
+if py3k:
+ from inspect import getfullargspec as inspect_getfullargspec
+ from urllib.parse import quote_plus, unquote_plus
+ string_types = str,
+ binary_type = bytes
+ text_type = str
else:
- from urllib.parse import parse_qsl
-
-# start Py3K
-from inspect import getfullargspec as inspect_getfullargspec
-# end Py3K
-# start Py2K
-#from inspect import getargspec as inspect_getfullargspec
-# end Py2K
+ from inspect import getargspec as inspect_getfullargspec
+ from urllib import quote_plus, unquote_plus
+ string_types = basestring,
+ binary_type = str
+ text_type = unicode
if py3k_warning:
# they're bringing it back in 3.2. brilliant !