mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
Apply minor refactoring for providers module
This commit is contained in:
parent
7cb3310c5d
commit
ef40c2a543
File diff suppressed because it is too large
Load Diff
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user