summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/ext/associationproxy.py6
-rw-r--r--lib/sqlalchemy/ext/orderinglist.py3
-rw-r--r--lib/sqlalchemy/orm/attributes.py8
-rw-r--r--lib/sqlalchemy/orm/collections.py2
-rw-r--r--lib/sqlalchemy/orm/relationships.py4
-rw-r--r--lib/sqlalchemy/sql/ddl.py2
-rw-r--r--lib/sqlalchemy/sql/schema.py6
-rw-r--r--lib/sqlalchemy/sql/type_api.py2
-rw-r--r--lib/sqlalchemy/testing/assertsql.py2
-rw-r--r--lib/sqlalchemy/testing/exclusions.py2
-rw-r--r--lib/sqlalchemy/util/compat.py10
11 files changed, 21 insertions, 26 deletions
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py
index 32dee79c6..f72b46c25 100644
--- a/lib/sqlalchemy/ext/associationproxy.py
+++ b/lib/sqlalchemy/ext/associationproxy.py
@@ -1180,7 +1180,7 @@ class _AssociationList(_AssociationCollection):
for func_name, func in list(locals().items()):
if (
- util.callable(func)
+ callable(func)
and func.__name__ == func_name
and not func.__doc__
and hasattr(list, func_name)
@@ -1355,7 +1355,7 @@ class _AssociationDict(_AssociationCollection):
for func_name, func in list(locals().items()):
if (
- util.callable(func)
+ callable(func)
and func.__name__ == func_name
and not func.__doc__
and hasattr(dict, func_name)
@@ -1574,7 +1574,7 @@ class _AssociationSet(_AssociationCollection):
for func_name, func in list(locals().items()):
if (
- util.callable(func)
+ callable(func)
and func.__name__ == func_name
and not func.__doc__
and hasattr(set, func_name)
diff --git a/lib/sqlalchemy/ext/orderinglist.py b/lib/sqlalchemy/ext/orderinglist.py
index 16e0f1f2a..5dbe58726 100644
--- a/lib/sqlalchemy/ext/orderinglist.py
+++ b/lib/sqlalchemy/ext/orderinglist.py
@@ -119,7 +119,6 @@ start numbering at 1 or some other integer, provide ``count_from=1``.
"""
-from .. import util
from ..orm.collections import collection
from ..orm.collections import collection_adapter
@@ -367,7 +366,7 @@ class OrderingList(list):
for func_name, func in list(locals().items()):
if (
- util.callable(func)
+ callable(func)
and func.__name__ == func_name
and not func.__doc__
and hasattr(list, func_name)
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index d50eab03e..9d404e00d 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -328,7 +328,7 @@ def create_proxied_attribute(descriptor):
@util.memoized_property
def comparator(self):
- if util.callable(self._comparator):
+ if callable(self._comparator):
self._comparator = self._comparator()
if self._adapt_to_entity:
self._comparator = self._comparator.adapt_to_entity(
@@ -702,8 +702,10 @@ class AttributeImpl(object):
if not passive & CALLABLES_OK:
return PASSIVE_NO_RESULT
- if self.accepts_scalar_loader and \
- key in state.expired_attributes:
+ if (
+ self.accepts_scalar_loader
+ and key in state.expired_attributes
+ ):
value = state._load_expired(state, passive)
elif key in state.callables:
callable_ = state.callables[key]
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index ae96a8c4d..4b096c152 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -936,7 +936,7 @@ def _locate_roles_and_methods(cls):
for supercls in cls.__mro__:
for name, method in vars(supercls).items():
- if not util.callable(method):
+ if not callable(method):
continue
# note role declarations
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py
index 46eec75eb..63ec21099 100644
--- a/lib/sqlalchemy/orm/relationships.py
+++ b/lib/sqlalchemy/orm/relationships.py
@@ -1824,7 +1824,7 @@ class RelationshipProperty(StrategizedProperty):
class or aliased class tha is referred towards.
"""
- if util.callable(self.argument) and not isinstance(
+ if callable(self.argument) and not isinstance(
self.argument, (type, mapperlib.Mapper)
):
argument = self.argument()
@@ -1888,7 +1888,7 @@ class RelationshipProperty(StrategizedProperty):
"remote_side",
):
attr_value = getattr(self, attr)
- if util.callable(attr_value):
+ if callable(attr_value):
setattr(self, attr, attr_value())
# remove "annotations" which are present if mapped class
diff --git a/lib/sqlalchemy/sql/ddl.py b/lib/sqlalchemy/sql/ddl.py
index ef6614b61..48d4bc9dc 100644
--- a/lib/sqlalchemy/sql/ddl.py
+++ b/lib/sqlalchemy/sql/ddl.py
@@ -258,7 +258,7 @@ class DDLElement(roles.DDLRole, Executable, _DDLCompiles):
def _check_ddl_on(self, on):
if on is not None and (
not isinstance(on, util.string_types + (tuple, list, set))
- and not util.callable(on)
+ and not callable(on)
):
raise exc.ArgumentError(
"Expected the name of a database dialect, a tuple "
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index f0a697728..d5ee1057b 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -2222,13 +2222,13 @@ class ColumnDefault(DefaultGenerator):
raise exc.ArgumentError(
"ColumnDefault may not be a server-side default type."
)
- if util.callable(arg):
+ if callable(arg):
arg = self._maybe_wrap_callable(arg)
self.arg = arg
@util.memoized_property
def is_callable(self):
- return util.callable(self.arg)
+ return callable(self.arg)
@util.memoized_property
def is_clause_element(self):
@@ -4211,7 +4211,7 @@ class MetaData(SchemaItem):
for name, schname in zip(available, available_w_schema)
if extend_existing or schname not in current
]
- elif util.callable(only):
+ elif callable(only):
load = [
name
for name, schname in zip(available, available_w_schema)
diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py
index 11407ad2e..9c5f5dd47 100644
--- a/lib/sqlalchemy/sql/type_api.py
+++ b/lib/sqlalchemy/sql/type_api.py
@@ -1461,7 +1461,7 @@ def to_instance(typeobj, *arg, **kw):
if typeobj is None:
return NULLTYPE
- if util.callable(typeobj):
+ if callable(typeobj):
return typeobj(*arg, **kw)
else:
return typeobj
diff --git a/lib/sqlalchemy/testing/assertsql.py b/lib/sqlalchemy/testing/assertsql.py
index 55f4dc2ab..6a654df1e 100644
--- a/lib/sqlalchemy/testing/assertsql.py
+++ b/lib/sqlalchemy/testing/assertsql.py
@@ -170,7 +170,7 @@ class CompiledSQL(SQLMatchRule):
def _all_params(self, context):
if self.params:
- if util.callable(self.params):
+ if callable(self.params):
params = self.params(context)
else:
params = self.params
diff --git a/lib/sqlalchemy/testing/exclusions.py b/lib/sqlalchemy/testing/exclusions.py
index d205354cf..edb9caa16 100644
--- a/lib/sqlalchemy/testing/exclusions.py
+++ b/lib/sqlalchemy/testing/exclusions.py
@@ -208,7 +208,7 @@ class Predicate(object):
)
return SpecPredicate(db, op, spec, description=description)
- elif util.callable(predicate):
+ elif callable(predicate):
return LambdaPredicate(predicate, description)
else:
assert False, "unknown predicate type: %s" % predicate
diff --git a/lib/sqlalchemy/util/compat.py b/lib/sqlalchemy/util/compat.py
index b655a55f3..8cfaea26e 100644
--- a/lib/sqlalchemy/util/compat.py
+++ b/lib/sqlalchemy/util/compat.py
@@ -158,14 +158,8 @@ if py3k:
def ue(s):
return s
- if py32:
- callable = callable # noqa
- else:
-
- def callable(fn): # noqa
- return hasattr(fn, "__call__")
-
-
+ # Unused. Kept for backwards compatibility.
+ callable = callable # noqa
else:
import base64
import ConfigParser as configparser # noqa