Fixes: #4850
<!-- Provide a general summary of your proposed changes in the Title field above -->
### Description
<!-- Describe your changes in detail -->
Removes usage of `util.callable`.
### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)
-->
This pull request is:
- [ ] A documentation / typographical error fix
- Good to go, no issue or tests are needed
- [x] A short code fix
- please include the issue number, and create an issue if none exists, which
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests. one line code fixes without tests will not be accepted.
- [ ] A new feature implementation
- please include the issue number, and create an issue if none exists, which must
include a complete example of how the feature would look.
- Please include: `Fixes: #<issue number>` in the commit message
- please include tests.
**Have a nice day!**
Closes: #4851
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4851
Pull-request-sha:
a0ccdff2cb74f5e944d8baccc269c382b591c8e2
Change-Id: I79918f44becbc5dbefdc7ff65128695c1cabed1d
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)
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)
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)
"""
-from .. import util
from ..orm.collections import collection
from ..orm.collections import collection_adapter
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)
@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(
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]
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
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()
"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
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 "
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):
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)
if typeobj is None:
return NULLTYPE
- if util.callable(typeobj):
+ if callable(typeobj):
return typeobj(*arg, **kw)
else:
return typeobj
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
)
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
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