From 2709ae46884f405d95dc16be0667a6cbbebcfb69 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 27 Apr 2013 20:02:24 -0400 Subject: work through dialects --- lib/sqlalchemy/util/__init__.py | 2 +- lib/sqlalchemy/util/compat.py | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) (limited to 'lib/sqlalchemy/util') diff --git a/lib/sqlalchemy/util/__init__.py b/lib/sqlalchemy/util/__init__.py index 3fa06c793..2fcfabefd 100644 --- a/lib/sqlalchemy/util/__init__.py +++ b/lib/sqlalchemy/util/__init__.py @@ -7,7 +7,7 @@ from .compat import callable, cmp, reduce, \ threading, py3k, py3k_warning, jython, pypy, cpython, win32, set_types, \ pickle, dottedgetter, parse_qsl, namedtuple, next, WeakSet, reraise, \ - raise_from_cause + raise_from_cause, text_type, string_type, binary_type, quote_plus from ._collections import KeyedTuple, ImmutableContainer, immutabledict, \ Properties, OrderedProperties, ImmutableProperties, OrderedDict, \ 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 ! -- cgit v1.2.1