diff options
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/orm/collections.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/util/__init__.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/util/compat.py | 17 | ||||
-rw-r--r-- | lib/sqlalchemy/util/langhelpers.py | 31 |
4 files changed, 27 insertions, 25 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py index d605d849b..7c82f3735 100644 --- a/lib/sqlalchemy/orm/collections.py +++ b/lib/sqlalchemy/orm/collections.py @@ -1166,7 +1166,7 @@ def _dict_decorators(): l.pop('Unspecified') return l -if util.py3k: +if util.py3k_warning: _set_binop_bases = (set, frozenset) else: import sets diff --git a/lib/sqlalchemy/util/__init__.py b/lib/sqlalchemy/util/__init__.py index c78cddf77..d1a72eaf2 100644 --- a/lib/sqlalchemy/util/__init__.py +++ b/lib/sqlalchemy/util/__init__.py @@ -5,7 +5,7 @@ # the MIT License: http://www.opensource.org/licenses/mit-license.php from compat import callable, cmp, reduce, defaultdict, py25_dict, \ - threading, py3k, jython, pypy, win32, set_types, buffer, pickle, \ + threading, py3k_warning, jython, pypy, win32, set_types, buffer, pickle, \ update_wrapper, partial, md5_hex, decode_slice, dottedgetter,\ parse_qsl diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py index 380e3a9a5..18549c8b9 100644 --- a/lib/sqlalchemy/util/compat.py +++ b/lib/sqlalchemy/util/compat.py @@ -18,12 +18,12 @@ except ImportError: import dummy_threading as threading py32 = sys.version_info >= (3, 2) -py3k = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0) +py3k_warning = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0) jython = sys.platform.startswith('java') pypy = hasattr(sys, 'pypy_version_info') win32 = sys.platform.startswith('win') -if py3k: +if py3k_warning: set_types = set elif sys.version_info < (2, 6): import sets @@ -43,7 +43,7 @@ else: set_types = set, sets.Set -if py3k: +if py3k_warning: import pickle else: try: @@ -89,12 +89,13 @@ if sys.version_info < (2, 6): else: from urlparse import parse_qsl -if py3k: - from inspect import getfullargspec as inspect_getfullargspec -else: - from inspect import getargspec as inspect_getfullargspec +# Py3K +#from inspect import getfullargspec as inspect_getfullargspec +# Py2K +from inspect import getargspec as inspect_getfullargspec +# end Py2K -if py3k: +if py3k_warning: # they're bringing it back in 3.2. brilliant ! def callable(fn): return hasattr(fn, '__call__') diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 722003796..f10ab3fb5 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -15,7 +15,7 @@ import re import sys import types import warnings -from compat import update_wrapper, set_types, threading, callable, inspect_getfullargspec, py3k +from compat import update_wrapper, set_types, threading, callable, inspect_getfullargspec, py3k_warning from sqlalchemy import exc def _unique_symbols(used, *bases): @@ -162,20 +162,21 @@ def format_argspec_plus(fn, grouped=True): else: self_arg = None - if py3k: - apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2], None, spec[4]) - num_defaults = 0 - if spec[3]: - num_defaults += len(spec[3]) - if spec[4]: - num_defaults += len(spec[4]) - name_args = spec[0] + spec[4] - else: - apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2]) - num_defaults = 0 - if spec[3]: - num_defaults += len(spec[3]) - name_args = spec[0] + # Py3K + #apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2], None, spec[4]) + #num_defaults = 0 + #if spec[3]: + # num_defaults += len(spec[3]) + #if spec[4]: + # num_defaults += len(spec[4]) + #name_args = spec[0] + spec[4] + # Py2K + apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2]) + num_defaults = 0 + if spec[3]: + num_defaults += len(spec[3]) + name_args = spec[0] + # end Py2K if num_defaults: defaulted_vals = name_args[0-num_defaults:] |