mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-26 11:33:58 +03:00
Merge remote-tracking branch 'origin/remove_public_modifier'
This commit is contained in:
commit
26c8637206
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -63,5 +63,9 @@ venv/
|
||||||
.ropeproject/
|
.ropeproject/
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
|
src/dependency_injector/*.h
|
||||||
src/dependency_injector/*.so
|
src/dependency_injector/*.so
|
||||||
|
src/dependency_injector/containers/*.h
|
||||||
|
src/dependency_injector/containers/*.so
|
||||||
|
src/dependency_injector/providers/*.h
|
||||||
src/dependency_injector/providers/*.so
|
src/dependency_injector/providers/*.so
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Container(containers.DeclarativeContainer):
|
||||||
|
|
||||||
factory2 = providers.Factory(object)
|
factory2 = providers.Factory(object)
|
||||||
|
|
||||||
|
|
||||||
# Creating some objects:
|
# Creating some objects:
|
||||||
object1 = Container.factory1()
|
object1 = Container.factory1()
|
||||||
object2 = Container.factory2()
|
object2 = Container.factory2()
|
||||||
|
|
|
@ -71,6 +71,7 @@ class CsvApplication(containers.DeclarativeContainer):
|
||||||
csv_file_path=settings.MOVIES_CSV_PATH,
|
csv_file_path=settings.MOVIES_CSV_PATH,
|
||||||
delimiter=',')
|
delimiter=',')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
DbApplication.init_db()
|
DbApplication.init_db()
|
||||||
DbApplication.main()
|
DbApplication.main()
|
||||||
|
|
|
@ -6,6 +6,7 @@ import dependency_injector.providers as providers
|
||||||
class User(object):
|
class User(object):
|
||||||
"""Example class User."""
|
"""Example class User."""
|
||||||
|
|
||||||
|
|
||||||
# Users factory:
|
# Users factory:
|
||||||
users_factory = providers.Factory(User)
|
users_factory = providers.Factory(User)
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ assert isinstance(user1, User) and isinstance(user2, User)
|
||||||
class SuperUser(User):
|
class SuperUser(User):
|
||||||
"""Example class SuperUser."""
|
"""Example class SuperUser."""
|
||||||
|
|
||||||
|
|
||||||
# Overriding users factory:
|
# Overriding users factory:
|
||||||
users_factory.override(providers.Factory(SuperUser))
|
users_factory.override(providers.Factory(SuperUser))
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ class UsersService(object):
|
||||||
"""Find user by his id and return user model."""
|
"""Find user by his id and return user model."""
|
||||||
return self.user_cls(id=id, password='secret' + str(id))
|
return self.user_cls(id=id, password='secret' + str(id))
|
||||||
|
|
||||||
|
|
||||||
# Users factory and UsersService provider:
|
# Users factory and UsersService provider:
|
||||||
users_service = providers.Factory(UsersService, user_cls=User)
|
users_service = providers.Factory(UsersService, user_cls=User)
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ class ExtendedUsersService(UsersService):
|
||||||
user.gender = 'male'
|
user.gender = 'male'
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
# Overriding users_service provider:
|
# Overriding users_service provider:
|
||||||
extended_users_service = providers.Factory(ExtendedUsersService,
|
extended_users_service = providers.Factory(ExtendedUsersService,
|
||||||
user_cls=ExtendedUser)
|
user_cls=ExtendedUser)
|
||||||
|
|
|
@ -975,7 +975,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
|
||||||
|
|
||||||
|
|
||||||
/* Module declarations from 'dependency_injector.providers.utils' */
|
/* Module declarations from 'dependency_injector.providers.utils' */
|
||||||
__PYX_EXTERN_C DL_EXPORT(PyObject) *__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES;
|
static PyObject *__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES = 0;
|
||||||
static int __pyx_f_19dependency_injector_9providers_5utils_is_provider(PyObject *, int __pyx_skip_dispatch); /*proto*/
|
static int __pyx_f_19dependency_injector_9providers_5utils_is_provider(PyObject *, int __pyx_skip_dispatch); /*proto*/
|
||||||
static PyObject *__pyx_f_19dependency_injector_9providers_5utils_ensure_is_provider(PyObject *, int __pyx_skip_dispatch); /*proto*/
|
static PyObject *__pyx_f_19dependency_injector_9providers_5utils_ensure_is_provider(PyObject *, int __pyx_skip_dispatch); /*proto*/
|
||||||
static int __pyx_f_19dependency_injector_9providers_5utils_is_delegated(PyObject *, int __pyx_skip_dispatch); /*proto*/
|
static int __pyx_f_19dependency_injector_9providers_5utils_is_delegated(PyObject *, int __pyx_skip_dispatch); /*proto*/
|
||||||
|
@ -1313,7 +1313,6 @@ static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_5utils_la
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return __pyx_r;
|
return __pyx_r;
|
||||||
}
|
}
|
||||||
PyObject *__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES = 0;
|
|
||||||
|
|
||||||
/* "dependency_injector/providers/utils.pyx":25
|
/* "dependency_injector/providers/utils.pyx":25
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* Generated by Cython 0.25.1 */
|
|
||||||
|
|
||||||
#ifndef __PYX_HAVE__dependency_injector__providers__utils
|
|
||||||
#define __PYX_HAVE__dependency_injector__providers__utils
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __PYX_HAVE_API__dependency_injector__providers__utils
|
|
||||||
|
|
||||||
#ifndef __PYX_EXTERN_C
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define __PYX_EXTERN_C extern "C"
|
|
||||||
#else
|
|
||||||
#define __PYX_EXTERN_C extern
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DL_IMPORT
|
|
||||||
#define DL_IMPORT(_T) _T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__PYX_EXTERN_C DL_IMPORT(PyObject) *__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES;
|
|
||||||
|
|
||||||
#endif /* !__PYX_HAVE_API__dependency_injector__providers__utils */
|
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION < 3
|
|
||||||
PyMODINIT_FUNC initutils(void);
|
|
||||||
#else
|
|
||||||
PyMODINIT_FUNC PyInit_utils(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !__PYX_HAVE__dependency_injector__providers__utils */
|
|
|
@ -3,7 +3,7 @@
|
||||||
Powered by Cython.
|
Powered by Cython.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cdef public object CLASS_TYPES
|
cdef object CLASS_TYPES
|
||||||
|
|
||||||
|
|
||||||
cpdef bint is_provider(object instance)
|
cpdef bint is_provider(object instance)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user