mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-12 09:30:46 +03:00
Change scope of IS_PYPY and OBJECT_INIT constants in injections module to protected
This commit is contained in:
parent
ff629989bb
commit
a8fb12dcd4
|
@ -13,11 +13,11 @@ from .utils import is_kwarg_injection
|
||||||
from .errors import Error
|
from .errors import Error
|
||||||
|
|
||||||
|
|
||||||
IS_PYPY = '__pypy__' in sys.builtin_module_names
|
_IS_PYPY = '__pypy__' in sys.builtin_module_names
|
||||||
if IS_PYPY or six.PY3: # pragma: no cover
|
if _IS_PYPY or six.PY3: # pragma: no cover
|
||||||
OBJECT_INIT = six.get_unbound_function(object.__init__)
|
_OBJECT_INIT = six.get_unbound_function(object.__init__)
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
OBJECT_INIT = None
|
_OBJECT_INIT = None
|
||||||
|
|
||||||
|
|
||||||
class Injection(object):
|
class Injection(object):
|
||||||
|
@ -150,7 +150,7 @@ def inject(*args, **kwargs):
|
||||||
cls = callback_or_cls
|
cls = callback_or_cls
|
||||||
try:
|
try:
|
||||||
cls_init = six.get_unbound_function(cls.__init__)
|
cls_init = six.get_unbound_function(cls.__init__)
|
||||||
assert cls_init is not OBJECT_INIT
|
assert cls_init is not _OBJECT_INIT
|
||||||
except (AttributeError, AssertionError):
|
except (AttributeError, AssertionError):
|
||||||
raise Error(
|
raise Error(
|
||||||
'Class {0}.{1} has no __init__() '.format(cls.__module__,
|
'Class {0}.{1} has no __init__() '.format(cls.__module__,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user