mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 01:26:51 +03:00
Fix of bug in Python 2.6 with failed isclass check in inspect module
This commit is contained in:
parent
87fc17284c
commit
e817f726c2
|
@ -1,13 +1,13 @@
|
|||
"""Utils module."""
|
||||
|
||||
from inspect import isclass
|
||||
from six import class_types
|
||||
|
||||
from .errors import Error
|
||||
|
||||
|
||||
def is_provider(instance):
|
||||
"""Check if instance is provider instance."""
|
||||
return (not isclass(instance) and
|
||||
return (not isinstance(instance, class_types) and
|
||||
hasattr(instance, '__IS_OBJECTS_PROVIDER__'))
|
||||
|
||||
|
||||
|
@ -21,23 +21,23 @@ def ensure_is_provider(instance):
|
|||
|
||||
def is_injection(instance):
|
||||
"""Check if instance is injection instance."""
|
||||
return (not isclass(instance) and
|
||||
return (not isinstance(instance, class_types) and
|
||||
hasattr(instance, '__IS_OBJECTS_INJECTION__'))
|
||||
|
||||
|
||||
def is_init_arg_injection(instance):
|
||||
"""Check if instance is init arg injection instance."""
|
||||
return (not isclass(instance) and
|
||||
return (not isinstance(instance, class_types) and
|
||||
hasattr(instance, '__IS_OBJECTS_INIT_ARG_INJECTION__'))
|
||||
|
||||
|
||||
def is_attribute_injection(instance):
|
||||
"""Check if instance is attribute injection instance."""
|
||||
return (not isclass(instance) and
|
||||
return (not isinstance(instance, class_types) and
|
||||
hasattr(instance, '__IS_OBJECTS_ATTRIBUTE_INJECTION__'))
|
||||
|
||||
|
||||
def is_method_injection(instance):
|
||||
"""Check if instance is method injection instance."""
|
||||
return (not isclass(instance) and
|
||||
return (not isinstance(instance, class_types) and
|
||||
hasattr(instance, '__IS_OBJECTS_METHOD_INJECTION__'))
|
||||
|
|
Loading…
Reference in New Issue
Block a user