Apply minor refactoring for providers module

This commit is contained in:
Roman Mogilatov 2017-03-29 00:08:38 +03:00
parent 7cb3310c5d
commit ef40c2a543
2 changed files with 1865 additions and 1866 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,16 @@ from .errors import Error
cimport cython
if sys.version_info[0] == 3: # pragma: no cover
CLASS_TYPES = (type,)
else: # pragma: no cover
CLASS_TYPES = (type, types.ClassType)
copy._deepcopy_dispatch[types.MethodType] = \
lambda obj, memo: type(obj)(obj.im_func,
copy.deepcopy(obj.im_self, memo),
obj.im_class)
GLOBAL_LOCK = threading.RLock()
"""Global reentrant lock.
@ -1451,17 +1461,6 @@ cpdef tuple parse_named_injections(dict kwargs):
return tuple(injections)
if sys.version_info[0] == 3: # pragma: no cover
CLASS_TYPES = (type,)
else: # pragma: no cover
CLASS_TYPES = (type, types.ClassType)
copy._deepcopy_dispatch[types.MethodType] = \
lambda obj, memo: type(obj)(obj.im_func,
copy.deepcopy(obj.im_self, memo),
obj.im_class)
cpdef bint is_provider(object instance):
"""Check if instance is provider instance.