diff --git a/setup.py b/setup.py index 4a070d1d..bd0c7050 100644 --- a/setup.py +++ b/setup.py @@ -41,38 +41,13 @@ setup(name='dependency-injector', packages=[ 'dependency_injector', 'dependency_injector.containers', - 'dependency_injector.providers', ], package_dir={ '': 'src', }, ext_modules=[ - Extension('dependency_injector.providers.base', - ['src/dependency_injector/providers/base.c'], - define_macros=defined_macros, - extra_compile_args=['-O2']), - Extension('dependency_injector.providers.configuration', - ['src/dependency_injector/providers/configuration.c'], - define_macros=defined_macros, - extra_compile_args=['-O2']), - Extension('dependency_injector.providers.callables', - ['src/dependency_injector/providers/callables.c'], - define_macros=defined_macros, - extra_compile_args=['-O2']), - Extension('dependency_injector.providers.factories', - ['src/dependency_injector/providers/factories.c'], - define_macros=defined_macros, - extra_compile_args=['-O2']), - Extension('dependency_injector.providers.singletons', - ['src/dependency_injector/providers/singletons.c'], - define_macros=defined_macros, - extra_compile_args=['-O2']), - Extension('dependency_injector.providers.injections', - ['src/dependency_injector/providers/injections.c'], - define_macros=defined_macros, - extra_compile_args=['-O2']), - Extension('dependency_injector.providers.utils', - ['src/dependency_injector/providers/utils.c'], + Extension('dependency_injector.providers', + ['src/dependency_injector/providers.c'], define_macros=defined_macros, extra_compile_args=['-O2']), ], diff --git a/src/dependency_injector/providers.c b/src/dependency_injector/providers.c new file mode 100644 index 00000000..15844f32 --- /dev/null +++ b/src/dependency_injector/providers.c @@ -0,0 +1,25899 @@ +/* Generated by Cython 0.25.2 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) + #error Cython requires Python 2.6+ or Python 3.2+. +#else +#define CYTHON_ABI "0_25_2" +#include +#ifndef offsetof + #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef HAVE_LONG_LONG + #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) + #define HAVE_LONG_LONG + #endif +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION + #define CYTHON_COMPILING_IN_PYPY 1 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 +#elif defined(PYSTON_VERSION) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 1 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_PYSTON 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif +#endif +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) +#endif +#if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #undef SHIFT + #undef BASE + #undef MASK +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) + #define Py_OptimizeFlag 0 +#endif +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#endif +#ifndef Py_TPFLAGS_CHECKTYPES + #define Py_TPFLAGS_CHECKTYPES 0 +#endif +#ifndef Py_TPFLAGS_HAVE_INDEX + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#ifndef Py_TPFLAGS_HAVE_NEWBUFFER + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#ifndef Py_TPFLAGS_HAVE_FINALIZE + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif +#ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #define __Pyx_PyCFunctionFast _PyCFunctionFast +#endif +#if CYTHON_FAST_PYCCALL +#define __Pyx_PyFastCFunction_Check(func)\ + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) +#else +#define __Pyx_PyFastCFunction_Check(func) 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) +#else + #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_PYSTON + #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#else + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) +#endif +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) + #else + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) + #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) + +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #elif defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) + #define _USE_MATH_DEFINES +#endif +#include +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + + +#define __PYX_ERR(f_index, lineno, Ln_error) \ +{ \ + __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ +} + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#define __PYX_HAVE__dependency_injector__providers +#define __PYX_HAVE_API__dependency_injector__providers +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) && defined (_M_X64) + #define __Pyx_sst_abs(value) _abs64(value) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) +#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) +#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) +#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +#if CYTHON_ASSUME_SAFE_MACROS +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static PyObject *__pyx_empty_unicode; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +static const char *__pyx_f[] = { + "src/dependency_injector/providers.pxd", + "src/dependency_injector/providers.pyx", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_19dependency_injector_9providers_Provider; +struct __pyx_obj_19dependency_injector_9providers_Object; +struct __pyx_obj_19dependency_injector_9providers_Delegate; +struct __pyx_obj_19dependency_injector_9providers_ExternalDependency; +struct __pyx_obj_19dependency_injector_9providers_OverridingContext; +struct __pyx_obj_19dependency_injector_9providers_Callable; +struct __pyx_obj_19dependency_injector_9providers_DelegatedCallable; +struct __pyx_obj_19dependency_injector_9providers_Configuration; +struct __pyx_obj_19dependency_injector_9providers_Factory; +struct __pyx_obj_19dependency_injector_9providers_DelegatedFactory; +struct __pyx_obj_19dependency_injector_9providers_BaseSingleton; +struct __pyx_obj_19dependency_injector_9providers_Singleton; +struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton; +struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton; +struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton; +struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton; +struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton; +struct __pyx_obj_19dependency_injector_9providers_Injection; +struct __pyx_obj_19dependency_injector_9providers_PositionalInjection; +struct __pyx_obj_19dependency_injector_9providers_NamedInjection; +struct __pyx_opt_args_19dependency_injector_9providers_deepcopy; + +/* "dependency_injector/providers.pxd":154 + * + * + * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_19dependency_injector_9providers_deepcopy { + int __pyx_n; + PyObject *memo; +}; + +/* "dependency_injector/providers.pxd":10 + * + * # Base providers + * cdef class Provider(object): # <<<<<<<<<<<<<< + * cdef tuple __overridden + * cdef int __overridden_len + */ +struct __pyx_obj_19dependency_injector_9providers_Provider { + PyObject_HEAD + struct __pyx_vtabstruct_19dependency_injector_9providers_Provider *__pyx_vtab; + PyObject *__pyx___overridden; + int __pyx___overridden_len; +}; + + +/* "dependency_injector/providers.pxd":18 + * + * + * cdef class Object(Provider): # <<<<<<<<<<<<<< + * cdef object __provides + * + */ +struct __pyx_obj_19dependency_injector_9providers_Object { + struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base; + PyObject *__pyx___provides; +}; + + +/* "dependency_injector/providers.pxd":24 + * + * + * cdef class Delegate(Object): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_19dependency_injector_9providers_Delegate { + struct __pyx_obj_19dependency_injector_9providers_Object __pyx_base; +}; + + +/* "dependency_injector/providers.pxd":28 + * + * + * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< + * cdef type __instance_of + * + */ +struct __pyx_obj_19dependency_injector_9providers_ExternalDependency { + struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base; + PyTypeObject *__pyx___instance_of; +}; + + +/* "dependency_injector/providers.pxd":32 + * + * + * cdef class OverridingContext(object): # <<<<<<<<<<<<<< + * cdef Provider __overridden + * cdef Provider __overriding + */ +struct __pyx_obj_19dependency_injector_9providers_OverridingContext { + PyObject_HEAD + struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx___overridden; + struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx___overriding; +}; + + +/* "dependency_injector/providers.pxd":38 + * + * # Callable providers + * cdef class Callable(Provider): # <<<<<<<<<<<<<< + * cdef object __provides + * + */ +struct __pyx_obj_19dependency_injector_9providers_Callable { + struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base; + PyObject *__pyx___provides; + PyObject *__pyx___args; + int __pyx___args_len; + PyObject *__pyx___kwargs; + int __pyx___kwargs_len; +}; + + +/* "dependency_injector/providers.pxd":50 + * + * + * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_19dependency_injector_9providers_DelegatedCallable { + struct __pyx_obj_19dependency_injector_9providers_Callable __pyx_base; +}; + + +/* "dependency_injector/providers.pxd":55 + * + * # Configuration providers + * cdef class Configuration(Provider): # <<<<<<<<<<<<<< + * cdef str __name + * cdef object __value + */ +struct __pyx_obj_19dependency_injector_9providers_Configuration { + struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base; + PyObject *__pyx___name; + PyObject *__pyx___value; + PyObject *__pyx___children; +}; + + +/* "dependency_injector/providers.pxd":67 + * + * # Factory providers + * cdef class Factory(Provider): # <<<<<<<<<<<<<< + * cdef Callable __instantiator + * + */ +struct __pyx_obj_19dependency_injector_9providers_Factory { + struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base; + struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx___instantiator; + PyObject *__pyx___attributes; + int __pyx___attributes_len; +}; + + +/* "dependency_injector/providers.pxd":76 + * + * + * cdef class DelegatedFactory(Factory): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_19dependency_injector_9providers_DelegatedFactory { + struct __pyx_obj_19dependency_injector_9providers_Factory __pyx_base; +}; + + +/* "dependency_injector/providers.pxd":81 + * + * # Singleton providers + * cdef class BaseSingleton(Provider): # <<<<<<<<<<<<<< + * cdef Factory __instantiator + * + */ +struct __pyx_obj_19dependency_injector_9providers_BaseSingleton { + struct __pyx_obj_19dependency_injector_9providers_Provider __pyx_base; + struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx___instantiator; +}; + + +/* "dependency_injector/providers.pxd":85 + * + * + * cdef class Singleton(BaseSingleton): # <<<<<<<<<<<<<< + * cdef object __storage + * + */ +struct __pyx_obj_19dependency_injector_9providers_Singleton { + struct __pyx_obj_19dependency_injector_9providers_BaseSingleton __pyx_base; + PyObject *__pyx___storage; +}; + + +/* "dependency_injector/providers.pxd":91 + * + * + * cdef class DelegatedSingleton(Singleton): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton { + struct __pyx_obj_19dependency_injector_9providers_Singleton __pyx_base; +}; + + +/* "dependency_injector/providers.pxd":95 + * + * + * cdef class ThreadSafeSingleton(BaseSingleton): # <<<<<<<<<<<<<< + * cdef object __storage + * cdef object __lock + */ +struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton { + struct __pyx_obj_19dependency_injector_9providers_BaseSingleton __pyx_base; + PyObject *__pyx___storage; + PyObject *__pyx___lock; +}; + + +/* "dependency_injector/providers.pxd":102 + * + * + * cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton { + struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton __pyx_base; +}; + + +/* "dependency_injector/providers.pxd":106 + * + * + * cdef class ThreadLocalSingleton(BaseSingleton): # <<<<<<<<<<<<<< + * cdef object __storage + * + */ +struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton { + struct __pyx_obj_19dependency_injector_9providers_BaseSingleton __pyx_base; + PyObject *__pyx___storage; +}; + + +/* "dependency_injector/providers.pxd":112 + * + * + * cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton { + struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton __pyx_base; +}; + + +/* "dependency_injector/providers.pxd":117 + * + * # Injections + * cdef class Injection(object): # <<<<<<<<<<<<<< + * cdef object __value + * cdef int __is_provider + */ +struct __pyx_obj_19dependency_injector_9providers_Injection { + PyObject_HEAD + PyObject *__pyx___value; + int __pyx___is_provider; + int __pyx___is_delegated; + int __pyx___call; +}; + + +/* "dependency_injector/providers.pxd":124 + * + * + * cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_19dependency_injector_9providers_PositionalInjection { + struct __pyx_obj_19dependency_injector_9providers_Injection __pyx_base; +}; + + +/* "dependency_injector/providers.pxd":128 + * + * + * cdef class NamedInjection(Injection): # <<<<<<<<<<<<<< + * cdef object __name + * + */ +struct __pyx_obj_19dependency_injector_9providers_NamedInjection { + struct __pyx_obj_19dependency_injector_9providers_Injection __pyx_base; + PyObject *__pyx___name; +}; + + + +/* "dependency_injector/providers.pyx":24 + * + * + * cdef class Provider(object): # <<<<<<<<<<<<<< + * """Base provider class. + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_Provider { + PyObject *(*_provide)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); + PyObject *(*_call_last_overriding)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Provider *__pyx_vtabptr_19dependency_injector_9providers_Provider; + + +/* "dependency_injector/providers.pyx":191 + * + * + * cdef class Object(Provider): # <<<<<<<<<<<<<< + * """Object provider returns provided instance "as is". + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_Object { + struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Object *__pyx_vtabptr_19dependency_injector_9providers_Object; + + +/* "dependency_injector/providers.pyx":251 + * + * + * cdef class Delegate(Object): # <<<<<<<<<<<<<< + * """Delegate provider returns provider "as is". + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_Delegate { + struct __pyx_vtabstruct_19dependency_injector_9providers_Object __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Delegate *__pyx_vtabptr_19dependency_injector_9providers_Delegate; + + +/* "dependency_injector/providers.pyx":270 + * + * + * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< + * """:py:class:`ExternalDependency` provider describes dependency interface. + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_ExternalDependency { + struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_ExternalDependency *__pyx_vtabptr_19dependency_injector_9providers_ExternalDependency; + + +/* "dependency_injector/providers.pyx":402 + * + * + * cdef class Callable(Provider): # <<<<<<<<<<<<<< + * r"""Callable provider calls wrapped callable on every call. + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_Callable { + struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Callable *__pyx_vtabptr_19dependency_injector_9providers_Callable; + + +/* "dependency_injector/providers.pyx":583 + * + * + * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< + * """Callable that is injected "as is". + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedCallable { + struct __pyx_vtabstruct_19dependency_injector_9providers_Callable __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedCallable *__pyx_vtabptr_19dependency_injector_9providers_DelegatedCallable; + + +/* "dependency_injector/providers.pyx":592 + * + * + * cdef class Configuration(Provider): # <<<<<<<<<<<<<< + * """Configuration provider. + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_Configuration { + struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_base; + PyObject *(*get_name)(struct __pyx_obj_19dependency_injector_9providers_Configuration *, int __pyx_skip_dispatch); + PyObject *(*update)(struct __pyx_obj_19dependency_injector_9providers_Configuration *, PyObject *, int __pyx_skip_dispatch); + PyObject *(*_get_child_name)(struct __pyx_obj_19dependency_injector_9providers_Configuration *, PyObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Configuration *__pyx_vtabptr_19dependency_injector_9providers_Configuration; + + +/* "dependency_injector/providers.pyx":706 + * + * + * cdef class Factory(Provider): # <<<<<<<<<<<<<< + * r"""Factory provider creates new instance on every call. + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_Factory { + struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Factory *__pyx_vtabptr_19dependency_injector_9providers_Factory; + + +/* "dependency_injector/providers.pyx":939 + * + * + * cdef class DelegatedFactory(Factory): # <<<<<<<<<<<<<< + * """Factory that is injected "as is". + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedFactory { + struct __pyx_vtabstruct_19dependency_injector_9providers_Factory __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedFactory *__pyx_vtabptr_19dependency_injector_9providers_DelegatedFactory; + + +/* "dependency_injector/providers.pyx":960 + * + * + * cdef class BaseSingleton(Provider): # <<<<<<<<<<<<<< + * """Base class of singleton providers.""" + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton { + struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton *__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton; + + +/* "dependency_injector/providers.pyx":1134 + * + * + * cdef class Singleton(BaseSingleton): # <<<<<<<<<<<<<< + * """Singleton provider returns same instance on every call. + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton { + struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton *__pyx_vtabptr_19dependency_injector_9providers_Singleton; + + +/* "dependency_injector/providers.pyx":1195 + * + * + * cdef class DelegatedSingleton(Singleton): # <<<<<<<<<<<<<< + * """Delegated singleton is injected "as is". + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedSingleton { + struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedSingleton *__pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton; + + +/* "dependency_injector/providers.pyx":1216 + * + * + * cdef class ThreadSafeSingleton(BaseSingleton): # <<<<<<<<<<<<<< + * """Thread-safe singleton provider.""" + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton { + struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton; + + +/* "dependency_injector/providers.pyx":1251 + * + * + * cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): # <<<<<<<<<<<<<< + * """Delegated thread-safe singleton is injected "as is". + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadSafeSingleton { + struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadSafeSingleton *__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton; + + +/* "dependency_injector/providers.pyx":1272 + * + * + * cdef class ThreadLocalSingleton(BaseSingleton): # <<<<<<<<<<<<<< + * """Thread-local singleton provides single objects in scope of thread. + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton { + struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton; + + +/* "dependency_injector/providers.pyx":1325 + * + * + * cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): # <<<<<<<<<<<<<< + * """Delegated thread-local singleton is injected "as is". + * + */ + +struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadLocalSingleton { + struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton __pyx_base; +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadLocalSingleton *__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadLocalSingleton; + +/* --- Runtime support code (head) --- */ +/* Refnanny.proto */ +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext()\ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif +#define __Pyx_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_XDECREF(tmp);\ + } while (0) +#define __Pyx_DECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; __Pyx_DECREF(tmp);\ + } while (0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + +/* GetModuleGlobalName.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#endif + +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* KeywordStringCheck.proto */ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyObjectCallNoArg.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* SliceTupleAndList.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); +#else +#define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) +#define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) +#endif + +/* ArgTypeTest.proto */ +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); + +/* CallableCheck.proto */ +#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) +#else +#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) +#endif + +/* StringJoin.proto */ +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyString_Join __Pyx_PyBytes_Join +#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) +#else +#define __Pyx_PyString_Join PyUnicode_Join +#define __Pyx_PyBaseString_Join PyUnicode_Join +#endif +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION < 3 + #define __Pyx_PyBytes_Join _PyString_Join + #else + #define __Pyx_PyBytes_Join _PyBytes_Join + #endif +#else +static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); +#endif + +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +/* ExtTypeTest.proto */ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); + +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +/* dict_getitem_default.proto */ +static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); + +/* PyObjectLookupSpecial.proto */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); +#if PY_MAJOR_VERSION < 3 + if (unlikely(PyInstance_Check(obj))) + return __Pyx_PyObject_GetAttrStr(obj, attr_name); +#endif + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#else +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + +/* SaveResetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +#else +#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) +#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) +#endif + +/* GetException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* PyObjectSetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* SwapException.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); +#endif + +/* None.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* py_dict_items.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); + +/* UnpackUnboundCMethod.proto */ +typedef struct { + PyObject *type; + PyObject **method_name; + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; + +/* CallUnboundCMethod0.proto */ +static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CallUnboundCMethod0(cfunc, self)\ + ((likely((cfunc)->func)) ?\ + (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\ + (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\ + ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\ + (PY_VERSION_HEX >= 0x030600B1 && (cfunc)->flag == METH_FASTCALL ? (*(__Pyx_PyCFunctionFast)(cfunc)->func)(self, &PyTuple_GET_ITEM(__pyx_empty_tuple, 0), 0, NULL) :\ + __Pyx__CallUnboundCMethod0(cfunc, self))))) :\ + __Pyx__CallUnboundCMethod0(cfunc, self)) +#else +#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) +#endif + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* ListExtend.proto */ +static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject* none = _PyList_Extend((PyListObject*)L, v); + if (unlikely(!none)) + return -1; + Py_DECREF(none); + return 0; +#else + return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); +#endif +} + +/* PyDictContains.proto */ +static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +/* SetVTable.proto */ +static int __Pyx_SetVtable(PyObject *dict, void *vtable); + +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* PyIntBinop.proto */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace); +#else +#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\ + PyObject_RichCompare(op1, op2, Py_EQ) + #endif + +/* FetchCommonType.proto */ +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); + +/* CythonFunction.proto */ +#define __Pyx_CyFunction_USED 1 +#include +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; +#if PY_VERSION_HEX < 0x030500A0 + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; + void *defaults; + int defaults_pyobjects; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(void); + +/* CodeObjectCache.proto */ +typedef struct { + PyCodeObject* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* CheckBinaryVersion.proto */ +static int __Pyx_check_binary_version(void); + +/* VoidPtrExport.proto */ +static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig); + +/* FunctionExport.proto */ +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); + +/* InitStrings.proto */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +static PyObject *__pyx_f_19dependency_injector_9providers_8Provider__provide(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_8Provider__call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_6Object__provide(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_8Callable__provide(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration_get_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration_update(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration__provide(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration__get_child_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_7Factory__provide(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_9Singleton__provide(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_19ThreadSafeSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_20ThreadLocalSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ + +/* Module declarations from 'cython' */ + +/* Module declarations from 'dependency_injector.providers' */ +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Provider = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Object = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Delegate = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_ExternalDependency = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_OverridingContext = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Callable = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedCallable = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Configuration = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Factory = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedFactory = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_BaseSingleton = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Singleton = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_Injection = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_PositionalInjection = 0; +static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_NamedInjection = 0; +static PyObject *__pyx_v_19dependency_injector_9providers_CLASS_TYPES = 0; +static PyObject *__pyx_f_19dependency_injector_9providers_parse_positional_injections(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_parse_named_injections(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static int __pyx_f_19dependency_injector_9providers_is_provider(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_ensure_is_provider(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static int __pyx_f_19dependency_injector_9providers_is_delegated(PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_represent_provider(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_deepcopy(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_deepcopy *__pyx_optional_args); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_name(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_value(struct __pyx_obj_19dependency_injector_9providers_Injection *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provide_positional_args(PyObject *, PyObject *, int); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provide_keyword_args(PyObject *, PyObject *, int); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject_attributes(PyObject *, PyObject *, int); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callable_call(struct __pyx_obj_19dependency_injector_9providers_Callable *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factory_call(struct __pyx_obj_19dependency_injector_9providers_Factory *, PyObject *, PyObject *); /*proto*/ +#define __Pyx_MODULE_NAME "dependency_injector.providers" +int __pyx_module_is_main_dependency_injector__providers = 0; + +/* Implementation of 'dependency_injector.providers' */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_super; +static PyObject *__pyx_builtin_id; +static PyObject *__pyx_builtin_NotImplementedError; +static PyObject *__pyx_builtin_AttributeError; +static PyObject *__pyx_builtin_hex; +static const char __pyx_k__2[] = "."; +static const char __pyx_k__3[] = ""; +static const char __pyx_k_id[] = "id"; +static const char __pyx_k_cls[] = "cls"; +static const char __pyx_k_get[] = "get"; +static const char __pyx_k_hex[] = "hex"; +static const char __pyx_k_obj[] = "obj"; +static const char __pyx_k_str[] = "__str__"; +static const char __pyx_k_sys[] = "sys"; +static const char __pyx_k_args[] = "args"; +static const char __pyx_k_copy[] = "copy"; +static const char __pyx_k_exit[] = "__exit__"; +static const char __pyx_k_init[] = "__init__"; +static const char __pyx_k_join[] = "join"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_memo[] = "memo"; +static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_Error[] = "Error"; +static const char __pyx_k_RLock[] = "RLock"; +static const char __pyx_k_class[] = "__class__"; +static const char __pyx_k_enter[] = "__enter__"; +static const char __pyx_k_items[] = "items"; +static const char __pyx_k_local[] = "local"; +static const char __pyx_k_range[] = "range"; +static const char __pyx_k_super[] = "super"; +static const char __pyx_k_types[] = "types"; +static const char __pyx_k_value[] = "value"; +static const char __pyx_k_errors[] = "errors"; +static const char __pyx_k_format[] = "format"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_kwargs[] = "kwargs"; +static const char __pyx_k_lambda[] = ""; +static const char __pyx_k_module[] = "__module__"; +static const char __pyx_k_name_2[] = "name"; +static const char __pyx_k_update[] = "update"; +static const char __pyx_k_address[] = "address"; +static const char __pyx_k_im_func[] = "im_func"; +static const char __pyx_k_im_self[] = "im_self"; +static const char __pyx_k_provide[] = "_provide"; +static const char __pyx_k_add_args[] = "add_args"; +static const char __pyx_k_deepcopy[] = "deepcopy"; +static const char __pyx_k_get_name[] = "get_name"; +static const char __pyx_k_im_class[] = "im_class"; +static const char __pyx_k_instance[] = "instance"; +static const char __pyx_k_override[] = "override"; +static const char __pyx_k_provider[] = "provider"; +static const char __pyx_k_provides[] = "provides"; +static const char __pyx_k_pyx_capi[] = "__pyx_capi__"; +static const char __pyx_k_set_args[] = "set_args"; +static const char __pyx_k_ClassType[] = "ClassType"; +static const char __pyx_k_threading[] = "threading"; +static const char __pyx_k_MethodType[] = "MethodType"; +static const char __pyx_k_add_kwargs[] = "add_kwargs"; +static const char __pyx_k_attributes[] = "attributes"; +static const char __pyx_k_clear_args[] = "clear_args"; +static const char __pyx_k_overridden[] = "overridden"; +static const char __pyx_k_overriding[] = "overriding"; +static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static const char __pyx_k_set_kwargs[] = "set_kwargs"; +static const char __pyx_k_0_is_not_an[] = "{0} is not an "; +static const char __pyx_k_CLASS_TYPES[] = "CLASS_TYPES"; +static const char __pyx_k_GLOBAL_LOCK[] = "GLOBAL_LOCK"; +static const char __pyx_k_IS_PROVIDER[] = "__IS_PROVIDER__"; +static const char __pyx_k_instance_of[] = "instance_of"; +static const char __pyx_k_IS_DELEGATED[] = "__IS_DELEGATED__"; +static const char __pyx_k_clear_kwargs[] = "clear_kwargs"; +static const char __pyx_k_version_info[] = "version_info"; +static const char __pyx_k_instance_of_0[] = "instance of {0}"; +static const char __pyx_k_provided_type[] = "provided_type"; +static const char __pyx_k_AttributeError[] = "AttributeError"; +static const char __pyx_k_add_attributes[] = "add_attributes"; +static const char __pyx_k_get_child_name[] = "_get_child_name"; +static const char __pyx_k_set_attributes[] = "set_attributes"; +static const char __pyx_k_clear_attributes[] = "clear_attributes"; +static const char __pyx_k_deepcopy_dispatch[] = "_deepcopy_dispatch"; +static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; +static const char __pyx_k_call_last_overriding[] = "_call_last_overriding"; +static const char __pyx_k_reset_last_overriding[] = "reset_last_overriding"; +static const char __pyx_k_Dependency_is_not_defined[] = "Dependency is not defined"; +static const char __pyx_k_Provider_0_is_not_overridden[] = "Provider {0} is not overridden"; +static const char __pyx_k_provider_provides_at_address[] = "<{provider}({provides}) at {address}>"; +static const char __pyx_k_dependency_injector_providers[] = "dependency_injector.providers"; +static const char __pyx_k_0_can_provide_only_1_instances[] = "{0} can provide only {1} instances"; +static const char __pyx_k_Dependency_injector_providers_Po[] = "Dependency injector providers.\n\nPowered by Cython.\n"; +static const char __pyx_k_Expected_provider_instance_got_0[] = "Expected provider instance, got {0}"; +static const char __pyx_k_Provider_0_could_not_be_overridd[] = "Provider {0} could not be overridden with itself"; +static const char __pyx_k_Provider_0_expected_to_get_calla[] = "Provider {0} expected to get callable, got {0}"; +static PyObject *__pyx_kp_s_0_can_provide_only_1_instances; +static PyObject *__pyx_kp_s_0_is_not_an; +static PyObject *__pyx_n_s_AttributeError; +static PyObject *__pyx_n_s_CLASS_TYPES; +static PyObject *__pyx_n_s_ClassType; +static PyObject *__pyx_kp_s_Dependency_is_not_defined; +static PyObject *__pyx_n_s_Error; +static PyObject *__pyx_kp_s_Expected_provider_instance_got_0; +static PyObject *__pyx_n_s_GLOBAL_LOCK; +static PyObject *__pyx_n_s_IS_DELEGATED; +static PyObject *__pyx_n_s_IS_PROVIDER; +static PyObject *__pyx_n_s_MethodType; +static PyObject *__pyx_n_s_NotImplementedError; +static PyObject *__pyx_kp_s_Provider_0_could_not_be_overridd; +static PyObject *__pyx_kp_s_Provider_0_expected_to_get_calla; +static PyObject *__pyx_kp_s_Provider_0_is_not_overridden; +static PyObject *__pyx_n_s_RLock; +static PyObject *__pyx_kp_s__2; +static PyObject *__pyx_kp_s__3; +static PyObject *__pyx_n_s_add_args; +static PyObject *__pyx_n_s_add_attributes; +static PyObject *__pyx_n_s_add_kwargs; +static PyObject *__pyx_n_s_address; +static PyObject *__pyx_n_s_args; +static PyObject *__pyx_n_s_attributes; +static PyObject *__pyx_n_s_call_last_overriding; +static PyObject *__pyx_n_s_class; +static PyObject *__pyx_n_s_clear_args; +static PyObject *__pyx_n_s_clear_attributes; +static PyObject *__pyx_n_s_clear_kwargs; +static PyObject *__pyx_n_s_cls; +static PyObject *__pyx_n_s_copy; +static PyObject *__pyx_n_s_deepcopy; +static PyObject *__pyx_n_s_deepcopy_dispatch; +static PyObject *__pyx_n_s_dependency_injector_providers; +static PyObject *__pyx_n_s_enter; +static PyObject *__pyx_n_s_errors; +static PyObject *__pyx_n_s_exit; +static PyObject *__pyx_n_s_format; +static PyObject *__pyx_n_s_get; +static PyObject *__pyx_n_s_get_child_name; +static PyObject *__pyx_n_s_get_name; +static PyObject *__pyx_n_s_hex; +static PyObject *__pyx_n_s_id; +static PyObject *__pyx_n_s_im_class; +static PyObject *__pyx_n_s_im_func; +static PyObject *__pyx_n_s_im_self; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_init; +static PyObject *__pyx_n_s_instance; +static PyObject *__pyx_n_s_instance_of; +static PyObject *__pyx_kp_s_instance_of_0; +static PyObject *__pyx_n_s_items; +static PyObject *__pyx_n_s_join; +static PyObject *__pyx_n_s_kwargs; +static PyObject *__pyx_n_s_lambda; +static PyObject *__pyx_n_s_local; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_memo; +static PyObject *__pyx_n_s_module; +static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_name_2; +static PyObject *__pyx_n_s_obj; +static PyObject *__pyx_n_s_overridden; +static PyObject *__pyx_n_s_override; +static PyObject *__pyx_n_s_overriding; +static PyObject *__pyx_n_s_provide; +static PyObject *__pyx_n_s_provided_type; +static PyObject *__pyx_n_s_provider; +static PyObject *__pyx_kp_s_provider_provides_at_address; +static PyObject *__pyx_n_s_provides; +static PyObject *__pyx_n_s_pyx_capi; +static PyObject *__pyx_n_s_pyx_vtable; +static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_reset_last_overriding; +static PyObject *__pyx_n_s_set_args; +static PyObject *__pyx_n_s_set_attributes; +static PyObject *__pyx_n_s_set_kwargs; +static PyObject *__pyx_n_s_str; +static PyObject *__pyx_n_s_super; +static PyObject *__pyx_n_s_sys; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_threading; +static PyObject *__pyx_n_s_types; +static PyObject *__pyx_n_s_update; +static PyObject *__pyx_n_s_value; +static PyObject *__pyx_n_s_version_info; +static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_memo); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_8Provider___init__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_2__call__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_6__str__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_8__repr__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_10overridden___get__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_10override(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_provider); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_12reset_last_overriding(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_14reset_override(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_16delegate(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_18_provide(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_20_call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_6Object___init__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, PyObject *__pyx_v_provides); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_4__str__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_6__repr__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_8_provide(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_8Delegate___init__(struct __pyx_obj_19dependency_injector_9providers_Delegate *__pyx_v_self, PyObject *__pyx_v_provides); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_18ExternalDependency___init__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyTypeObject *__pyx_v_instance_of); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_4__call__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_6__str__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_8__repr__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_11instance_of___get__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_10provided_by(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_provider); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_17OverridingContext___init__(struct __pyx_obj_19dependency_injector_9providers_OverridingContext *__pyx_v_self, struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_overridden, struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_overriding); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_17OverridingContext_2__enter__(struct __pyx_obj_19dependency_injector_9providers_OverridingContext *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_17OverridingContext_4__exit__(struct __pyx_obj_19dependency_injector_9providers_OverridingContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v__); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_8Callable___init__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_4__str__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_8provides___get__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_4args___get__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6add_args(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_8set_args(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_10clear_args(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_18_provide(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_13Configuration___init__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_4__str__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_6__getattr__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_8get_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_10update(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_12_provide(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_14_get_child_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_7Factory___init__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_4__str__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_4args___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6add_args(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_8set_args(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_10clear_args(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_24_provide(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_13BaseSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_2__str__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_4args___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6add_args(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_8set_args(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_10clear_args(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_24reset(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_9Singleton___init__(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_9Singleton_2reset(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_9Singleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_19PositionalInjection___init__(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_19PositionalInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_19PositionalInjection_4get_value(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_19PositionalInjection_6get_original_value(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self); /* proto */ +static int __pyx_pf_19dependency_injector_9providers_14NamedInjection___init__(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_4get_name(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_6get_value(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_8get_original_value(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_parse_positional_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_2parse_named_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_4is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_6ensure_is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_8is_delegated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_10represent_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provider, PyObject *__pyx_v_provides); /* proto */ +static PyObject *__pyx_pf_19dependency_injector_9providers_12deepcopy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance, PyObject *__pyx_v_memo); /* proto */ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Provider(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Object(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Delegate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_ExternalDependency(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_OverridingContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Callable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedCallable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Configuration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Factory(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedFactory(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_BaseSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Singleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_ThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_ThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Injection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_PositionalInjection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_19dependency_injector_9providers_NamedInjection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; +static PyObject *__pyx_int_3; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__4; + +/* "dependency_injector/providers.pyx":1454 + * + * copy._deepcopy_dispatch[types.MethodType] = \ + * lambda obj, memo: type(obj)(obj.im_func, # <<<<<<<<<<<<<< + * copy.deepcopy(obj.im_self, memo), + * obj.im_class) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_14lambda(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_19dependency_injector_9providers_14lambda = {"lambda", (PyCFunction)__pyx_pw_19dependency_injector_9providers_14lambda, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_19dependency_injector_9providers_14lambda(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_obj = 0; + PyObject *__pyx_v_memo = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_memo,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memo)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lambda", 1, 2, 2, 1); __PYX_ERR(1, 1454, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda") < 0)) __PYX_ERR(1, 1454, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_obj = values[0]; + __pyx_v_memo = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lambda", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1454, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_lambda_funcdef_19dependency_injector_9providers_lambda(__pyx_self, __pyx_v_obj, __pyx_v_memo); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("lambda", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_im_func); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "dependency_injector/providers.pyx":1455 + * copy._deepcopy_dispatch[types.MethodType] = \ + * lambda obj, memo: type(obj)(obj.im_func, + * copy.deepcopy(obj.im_self, memo), # <<<<<<<<<<<<<< + * obj.im_class) + * + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_im_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_v_memo}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1455, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_v_memo}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1455, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_6) { + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + } + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4); + __Pyx_INCREF(__pyx_v_memo); + __Pyx_GIVEREF(__pyx_v_memo); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_memo); + __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1455, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "dependency_injector/providers.pyx":1456 + * lambda obj, memo: type(obj)(obj.im_func, + * copy.deepcopy(obj.im_self, memo), + * obj.im_class) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_im_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1456, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_obj))); + __pyx_t_8 = ((PyObject *)Py_TYPE(__pyx_v_obj)); __pyx_t_4 = NULL; + __pyx_t_7 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + __pyx_t_7 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_8)) { + PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_t_3, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1454, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { + PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_t_3, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1454, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_5); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1454 + * + * copy._deepcopy_dispatch[types.MethodType] = \ + * lambda obj, memo: type(obj)(obj.im_func, # <<<<<<<<<<<<<< + * copy.deepcopy(obj.im_self, memo), + * obj.im_class) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("dependency_injector.providers.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":73 + * __IS_PROVIDER__ = True + * + * def __init__(self): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__overridden = tuple() + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_8Provider_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider___init__[] = "Initializer."; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_8Provider___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_8Provider_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider___init__(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_8Provider___init__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":75 + * def __init__(self): + * """Initializer.""" + * self.__overridden = tuple() # <<<<<<<<<<<<<< + * self.__overridden_len = 0 + * super(Provider, self).__init__() + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); + __Pyx_DECREF(__pyx_v_self->__pyx___overridden); + __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":76 + * """Initializer.""" + * self.__overridden = tuple() + * self.__overridden_len = 0 # <<<<<<<<<<<<<< + * super(Provider, self).__init__() + * + */ + __pyx_v_self->__pyx___overridden_len = 0; + + /* "dependency_injector/providers.pyx":77 + * self.__overridden = tuple() + * self.__overridden_len = 0 + * super(Provider, self).__init__() # <<<<<<<<<<<<<< + * + * def __call__(self, *args, **kwargs): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Provider)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Provider)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_Provider)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 77, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":73 + * __IS_PROVIDER__ = True + * + * def __init__(self): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__overridden = tuple() + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Provider.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":79 + * super(Provider, self).__init__() + * + * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * """Return provided object. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_2__call__[] = "Return provided object.\n\n Callable interface implementation.\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_8Provider_2__call__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_2__call__(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_2__call__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__call__", 0); + + /* "dependency_injector/providers.pyx":84 + * Callable interface implementation. + * """ + * if self.__overridden_len != 0: # <<<<<<<<<<<<<< + * return self._call_last_overriding(args, kwargs) + * return self._provide(args, kwargs) + */ + __pyx_t_1 = ((__pyx_v_self->__pyx___overridden_len != 0) != 0); + if (__pyx_t_1) { + + /* "dependency_injector/providers.pyx":85 + * """ + * if self.__overridden_len != 0: + * return self._call_last_overriding(args, kwargs) # <<<<<<<<<<<<<< + * return self._provide(args, kwargs) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_Provider *)__pyx_v_self->__pyx_vtab)->_call_last_overriding(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":84 + * Callable interface implementation. + * """ + * if self.__overridden_len != 0: # <<<<<<<<<<<<<< + * return self._call_last_overriding(args, kwargs) + * return self._provide(args, kwargs) + */ + } + + /* "dependency_injector/providers.pyx":86 + * if self.__overridden_len != 0: + * return self._call_last_overriding(args, kwargs) + * return self._provide(args, kwargs) # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_Provider *)__pyx_v_self->__pyx_vtab)->_provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":79 + * super(Provider, self).__init__() + * + * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * """Return provided object. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Provider.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":88 + * return self._provide(args, kwargs) + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_4__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_4__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_v_overriding_provider = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":90 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":91 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":92 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * + * copied = self.__class__() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":91 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + } + + /* "dependency_injector/providers.pyx":94 + * return copied + * + * copied = self.__class__() # <<<<<<<<<<<<<< + * + * for overriding_provider in self.overridden: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 94, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 94, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":96 + * copied = self.__class__() + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 96, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 96, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 96, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 96, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":97 + * + * for overriding_provider in self.overridden: + * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< + * + * return copied + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 97, __pyx_L1_error) + __pyx_t_10.__pyx_n = 1; + __pyx_t_10.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 97, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 97, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":96 + * copied = self.__class__() + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":99 + * copied.override(deepcopy(overriding_provider, memo)) + * + * return copied # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":88 + * return self._provide(args, kwargs) + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dependency_injector.providers.Provider.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XDECREF(__pyx_v_overriding_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":101 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_7__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_6__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_8Provider_6__str__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_7__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_6__str__(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_6__str__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "dependency_injector/providers.pyx":106 + * :rtype: str + * """ + * return represent_provider(provider=self, provides=None) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_represent_provider(((PyObject *)__pyx_v_self), Py_None, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":101 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Provider.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":108 + * return represent_provider(provider=self, provides=None) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_9__repr__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_8__repr__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_8Provider_8__repr__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_9__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_8__repr__(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_8__repr__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "dependency_injector/providers.pyx":113 + * :rtype: str + * """ + * return self.__str__() # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 113, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 113, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":108 + * return represent_provider(provider=self, provides=None) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Provider.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":116 + * + * @property + * def overridden(self): # <<<<<<<<<<<<<< + * """Return tuple of overriding providers.""" + * return self.__overridden + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_10overridden_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_10overridden_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_10overridden___get__(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_10overridden___get__(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":118 + * def overridden(self): + * """Return tuple of overriding providers.""" + * return self.__overridden # <<<<<<<<<<<<<< + * + * def override(self, provider): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___overridden); + __pyx_r = __pyx_v_self->__pyx___overridden; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":116 + * + * @property + * def overridden(self): # <<<<<<<<<<<<<< + * """Return tuple of overriding providers.""" + * return self.__overridden + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":120 + * return self.__overridden + * + * def override(self, provider): # <<<<<<<<<<<<<< + * """Override provider with another provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_11override(PyObject *__pyx_v_self, PyObject *__pyx_v_provider); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_10override[] = "Override provider with another provider.\n\n :param provider: Overriding provider.\n :type provider: :py:class:`Provider`\n\n :raise: :py:exc:`dependency_injector.errors.Error`\n\n :return: Overriding context.\n :rtype: :py:class:`OverridingContext`\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_11override(PyObject *__pyx_v_self, PyObject *__pyx_v_provider) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("override (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_10override(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self), ((PyObject *)__pyx_v_provider)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_10override(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_provider) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("override", 0); + __Pyx_INCREF(__pyx_v_provider); + + /* "dependency_injector/providers.pyx":131 + * :rtype: :py:class:`OverridingContext` + * """ + * if provider is self: # <<<<<<<<<<<<<< + * raise Error('Provider {0} could not be overridden ' + * 'with itself'.format(self)) + */ + __pyx_t_1 = (__pyx_v_provider == ((PyObject *)__pyx_v_self)); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "dependency_injector/providers.pyx":132 + * """ + * if provider is self: + * raise Error('Provider {0} could not be overridden ' # <<<<<<<<<<<<<< + * 'with itself'.format(self)) + * + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "dependency_injector/providers.pyx":133 + * if provider is self: + * raise Error('Provider {0} could not be overridden ' + * 'with itself'.format(self)) # <<<<<<<<<<<<<< + * + * if not is_provider(provider): + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Provider_0_could_not_be_overridd, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_7) { + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, ((PyObject *)__pyx_v_self)}; + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 133, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_5); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, ((PyObject *)__pyx_v_self)}; + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 133, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_5); + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, ((PyObject *)__pyx_v_self)); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 132, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 132, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 132, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 132, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":131 + * :rtype: :py:class:`OverridingContext` + * """ + * if provider is self: # <<<<<<<<<<<<<< + * raise Error('Provider {0} could not be overridden ' + * 'with itself'.format(self)) + */ + } + + /* "dependency_injector/providers.pyx":135 + * 'with itself'.format(self)) + * + * if not is_provider(provider): # <<<<<<<<<<<<<< + * provider = Object(provider) + * + */ + __pyx_t_2 = ((!(__pyx_f_19dependency_injector_9providers_is_provider(__pyx_v_provider, 0) != 0)) != 0); + if (__pyx_t_2) { + + /* "dependency_injector/providers.pyx":136 + * + * if not is_provider(provider): + * provider = Object(provider) # <<<<<<<<<<<<<< + * + * self.__overridden += (provider,) + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_provider); + __Pyx_GIVEREF(__pyx_v_provider); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_provider); + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Object), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF_SET(__pyx_v_provider, __pyx_t_4); + __pyx_t_4 = 0; + + /* "dependency_injector/providers.pyx":135 + * 'with itself'.format(self)) + * + * if not is_provider(provider): # <<<<<<<<<<<<<< + * provider = Object(provider) + * + */ + } + + /* "dependency_injector/providers.pyx":138 + * provider = Object(provider) + * + * self.__overridden += (provider,) # <<<<<<<<<<<<<< + * self.__overridden_len += 1 + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_provider); + __Pyx_GIVEREF(__pyx_v_provider); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_provider); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___overridden, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); + __Pyx_DECREF(__pyx_v_self->__pyx___overridden); + __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":139 + * + * self.__overridden += (provider,) + * self.__overridden_len += 1 # <<<<<<<<<<<<<< + * + * return OverridingContext(self, provider) + */ + __pyx_v_self->__pyx___overridden_len = (__pyx_v_self->__pyx___overridden_len + 1); + + /* "dependency_injector/providers.pyx":141 + * self.__overridden_len += 1 + * + * return OverridingContext(self, provider) # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __Pyx_INCREF(__pyx_v_provider); + __Pyx_GIVEREF(__pyx_v_provider); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_provider); + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_OverridingContext), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":120 + * return self.__overridden + * + * def override(self, provider): # <<<<<<<<<<<<<< + * """Override provider with another provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("dependency_injector.providers.Provider.override", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":145 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def reset_last_overriding(self): # <<<<<<<<<<<<<< + * """Reset last overriding provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_13reset_last_overriding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_12reset_last_overriding[] = "Reset last overriding provider.\n\n :raise: :py:exc:`dependency_injector.errors.Error` if provider is not\n overridden.\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_13reset_last_overriding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset_last_overriding (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_12reset_last_overriding(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_12reset_last_overriding(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("reset_last_overriding", 0); + + /* "dependency_injector/providers.pyx":153 + * :rtype: None + * """ + * if self.__overridden_len == 0: # <<<<<<<<<<<<<< + * raise Error('Provider {0} is not overridden'.format(str(self))) + * + */ + __pyx_t_1 = ((__pyx_v_self->__pyx___overridden_len == 0) != 0); + if (__pyx_t_1) { + + /* "dependency_injector/providers.pyx":154 + * """ + * if self.__overridden_len == 0: + * raise Error('Provider {0} is not overridden'.format(str(self))) # <<<<<<<<<<<<<< + * + * self.__overridden = self.__overridden[:self.__overridden_len - 1] + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Provider_0_is_not_overridden, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 154, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":153 + * :rtype: None + * """ + * if self.__overridden_len == 0: # <<<<<<<<<<<<<< + * raise Error('Provider {0} is not overridden'.format(str(self))) + * + */ + } + + /* "dependency_injector/providers.pyx":156 + * raise Error('Provider {0} is not overridden'.format(str(self))) + * + * self.__overridden = self.__overridden[:self.__overridden_len - 1] # <<<<<<<<<<<<<< + * self.__overridden_len -= 1 + * + */ + if (unlikely(__pyx_v_self->__pyx___overridden == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 156, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyTuple_GetSlice(__pyx_v_self->__pyx___overridden, 0, (__pyx_v_self->__pyx___overridden_len - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); + __Pyx_DECREF(__pyx_v_self->__pyx___overridden); + __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":157 + * + * self.__overridden = self.__overridden[:self.__overridden_len - 1] + * self.__overridden_len -= 1 # <<<<<<<<<<<<<< + * + * def reset_override(self): + */ + __pyx_v_self->__pyx___overridden_len = (__pyx_v_self->__pyx___overridden_len - 1); + + /* "dependency_injector/providers.pyx":145 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * def reset_last_overriding(self): # <<<<<<<<<<<<<< + * """Reset last overriding provider. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("dependency_injector.providers.Provider.reset_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":159 + * self.__overridden_len -= 1 + * + * def reset_override(self): # <<<<<<<<<<<<<< + * """Reset all overriding providers. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_15reset_override(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_14reset_override[] = "Reset all overriding providers.\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_15reset_override(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset_override (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_14reset_override(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_14reset_override(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reset_override", 0); + + /* "dependency_injector/providers.pyx":164 + * :rtype: None + * """ + * self.__overridden = tuple() # <<<<<<<<<<<<<< + * self.__overridden_len = 0 + * + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); + __Pyx_DECREF(__pyx_v_self->__pyx___overridden); + __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":165 + * """ + * self.__overridden = tuple() + * self.__overridden_len = 0 # <<<<<<<<<<<<<< + * + * def delegate(self): + */ + __pyx_v_self->__pyx___overridden_len = 0; + + /* "dependency_injector/providers.pyx":159 + * self.__overridden_len -= 1 + * + * def reset_override(self): # <<<<<<<<<<<<<< + * """Reset all overriding providers. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Provider.reset_override", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":167 + * self.__overridden_len = 0 + * + * def delegate(self): # <<<<<<<<<<<<<< + * """Return provider's delegate. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_17delegate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_16delegate[] = "Return provider's delegate.\n\n :rtype: :py:class:`Delegate`\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_17delegate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("delegate (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_16delegate(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_16delegate(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("delegate", 0); + + /* "dependency_injector/providers.pyx":172 + * :rtype: :py:class:`Delegate` + * """ + * return Delegate(self) # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Delegate), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":167 + * self.__overridden_len = 0 + * + * def delegate(self): # <<<<<<<<<<<<<< + * """Return provider's delegate. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Provider.delegate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":174 + * return Delegate(self) + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Providing strategy implementation. + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_8Provider__provide(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_19_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":181 + * overridden provider is called. Need to be overridden in subclasses. + * """ + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * @cython.boundscheck(False) + */ + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 181, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":174 + * return Delegate(self) + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Providing strategy implementation. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.Provider._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_18_provide[] = "Providing strategy implementation.\n\n Abstract protected method that implements providing strategy of\n particular provider. Current method is called every time when not\n overridden provider is called. Need to be overridden in subclasses.\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 174, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 174, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 174, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Provider._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 174, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 174, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_18_provide(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_18_provide(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_8Provider__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 174, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Provider._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":185 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cpdef object _call_last_overriding(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Call last overriding provider and return result.""" + * return self.__overridden[self.__overridden_len - 1](*args, + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_21_call_last_overriding(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_8Provider__call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + long __pyx_t_7; + __Pyx_RefNannySetupContext("_call_last_overriding", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_call_last_overriding); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_21_call_last_overriding)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 185, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 185, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":187 + * cpdef object _call_last_overriding(self, tuple args, dict kwargs): + * """Call last overriding provider and return result.""" + * return self.__overridden[self.__overridden_len - 1](*args, # <<<<<<<<<<<<<< + * **kwargs) + * + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_self->__pyx___overridden == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 187, __pyx_L1_error) + } + __pyx_t_7 = (__pyx_v_self->__pyx___overridden_len - 1); + if (unlikely(__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(1, 187, __pyx_L1_error) + } + + /* "dependency_injector/providers.pyx":188 + * """Call last overriding provider and return result.""" + * return self.__overridden[self.__overridden_len - 1](*args, + * **kwargs) # <<<<<<<<<<<<<< + * + * + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(1, 188, __pyx_L1_error) + } + + /* "dependency_injector/providers.pyx":187 + * cpdef object _call_last_overriding(self, tuple args, dict kwargs): + * """Call last overriding provider and return result.""" + * return self.__overridden[self.__overridden_len - 1](*args, # <<<<<<<<<<<<<< + * **kwargs) + * + */ + __pyx_t_1 = __Pyx_PyObject_Call(PyTuple_GET_ITEM(__pyx_v_self->__pyx___overridden, __pyx_t_7), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_t_1)); + __pyx_r = __pyx_t_1; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":185 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cpdef object _call_last_overriding(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Call last overriding provider and return result.""" + * return self.__overridden[self.__overridden_len - 1](*args, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.Provider._call_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_21_call_last_overriding(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Provider_20_call_last_overriding[] = "Call last overriding provider and return result."; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Provider_21_call_last_overriding(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_call_last_overriding (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_call_last_overriding", 1, 2, 2, 1); __PYX_ERR(1, 185, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_call_last_overriding") < 0)) __PYX_ERR(1, 185, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_call_last_overriding", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 185, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Provider._call_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 185, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 185, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Provider_20_call_last_overriding(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Provider_20_call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_call_last_overriding", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_8Provider__call_last_overriding(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Provider._call_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":201 + * """ + * + * def __init__(self, provides): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_6Object_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_6Object___init__[] = "Initializer.\n\n :param provides: Value that have to be provided.\n :type provides: object\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_6Object___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_6Object_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 201, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 201, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Object.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_6Object___init__(((struct __pyx_obj_19dependency_injector_9providers_Object *)__pyx_v_self), __pyx_v_provides); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_6Object___init__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, PyObject *__pyx_v_provides) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":207 + * :type provides: object + * """ + * self.__provides = provides # <<<<<<<<<<<<<< + * super(Object, self).__init__() + * + */ + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + __Pyx_GOTREF(__pyx_v_self->__pyx___provides); + __Pyx_DECREF(__pyx_v_self->__pyx___provides); + __pyx_v_self->__pyx___provides = __pyx_v_provides; + + /* "dependency_injector/providers.pyx":208 + * """ + * self.__provides = provides + * super(Object, self).__init__() # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Object)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Object)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_Object)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 208, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":201 + * """ + * + * def __init__(self, provides): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Object.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":210 + * super(Object, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_6Object_2__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_6Object_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_Object *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_v_overriding_provider = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":212 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":213 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":214 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * + * copied = self.__class__(deepcopy(self.__provides, memo)) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":213 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + } + + /* "dependency_injector/providers.pyx":216 + * return copied + * + * copied = self.__class__(deepcopy(self.__provides, memo)) # <<<<<<<<<<<<<< + * + * for overriding_provider in self.overridden: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __pyx_v_self->__pyx___provides; + __Pyx_INCREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 216, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 216, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 216, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 216, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":218 + * copied = self.__class__(deepcopy(self.__provides, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 218, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 218, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 218, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_10(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 218, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":219 + * + * for overriding_provider in self.overridden: + * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< + * + * return copied + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 219, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 219, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":218 + * copied = self.__class__(deepcopy(self.__provides, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":221 + * copied.override(deepcopy(overriding_provider, memo)) + * + * return copied # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":210 + * super(Object, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dependency_injector.providers.Object.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XDECREF(__pyx_v_overriding_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":223 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_5__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_6Object_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_6Object_4__str__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_5__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_6Object_4__str__(((struct __pyx_obj_19dependency_injector_9providers_Object *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_4__str__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "dependency_injector/providers.pyx":228 + * :rtype: str + * """ + * return represent_provider(provider=self, provides=self.__provides) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->__pyx___provides; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_19dependency_injector_9providers_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":223 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Object.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":230 + * return represent_provider(provider=self, provides=self.__provides) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_7__repr__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_6Object_6__repr__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_6Object_6__repr__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_7__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_6Object_6__repr__(((struct __pyx_obj_19dependency_injector_9providers_Object *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_6__repr__(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "dependency_injector/providers.pyx":235 + * :rtype: str + * """ + * return self.__str__() # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":230 + * return represent_provider(provider=self, provides=self.__provides) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Object.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":237 + * return self.__str__() + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return provided instance. + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_9_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_6Object__provide(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_6Object_9_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":248 + * :rtype: object + * """ + * return self.__provides # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___provides); + __pyx_r = __pyx_v_self->__pyx___provides; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":237 + * return self.__str__() + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return provided instance. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.Object._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_9_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_6Object_8_provide[] = "Return provided instance.\n\n :param args: Tuple of context positional arguments.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword arguments.\n :type kwargs: dict[str, object]\n\n :rtype: object\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_6Object_9_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 237, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 237, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 237, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Object._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 237, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 237, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_6Object_8_provide(((struct __pyx_obj_19dependency_injector_9providers_Object *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_6Object_8_provide(struct __pyx_obj_19dependency_injector_9providers_Object *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_6Object__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Object._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":261 + * """ + * + * def __init__(self, provides): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_8Delegate_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Delegate___init__[] = "Initializer.\n\n :param provides: Value that have to be provided.\n :type provides: object\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_8Delegate___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_8Delegate_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 261, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 261, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Delegate.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Delegate___init__(((struct __pyx_obj_19dependency_injector_9providers_Delegate *)__pyx_v_self), __pyx_v_provides); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_8Delegate___init__(struct __pyx_obj_19dependency_injector_9providers_Delegate *__pyx_v_self, PyObject *__pyx_v_provides) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":267 + * :type provides: object + * """ + * super(Delegate, self).__init__(ensure_is_provider(provides)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Delegate)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Delegate)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_Delegate)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_f_19dependency_injector_9providers_ensure_is_provider(__pyx_v_provides, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":261 + * """ + * + * def __init__(self, provides): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.Delegate.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":292 + * """ + * + * def __init__(self, type instance_of): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__instance_of = instance_of + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_18ExternalDependency_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_18ExternalDependency___init__[] = "Initializer."; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_18ExternalDependency_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyTypeObject *__pyx_v_instance_of = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_instance_of,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_instance_of)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 292, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_instance_of = ((PyTypeObject*)values[0]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 292, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.ExternalDependency.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_instance_of), (&PyType_Type), 1, "instance_of", 1))) __PYX_ERR(1, 292, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_18ExternalDependency___init__(((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self), __pyx_v_instance_of); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_18ExternalDependency___init__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyTypeObject *__pyx_v_instance_of) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":294 + * def __init__(self, type instance_of): + * """Initializer.""" + * self.__instance_of = instance_of # <<<<<<<<<<<<<< + * super(ExternalDependency, self).__init__() + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_instance_of)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_instance_of)); + __Pyx_GOTREF(__pyx_v_self->__pyx___instance_of); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); + __pyx_v_self->__pyx___instance_of = __pyx_v_instance_of; + + /* "dependency_injector/providers.pyx":295 + * """Initializer.""" + * self.__instance_of = instance_of + * super(ExternalDependency, self).__init__() # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_ExternalDependency)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_ExternalDependency)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_ExternalDependency)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 295, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 295, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 295, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":292 + * """ + * + * def __init__(self, type instance_of): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__instance_of = instance_of + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.ExternalDependency.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":297 + * super(ExternalDependency, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_18ExternalDependency_2__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_18ExternalDependency_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_v_overriding_provider = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":299 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 299, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":300 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":301 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * + * copied = self.__class__(self.__instance_of) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":300 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + } + + /* "dependency_injector/providers.pyx":303 + * return copied + * + * copied = self.__class__(self.__instance_of) # <<<<<<<<<<<<<< + * + * for overriding_provider in self.overridden: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self->__pyx___instance_of)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self->__pyx___instance_of)}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self->__pyx___instance_of)}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_self->__pyx___instance_of)); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":305 + * copied = self.__class__(self.__instance_of) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 305, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 305, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 305, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 305, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":306 + * + * for overriding_provider in self.overridden: + * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< + * + * return copied + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 306, __pyx_L1_error) + __pyx_t_10.__pyx_n = 1; + __pyx_t_10.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_5 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":305 + * copied = self.__class__(self.__instance_of) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":308 + * copied.override(deepcopy(overriding_provider, memo)) + * + * return copied # <<<<<<<<<<<<<< + * + * def __call__(self, *args, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":297 + * super(ExternalDependency, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dependency_injector.providers.ExternalDependency.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XDECREF(__pyx_v_overriding_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":310 + * return copied + * + * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * """Return provided instance. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_18ExternalDependency_4__call__[] = "Return provided instance.\n\n :param args: Tuple of context positional arguments.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword arguments.\n :type kwargs: dict[str, object]\n\n :raise: :py:exc:`dependency_injector.errors.Error`\n\n :rtype: object\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_4__call__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_18ExternalDependency_4__call__(((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_4__call__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_instance = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + __Pyx_RefNannySetupContext("__call__", 0); + + /* "dependency_injector/providers.pyx":325 + * cdef object instance + * + * if self.__overridden_len == 0: # <<<<<<<<<<<<<< + * raise Error('Dependency is not defined') + * + */ + __pyx_t_1 = ((__pyx_v_self->__pyx_base.__pyx___overridden_len == 0) != 0); + if (__pyx_t_1) { + + /* "dependency_injector/providers.pyx":326 + * + * if self.__overridden_len == 0: + * raise Error('Dependency is not defined') # <<<<<<<<<<<<<< + * + * instance = self._call_last_overriding(args, kwargs) + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 326, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":325 + * cdef object instance + * + * if self.__overridden_len == 0: # <<<<<<<<<<<<<< + * raise Error('Dependency is not defined') + * + */ + } + + /* "dependency_injector/providers.pyx":328 + * raise Error('Dependency is not defined') + * + * instance = self._call_last_overriding(args, kwargs) # <<<<<<<<<<<<<< + * + * if not isinstance(instance, self.instance_of): + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._call_last_overriding(((struct __pyx_obj_19dependency_injector_9providers_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_instance = __pyx_t_3; + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":330 + * instance = self._call_last_overriding(args, kwargs) + * + * if not isinstance(instance, self.instance_of): # <<<<<<<<<<<<<< + * raise Error('{0} is not an '.format(instance) + + * 'instance of {0}'.format(self.instance_of)) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_instance_of); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_IsInstance(__pyx_v_instance, __pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 330, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = ((!(__pyx_t_1 != 0)) != 0); + if (__pyx_t_4) { + + /* "dependency_injector/providers.pyx":331 + * + * if not isinstance(instance, self.instance_of): + * raise Error('{0} is not an '.format(instance) + # <<<<<<<<<<<<<< + * 'instance of {0}'.format(self.instance_of)) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_is_not_an, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_7) { + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_instance); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_instance}; + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_5); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_instance}; + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_5); + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(__pyx_v_instance); + __Pyx_GIVEREF(__pyx_v_instance); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_instance); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "dependency_injector/providers.pyx":332 + * if not isinstance(instance, self.instance_of): + * raise Error('{0} is not an '.format(instance) + + * 'instance of {0}'.format(self.instance_of)) # <<<<<<<<<<<<<< + * + * return instance + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_instance_of_0, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_instance_of); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (!__pyx_t_9) { + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 332, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_6); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_8)) { + PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 332, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { + PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 332, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + { + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "dependency_injector/providers.pyx":331 + * + * if not isinstance(instance, self.instance_of): + * raise Error('{0} is not an '.format(instance) + # <<<<<<<<<<<<<< + * 'instance of {0}'.format(self.instance_of)) + * + */ + __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 331, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 331, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":330 + * instance = self._call_last_overriding(args, kwargs) + * + * if not isinstance(instance, self.instance_of): # <<<<<<<<<<<<<< + * raise Error('{0} is not an '.format(instance) + + * 'instance of {0}'.format(self.instance_of)) + */ + } + + /* "dependency_injector/providers.pyx":334 + * 'instance of {0}'.format(self.instance_of)) + * + * return instance # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_instance); + __pyx_r = __pyx_v_instance; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":310 + * return copied + * + * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< + * """Return provided instance. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("dependency_injector.providers.ExternalDependency.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_instance); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":336 + * return instance + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_7__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_18ExternalDependency_6__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_6__str__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_7__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_18ExternalDependency_6__str__(((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_6__str__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "dependency_injector/providers.pyx":341 + * :rtype: str + * """ + * return represent_provider(provider=self, provides=self.__instance_of) # <<<<<<<<<<<<<< + * + * def __repr__(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instance_of); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_19dependency_injector_9providers_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":336 + * return instance + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.ExternalDependency.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":343 + * return represent_provider(provider=self, provides=self.__instance_of) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_9__repr__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_18ExternalDependency_8__repr__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_8__repr__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_9__repr__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_18ExternalDependency_8__repr__(((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_8__repr__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "dependency_injector/providers.pyx":348 + * :rtype: str + * """ + * return self.__str__() # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 348, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 348, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":343 + * return represent_provider(provider=self, provides=self.__instance_of) + * + * def __repr__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.ExternalDependency.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":351 + * + * @property + * def instance_of(self): # <<<<<<<<<<<<<< + * """Return class of required dependency.""" + * return self.__instance_of + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_11instance_of_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_11instance_of_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_18ExternalDependency_11instance_of___get__(((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_11instance_of___get__(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":353 + * def instance_of(self): + * """Return class of required dependency.""" + * return self.__instance_of # <<<<<<<<<<<<<< + * + * def provided_by(self, provider): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); + __pyx_r = ((PyObject *)__pyx_v_self->__pyx___instance_of); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":351 + * + * @property + * def instance_of(self): # <<<<<<<<<<<<<< + * """Return class of required dependency.""" + * return self.__instance_of + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":355 + * return self.__instance_of + * + * def provided_by(self, provider): # <<<<<<<<<<<<<< + * """Set external dependency provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_11provided_by(PyObject *__pyx_v_self, PyObject *__pyx_v_provider); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_18ExternalDependency_10provided_by[] = "Set external dependency provider.\n\n :param provider: Provider that provides required dependency.\n :type provider: :py:class:`Provider`\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_18ExternalDependency_11provided_by(PyObject *__pyx_v_self, PyObject *__pyx_v_provider) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("provided_by (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_18ExternalDependency_10provided_by(((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)__pyx_v_self), ((PyObject *)__pyx_v_provider)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_18ExternalDependency_10provided_by(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_provider) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("provided_by", 0); + + /* "dependency_injector/providers.pyx":363 + * :rtype: None + * """ + * return self.override(provider) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_override); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_provider); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_provider}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 363, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_provider}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 363, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_provider); + __Pyx_GIVEREF(__pyx_v_provider); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_provider); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 363, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":355 + * return self.__instance_of + * + * def provided_by(self, provider): # <<<<<<<<<<<<<< + * """Set external dependency provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("dependency_injector.providers.ExternalDependency.provided_by", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":380 + * """ + * + * def __init__(self, Provider overridden, Provider overriding): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_17OverridingContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_17OverridingContext___init__[] = "Initializer.\n\n :param overridden: Overridden provider.\n :type overridden: :py:class:`Provider`\n\n :param overriding: Overriding provider.\n :type overriding: :py:class:`Provider`\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_17OverridingContext___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_17OverridingContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_overridden = 0; + struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_overriding = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_overridden,&__pyx_n_s_overriding,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overridden)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overriding)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(1, 380, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 380, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_overridden = ((struct __pyx_obj_19dependency_injector_9providers_Provider *)values[0]); + __pyx_v_overriding = ((struct __pyx_obj_19dependency_injector_9providers_Provider *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 380, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.OverridingContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_overridden), __pyx_ptype_19dependency_injector_9providers_Provider, 1, "overridden", 0))) __PYX_ERR(1, 380, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_overriding), __pyx_ptype_19dependency_injector_9providers_Provider, 1, "overriding", 0))) __PYX_ERR(1, 380, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_17OverridingContext___init__(((struct __pyx_obj_19dependency_injector_9providers_OverridingContext *)__pyx_v_self), __pyx_v_overridden, __pyx_v_overriding); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_17OverridingContext___init__(struct __pyx_obj_19dependency_injector_9providers_OverridingContext *__pyx_v_self, struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_overridden, struct __pyx_obj_19dependency_injector_9providers_Provider *__pyx_v_overriding) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":389 + * :type overriding: :py:class:`Provider` + * """ + * self.__overridden = overridden # <<<<<<<<<<<<<< + * self.__overriding = overriding + * super(OverridingContext, self).__init__() + */ + __Pyx_INCREF(((PyObject *)__pyx_v_overridden)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_overridden)); + __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___overridden)); + __pyx_v_self->__pyx___overridden = __pyx_v_overridden; + + /* "dependency_injector/providers.pyx":390 + * """ + * self.__overridden = overridden + * self.__overriding = overriding # <<<<<<<<<<<<<< + * super(OverridingContext, self).__init__() + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_overriding)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_overriding)); + __Pyx_GOTREF(__pyx_v_self->__pyx___overriding); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___overriding)); + __pyx_v_self->__pyx___overriding = __pyx_v_overriding; + + /* "dependency_injector/providers.pyx":391 + * self.__overridden = overridden + * self.__overriding = overriding + * super(OverridingContext, self).__init__() # <<<<<<<<<<<<<< + * + * def __enter__(self): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_OverridingContext)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_OverridingContext)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_OverridingContext)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 391, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 391, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 391, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":380 + * """ + * + * def __init__(self, Provider overridden, Provider overriding): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.OverridingContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":393 + * super(OverridingContext, self).__init__() + * + * def __enter__(self): # <<<<<<<<<<<<<< + * """Do nothing.""" + * return self.__overriding + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_17OverridingContext_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_17OverridingContext_2__enter__[] = "Do nothing."; +static PyObject *__pyx_pw_19dependency_injector_9providers_17OverridingContext_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_17OverridingContext_2__enter__(((struct __pyx_obj_19dependency_injector_9providers_OverridingContext *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_17OverridingContext_2__enter__(struct __pyx_obj_19dependency_injector_9providers_OverridingContext *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__enter__", 0); + + /* "dependency_injector/providers.pyx":395 + * def __enter__(self): + * """Do nothing.""" + * return self.__overriding # <<<<<<<<<<<<<< + * + * def __exit__(self, *_): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx___overriding)); + __pyx_r = ((PyObject *)__pyx_v_self->__pyx___overriding); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":393 + * super(OverridingContext, self).__init__() + * + * def __enter__(self): # <<<<<<<<<<<<<< + * """Do nothing.""" + * return self.__overriding + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":397 + * return self.__overriding + * + * def __exit__(self, *_): # <<<<<<<<<<<<<< + * """Exit overriding context.""" + * self.__overridden.reset_last_overriding() + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_17OverridingContext_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_17OverridingContext_4__exit__[] = "Exit overriding context."; +static PyObject *__pyx_pw_19dependency_injector_9providers_17OverridingContext_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + CYTHON_UNUSED PyObject *__pyx_v__ = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v__ = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_17OverridingContext_4__exit__(((struct __pyx_obj_19dependency_injector_9providers_OverridingContext *)__pyx_v_self), __pyx_v__); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v__); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_17OverridingContext_4__exit__(struct __pyx_obj_19dependency_injector_9providers_OverridingContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v__) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__exit__", 0); + + /* "dependency_injector/providers.pyx":399 + * def __exit__(self, *_): + * """Exit overriding context.""" + * self.__overridden.reset_last_overriding() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___overridden), __pyx_n_s_reset_last_overriding); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 399, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 399, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 399, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":397 + * return self.__overriding + * + * def __exit__(self, *_): # <<<<<<<<<<<<<< + * """Exit overriding context.""" + * self.__overridden.reset_last_overriding() + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.OverridingContext.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":426 + * """ + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_8Callable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable___init__[] = "Initializer.\n\n :param provides: Wrapped callable.\n :type provides: callable\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_8Callable___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_8Callable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 426, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 426, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("dependency_injector.providers.Callable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable___init__(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_8Callable___init__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":438 + * :type kwargs: dict[str, object] + * """ + * if not callable(provides): # <<<<<<<<<<<<<< + * raise Error('Provider {0} expected to get callable, ' + * 'got {0}'.format('.'.join((self.__class__.__module__, + */ + __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_provides); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 438, __pyx_L1_error) + __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); + if (__pyx_t_2) { + + /* "dependency_injector/providers.pyx":439 + * """ + * if not callable(provides): + * raise Error('Provider {0} expected to get callable, ' # <<<<<<<<<<<<<< + * 'got {0}'.format('.'.join((self.__class__.__module__, + * self.__class__.__name__)), + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "dependency_injector/providers.pyx":440 + * if not callable(provides): + * raise Error('Provider {0} expected to get callable, ' + * 'got {0}'.format('.'.join((self.__class__.__module__, # <<<<<<<<<<<<<< + * self.__class__.__name__)), + * provides)) + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Provider_0_expected_to_get_calla, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_module); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "dependency_injector/providers.pyx":441 + * raise Error('Provider {0} expected to get callable, ' + * 'got {0}'.format('.'.join((self.__class__.__module__, + * self.__class__.__name__)), # <<<<<<<<<<<<<< + * provides)) + * self.__provides = provides + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "dependency_injector/providers.pyx":440 + * if not callable(provides): + * raise Error('Provider {0} expected to get callable, ' + * 'got {0}'.format('.'.join((self.__class__.__module__, # <<<<<<<<<<<<<< + * self.__class__.__name__)), + * provides)) + */ + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9); + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyString_Join(__pyx_kp_s__2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "dependency_injector/providers.pyx":442 + * 'got {0}'.format('.'.join((self.__class__.__module__, + * self.__class__.__name__)), + * provides)) # <<<<<<<<<<<<<< + * self.__provides = provides + * + */ + __pyx_t_7 = NULL; + __pyx_t_10 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_10 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_v_provides}; + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_v_provides}; + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_t_9); + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_provides); + __pyx_t_9 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 439, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 439, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 439, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 439, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 439, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":438 + * :type kwargs: dict[str, object] + * """ + * if not callable(provides): # <<<<<<<<<<<<<< + * raise Error('Provider {0} expected to get callable, ' + * 'got {0}'.format('.'.join((self.__class__.__module__, + */ + } + + /* "dependency_injector/providers.pyx":443 + * self.__class__.__name__)), + * provides)) + * self.__provides = provides # <<<<<<<<<<<<<< + * + * self.__args = tuple() + */ + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + __Pyx_GOTREF(__pyx_v_self->__pyx___provides); + __Pyx_DECREF(__pyx_v_self->__pyx___provides); + __pyx_v_self->__pyx___provides = __pyx_v_provides; + + /* "dependency_injector/providers.pyx":445 + * self.__provides = provides + * + * self.__args = tuple() # <<<<<<<<<<<<<< + * self.__args_len = 0 + * self.set_args(*args) + */ + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->__pyx___args); + __Pyx_DECREF(__pyx_v_self->__pyx___args); + __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":446 + * + * self.__args = tuple() + * self.__args_len = 0 # <<<<<<<<<<<<<< + * self.set_args(*args) + * + */ + __pyx_v_self->__pyx___args_len = 0; + + /* "dependency_injector/providers.pyx":447 + * self.__args = tuple() + * self.__args_len = 0 + * self.set_args(*args) # <<<<<<<<<<<<<< + * + * self.__kwargs = tuple() + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dependency_injector/providers.pyx":449 + * self.set_args(*args) + * + * self.__kwargs = tuple() # <<<<<<<<<<<<<< + * self.__kwargs_len = 0 + * self.set_kwargs(**kwargs) + */ + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); + __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); + __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + + /* "dependency_injector/providers.pyx":450 + * + * self.__kwargs = tuple() + * self.__kwargs_len = 0 # <<<<<<<<<<<<<< + * self.set_kwargs(**kwargs) + * + */ + __pyx_v_self->__pyx___kwargs_len = 0; + + /* "dependency_injector/providers.pyx":451 + * self.__kwargs = tuple() + * self.__kwargs_len = 0 + * self.set_kwargs(**kwargs) # <<<<<<<<<<<<<< + * + * super(Callable, self).__init__() + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":453 + * self.set_kwargs(**kwargs) + * + * super(Callable, self).__init__() # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Callable)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Callable)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_Callable)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_8) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 453, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":426 + * """ + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("dependency_injector.providers.Callable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":455 + * super(Callable, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_2__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_v_overriding_provider = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":457 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 457, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":458 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":459 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * + * copied = self.__class__(self.provides, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":458 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + } + + /* "dependency_injector/providers.pyx":461 + * return copied + * + * copied = self.__class__(self.provides, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provides); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":462 + * + * copied = self.__class__(self.provides, + * *deepcopy(self.args, memo), # <<<<<<<<<<<<<< + * **deepcopy(self.kwargs, memo)) + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 462, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_2, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 462, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":461 + * return copied + * + * copied = self.__class__(self.provides, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":463 + * copied = self.__class__(self.provides, + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) # <<<<<<<<<<<<<< + * + * for overriding_provider in self.overridden: + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 463, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_3 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(1, 463, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_t_3))) { + __pyx_t_2 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "dependency_injector/providers.pyx":461 + * return copied + * + * copied = self.__class__(self.provides, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":465 + * **deepcopy(self.kwargs, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 465, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 465, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 465, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 465, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_10(__pyx_t_2); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 465, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":466 + * + * for overriding_provider in self.overridden: + * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< + * + * return copied + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 466, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 466, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 466, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 466, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 466, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":465 + * **deepcopy(self.kwargs, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":468 + * copied.override(deepcopy(overriding_provider, memo)) + * + * return copied # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":455 + * super(Callable, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dependency_injector.providers.Callable.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XDECREF(__pyx_v_overriding_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":470 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_5__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_8Callable_4__str__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_5__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_4__str__(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_4__str__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "dependency_injector/providers.pyx":475 + * :rtype: str + * """ + * return represent_provider(provider=self, provides=self.__provides) # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->__pyx___provides; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_19dependency_injector_9providers_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 475, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":470 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Callable.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":478 + * + * @property + * def provides(self): # <<<<<<<<<<<<<< + * """Return wrapped callable.""" + * return self.__provides + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_8provides_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_8provides_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_8provides___get__(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_8provides___get__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":480 + * def provides(self): + * """Return wrapped callable.""" + * return self.__provides # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___provides); + __pyx_r = __pyx_v_self->__pyx___provides; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":478 + * + * @property + * def provides(self): # <<<<<<<<<<<<<< + * """Return wrapped callable.""" + * return self.__provides + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":483 + * + * @property + * def args(self): # <<<<<<<<<<<<<< + * """Return positional argument injections.""" + * cdef int index + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_4args___get__(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_4args___get__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self) { + int __pyx_v_index; + struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_arg = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":489 + * cdef list args + * + * args = list() # <<<<<<<<<<<<<< + * for index in range(self.__args_len): + * arg = self.__args[index] + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 489, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_args = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":490 + * + * args = list() + * for index in range(self.__args_len): # <<<<<<<<<<<<<< + * arg = self.__args[index] + * args.append(arg.__value) + */ + __pyx_t_2 = __pyx_v_self->__pyx___args_len; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_index = __pyx_t_3; + + /* "dependency_injector/providers.pyx":491 + * args = list() + * for index in range(self.__args_len): + * arg = self.__args[index] # <<<<<<<<<<<<<< + * args.append(arg.__value) + * return tuple(args) + */ + if (unlikely(__pyx_v_self->__pyx___args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 491, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->__pyx___args, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_PositionalInjection))))) __PYX_ERR(1, 491, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_arg, ((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":492 + * for index in range(self.__args_len): + * arg = self.__args[index] + * args.append(arg.__value) # <<<<<<<<<<<<<< + * return tuple(args) + * + */ + __pyx_t_1 = __pyx_v_arg->__pyx_base.__pyx___value; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_args, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 492, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":493 + * arg = self.__args[index] + * args.append(arg.__value) + * return tuple(args) # <<<<<<<<<<<<<< + * + * def add_args(self, *args): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_AsTuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":483 + * + * @property + * def args(self): # <<<<<<<<<<<<<< + * """Return positional argument injections.""" + * cdef int index + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Callable.args.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_arg); + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":495 + * return tuple(args) + * + * def add_args(self, *args): # <<<<<<<<<<<<<< + * """Add postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_6add_args[] = "Add postional argument injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_args (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_args", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_6add_args(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6add_args(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + __Pyx_RefNannySetupContext("add_args", 0); + + /* "dependency_injector/providers.pyx":503 + * :return: Reference ``self`` + * """ + * self.__args += parse_positional_injections(args) # <<<<<<<<<<<<<< + * self.__args_len = len(self.__args) + * return self + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_positional_injections(__pyx_v_args, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___args, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 503, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___args); + __Pyx_DECREF(__pyx_v_self->__pyx___args); + __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":504 + * """ + * self.__args += parse_positional_injections(args) + * self.__args_len = len(self.__args) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __pyx_v_self->__pyx___args; + __Pyx_INCREF(__pyx_t_2); + if (unlikely(__pyx_t_2 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 504, __pyx_L1_error) + } + __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(1, 504, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_self->__pyx___args_len = __pyx_t_3; + + /* "dependency_injector/providers.pyx":505 + * self.__args += parse_positional_injections(args) + * self.__args_len = len(self.__args) + * return self # <<<<<<<<<<<<<< + * + * def set_args(self, *args): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":495 + * return tuple(args) + * + * def add_args(self, *args): # <<<<<<<<<<<<<< + * """Add postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Callable.add_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":507 + * return self + * + * def set_args(self, *args): # <<<<<<<<<<<<<< + * """Set postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_8set_args[] = "Set postional argument injections.\n\n Existing positional argument injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_args (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_args", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_8set_args(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_8set_args(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + __Pyx_RefNannySetupContext("set_args", 0); + + /* "dependency_injector/providers.pyx":517 + * :return: Reference ``self`` + * """ + * self.__args = parse_positional_injections(args) # <<<<<<<<<<<<<< + * self.__args_len = len(self.__args) + * return self + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_positional_injections(__pyx_v_args, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 517, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___args); + __Pyx_DECREF(__pyx_v_self->__pyx___args); + __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":518 + * """ + * self.__args = parse_positional_injections(args) + * self.__args_len = len(self.__args) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___args; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 518, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 518, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx___args_len = __pyx_t_2; + + /* "dependency_injector/providers.pyx":519 + * self.__args = parse_positional_injections(args) + * self.__args_len = len(self.__args) + * return self # <<<<<<<<<<<<<< + * + * def clear_args(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":507 + * return self + * + * def set_args(self, *args): # <<<<<<<<<<<<<< + * """Set postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Callable.set_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":521 + * return self + * + * def clear_args(self): # <<<<<<<<<<<<<< + * """Drop postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_10clear_args[] = "Drop postional argument injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_args (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_10clear_args(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_10clear_args(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + __Pyx_RefNannySetupContext("clear_args", 0); + + /* "dependency_injector/providers.pyx":526 + * :return: Reference ``self`` + * """ + * self.__args = tuple() # <<<<<<<<<<<<<< + * self.__args_len = len(self.__args) + * return self + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 526, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___args); + __Pyx_DECREF(__pyx_v_self->__pyx___args); + __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":527 + * """ + * self.__args = tuple() + * self.__args_len = len(self.__args) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___args; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 527, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 527, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx___args_len = __pyx_t_2; + + /* "dependency_injector/providers.pyx":528 + * self.__args = tuple() + * self.__args_len = len(self.__args) + * return self # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":521 + * return self + * + * def clear_args(self): # <<<<<<<<<<<<<< + * """Drop postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Callable.clear_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":531 + * + * @property + * def kwargs(self): # <<<<<<<<<<<<<< + * """Return keyword argument injections.""" + * cdef int index + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_6kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_6kwargs_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_6kwargs___get__(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self) { + int __pyx_v_index; + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_kwarg = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":537 + * cdef dict kwargs + * + * kwargs = dict() # <<<<<<<<<<<<<< + * for index in range(self.__kwargs_len): + * kwarg = self.__kwargs[index] + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 537, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_kwargs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":538 + * + * kwargs = dict() + * for index in range(self.__kwargs_len): # <<<<<<<<<<<<<< + * kwarg = self.__kwargs[index] + * kwargs[kwarg.__name] = kwarg.__value + */ + __pyx_t_2 = __pyx_v_self->__pyx___kwargs_len; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_index = __pyx_t_3; + + /* "dependency_injector/providers.pyx":539 + * kwargs = dict() + * for index in range(self.__kwargs_len): + * kwarg = self.__kwargs[index] # <<<<<<<<<<<<<< + * kwargs[kwarg.__name] = kwarg.__value + * return kwargs + */ + if (unlikely(__pyx_v_self->__pyx___kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 539, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->__pyx___kwargs, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 539, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_NamedInjection))))) __PYX_ERR(1, 539, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_kwarg, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":540 + * for index in range(self.__kwargs_len): + * kwarg = self.__kwargs[index] + * kwargs[kwarg.__name] = kwarg.__value # <<<<<<<<<<<<<< + * return kwargs + * + */ + __pyx_t_1 = __pyx_v_kwarg->__pyx_base.__pyx___value; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_kwarg->__pyx___name, __pyx_t_1) < 0)) __PYX_ERR(1, 540, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":541 + * kwarg = self.__kwargs[index] + * kwargs[kwarg.__name] = kwarg.__value + * return kwargs # <<<<<<<<<<<<<< + * + * def add_kwargs(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_kwargs); + __pyx_r = __pyx_v_kwargs; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":531 + * + * @property + * def kwargs(self): # <<<<<<<<<<<<<< + * """Return keyword argument injections.""" + * cdef int index + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Callable.kwargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_kwarg); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":543 + * return kwargs + * + * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Add keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_12add_kwargs[] = "Add keyword argument injections.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_kwargs (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("add_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_kwargs", 1))) return NULL; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_12add_kwargs(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + __Pyx_RefNannySetupContext("add_kwargs", 0); + + /* "dependency_injector/providers.pyx":551 + * :return: Reference ``self`` + * """ + * self.__kwargs += parse_named_injections(kwargs) # <<<<<<<<<<<<<< + * self.__kwargs_len = len(self.__kwargs) + * return self + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___kwargs, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 551, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); + __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); + __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":552 + * """ + * self.__kwargs += parse_named_injections(kwargs) + * self.__kwargs_len = len(self.__kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __pyx_v_self->__pyx___kwargs; + __Pyx_INCREF(__pyx_t_2); + if (unlikely(__pyx_t_2 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 552, __pyx_L1_error) + } + __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(1, 552, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_self->__pyx___kwargs_len = __pyx_t_3; + + /* "dependency_injector/providers.pyx":553 + * self.__kwargs += parse_named_injections(kwargs) + * self.__kwargs_len = len(self.__kwargs) + * return self # <<<<<<<<<<<<<< + * + * def set_kwargs(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":543 + * return kwargs + * + * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Add keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Callable.add_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":555 + * return self + * + * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Set keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_14set_kwargs[] = "Set keyword argument injections.\n\n Existing keyword argument injections are dropped.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_kwargs (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("set_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_kwargs", 1))) return NULL; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_14set_kwargs(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + __Pyx_RefNannySetupContext("set_kwargs", 0); + + /* "dependency_injector/providers.pyx":565 + * :return: Reference ``self`` + * """ + * self.__kwargs = parse_named_injections(kwargs) # <<<<<<<<<<<<<< + * self.__kwargs_len = len(self.__kwargs) + * return self + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 565, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); + __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); + __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":566 + * """ + * self.__kwargs = parse_named_injections(kwargs) + * self.__kwargs_len = len(self.__kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___kwargs; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 566, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 566, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx___kwargs_len = __pyx_t_2; + + /* "dependency_injector/providers.pyx":567 + * self.__kwargs = parse_named_injections(kwargs) + * self.__kwargs_len = len(self.__kwargs) + * return self # <<<<<<<<<<<<<< + * + * def clear_kwargs(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":555 + * return self + * + * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Set keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Callable.set_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":569 + * return self + * + * def clear_kwargs(self): # <<<<<<<<<<<<<< + * """Drop keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_16clear_kwargs[] = "Drop keyword argument injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_kwargs (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_16clear_kwargs(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + __Pyx_RefNannySetupContext("clear_kwargs", 0); + + /* "dependency_injector/providers.pyx":574 + * :return: Reference ``self`` + * """ + * self.__kwargs = tuple() # <<<<<<<<<<<<<< + * self.__kwargs_len = len(self.__kwargs) + * return self + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 574, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); + __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); + __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":575 + * """ + * self.__kwargs = tuple() + * self.__kwargs_len = len(self.__kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___kwargs; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 575, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 575, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx___kwargs_len = __pyx_t_2; + + /* "dependency_injector/providers.pyx":576 + * self.__kwargs = tuple() + * self.__kwargs_len = len(self.__kwargs) + * return self # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":569 + * return self + * + * def clear_kwargs(self): # <<<<<<<<<<<<<< + * """Drop keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Callable.clear_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":578 + * return self + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return result of provided callable's call.""" + * return __callable_call(self, args, kwargs) + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_8Callable__provide(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_19_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":580 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return result of provided callable's call.""" + * return __callable_call(self, args, kwargs) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers___callable_call(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 580, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":578 + * return self + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return result of provided callable's call.""" + * return __callable_call(self, args, kwargs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.Callable._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8Callable_18_provide[] = "Return result of provided callable's call."; +static PyObject *__pyx_pw_19dependency_injector_9providers_8Callable_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 578, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 578, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 578, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Callable._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 578, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 578, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_8Callable_18_provide(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8Callable_18_provide(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_8Callable__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 578, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Callable._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":612 + * """ + * + * def __init__(self, name): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_13Configuration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13Configuration___init__[] = "Initializer.\n\n :param name: Name of configuration unit.\n :type name: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13Configuration___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_13Configuration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name_2)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 612, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_name = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 612, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Configuration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration___init__(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_13Configuration___init__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_name) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":618 + * :type name: str + * """ + * self.__name = name # <<<<<<<<<<<<<< + * self.__value = None + * self.__children = dict() + */ + if (!(likely(PyString_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(1, 618, __pyx_L1_error) + __pyx_t_1 = __pyx_v_name; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___name); + __Pyx_DECREF(__pyx_v_self->__pyx___name); + __pyx_v_self->__pyx___name = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":619 + * """ + * self.__name = name + * self.__value = None # <<<<<<<<<<<<<< + * self.__children = dict() + * super(Configuration, self).__init__() + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->__pyx___value); + __Pyx_DECREF(__pyx_v_self->__pyx___value); + __pyx_v_self->__pyx___value = Py_None; + + /* "dependency_injector/providers.pyx":620 + * self.__name = name + * self.__value = None + * self.__children = dict() # <<<<<<<<<<<<<< + * super(Configuration, self).__init__() + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___children); + __Pyx_DECREF(__pyx_v_self->__pyx___children); + __pyx_v_self->__pyx___children = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":621 + * self.__value = None + * self.__children = dict() + * super(Configuration, self).__init__() # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Configuration)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Configuration)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_Configuration)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 621, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":612 + * """ + * + * def __init__(self, name): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":623 + * super(Configuration, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13Configuration_2__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_v_overriding_provider = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":625 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 625, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":626 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":627 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * + * copied = self.__class__(self.__name) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":626 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + } + + /* "dependency_injector/providers.pyx":629 + * return copied + * + * copied = self.__class__(self.__name) # <<<<<<<<<<<<<< + * copied.update(deepcopy(self.__value)) + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx___name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_self->__pyx___name}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_self->__pyx___name}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_INCREF(__pyx_v_self->__pyx___name); + __Pyx_GIVEREF(__pyx_v_self->__pyx___name); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self->__pyx___name); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 629, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":630 + * + * copied = self.__class__(self.__name) + * copied.update(deepcopy(self.__value)) # <<<<<<<<<<<<<< + * + * for overriding_provider in self.overridden: + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __pyx_v_self->__pyx___value; + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_4, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":632 + * copied.update(deepcopy(self.__value)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 632, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 632, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 632, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 632, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_9(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 632, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":633 + * + * for overriding_provider in self.overridden: + * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< + * + * return copied + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 633, __pyx_L1_error) + __pyx_t_10.__pyx_n = 1; + __pyx_t_10.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_5 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 633, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 633, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 633, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 633, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":632 + * copied.update(deepcopy(self.__value)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":635 + * copied.override(deepcopy(overriding_provider, memo)) + * + * return copied # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":623 + * super(Configuration, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XDECREF(__pyx_v_overriding_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":637 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_5__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13Configuration_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13Configuration_4__str__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_5__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration_4__str__(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_4__str__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "dependency_injector/providers.pyx":642 + * :rtype: str + * """ + * return represent_provider(provider=self, provides=self.__name) # <<<<<<<<<<<<<< + * + * def __getattr__(self, name): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_v_self->__pyx___name; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_19dependency_injector_9providers_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 642, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":637 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":644 + * return represent_provider(provider=self, provides=self.__name) + * + * def __getattr__(self, name): # <<<<<<<<<<<<<< + * """Return child configuration provider.""" + * cdef Configuration child_provider + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_7__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13Configuration_6__getattr__[] = "Return child configuration provider."; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13Configuration_6__getattr__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_7__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration_6__getattr__(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self), ((PyObject *)__pyx_v_name)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_6__getattr__(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_name) { + struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_child_provider = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + __Pyx_RefNannySetupContext("__getattr__", 0); + + /* "dependency_injector/providers.pyx":649 + * cdef object value + * + * child_provider = self.__children.get(name) # <<<<<<<<<<<<<< + * + * if child_provider is None: + */ + if (unlikely(__pyx_v_self->__pyx___children == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); + __PYX_ERR(1, 649, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->__pyx___children, __pyx_v_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 649, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_Configuration))))) __PYX_ERR(1, 649, __pyx_L1_error) + __pyx_v_child_provider = ((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":651 + * child_provider = self.__children.get(name) + * + * if child_provider is None: # <<<<<<<<<<<<<< + * child_provider = self.__class__(self._get_child_name(name)) + * + */ + __pyx_t_2 = (((PyObject *)__pyx_v_child_provider) == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "dependency_injector/providers.pyx":652 + * + * if child_provider is None: + * child_provider = self.__class__(self._get_child_name(name)) # <<<<<<<<<<<<<< + * + * if isinstance(self.__value, dict): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyString_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(1, 652, __pyx_L1_error) + __pyx_t_5 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_Configuration *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_child_name(__pyx_v_self, ((PyObject*)__pyx_v_name), 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_6) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_Configuration))))) __PYX_ERR(1, 652, __pyx_L1_error) + __Pyx_DECREF_SET(__pyx_v_child_provider, ((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":654 + * child_provider = self.__class__(self._get_child_name(name)) + * + * if isinstance(self.__value, dict): # <<<<<<<<<<<<<< + * child_provider.update(self.__value.get(name)) + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___value; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyDict_Check(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { + + /* "dependency_injector/providers.pyx":655 + * + * if isinstance(self.__value, dict): + * child_provider.update(self.__value.get(name)) # <<<<<<<<<<<<<< + * + * self.__children[name] = child_provider + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___value, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_7) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_name}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 655, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_name}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 655, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_name); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_Configuration *)__pyx_v_child_provider->__pyx_base.__pyx_vtab)->update(__pyx_v_child_provider, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 655, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "dependency_injector/providers.pyx":654 + * child_provider = self.__class__(self._get_child_name(name)) + * + * if isinstance(self.__value, dict): # <<<<<<<<<<<<<< + * child_provider.update(self.__value.get(name)) + * + */ + } + + /* "dependency_injector/providers.pyx":657 + * child_provider.update(self.__value.get(name)) + * + * self.__children[name] = child_provider # <<<<<<<<<<<<<< + * + * return child_provider + */ + if (unlikely(__pyx_v_self->__pyx___children == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 657, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_v_self->__pyx___children, __pyx_v_name, ((PyObject *)__pyx_v_child_provider)) < 0)) __PYX_ERR(1, 657, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":651 + * child_provider = self.__children.get(name) + * + * if child_provider is None: # <<<<<<<<<<<<<< + * child_provider = self.__class__(self._get_child_name(name)) + * + */ + } + + /* "dependency_injector/providers.pyx":659 + * self.__children[name] = child_provider + * + * return child_provider # <<<<<<<<<<<<<< + * + * cpdef str get_name(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_child_provider)); + __pyx_r = ((PyObject *)__pyx_v_child_provider); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":644 + * return represent_provider(provider=self, provides=self.__name) + * + * def __getattr__(self, name): # <<<<<<<<<<<<<< + * """Return child configuration provider.""" + * cdef Configuration child_provider + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":661 + * return child_provider + * + * cpdef str get_name(self): # <<<<<<<<<<<<<< + * """Name of configuration unit.""" + * return self.__name + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration_get_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("get_name", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_9get_name)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 661, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 661, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(1, 661, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":663 + * cpdef str get_name(self): + * """Name of configuration unit.""" + * return self.__name # <<<<<<<<<<<<<< + * + * cpdef object update(self, value): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___name); + __pyx_r = __pyx_v_self->__pyx___name; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":661 + * return child_provider + * + * cpdef str get_name(self): # <<<<<<<<<<<<<< + * """Name of configuration unit.""" + * return self.__name + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13Configuration_8get_name[] = "Name of configuration unit."; +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_name (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration_8get_name(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_8get_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_name", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13Configuration_get_name(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 661, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":665 + * return self.__name + * + * cpdef object update(self, value): # <<<<<<<<<<<<<< + * """Set configuration options. + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_11update(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration_update(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch) { + struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_child_provider = 0; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *(*__pyx_t_9)(PyObject *); + __Pyx_RefNannySetupContext("update", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_11update)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_value}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 665, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_value}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 665, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_value); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":676 + * cdef object child_value + * + * self.__value = value # <<<<<<<<<<<<<< + * + * if not isinstance(self.__value, dict): + */ + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->__pyx___value); + __Pyx_DECREF(__pyx_v_self->__pyx___value); + __pyx_v_self->__pyx___value = __pyx_v_value; + + /* "dependency_injector/providers.pyx":678 + * self.__value = value + * + * if not isinstance(self.__value, dict): # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___value; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_6 = PyDict_Check(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":679 + * + * if not isinstance(self.__value, dict): + * return # <<<<<<<<<<<<<< + * + * for name in self.__value: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":678 + * self.__value = value + * + * if not isinstance(self.__value, dict): # <<<<<<<<<<<<<< + * return + * + */ + } + + /* "dependency_injector/providers.pyx":681 + * return + * + * for name in self.__value: # <<<<<<<<<<<<<< + * child_provider = self.__children.get(name) + * + */ + if (likely(PyList_CheckExact(__pyx_v_self->__pyx___value)) || PyTuple_CheckExact(__pyx_v_self->__pyx___value)) { + __pyx_t_1 = __pyx_v_self->__pyx___value; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + __pyx_t_9 = NULL; + } else { + __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->__pyx___value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 681, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_9)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 681, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(1, 681, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 681, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_9(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 681, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":682 + * + * for name in self.__value: + * child_provider = self.__children.get(name) # <<<<<<<<<<<<<< + * + * if child_provider is None: + */ + if (unlikely(__pyx_v_self->__pyx___children == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); + __PYX_ERR(1, 682, __pyx_L1_error) + } + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->__pyx___children, __pyx_v_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_19dependency_injector_9providers_Configuration))))) __PYX_ERR(1, 682, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_child_provider, ((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":684 + * child_provider = self.__children.get(name) + * + * if child_provider is None: # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_7 = (((PyObject *)__pyx_v_child_provider) == Py_None); + __pyx_t_6 = (__pyx_t_7 != 0); + if (__pyx_t_6) { + + /* "dependency_injector/providers.pyx":685 + * + * if child_provider is None: + * continue # <<<<<<<<<<<<<< + * + * child_provider.update(self.__value.get(name)) + */ + goto __pyx_L4_continue; + + /* "dependency_injector/providers.pyx":684 + * child_provider = self.__children.get(name) + * + * if child_provider is None: # <<<<<<<<<<<<<< + * continue + * + */ + } + + /* "dependency_injector/providers.pyx":687 + * continue + * + * child_provider.update(self.__value.get(name)) # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___value, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_name}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_name}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_name); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_Configuration *)__pyx_v_child_provider->__pyx_base.__pyx_vtab)->update(__pyx_v_child_provider, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 687, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":681 + * return + * + * for name in self.__value: # <<<<<<<<<<<<<< + * child_provider = self.__children.get(name) + * + */ + __pyx_L4_continue:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":665 + * return self.__name + * + * cpdef object update(self, value): # <<<<<<<<<<<<<< + * """Set configuration options. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child_provider); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_11update(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13Configuration_10update[] = "Set configuration options.\n\n :param value: Value of configuration option.\n :type value: object | dict\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_11update(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("update (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration_10update(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_10update(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("update", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13Configuration_update(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 665, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Configuration.update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":689 + * child_provider.update(self.__value.get(name)) + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return result of provided callable's call.""" + * return self.__value + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_13_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration__provide(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_13_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 689, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 689, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":691 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return result of provided callable's call.""" + * return self.__value # <<<<<<<<<<<<<< + * + * cpdef str _get_child_name(self, str child_name): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___value); + __pyx_r = __pyx_v_self->__pyx___value; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":689 + * child_provider.update(self.__value.get(name)) + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return result of provided callable's call.""" + * return self.__value + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.Configuration._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_13_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13Configuration_12_provide[] = "Return result of provided callable's call."; +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_13_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 689, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 689, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 689, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Configuration._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 689, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 689, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration_12_provide(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_12_provide(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13Configuration__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 689, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Configuration._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":693 + * return self.__value + * + * cpdef str _get_child_name(self, str child_name): # <<<<<<<<<<<<<< + * cdef str child_full_name + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_15_get_child_name(PyObject *__pyx_v_self, PyObject *__pyx_v_child_name); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_13Configuration__get_child_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name, int __pyx_skip_dispatch) { + PyObject *__pyx_v_child_full_name = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("_get_child_name", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_child_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_15_get_child_name)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_child_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_child_name}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_child_name}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_child_name); + __Pyx_GIVEREF(__pyx_v_child_name); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_child_name); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(1, 693, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":696 + * cdef str child_full_name + * + * child_full_name = '' # <<<<<<<<<<<<<< + * + * if self.__name: + */ + __Pyx_INCREF(__pyx_kp_s__3); + __pyx_v_child_full_name = __pyx_kp_s__3; + + /* "dependency_injector/providers.pyx":698 + * child_full_name = '' + * + * if self.__name: # <<<<<<<<<<<<<< + * child_full_name += self.__name + '.' + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->__pyx___name); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 698, __pyx_L1_error) + if (__pyx_t_6) { + + /* "dependency_injector/providers.pyx":699 + * + * if self.__name: + * child_full_name += self.__name + '.' # <<<<<<<<<<<<<< + * + * child_full_name += child_name + */ + __pyx_t_1 = PyNumber_Add(__pyx_v_self->__pyx___name, __pyx_kp_s__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_child_full_name, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 699, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_child_full_name, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":698 + * child_full_name = '' + * + * if self.__name: # <<<<<<<<<<<<<< + * child_full_name += self.__name + '.' + * + */ + } + + /* "dependency_injector/providers.pyx":701 + * child_full_name += self.__name + '.' + * + * child_full_name += child_name # <<<<<<<<<<<<<< + * + * return child_full_name + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_child_full_name, __pyx_v_child_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 701, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_child_full_name, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":703 + * child_full_name += child_name + * + * return child_full_name # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_child_full_name); + __pyx_r = __pyx_v_child_full_name; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":693 + * return self.__value + * + * cpdef str _get_child_name(self, str child_name): # <<<<<<<<<<<<<< + * cdef str child_full_name + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.Configuration._get_child_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_child_full_name); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_15_get_child_name(PyObject *__pyx_v_self, PyObject *__pyx_v_child_name); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_13Configuration_15_get_child_name(PyObject *__pyx_v_self, PyObject *__pyx_v_child_name) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_child_name (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child_name), (&PyString_Type), 1, "child_name", 1))) __PYX_ERR(1, 693, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_13Configuration_14_get_child_name(((struct __pyx_obj_19dependency_injector_9providers_Configuration *)__pyx_v_self), ((PyObject*)__pyx_v_child_name)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13Configuration_14_get_child_name(struct __pyx_obj_19dependency_injector_9providers_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_get_child_name", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13Configuration__get_child_name(__pyx_v_self, __pyx_v_child_name, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 693, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Configuration._get_child_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":759 + * provided_type = None + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_7Factory_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_7Factory___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_7Factory_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 759, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 759, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("dependency_injector.providers.Factory.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory___init__(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_7Factory___init__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":771 + * :type kwargs: dict[str, object] + * """ + * if (self.__class__.provided_type and # <<<<<<<<<<<<<< + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 771, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 771, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + + /* "dependency_injector/providers.pyx":772 + * """ + * if (self.__class__.provided_type and + * not issubclass(provides, self.__class__.provided_type)): # <<<<<<<<<<<<<< + * raise Error('{0} can provide only {1} instances'.format( + * self.__class__, self.__class__.provided_type)) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 772, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyObject_IsSubclass(__pyx_v_provides, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 772, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + + /* "dependency_injector/providers.pyx":771 + * :type kwargs: dict[str, object] + * """ + * if (self.__class__.provided_type and # <<<<<<<<<<<<<< + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + */ + if (__pyx_t_1) { + + /* "dependency_injector/providers.pyx":773 + * if (self.__class__.provided_type and + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( # <<<<<<<<<<<<<< + * self.__class__, self.__class__.provided_type)) + * + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_can_provide_only_1_instances, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + + /* "dependency_injector/providers.pyx":774 + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + * self.__class__, self.__class__.provided_type)) # <<<<<<<<<<<<<< + * + * self.__instantiator = Callable(provides, *args, **kwargs) + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 774, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10); + __pyx_t_8 = 0; + __pyx_t_10 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_7) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 773, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 773, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":771 + * :type kwargs: dict[str, object] + * """ + * if (self.__class__.provided_type and # <<<<<<<<<<<<<< + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + */ + } + + /* "dependency_injector/providers.pyx":776 + * self.__class__, self.__class__.provided_type)) + * + * self.__instantiator = Callable(provides, *args, **kwargs) # <<<<<<<<<<<<<< + * + * self.__attributes = tuple() + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Callable), __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 776, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___instantiator); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___instantiator)); + __pyx_v_self->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":778 + * self.__instantiator = Callable(provides, *args, **kwargs) + * + * self.__attributes = tuple() # <<<<<<<<<<<<<< + * self.__attributes_len = 0 + * + */ + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 778, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); + __Pyx_DECREF(__pyx_v_self->__pyx___attributes); + __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":779 + * + * self.__attributes = tuple() + * self.__attributes_len = 0 # <<<<<<<<<<<<<< + * + * super(Factory, self).__init__() + */ + __pyx_v_self->__pyx___attributes_len = 0; + + /* "dependency_injector/providers.pyx":781 + * self.__attributes_len = 0 + * + * super(Factory, self).__init__() # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Factory)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Factory)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_Factory)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 781, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_12) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 781, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 781, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":759 + * provided_type = None + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("dependency_injector.providers.Factory.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":783 + * super(Factory, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_2__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_v_overriding_provider = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":785 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":786 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":787 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * + * copied = self.__class__(self.cls, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":786 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + } + + /* "dependency_injector/providers.pyx":789 + * return copied + * + * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cls); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":790 + * + * copied = self.__class__(self.cls, + * *deepcopy(self.args, memo), # <<<<<<<<<<<<<< + * **deepcopy(self.kwargs, memo)) + * copied.set_attributes(**deepcopy(self.attributes, memo)) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 790, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_2, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 790, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":789 + * return copied + * + * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":791 + * copied = self.__class__(self.cls, + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) # <<<<<<<<<<<<<< + * copied.set_attributes(**deepcopy(self.attributes, memo)) + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 791, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 791, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_3 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 791, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(1, 791, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_t_3))) { + __pyx_t_2 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 791, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "dependency_injector/providers.pyx":789 + * return copied + * + * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 789, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":792 + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + * copied.set_attributes(**deepcopy(self.attributes, memo)) # <<<<<<<<<<<<<< + * + * for overriding_provider in self.overridden: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_set_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 792, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_4, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(1, 792, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_t_1))) { + __pyx_t_2 = PyDict_Copy(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 792, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":794 + * copied.set_attributes(**deepcopy(self.attributes, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 794, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 794, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_10(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 794, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":795 + * + * for overriding_provider in self.overridden: + * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< + * + * return copied + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 795, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 795, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":794 + * copied.set_attributes(**deepcopy(self.attributes, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":797 + * copied.override(deepcopy(overriding_provider, memo)) + * + * return copied # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":783 + * super(Factory, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dependency_injector.providers.Factory.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XDECREF(__pyx_v_overriding_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":799 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_5__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_7Factory_4__str__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_5__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_4__str__(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_4__str__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "dependency_injector/providers.pyx":804 + * :rtype: str + * """ + * return represent_provider(provider=self, # <<<<<<<<<<<<<< + * provides=self.__instantiator.provides) + * + */ + __Pyx_XDECREF(__pyx_r); + + /* "dependency_injector/providers.pyx":805 + * """ + * return represent_provider(provider=self, + * provides=self.__instantiator.provides) # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_provides); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 805, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "dependency_injector/providers.pyx":804 + * :rtype: str + * """ + * return represent_provider(provider=self, # <<<<<<<<<<<<<< + * provides=self.__instantiator.provides) + * + */ + __pyx_t_2 = __pyx_f_19dependency_injector_9providers_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 804, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":799 + * return copied + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Factory.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":808 + * + * @property + * def cls(self): # <<<<<<<<<<<<<< + * """Return provided type.""" + * return self.__instantiator.provides + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_3cls_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_3cls_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_3cls___get__(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":810 + * def cls(self): + * """Return provided type.""" + * return self.__instantiator.provides # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_provides); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 810, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":808 + * + * @property + * def cls(self): # <<<<<<<<<<<<<< + * """Return provided type.""" + * return self.__instantiator.provides + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Factory.cls.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":813 + * + * @property + * def args(self): # <<<<<<<<<<<<<< + * """Return positional argument injections.""" + * return self.__instantiator.args + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_4args___get__(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_4args___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":815 + * def args(self): + * """Return positional argument injections.""" + * return self.__instantiator.args # <<<<<<<<<<<<<< + * + * def add_args(self, *args): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 815, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":813 + * + * @property + * def args(self): # <<<<<<<<<<<<<< + * """Return positional argument injections.""" + * return self.__instantiator.args + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Factory.args.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":817 + * return self.__instantiator.args + * + * def add_args(self, *args): # <<<<<<<<<<<<<< + * """Add __init__ postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_6add_args[] = "Add __init__ postional argument injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_args (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_args", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_6add_args(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6add_args(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("add_args", 0); + + /* "dependency_injector/providers.pyx":825 + * :return: Reference ``self`` + * """ + * self.__instantiator.add_args(*args) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 825, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":826 + * """ + * self.__instantiator.add_args(*args) + * return self # <<<<<<<<<<<<<< + * + * def set_args(self, *args): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":817 + * return self.__instantiator.args + * + * def add_args(self, *args): # <<<<<<<<<<<<<< + * """Add __init__ postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Factory.add_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":828 + * return self + * + * def set_args(self, *args): # <<<<<<<<<<<<<< + * """Set __init__ postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_8set_args[] = "Set __init__ postional argument injections.\n\n Existing __init__ positional argument injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_args (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_args", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_8set_args(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_8set_args(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("set_args", 0); + + /* "dependency_injector/providers.pyx":838 + * :return: Reference ``self`` + * """ + * self.__instantiator.set_args(*args) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 838, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":839 + * """ + * self.__instantiator.set_args(*args) + * return self # <<<<<<<<<<<<<< + * + * def clear_args(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":828 + * return self + * + * def set_args(self, *args): # <<<<<<<<<<<<<< + * """Set __init__ postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Factory.set_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":841 + * return self + * + * def clear_args(self): # <<<<<<<<<<<<<< + * """Drop __init__ postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_10clear_args[] = "Drop __init__ postional argument injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_args (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_10clear_args(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_10clear_args(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("clear_args", 0); + + /* "dependency_injector/providers.pyx":846 + * :return: Reference ``self`` + * """ + * self.__instantiator.clear_args() # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 846, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 846, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 846, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":847 + * """ + * self.__instantiator.clear_args() + * return self # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":841 + * return self + * + * def clear_args(self): # <<<<<<<<<<<<<< + * """Drop __init__ postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Factory.clear_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":850 + * + * @property + * def kwargs(self): # <<<<<<<<<<<<<< + * """Return keyword argument injections.""" + * return self.__instantiator.kwargs + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_6kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_6kwargs_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_6kwargs___get__(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":852 + * def kwargs(self): + * """Return keyword argument injections.""" + * return self.__instantiator.kwargs # <<<<<<<<<<<<<< + * + * def add_kwargs(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 852, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":850 + * + * @property + * def kwargs(self): # <<<<<<<<<<<<<< + * """Return keyword argument injections.""" + * return self.__instantiator.kwargs + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Factory.kwargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":854 + * return self.__instantiator.kwargs + * + * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Add __init__ keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_12add_kwargs[] = "Add __init__ keyword argument injections.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_kwargs (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("add_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_kwargs", 1))) return NULL; + if (__pyx_kwds) { + __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = NULL; + } + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_12add_kwargs(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("add_kwargs", 0); + + /* "dependency_injector/providers.pyx":862 + * :return: Reference ``self`` + * """ + * self.__instantiator.add_kwargs(**kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 862, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":863 + * """ + * self.__instantiator.add_kwargs(**kwargs) + * return self # <<<<<<<<<<<<<< + * + * def set_kwargs(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":854 + * return self.__instantiator.kwargs + * + * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Add __init__ keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Factory.add_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":865 + * return self + * + * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Set __init__ keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_14set_kwargs[] = "Set __init__ keyword argument injections.\n\n Existing __init__ keyword argument injections are dropped.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_kwargs (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("set_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_kwargs", 1))) return NULL; + if (__pyx_kwds) { + __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = NULL; + } + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_14set_kwargs(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("set_kwargs", 0); + + /* "dependency_injector/providers.pyx":875 + * :return: Reference ``self`` + * """ + * self.__instantiator.set_kwargs(**kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 875, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":876 + * """ + * self.__instantiator.set_kwargs(**kwargs) + * return self # <<<<<<<<<<<<<< + * + * def clear_kwargs(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":865 + * return self + * + * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Set __init__ keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Factory.set_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":878 + * return self + * + * def clear_kwargs(self): # <<<<<<<<<<<<<< + * """Drop __init__ keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_16clear_kwargs[] = "Drop __init__ keyword argument injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_kwargs (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_16clear_kwargs(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("clear_kwargs", 0); + + /* "dependency_injector/providers.pyx":883 + * :return: Reference ``self`` + * """ + * self.__instantiator.clear_kwargs() # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 883, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 883, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 883, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":884 + * """ + * self.__instantiator.clear_kwargs() + * return self # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":878 + * return self + * + * def clear_kwargs(self): # <<<<<<<<<<<<<< + * """Drop __init__ keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Factory.clear_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":887 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * """Return attribute injections.""" + * cdef int index + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_10attributes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_10attributes_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_10attributes___get__(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + int __pyx_v_index; + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_attribute = 0; + PyObject *__pyx_v_attributes = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":893 + * cdef dict attributes + * + * attributes = dict() # <<<<<<<<<<<<<< + * for index in range(self.__attributes_len): + * attribute = self.__attributes[index] + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 893, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_attributes = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":894 + * + * attributes = dict() + * for index in range(self.__attributes_len): # <<<<<<<<<<<<<< + * attribute = self.__attributes[index] + * attributes[attribute.__name] = attribute.__value + */ + __pyx_t_2 = __pyx_v_self->__pyx___attributes_len; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_index = __pyx_t_3; + + /* "dependency_injector/providers.pyx":895 + * attributes = dict() + * for index in range(self.__attributes_len): + * attribute = self.__attributes[index] # <<<<<<<<<<<<<< + * attributes[attribute.__name] = attribute.__value + * return attributes + */ + if (unlikely(__pyx_v_self->__pyx___attributes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 895, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->__pyx___attributes, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 895, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_NamedInjection))))) __PYX_ERR(1, 895, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_attribute, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_1)); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":896 + * for index in range(self.__attributes_len): + * attribute = self.__attributes[index] + * attributes[attribute.__name] = attribute.__value # <<<<<<<<<<<<<< + * return attributes + * + */ + __pyx_t_1 = __pyx_v_attribute->__pyx_base.__pyx___value; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(PyDict_SetItem(__pyx_v_attributes, __pyx_v_attribute->__pyx___name, __pyx_t_1) < 0)) __PYX_ERR(1, 896, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":897 + * attribute = self.__attributes[index] + * attributes[attribute.__name] = attribute.__value + * return attributes # <<<<<<<<<<<<<< + * + * def add_attributes(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_attributes); + __pyx_r = __pyx_v_attributes; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":887 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * """Return attribute injections.""" + * cdef int index + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Factory.attributes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_attribute); + __Pyx_XDECREF(__pyx_v_attributes); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":899 + * return attributes + * + * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Add attribute injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_18add_attributes[] = "Add attribute injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_attributes (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("add_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_attributes", 1))) return NULL; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_18add_attributes(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + __Pyx_RefNannySetupContext("add_attributes", 0); + + /* "dependency_injector/providers.pyx":907 + * :return: Reference ``self`` + * """ + * self.__attributes += parse_named_injections(kwargs) # <<<<<<<<<<<<<< + * self.__attributes_len = len(self.__attributes) + * return self + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 907, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___attributes, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 907, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); + __Pyx_DECREF(__pyx_v_self->__pyx___attributes); + __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":908 + * """ + * self.__attributes += parse_named_injections(kwargs) + * self.__attributes_len = len(self.__attributes) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __pyx_v_self->__pyx___attributes; + __Pyx_INCREF(__pyx_t_2); + if (unlikely(__pyx_t_2 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 908, __pyx_L1_error) + } + __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(1, 908, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_self->__pyx___attributes_len = __pyx_t_3; + + /* "dependency_injector/providers.pyx":909 + * self.__attributes += parse_named_injections(kwargs) + * self.__attributes_len = len(self.__attributes) + * return self # <<<<<<<<<<<<<< + * + * def set_attributes(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":899 + * return attributes + * + * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Add attribute injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.Factory.add_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":911 + * return self + * + * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Set attribute injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_20set_attributes[] = "Set attribute injections.\n\n Existing attribute injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_attributes (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("set_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_attributes", 1))) return NULL; + __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_20set_attributes(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + __Pyx_RefNannySetupContext("set_attributes", 0); + + /* "dependency_injector/providers.pyx":921 + * :return: Reference ``self`` + * """ + * self.__attributes = parse_named_injections(kwargs) # <<<<<<<<<<<<<< + * self.__attributes_len = len(self.__attributes) + * return self + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 921, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); + __Pyx_DECREF(__pyx_v_self->__pyx___attributes); + __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":922 + * """ + * self.__attributes = parse_named_injections(kwargs) + * self.__attributes_len = len(self.__attributes) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___attributes; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 922, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 922, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx___attributes_len = __pyx_t_2; + + /* "dependency_injector/providers.pyx":923 + * self.__attributes = parse_named_injections(kwargs) + * self.__attributes_len = len(self.__attributes) + * return self # <<<<<<<<<<<<<< + * + * def clear_attributes(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":911 + * return self + * + * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Set attribute injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Factory.set_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":925 + * return self + * + * def clear_attributes(self): # <<<<<<<<<<<<<< + * """Drop attribute injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_22clear_attributes[] = "Drop attribute injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_attributes (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_22clear_attributes(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + __Pyx_RefNannySetupContext("clear_attributes", 0); + + /* "dependency_injector/providers.pyx":930 + * :return: Reference ``self`` + * """ + * self.__attributes = tuple() # <<<<<<<<<<<<<< + * self.__attributes_len = len(self.__attributes) + * return self + */ + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 930, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); + __Pyx_DECREF(__pyx_v_self->__pyx___attributes); + __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":931 + * """ + * self.__attributes = tuple() + * self.__attributes_len = len(self.__attributes) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __pyx_v_self->__pyx___attributes; + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 931, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 931, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx___attributes_len = __pyx_t_2; + + /* "dependency_injector/providers.pyx":932 + * self.__attributes = tuple() + * self.__attributes_len = len(self.__attributes) + * return self # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":925 + * return self + * + * def clear_attributes(self): # <<<<<<<<<<<<<< + * """Drop attribute injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Factory.clear_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":934 + * return self + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return new instance.""" + * return __factory_call(self, args, kwargs) + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_25_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_7Factory__provide(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 934, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_25_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 934, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 934, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 934, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 934, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":936 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return new instance.""" + * return __factory_call(self, args, kwargs) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers___factory_call(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 936, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":934 + * return self + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return new instance.""" + * return __factory_call(self, args, kwargs) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.Factory._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_25_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_7Factory_24_provide[] = "Return new instance."; +static PyObject *__pyx_pw_19dependency_injector_9providers_7Factory_25_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 934, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 934, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 934, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Factory._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 934, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 934, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_7Factory_24_provide(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_7Factory_24_provide(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_7Factory__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 934, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Factory._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":965 + * provided_type = None + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_13BaseSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_13BaseSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 965, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 965, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton___init__(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_13BaseSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":977 + * :type kwargs: dict[str, object] + * """ + * if (self.__class__.provided_type and # <<<<<<<<<<<<<< + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 977, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + + /* "dependency_injector/providers.pyx":978 + * """ + * if (self.__class__.provided_type and + * not issubclass(provides, self.__class__.provided_type)): # <<<<<<<<<<<<<< + * raise Error('{0} can provide only {1} instances'.format( + * self.__class__, self.__class__.provided_type)) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyObject_IsSubclass(__pyx_v_provides, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 978, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0); + __pyx_t_1 = __pyx_t_5; + __pyx_L4_bool_binop_done:; + + /* "dependency_injector/providers.pyx":977 + * :type kwargs: dict[str, object] + * """ + * if (self.__class__.provided_type and # <<<<<<<<<<<<<< + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + */ + if (__pyx_t_1) { + + /* "dependency_injector/providers.pyx":979 + * if (self.__class__.provided_type and + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( # <<<<<<<<<<<<<< + * self.__class__, self.__class__.provided_type)) + * + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_can_provide_only_1_instances, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + + /* "dependency_injector/providers.pyx":980 + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + * self.__class__, self.__class__.provided_type)) # <<<<<<<<<<<<<< + * + * self.__instantiator = Factory(provides, *args, **kwargs) + */ + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 980, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 980, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 980, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = NULL; + __pyx_t_11 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_11 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (__pyx_t_9) { + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL; + } + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10); + __pyx_t_8 = 0; + __pyx_t_10 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_7) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 979, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 979, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":977 + * :type kwargs: dict[str, object] + * """ + * if (self.__class__.provided_type and # <<<<<<<<<<<<<< + * not issubclass(provides, self.__class__.provided_type)): + * raise Error('{0} can provide only {1} instances'.format( + */ + } + + /* "dependency_injector/providers.pyx":982 + * self.__class__, self.__class__.provided_type)) + * + * self.__instantiator = Factory(provides, *args, **kwargs) # <<<<<<<<<<<<<< + * + * super(BaseSingleton, self).__init__() + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 982, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 982, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Factory), __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 982, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___instantiator); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___instantiator)); + __pyx_v_self->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":984 + * self.__instantiator = Factory(provides, *args, **kwargs) + * + * super(BaseSingleton, self).__init__() # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_BaseSingleton)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_BaseSingleton)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_BaseSingleton)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 984, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_12) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 984, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 984, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":965 + * provided_type = None + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":986 + * super(BaseSingleton, self).__init__() + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__(PyObject *__pyx_v_self); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_2__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton_2__str__; +#endif +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_2__str__(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_2__str__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "dependency_injector/providers.pyx":991 + * :rtype: str + * """ + * return represent_provider(provider=self, # <<<<<<<<<<<<<< + * provides=self.__instantiator.cls) + * + */ + __Pyx_XDECREF(__pyx_r); + + /* "dependency_injector/providers.pyx":992 + * """ + * return represent_provider(provider=self, + * provides=self.__instantiator.cls) # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_cls); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 992, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "dependency_injector/providers.pyx":991 + * :rtype: str + * """ + * return represent_provider(provider=self, # <<<<<<<<<<<<<< + * provides=self.__instantiator.cls) + * + */ + __pyx_t_2 = __pyx_f_19dependency_injector_9providers_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 991, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":986 + * super(BaseSingleton, self).__init__() + * + * def __str__(self): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":994 + * provides=self.__instantiator.cls) + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_4__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_4__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_v_overriding_provider = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":996 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 996, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":997 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":998 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * + * copied = self.__class__(self.cls, + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":997 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * + */ + } + + /* "dependency_injector/providers.pyx":1000 + * return copied + * + * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cls); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1001 + * + * copied = self.__class__(self.cls, + * *deepcopy(self.args, memo), # <<<<<<<<<<<<<< + * **deepcopy(self.kwargs, memo)) + * copied.set_attributes(**deepcopy(self.attributes, memo)) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1001, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 1001, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_2, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1001, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1000 + * return copied + * + * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1002 + * copied = self.__class__(self.cls, + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) # <<<<<<<<<<<<<< + * copied.set_attributes(**deepcopy(self.attributes, memo)) + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1002, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 1002, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_3 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1002, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(__pyx_t_3 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(1, 1002, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_t_3))) { + __pyx_t_2 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1002, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + /* "dependency_injector/providers.pyx":1000 + * return copied + * + * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1000, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1003 + * *deepcopy(self.args, memo), + * **deepcopy(self.kwargs, memo)) + * copied.set_attributes(**deepcopy(self.attributes, memo)) # <<<<<<<<<<<<<< + * + * for overriding_provider in self.overridden: + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_set_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 1003, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_4, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(1, 1003, __pyx_L1_error) + } + if (likely(PyDict_CheckExact(__pyx_t_1))) { + __pyx_t_2 = PyDict_Copy(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1003, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1005 + * copied.set_attributes(**deepcopy(self.attributes, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1005, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 1005, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(1, 1005, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1005, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_10(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 1005, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1006 + * + * for overriding_provider in self.overridden: + * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< + * + * return copied + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 1006, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1006, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1005 + * copied.set_attributes(**deepcopy(self.attributes, memo)) + * + * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< + * copied.override(deepcopy(overriding_provider, memo)) + * + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1008 + * copied.override(deepcopy(overriding_provider, memo)) + * + * return copied # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":994 + * provides=self.__instantiator.cls) + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XDECREF(__pyx_v_overriding_provider); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1011 + * + * @property + * def cls(self): # <<<<<<<<<<<<<< + * """Return provided type.""" + * return self.__instantiator.cls + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_3cls_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_3cls_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_3cls___get__(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":1013 + * def cls(self): + * """Return provided type.""" + * return self.__instantiator.cls # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_cls); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1013, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1011 + * + * @property + * def cls(self): # <<<<<<<<<<<<<< + * """Return provided type.""" + * return self.__instantiator.cls + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.cls.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1016 + * + * @property + * def args(self): # <<<<<<<<<<<<<< + * """Return positional argument injections.""" + * return self.__instantiator.args + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_4args_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_4args___get__(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_4args___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":1018 + * def args(self): + * """Return positional argument injections.""" + * return self.__instantiator.args # <<<<<<<<<<<<<< + * + * def add_args(self, *args): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1016 + * + * @property + * def args(self): # <<<<<<<<<<<<<< + * """Return positional argument injections.""" + * return self.__instantiator.args + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.args.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1020 + * return self.__instantiator.args + * + * def add_args(self, *args): # <<<<<<<<<<<<<< + * """Add __init__ postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_6add_args[] = "Add __init__ postional argument injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_args (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_args", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_6add_args(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6add_args(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("add_args", 0); + + /* "dependency_injector/providers.pyx":1028 + * :return: Reference ``self`` + * """ + * self.__instantiator.add_args(*args) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1028, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1028, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1029 + * """ + * self.__instantiator.add_args(*args) + * return self # <<<<<<<<<<<<<< + * + * def set_args(self, *args): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1020 + * return self.__instantiator.args + * + * def add_args(self, *args): # <<<<<<<<<<<<<< + * """Add __init__ postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.add_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1031 + * return self + * + * def set_args(self, *args): # <<<<<<<<<<<<<< + * """Set __init__ postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_8set_args[] = "Set __init__ postional argument injections.\n\n Existing __init__ positional argument injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_args (wrapper)", 0); + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_args", 0))) return NULL; + __Pyx_INCREF(__pyx_args); + __pyx_v_args = __pyx_args; + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_8set_args(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), __pyx_v_args); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_8set_args(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("set_args", 0); + + /* "dependency_injector/providers.pyx":1041 + * :return: Reference ``self`` + * """ + * self.__instantiator.set_args(*args) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1042 + * """ + * self.__instantiator.set_args(*args) + * return self # <<<<<<<<<<<<<< + * + * def clear_args(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1031 + * return self + * + * def set_args(self, *args): # <<<<<<<<<<<<<< + * """Set __init__ postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.set_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1044 + * return self + * + * def clear_args(self): # <<<<<<<<<<<<<< + * """Drop __init__ postional argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_10clear_args[] = "Drop __init__ postional argument injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_args (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_10clear_args(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_10clear_args(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("clear_args", 0); + + /* "dependency_injector/providers.pyx":1049 + * :return: Reference ``self`` + * """ + * self.__instantiator.clear_args() # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1049, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1049, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1049, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1050 + * """ + * self.__instantiator.clear_args() + * return self # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1044 + * return self + * + * def clear_args(self): # <<<<<<<<<<<<<< + * """Drop __init__ postional argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.clear_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1053 + * + * @property + * def kwargs(self): # <<<<<<<<<<<<<< + * """Return keyword argument injections.""" + * return self.__instantiator.kwargs + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_6kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_6kwargs_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_6kwargs___get__(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":1055 + * def kwargs(self): + * """Return keyword argument injections.""" + * return self.__instantiator.kwargs # <<<<<<<<<<<<<< + * + * def add_kwargs(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1055, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1053 + * + * @property + * def kwargs(self): # <<<<<<<<<<<<<< + * """Return keyword argument injections.""" + * return self.__instantiator.kwargs + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.kwargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1057 + * return self.__instantiator.kwargs + * + * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Add __init__ keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_12add_kwargs[] = "Add __init__ keyword argument injections.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_kwargs (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("add_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_kwargs", 1))) return NULL; + if (__pyx_kwds) { + __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = NULL; + } + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_12add_kwargs(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("add_kwargs", 0); + + /* "dependency_injector/providers.pyx":1065 + * :return: Reference ``self`` + * """ + * self.__instantiator.add_kwargs(**kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1066 + * """ + * self.__instantiator.add_kwargs(**kwargs) + * return self # <<<<<<<<<<<<<< + * + * def set_kwargs(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1057 + * return self.__instantiator.kwargs + * + * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Add __init__ keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.add_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1068 + * return self + * + * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Set __init__ keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_14set_kwargs[] = "Set __init__ keyword argument injections.\n\n Existing __init__ keyword argument injections are dropped.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_kwargs (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("set_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_kwargs", 1))) return NULL; + if (__pyx_kwds) { + __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = NULL; + } + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_14set_kwargs(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("set_kwargs", 0); + + /* "dependency_injector/providers.pyx":1078 + * :return: Reference ``self`` + * """ + * self.__instantiator.set_kwargs(**kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1078, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1078, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1079 + * """ + * self.__instantiator.set_kwargs(**kwargs) + * return self # <<<<<<<<<<<<<< + * + * def clear_kwargs(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1068 + * return self + * + * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< + * """Set __init__ keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.set_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1081 + * return self + * + * def clear_kwargs(self): # <<<<<<<<<<<<<< + * """Drop __init__ keyword argument injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_16clear_kwargs[] = "Drop __init__ keyword argument injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_kwargs (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_16clear_kwargs(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("clear_kwargs", 0); + + /* "dependency_injector/providers.pyx":1086 + * :return: Reference ``self`` + * """ + * self.__instantiator.clear_kwargs() # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1086, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1086, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1086, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1087 + * """ + * self.__instantiator.clear_kwargs() + * return self # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1081 + * return self + * + * def clear_kwargs(self): # <<<<<<<<<<<<<< + * """Drop __init__ keyword argument injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.clear_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1090 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * """Return attribute injections.""" + * return self.__instantiator.attributes + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_10attributes_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_10attributes_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_10attributes___get__(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("__get__", 0); + + /* "dependency_injector/providers.pyx":1092 + * def attributes(self): + * """Return attribute injections.""" + * return self.__instantiator.attributes # <<<<<<<<<<<<<< + * + * def add_attributes(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1092, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1090 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * """Return attribute injections.""" + * return self.__instantiator.attributes + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.attributes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1094 + * return self.__instantiator.attributes + * + * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Add attribute injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_18add_attributes[] = "Add attribute injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_attributes (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("add_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_attributes", 1))) return NULL; + if (__pyx_kwds) { + __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = NULL; + } + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_18add_attributes(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("add_attributes", 0); + + /* "dependency_injector/providers.pyx":1102 + * :return: Reference ``self`` + * """ + * self.__instantiator.add_attributes(**kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1102, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1103 + * """ + * self.__instantiator.add_attributes(**kwargs) + * return self # <<<<<<<<<<<<<< + * + * def set_attributes(self, **kwargs): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1094 + * return self.__instantiator.attributes + * + * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Add attribute injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.add_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1105 + * return self + * + * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Set attribute injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_20set_attributes[] = "Set attribute injections.\n\n Existing attribute injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_attributes (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("set_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} + if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_attributes", 1))) return NULL; + if (__pyx_kwds) { + __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; + __Pyx_GOTREF(__pyx_v_kwargs); + } else { + __pyx_v_kwargs = NULL; + } + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_20set_attributes(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("set_attributes", 0); + + /* "dependency_injector/providers.pyx":1115 + * :return: Reference ``self`` + * """ + * self.__instantiator.set_attributes(**kwargs) # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1116 + * """ + * self.__instantiator.set_attributes(**kwargs) + * return self # <<<<<<<<<<<<<< + * + * def clear_attributes(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1105 + * return self + * + * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< + * """Set attribute injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.set_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1118 + * return self + * + * def clear_attributes(self): # <<<<<<<<<<<<<< + * """Drop attribute injections. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_22clear_attributes[] = "Drop attribute injections.\n\n :return: Reference ``self``\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("clear_attributes (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_22clear_attributes(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("clear_attributes", 0); + + /* "dependency_injector/providers.pyx":1123 + * :return: Reference ``self`` + * """ + * self.__instantiator.clear_attributes() # <<<<<<<<<<<<<< + * return self + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1123, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1124 + * """ + * self.__instantiator.clear_attributes() + * return self # <<<<<<<<<<<<<< + * + * def reset(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1118 + * return self + * + * def clear_attributes(self): # <<<<<<<<<<<<<< + * """Drop attribute injections. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.clear_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1126 + * return self + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_25reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_13BaseSingleton_24reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_13BaseSingleton_25reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_13BaseSingleton_24reset(((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_13BaseSingleton_24reset(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("reset", 0); + + /* "dependency_injector/providers.pyx":1131 + * :rtype: None + * """ + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 1131, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":1126 + * return self + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.BaseSingleton.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1165 + * """ + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_9Singleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_9Singleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_9Singleton___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_9Singleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 1165, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1165, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("dependency_injector.providers.Singleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_9Singleton___init__(((struct __pyx_obj_19dependency_injector_9providers_Singleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_9Singleton___init__(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":1177 + * :type kwargs: dict[str, object] + * """ + * self.__storage = None # <<<<<<<<<<<<<< + * super(Singleton, self).__init__(provides, *args, **kwargs) + * + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->__pyx___storage); + __Pyx_DECREF(__pyx_v_self->__pyx___storage); + __pyx_v_self->__pyx___storage = Py_None; + + /* "dependency_injector/providers.pyx":1178 + * """ + * self.__storage = None + * super(Singleton, self).__init__(provides, *args, **kwargs) # <<<<<<<<<<<<<< + * + * def reset(self): + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Singleton)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_Singleton)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_Singleton)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1165 + * """ + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.Singleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1180 + * super(Singleton, self).__init__(provides, *args, **kwargs) + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_9Singleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_9Singleton_2reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_9Singleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_9Singleton_2reset(((struct __pyx_obj_19dependency_injector_9providers_Singleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_9Singleton_2reset(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset", 0); + + /* "dependency_injector/providers.pyx":1185 + * :rtype: None + * """ + * self.__storage = None # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->__pyx___storage); + __Pyx_DECREF(__pyx_v_self->__pyx___storage); + __pyx_v_self->__pyx___storage = Py_None; + + /* "dependency_injector/providers.pyx":1180 + * super(Singleton, self).__init__(provides, *args, **kwargs) + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1187 + * self.__storage = None + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return single instance.""" + * if self.__storage is None: + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_9Singleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_9Singleton__provide(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_t_8; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Singleton_5_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1187, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1187, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":1189 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return single instance.""" + * if self.__storage is None: # <<<<<<<<<<<<<< + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) + */ + __pyx_t_7 = (__pyx_v_self->__pyx___storage == Py_None); + __pyx_t_8 = (__pyx_t_7 != 0); + if (__pyx_t_8) { + + /* "dependency_injector/providers.pyx":1190 + * """Return single instance.""" + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< + * args, kwargs) + * return self.__storage + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator); + __Pyx_INCREF(__pyx_t_1); + + /* "dependency_injector/providers.pyx":1191 + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) # <<<<<<<<<<<<<< + * return self.__storage + * + */ + __pyx_t_2 = __pyx_f_19dependency_injector_9providers___factory_call(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1190 + * """Return single instance.""" + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< + * args, kwargs) + * return self.__storage + */ + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___storage); + __Pyx_DECREF(__pyx_v_self->__pyx___storage); + __pyx_v_self->__pyx___storage = __pyx_t_2; + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1189 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return single instance.""" + * if self.__storage is None: # <<<<<<<<<<<<<< + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) + */ + } + + /* "dependency_injector/providers.pyx":1192 + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) + * return self.__storage # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___storage); + __pyx_r = __pyx_v_self->__pyx___storage; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1187 + * self.__storage = None + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return single instance.""" + * if self.__storage is None: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.Singleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_9Singleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_9Singleton_4_provide[] = "Return single instance."; +static PyObject *__pyx_pw_19dependency_injector_9providers_9Singleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 1187, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 1187, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1187, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.Singleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 1187, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 1187, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_9Singleton_4_provide(((struct __pyx_obj_19dependency_injector_9providers_Singleton *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_9Singleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_9Singleton__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.Singleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1219 + * """Thread-safe singleton provider.""" + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_19ThreadSafeSingleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_19ThreadSafeSingleton___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 1219, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1219, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("dependency_injector.providers.ThreadSafeSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton___init__(((struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":1231 + * :type kwargs: dict[str, object] + * """ + * self.__storage = None # <<<<<<<<<<<<<< + * self.__lock = GLOBAL_LOCK + * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->__pyx___storage); + __Pyx_DECREF(__pyx_v_self->__pyx___storage); + __pyx_v_self->__pyx___storage = Py_None; + + /* "dependency_injector/providers.pyx":1232 + * """ + * self.__storage = None + * self.__lock = GLOBAL_LOCK # <<<<<<<<<<<<<< + * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_GLOBAL_LOCK); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___lock); + __Pyx_DECREF(__pyx_v_self->__pyx___lock); + __pyx_v_self->__pyx___lock = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1233 + * self.__storage = None + * self.__lock = GLOBAL_LOCK + * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) # <<<<<<<<<<<<<< + * + * def reset(self): + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1219 + * """Thread-safe singleton provider.""" + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.ThreadSafeSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1235 + * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_19ThreadSafeSingleton_2reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton_2reset(((struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset", 0); + + /* "dependency_injector/providers.pyx":1240 + * :rtype: None + * """ + * self.__storage = None # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->__pyx___storage); + __Pyx_DECREF(__pyx_v_self->__pyx___storage); + __pyx_v_self->__pyx___storage = Py_None; + + /* "dependency_injector/providers.pyx":1235 + * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1242 + * self.__storage = None + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return single instance.""" + * with self.__lock: + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_19ThreadSafeSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_5_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1242, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1242, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":1244 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return single instance.""" + * with self.__lock: # <<<<<<<<<<<<<< + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, + */ + /*with:*/ { + __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx___lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx___lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1244, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1244, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1244, __pyx_L3_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { + + /* "dependency_injector/providers.pyx":1245 + * """Return single instance.""" + * with self.__lock: + * if self.__storage is None: # <<<<<<<<<<<<<< + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) + */ + __pyx_t_11 = (__pyx_v_self->__pyx___storage == Py_None); + __pyx_t_12 = (__pyx_t_11 != 0); + if (__pyx_t_12) { + + /* "dependency_injector/providers.pyx":1246 + * with self.__lock: + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< + * args, kwargs) + * return self.__storage + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator); + __Pyx_INCREF(__pyx_t_1); + + /* "dependency_injector/providers.pyx":1247 + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) # <<<<<<<<<<<<<< + * return self.__storage + * + */ + __pyx_t_2 = __pyx_f_19dependency_injector_9providers___factory_call(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1246, __pyx_L7_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1246 + * with self.__lock: + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< + * args, kwargs) + * return self.__storage + */ + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->__pyx___storage); + __Pyx_DECREF(__pyx_v_self->__pyx___storage); + __pyx_v_self->__pyx___storage = __pyx_t_2; + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1245 + * """Return single instance.""" + * with self.__lock: + * if self.__storage is None: # <<<<<<<<<<<<<< + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) + */ + } + + /* "dependency_injector/providers.pyx":1244 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return single instance.""" + * with self.__lock: # <<<<<<<<<<<<<< + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, + */ + } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L14_try_end; + __pyx_L7_error:; + __Pyx_PyThreadState_assign + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + /*except:*/ { + __Pyx_AddTraceback("dependency_injector.providers.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(1, 1244, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1244, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 1244, __pyx_L9_except_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_13); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (__pyx_t_12 < 0) __PYX_ERR(1, 1244, __pyx_L9_except_error) + __pyx_t_11 = ((!(__pyx_t_12 != 0)) != 0); + if (__pyx_t_11) { + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_3); + __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; + __PYX_ERR(1, 1244, __pyx_L9_except_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L8_exception_handled; + } + __pyx_L9_except_error:; + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L8_exception_handled:; + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + __pyx_L14_try_end:; + } + } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_7) { + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__4, NULL); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + goto __pyx_L6; + } + __pyx_L6:; + } + goto __pyx_L19; + __pyx_L3_error:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L1_error; + __pyx_L19:; + } + + /* "dependency_injector/providers.pyx":1248 + * self.__storage = __factory_call(self.__instantiator, + * args, kwargs) + * return self.__storage # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___storage); + __pyx_r = __pyx_v_self->__pyx___storage; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1242 + * self.__storage = None + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return single instance.""" + * with self.__lock: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_19ThreadSafeSingleton_4_provide[] = "Return single instance."; +static PyObject *__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 1242, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 1242, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1242, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 1242, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 1242, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton_4_provide(((struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_19ThreadSafeSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_19ThreadSafeSingleton__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1290 + * """ + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_20ThreadLocalSingleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_20ThreadLocalSingleton___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provides = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); + if (unlikely(!__pyx_v_args)) { + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_RefNannyFinishContext(); + return -1; + } + __Pyx_GOTREF(__pyx_v_args); + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + default: + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(1, 1290, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_provides = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1290, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("dependency_injector.providers.ThreadLocalSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton___init__(((struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + __Pyx_XDECREF(__pyx_v_args); + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":1302 + * :type kwargs: dict[str, object] + * """ + * self.__storage = threading.local() # <<<<<<<<<<<<<< + * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_local); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1302, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1302, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1302, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx___storage); + __Pyx_DECREF(__pyx_v_self->__pyx___storage); + __pyx_v_self->__pyx___storage = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1303 + * """ + * self.__storage = threading.local() + * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) # <<<<<<<<<<<<<< + * + * def reset(self): + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_provides); + __Pyx_GIVEREF(__pyx_v_provides); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_provides); + __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1303, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1290 + * """ + * + * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< + * """Initializer. + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("dependency_injector.providers.ThreadLocalSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1305 + * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_20ThreadLocalSingleton_2reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton_2reset(((struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("reset", 0); + + /* "dependency_injector/providers.pyx":1310 + * :rtype: None + * """ + * self.__storage.instance = None # <<<<<<<<<<<<<< + * + * cpdef object _provide(self, tuple args, dict kwargs): + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance, Py_None) < 0) __PYX_ERR(1, 1310, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":1305 + * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) + * + * def reset(self): # <<<<<<<<<<<<<< + * """Reset cached instance, if any. + * + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("dependency_injector.providers.ThreadLocalSingleton.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1312 + * self.__storage.instance = None + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return single instance.""" + * cdef object instance + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_20ThreadLocalSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { + PyObject *__pyx_v_instance = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_5_provide)) { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1312, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1312, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_args); + __Pyx_GIVEREF(__pyx_v_args); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); + __Pyx_INCREF(__pyx_v_kwargs); + __Pyx_GIVEREF(__pyx_v_kwargs); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "dependency_injector/providers.pyx":1316 + * cdef object instance + * + * try: # <<<<<<<<<<<<<< + * instance = self.__storage.instance + * except AttributeError: + */ + /*try:*/ { + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + /*try:*/ { + + /* "dependency_injector/providers.pyx":1317 + * + * try: + * instance = self.__storage.instance # <<<<<<<<<<<<<< + * except AttributeError: + * instance = __factory_call(self.__instantiator, args, kwargs) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1317, __pyx_L6_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_instance = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1316 + * cdef object instance + * + * try: # <<<<<<<<<<<<<< + * instance = self.__storage.instance + * except AttributeError: + */ + } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L13_try_end; + __pyx_L6_error:; + __Pyx_PyThreadState_assign + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1318 + * try: + * instance = self.__storage.instance + * except AttributeError: # <<<<<<<<<<<<<< + * instance = __factory_call(self.__instantiator, args, kwargs) + * self.__storage.instance = instance + */ + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); + if (__pyx_t_5) { + __Pyx_AddTraceback("dependency_injector.providers.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(1, 1318, __pyx_L8_except_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_3); + + /* "dependency_injector/providers.pyx":1319 + * instance = self.__storage.instance + * except AttributeError: + * instance = __factory_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<< + * self.__storage.instance = instance + * finally: + */ + __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator); + __Pyx_INCREF(__pyx_t_6); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers___factory_call(((struct __pyx_obj_19dependency_injector_9providers_Factory *)__pyx_t_6), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1319, __pyx_L8_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_instance, __pyx_t_4); + __pyx_t_4 = 0; + + /* "dependency_injector/providers.pyx":1320 + * except AttributeError: + * instance = __factory_call(self.__instantiator, args, kwargs) + * self.__storage.instance = instance # <<<<<<<<<<<<<< + * finally: + * return instance + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance, __pyx_v_instance) < 0) __PYX_ERR(1, 1320, __pyx_L8_except_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L7_exception_handled; + } + goto __pyx_L8_except_error; + __pyx_L8_except_error:; + + /* "dependency_injector/providers.pyx":1316 + * cdef object instance + * + * try: # <<<<<<<<<<<<<< + * instance = self.__storage.instance + * except AttributeError: + */ + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + goto __pyx_L4_error; + __pyx_L7_exception_handled:; + __Pyx_PyThreadState_assign + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __pyx_L13_try_end:; + } + } + + /* "dependency_injector/providers.pyx":1322 + * self.__storage.instance = instance + * finally: + * return instance # <<<<<<<<<<<<<< + * + * + */ + /*finally:*/ { + /*normal exit:*/{ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_instance); + __pyx_r = __pyx_v_instance; + goto __pyx_L0; + } + /*exception exit:*/{ + __Pyx_PyThreadState_declare + __pyx_L4_error:; + __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + __Pyx_PyThreadState_assign + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); + __Pyx_XGOTREF(__pyx_t_12); + { + __Pyx_XDECREF(__pyx_r); + if (unlikely(!__pyx_v_instance)) { __Pyx_RaiseUnboundLocalError("instance"); __PYX_ERR(1, 1322, __pyx_L17_error) } + __Pyx_INCREF(__pyx_v_instance); + __pyx_r = __pyx_v_instance; + goto __pyx_L16_return; + } + __pyx_L16_return:; + __Pyx_PyThreadState_assign + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + goto __pyx_L0; + __pyx_L17_error:; + __Pyx_PyThreadState_assign + if (PY_MAJOR_VERSION >= 3) { + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; + goto __pyx_L1_error; + } + } + + /* "dependency_injector/providers.pyx":1312 + * self.__storage.instance = None + * + * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * """Return single instance.""" + * cdef object instance + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("dependency_injector.providers.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_instance); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_20ThreadLocalSingleton_4_provide[] = "Return single instance."; +static PyObject *__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_kwargs = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_provide (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(1, 1312, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(1, 1312, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_args = ((PyObject*)values[0]); + __pyx_v_kwargs = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1312, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 1312, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 1312, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton_4_provide(((struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_20ThreadLocalSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("_provide", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_20ThreadLocalSingleton__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1353 + * """Positional injection class.""" + * + * def __init__(self, value): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__value = value + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_19PositionalInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_19PositionalInjection___init__[] = "Initializer."; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_19PositionalInjection___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_19PositionalInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_value = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 1353, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_value = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1353, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.PositionalInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_19PositionalInjection___init__(((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_v_self), __pyx_v_value); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_19PositionalInjection___init__(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":1355 + * def __init__(self, value): + * """Initializer.""" + * self.__value = value # <<<<<<<<<<<<<< + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) + */ + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx___value); + __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx___value); + __pyx_v_self->__pyx_base.__pyx___value = __pyx_v_value; + + /* "dependency_injector/providers.pyx":1356 + * """Initializer.""" + * self.__value = value + * self.__is_provider = is_provider(value) # <<<<<<<<<<<<<< + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and + */ + __pyx_v_self->__pyx_base.__pyx___is_provider = ((int)__pyx_f_19dependency_injector_9providers_is_provider(__pyx_v_value, 0)); + + /* "dependency_injector/providers.pyx":1357 + * self.__value = value + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) # <<<<<<<<<<<<<< + * self.__call = (self.__is_provider == 1 and + * self.__is_delegated == 0) + */ + __pyx_v_self->__pyx_base.__pyx___is_delegated = ((int)__pyx_f_19dependency_injector_9providers_is_delegated(__pyx_v_value, 0)); + + /* "dependency_injector/providers.pyx":1358 + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< + * self.__is_delegated == 0) + * super(PositionalInjection, self).__init__() + */ + __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_provider == 1); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + + /* "dependency_injector/providers.pyx":1359 + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and + * self.__is_delegated == 0) # <<<<<<<<<<<<<< + * super(PositionalInjection, self).__init__() + * + */ + __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_delegated == 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + + /* "dependency_injector/providers.pyx":1358 + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< + * self.__is_delegated == 0) + * super(PositionalInjection, self).__init__() + */ + __pyx_v_self->__pyx_base.__pyx___call = ((int)__pyx_t_1); + + /* "dependency_injector/providers.pyx":1360 + * self.__call = (self.__is_provider == 1 and + * self.__is_delegated == 0) + * super(PositionalInjection, self).__init__() # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_PositionalInjection)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_PositionalInjection)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_PositionalInjection)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1360, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1360, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1360, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1353 + * """Positional injection class.""" + * + * def __init__(self, value): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__value = value + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.PositionalInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1362 + * super(PositionalInjection, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_19PositionalInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_19PositionalInjection_2__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_19PositionalInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_19PositionalInjection_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_19PositionalInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_8; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":1364 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1365 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * return self.__class__(deepcopy(self.__value, memo)) + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":1366 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * return self.__class__(deepcopy(self.__value, memo)) + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1365 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * return self.__class__(deepcopy(self.__value, memo)) + */ + } + + /* "dependency_injector/providers.pyx":1367 + * if copied is not None: + * return copied + * return self.__class__(deepcopy(self.__value, memo)) # <<<<<<<<<<<<<< + * + * def get_value(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __pyx_v_self->__pyx_base.__pyx___value; + __Pyx_INCREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 1367, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1367, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1367, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1367, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1367, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1362 + * super(PositionalInjection, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.PositionalInjection.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1369 + * return self.__class__(deepcopy(self.__value, memo)) + * + * def get_value(self): # <<<<<<<<<<<<<< + * """Return injection value.""" + * return __get_value(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_19PositionalInjection_5get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_19PositionalInjection_4get_value[] = "Return injection value."; +static PyObject *__pyx_pw_19dependency_injector_9providers_19PositionalInjection_5get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_value (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_19PositionalInjection_4get_value(((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_19PositionalInjection_4get_value(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_value", 0); + + /* "dependency_injector/providers.pyx":1371 + * def get_value(self): + * """Return injection value.""" + * return __get_value(self) # <<<<<<<<<<<<<< + * + * def get_original_value(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1371, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1369 + * return self.__class__(deepcopy(self.__value, memo)) + * + * def get_value(self): # <<<<<<<<<<<<<< + * """Return injection value.""" + * return __get_value(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.PositionalInjection.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1373 + * return __get_value(self) + * + * def get_original_value(self): # <<<<<<<<<<<<<< + * """Return original value.""" + * return self.__value + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_19PositionalInjection_7get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_19PositionalInjection_6get_original_value[] = "Return original value."; +static PyObject *__pyx_pw_19dependency_injector_9providers_19PositionalInjection_7get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_original_value (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_19PositionalInjection_6get_original_value(((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_19PositionalInjection_6get_original_value(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_original_value", 0); + + /* "dependency_injector/providers.pyx":1375 + * def get_original_value(self): + * """Return original value.""" + * return self.__value # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx___value); + __pyx_r = __pyx_v_self->__pyx_base.__pyx___value; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1373 + * return __get_value(self) + * + * def get_original_value(self): # <<<<<<<<<<<<<< + * """Return original value.""" + * return self.__value + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1381 + * """Keyword injection class.""" + * + * def __init__(self, name, value): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__name = name + */ + +/* Python wrapper */ +static int __pyx_pw_19dependency_injector_9providers_14NamedInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_14NamedInjection___init__[] = "Initializer."; +#if CYTHON_COMPILING_IN_CPYTHON +struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_14NamedInjection___init__; +#endif +static int __pyx_pw_19dependency_injector_9providers_14NamedInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_value = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name_2,&__pyx_n_s_value,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name_2)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(1, 1381, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 1381, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_name = values[0]; + __pyx_v_value = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1381, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.NamedInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_14NamedInjection___init__(((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_v_self), __pyx_v_name, __pyx_v_value); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_19dependency_injector_9providers_14NamedInjection___init__(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "dependency_injector/providers.pyx":1383 + * def __init__(self, name, value): + * """Initializer.""" + * self.__name = name # <<<<<<<<<<<<<< + * self.__value = value + * self.__is_provider = is_provider(value) + */ + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __Pyx_GOTREF(__pyx_v_self->__pyx___name); + __Pyx_DECREF(__pyx_v_self->__pyx___name); + __pyx_v_self->__pyx___name = __pyx_v_name; + + /* "dependency_injector/providers.pyx":1384 + * """Initializer.""" + * self.__name = name + * self.__value = value # <<<<<<<<<<<<<< + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) + */ + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx___value); + __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx___value); + __pyx_v_self->__pyx_base.__pyx___value = __pyx_v_value; + + /* "dependency_injector/providers.pyx":1385 + * self.__name = name + * self.__value = value + * self.__is_provider = is_provider(value) # <<<<<<<<<<<<<< + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and + */ + __pyx_v_self->__pyx_base.__pyx___is_provider = ((int)__pyx_f_19dependency_injector_9providers_is_provider(__pyx_v_value, 0)); + + /* "dependency_injector/providers.pyx":1386 + * self.__value = value + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) # <<<<<<<<<<<<<< + * self.__call = (self.__is_provider == 1 and + * self.__is_delegated == 0) + */ + __pyx_v_self->__pyx_base.__pyx___is_delegated = ((int)__pyx_f_19dependency_injector_9providers_is_delegated(__pyx_v_value, 0)); + + /* "dependency_injector/providers.pyx":1387 + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< + * self.__is_delegated == 0) + * super(NamedInjection, self).__init__() + */ + __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_provider == 1); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L3_bool_binop_done; + } + + /* "dependency_injector/providers.pyx":1388 + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and + * self.__is_delegated == 0) # <<<<<<<<<<<<<< + * super(NamedInjection, self).__init__() + * + */ + __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_delegated == 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L3_bool_binop_done:; + + /* "dependency_injector/providers.pyx":1387 + * self.__is_provider = is_provider(value) + * self.__is_delegated = is_delegated(value) + * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< + * self.__is_delegated == 0) + * super(NamedInjection, self).__init__() + */ + __pyx_v_self->__pyx_base.__pyx___call = ((int)__pyx_t_1); + + /* "dependency_injector/providers.pyx":1389 + * self.__call = (self.__is_provider == 1 and + * self.__is_delegated == 0) + * super(NamedInjection, self).__init__() # <<<<<<<<<<<<<< + * + * def __deepcopy__(self, memo): + */ + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_NamedInjection)); + __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_NamedInjection)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_NamedInjection)); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self)); + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1389, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1389, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1381 + * """Keyword injection class.""" + * + * def __init__(self, name, value): # <<<<<<<<<<<<<< + * """Initializer.""" + * self.__name = name + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.NamedInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1391 + * super(NamedInjection, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_14NamedInjection_2__deepcopy__[] = "Create and return full copy of provider."; +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_14NamedInjection_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self, PyObject *__pyx_v_memo) { + PyObject *__pyx_v_copied = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + __Pyx_RefNannySetupContext("__deepcopy__", 0); + + /* "dependency_injector/providers.pyx":1393 + * def __deepcopy__(self, memo): + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) # <<<<<<<<<<<<<< + * if copied is not None: + * return copied + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1393, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_copied = __pyx_t_1; + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1394 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * return self.__class__(deepcopy(self.__name, memo), + */ + __pyx_t_6 = (__pyx_v_copied != Py_None); + __pyx_t_7 = (__pyx_t_6 != 0); + if (__pyx_t_7) { + + /* "dependency_injector/providers.pyx":1395 + * copied = memo.get(id(self)) + * if copied is not None: + * return copied # <<<<<<<<<<<<<< + * return self.__class__(deepcopy(self.__name, memo), + * deepcopy(self.__value, memo)) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_copied); + __pyx_r = __pyx_v_copied; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1394 + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + * if copied is not None: # <<<<<<<<<<<<<< + * return copied + * return self.__class__(deepcopy(self.__name, memo), + */ + } + + /* "dependency_injector/providers.pyx":1396 + * if copied is not None: + * return copied + * return self.__class__(deepcopy(self.__name, memo), # <<<<<<<<<<<<<< + * deepcopy(self.__value, memo)) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __pyx_v_self->__pyx___name; + __Pyx_INCREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 1396, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_4 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "dependency_injector/providers.pyx":1397 + * return copied + * return self.__class__(deepcopy(self.__name, memo), + * deepcopy(self.__value, memo)) # <<<<<<<<<<<<<< + * + * def get_name(self): + */ + __pyx_t_5 = __pyx_v_self->__pyx_base.__pyx___value; + __Pyx_INCREF(__pyx_t_5); + if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 1397, __pyx_L1_error) + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); + __pyx_t_3 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + __pyx_t_9 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_9 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1396, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1396, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3); + __pyx_t_4 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1396, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1391 + * super(NamedInjection, self).__init__() + * + * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< + * """Create and return full copy of provider.""" + * copied = memo.get(id(self)) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("dependency_injector.providers.NamedInjection.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_copied); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1399 + * deepcopy(self.__value, memo)) + * + * def get_name(self): # <<<<<<<<<<<<<< + * """Return injection value.""" + * return __get_name(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_5get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_14NamedInjection_4get_name[] = "Return injection value."; +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_5get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_name (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_14NamedInjection_4get_name(((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_4get_name(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_name", 0); + + /* "dependency_injector/providers.pyx":1401 + * def get_name(self): + * """Return injection value.""" + * return __get_name(self) # <<<<<<<<<<<<<< + * + * def get_value(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1401, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1399 + * deepcopy(self.__value, memo)) + * + * def get_name(self): # <<<<<<<<<<<<<< + * """Return injection value.""" + * return __get_name(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.NamedInjection.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1403 + * return __get_name(self) + * + * def get_value(self): # <<<<<<<<<<<<<< + * """Return injection value.""" + * return __get_value(self) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_7get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_14NamedInjection_6get_value[] = "Return injection value."; +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_7get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_value (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_14NamedInjection_6get_value(((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_6get_value(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("get_value", 0); + + /* "dependency_injector/providers.pyx":1405 + * def get_value(self): + * """Return injection value.""" + * return __get_value(self) # <<<<<<<<<<<<<< + * + * def get_original_value(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1405, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1403 + * return __get_name(self) + * + * def get_value(self): # <<<<<<<<<<<<<< + * """Return injection value.""" + * return __get_value(self) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.NamedInjection.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1407 + * return __get_value(self) + * + * def get_original_value(self): # <<<<<<<<<<<<<< + * """Return original value.""" + * return self.__value + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_9get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_14NamedInjection_8get_original_value[] = "Return original value."; +static PyObject *__pyx_pw_19dependency_injector_9providers_14NamedInjection_9get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_original_value (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_14NamedInjection_8get_original_value(((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_14NamedInjection_8get_original_value(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_original_value", 0); + + /* "dependency_injector/providers.pyx":1409 + * def get_original_value(self): + * """Return original value.""" + * return self.__value # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx___value); + __pyx_r = __pyx_v_self->__pyx_base.__pyx___value; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1407 + * return __get_value(self) + * + * def get_original_value(self): # <<<<<<<<<<<<<< + * """Return original value.""" + * return self.__value + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1414 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cpdef tuple parse_positional_injections(tuple args): # <<<<<<<<<<<<<< + * """Parse positional injections.""" + * cdef list injections = list() + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_1parse_positional_injections(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_parse_positional_injections(PyObject *__pyx_v_args, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_injections = 0; + int __pyx_v_args_len; + int __pyx_v_index; + PyObject *__pyx_v_arg = 0; + struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_injection = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("parse_positional_injections", 0); + + /* "dependency_injector/providers.pyx":1416 + * cpdef tuple parse_positional_injections(tuple args): + * """Parse positional injections.""" + * cdef list injections = list() # <<<<<<<<<<<<<< + * cdef int args_len = len(args) + * + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1416, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_injections = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1417 + * """Parse positional injections.""" + * cdef list injections = list() + * cdef int args_len = len(args) # <<<<<<<<<<<<<< + * + * cdef int index + */ + if (unlikely(__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 1417, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 1417, __pyx_L1_error) + __pyx_v_args_len = __pyx_t_2; + + /* "dependency_injector/providers.pyx":1423 + * cdef PositionalInjection injection + * + * for index in range(args_len): # <<<<<<<<<<<<<< + * arg = args[index] + * injection = PositionalInjection(arg) + */ + __pyx_t_3 = __pyx_v_args_len; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_index = __pyx_t_4; + + /* "dependency_injector/providers.pyx":1424 + * + * for index in range(args_len): + * arg = args[index] # <<<<<<<<<<<<<< + * injection = PositionalInjection(arg) + * injections.append(injection) + */ + if (unlikely(__pyx_v_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 1424, __pyx_L1_error) + } + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v_args, __pyx_v_index); + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1425 + * for index in range(args_len): + * arg = args[index] + * injection = PositionalInjection(arg) # <<<<<<<<<<<<<< + * injections.append(injection) + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_arg); + __Pyx_GIVEREF(__pyx_v_arg); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arg); + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_PositionalInjection), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "dependency_injector/providers.pyx":1426 + * arg = args[index] + * injection = PositionalInjection(arg) + * injections.append(injection) # <<<<<<<<<<<<<< + * + * return tuple(injections) + */ + __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_injections, ((PyObject *)__pyx_v_injection)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(1, 1426, __pyx_L1_error) + } + + /* "dependency_injector/providers.pyx":1428 + * injections.append(injection) + * + * return tuple(injections) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyList_AsTuple(__pyx_v_injections); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1414 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cpdef tuple parse_positional_injections(tuple args): # <<<<<<<<<<<<<< + * """Parse positional injections.""" + * cdef list injections = list() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.parse_positional_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_injections); + __Pyx_XDECREF(__pyx_v_arg); + __Pyx_XDECREF((PyObject *)__pyx_v_injection); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_1parse_positional_injections(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_parse_positional_injections[] = "Parse positional injections."; +static PyObject *__pyx_pw_19dependency_injector_9providers_1parse_positional_injections(PyObject *__pyx_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("parse_positional_injections (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 1414, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_parse_positional_injections(__pyx_self, ((PyObject*)__pyx_v_args)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_parse_positional_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("parse_positional_injections", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_positional_injections(__pyx_v_args, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.parse_positional_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1433 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cpdef tuple parse_named_injections(dict kwargs): # <<<<<<<<<<<<<< + * """Parse named injections.""" + * cdef list injections = list() + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_3parse_named_injections(PyObject *__pyx_self, PyObject *__pyx_v_kwargs); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_parse_named_injections(PyObject *__pyx_v_kwargs, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_injections = 0; + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_arg = 0; + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_injection = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + int __pyx_t_9; + __Pyx_RefNannySetupContext("parse_named_injections", 0); + + /* "dependency_injector/providers.pyx":1435 + * cpdef tuple parse_named_injections(dict kwargs): + * """Parse named injections.""" + * cdef list injections = list() # <<<<<<<<<<<<<< + * + * cdef object name + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1435, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_injections = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":1441 + * cdef NamedInjection injection + * + * for name, arg in kwargs.items(): # <<<<<<<<<<<<<< + * injection = NamedInjection(name, arg) + * injections.append(injection) + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); + __PYX_ERR(1, 1441, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1441, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 1441, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 1441, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 1441, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if !CYTHON_COMPILING_IN_PYPY + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + __PYX_ERR(1, 1441, __pyx_L1_error) + } + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_5 = PyList_GET_ITEM(sequence, 0); + __pyx_t_6 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + #else + __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + Py_ssize_t index = -1; + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1441, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; + index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_5); + index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(1, 1441, __pyx_L1_error) + __pyx_t_8 = NULL; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + __PYX_ERR(1, 1441, __pyx_L1_error) + __pyx_L6_unpacking_done:; + } + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_6); + __pyx_t_6 = 0; + + /* "dependency_injector/providers.pyx":1442 + * + * for name, arg in kwargs.items(): + * injection = NamedInjection(name, arg) # <<<<<<<<<<<<<< + * injections.append(injection) + * + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name); + __Pyx_INCREF(__pyx_v_arg); + __Pyx_GIVEREF(__pyx_v_arg); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_arg); + __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_NamedInjection), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1442, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_6)); + __pyx_t_6 = 0; + + /* "dependency_injector/providers.pyx":1443 + * for name, arg in kwargs.items(): + * injection = NamedInjection(name, arg) + * injections.append(injection) # <<<<<<<<<<<<<< + * + * return tuple(injections) + */ + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_injections, ((PyObject *)__pyx_v_injection)); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(1, 1443, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":1441 + * cdef NamedInjection injection + * + * for name, arg in kwargs.items(): # <<<<<<<<<<<<<< + * injection = NamedInjection(name, arg) + * injections.append(injection) + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":1445 + * injections.append(injection) + * + * return tuple(injections) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_AsTuple(__pyx_v_injections); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1445, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1433 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cpdef tuple parse_named_injections(dict kwargs): # <<<<<<<<<<<<<< + * """Parse named injections.""" + * cdef list injections = list() + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("dependency_injector.providers.parse_named_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_injections); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_arg); + __Pyx_XDECREF((PyObject *)__pyx_v_injection); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_3parse_named_injections(PyObject *__pyx_self, PyObject *__pyx_v_kwargs); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_2parse_named_injections[] = "Parse named injections."; +static PyObject *__pyx_pw_19dependency_injector_9providers_3parse_named_injections(PyObject *__pyx_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("parse_named_injections (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 1433, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_2parse_named_injections(__pyx_self, ((PyObject*)__pyx_v_kwargs)); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_2parse_named_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("parse_named_injections", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.parse_named_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1459 + * + * + * cpdef bint is_provider(object instance): # <<<<<<<<<<<<<< + * """Check if instance is provider instance. + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_5is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ +static int __pyx_f_19dependency_injector_9providers_is_provider(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("is_provider", 0); + + /* "dependency_injector/providers.pyx":1467 + * :rtype: bool + * """ + * return (not isinstance(instance, CLASS_TYPES) and # <<<<<<<<<<<<<< + * getattr(instance, '__IS_PROVIDER__', False) is True) + * + */ + __pyx_t_2 = __pyx_v_19dependency_injector_9providers_CLASS_TYPES; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_IsInstance(__pyx_v_instance, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(1, 1467, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L3_bool_binop_done; + } + + /* "dependency_injector/providers.pyx":1468 + * """ + * return (not isinstance(instance, CLASS_TYPES) and + * getattr(instance, '__IS_PROVIDER__', False) is True) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_instance, __pyx_n_s_IS_PROVIDER, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1468, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_t_2 == Py_True); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1459 + * + * + * cpdef bint is_provider(object instance): # <<<<<<<<<<<<<< + * """Check if instance is provider instance. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("dependency_injector.providers.is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_5is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_4is_provider[] = "Check if instance is provider instance.\n\n :param instance: Instance to be checked.\n :type instance: object\n\n :rtype: bool\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_5is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_provider (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_4is_provider(__pyx_self, ((PyObject *)__pyx_v_instance)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_4is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("is_provider", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_19dependency_injector_9providers_is_provider(__pyx_v_instance, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1471 + * + * + * cpdef object ensure_is_provider(object instance): # <<<<<<<<<<<<<< + * """Check if instance is provider instance and return it. + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_7ensure_is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_ensure_is_provider(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("ensure_is_provider", 0); + + /* "dependency_injector/providers.pyx":1482 + * :rtype: :py:class:`dependency_injector.providers.Provider` + * """ + * if not is_provider(instance): # <<<<<<<<<<<<<< + * raise Error('Expected provider instance, ' + * 'got {0}'.format(str(instance))) + */ + __pyx_t_1 = ((!(__pyx_f_19dependency_injector_9providers_is_provider(__pyx_v_instance, 0) != 0)) != 0); + if (__pyx_t_1) { + + /* "dependency_injector/providers.pyx":1483 + * """ + * if not is_provider(instance): + * raise Error('Expected provider instance, ' # <<<<<<<<<<<<<< + * 'got {0}'.format(str(instance))) + * return instance + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "dependency_injector/providers.pyx":1484 + * if not is_provider(instance): + * raise Error('Expected provider instance, ' + * 'got {0}'.format(str(instance))) # <<<<<<<<<<<<<< + * return instance + * + */ + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Expected_provider_instance_got_0, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_instance); + __Pyx_GIVEREF(__pyx_v_instance); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_instance); + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (!__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1484, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1483, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1483, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1483, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(1, 1483, __pyx_L1_error) + + /* "dependency_injector/providers.pyx":1482 + * :rtype: :py:class:`dependency_injector.providers.Provider` + * """ + * if not is_provider(instance): # <<<<<<<<<<<<<< + * raise Error('Expected provider instance, ' + * 'got {0}'.format(str(instance))) + */ + } + + /* "dependency_injector/providers.pyx":1485 + * raise Error('Expected provider instance, ' + * 'got {0}'.format(str(instance))) + * return instance # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_instance); + __pyx_r = __pyx_v_instance; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1471 + * + * + * cpdef object ensure_is_provider(object instance): # <<<<<<<<<<<<<< + * """Check if instance is provider instance and return it. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("dependency_injector.providers.ensure_is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_7ensure_is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_6ensure_is_provider[] = "Check if instance is provider instance and return it.\n\n :param instance: Instance to be checked.\n :type instance: object\n\n :raise: :py:exc:`dependency_injector.errors.Error` if provided instance is\n not provider.\n\n :rtype: :py:class:`dependency_injector.providers.Provider`\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_7ensure_is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ensure_is_provider (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_6ensure_is_provider(__pyx_self, ((PyObject *)__pyx_v_instance)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_6ensure_is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("ensure_is_provider", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_ensure_is_provider(__pyx_v_instance, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1471, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.ensure_is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1488 + * + * + * cpdef bint is_delegated(object instance): # <<<<<<<<<<<<<< + * """Check if instance is delegated provider. + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_9is_delegated(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ +static int __pyx_f_19dependency_injector_9providers_is_delegated(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("is_delegated", 0); + + /* "dependency_injector/providers.pyx":1496 + * :rtype: bool + * """ + * return (not isinstance(instance, CLASS_TYPES) and # <<<<<<<<<<<<<< + * getattr(instance, '__IS_DELEGATED__', False) is True) + * + */ + __pyx_t_2 = __pyx_v_19dependency_injector_9providers_CLASS_TYPES; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyObject_IsInstance(__pyx_v_instance, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(1, 1496, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L3_bool_binop_done; + } + + /* "dependency_injector/providers.pyx":1497 + * """ + * return (not isinstance(instance, CLASS_TYPES) and + * getattr(instance, '__IS_DELEGATED__', False) is True) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_instance, __pyx_n_s_IS_DELEGATED, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1497, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = (__pyx_t_2 == Py_True); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = (__pyx_t_4 != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L3_bool_binop_done:; + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1488 + * + * + * cpdef bint is_delegated(object instance): # <<<<<<<<<<<<<< + * """Check if instance is delegated provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("dependency_injector.providers.is_delegated", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_9is_delegated(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_8is_delegated[] = "Check if instance is delegated provider.\n\n :param instance: Instance to be checked.\n :type instance: object\n\n :rtype: bool\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_9is_delegated(PyObject *__pyx_self, PyObject *__pyx_v_instance) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_delegated (wrapper)", 0); + __pyx_r = __pyx_pf_19dependency_injector_9providers_8is_delegated(__pyx_self, ((PyObject *)__pyx_v_instance)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_8is_delegated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("is_delegated", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_19dependency_injector_9providers_is_delegated(__pyx_v_instance, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1488, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.is_delegated", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1500 + * + * + * cpdef str represent_provider(object provider, object provides): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_11represent_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_represent_provider(PyObject *__pyx_v_provider, PyObject *__pyx_v_provides, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("represent_provider", 0); + + /* "dependency_injector/providers.pyx":1512 + * :rtype: str + * """ + * return '<{provider}({provides}) at {address}>'.format( # <<<<<<<<<<<<<< + * provider='.'.join((provider.__class__.__module__, + * provider.__class__.__name__)), + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_provider_provides_at_address, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "dependency_injector/providers.pyx":1513 + * """ + * return '<{provider}({provides}) at {address}>'.format( + * provider='.'.join((provider.__class__.__module__, # <<<<<<<<<<<<<< + * provider.__class__.__name__)), + * provides=repr(provides) if provides is not None else '', + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_module); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1514 + * return '<{provider}({provides}) at {address}>'.format( + * provider='.'.join((provider.__class__.__module__, + * provider.__class__.__name__)), # <<<<<<<<<<<<<< + * provides=repr(provides) if provides is not None else '', + * address=hex(id(provider))) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1514, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1513 + * """ + * return '<{provider}({provides}) at {address}>'.format( + * provider='.'.join((provider.__class__.__module__, # <<<<<<<<<<<<<< + * provider.__class__.__name__)), + * provides=repr(provides) if provides is not None else '', + */ + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s__2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_provider, __pyx_t_5) < 0) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "dependency_injector/providers.pyx":1515 + * provider='.'.join((provider.__class__.__module__, + * provider.__class__.__name__)), + * provides=repr(provides) if provides is not None else '', # <<<<<<<<<<<<<< + * address=hex(id(provider))) + * + */ + __pyx_t_6 = (__pyx_v_provides != Py_None); + if ((__pyx_t_6 != 0)) { + __pyx_t_3 = PyObject_Repr(__pyx_v_provides); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1515, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __Pyx_INCREF(__pyx_kp_s__3); + __pyx_t_5 = __pyx_kp_s__3; + } + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_provides, __pyx_t_5) < 0) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "dependency_injector/providers.pyx":1516 + * provider.__class__.__name__)), + * provides=repr(provides) if provides is not None else '', + * address=hex(id(provider))) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_provider); + __Pyx_GIVEREF(__pyx_v_provider); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_provider); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_hex, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1516, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_address, __pyx_t_3) < 0) __PYX_ERR(1, 1513, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1512 + * :rtype: str + * """ + * return '<{provider}({provides}) at {address}>'.format( # <<<<<<<<<<<<<< + * provider='.'.join((provider.__class__.__module__, + * provider.__class__.__name__)), + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1512, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 1512, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1500 + * + * + * cpdef str represent_provider(object provider, object provides): # <<<<<<<<<<<<<< + * """Return string representation of provider. + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.represent_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_11represent_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_10represent_provider[] = "Return string representation of provider.\n\n :param provider: Provider object\n :type provider: :py:class:`dependency_injector.providers.Provider`\n\n :param provides: Object that provider provides\n :type provider: object\n\n :return: String representation of provider\n :rtype: str\n "; +static PyObject *__pyx_pw_19dependency_injector_9providers_11represent_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_provider = 0; + PyObject *__pyx_v_provides = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("represent_provider (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provider,&__pyx_n_s_provides,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provider)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("represent_provider", 1, 2, 2, 1); __PYX_ERR(1, 1500, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "represent_provider") < 0)) __PYX_ERR(1, 1500, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_provider = values[0]; + __pyx_v_provides = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("represent_provider", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1500, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.represent_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_19dependency_injector_9providers_10represent_provider(__pyx_self, __pyx_v_provider, __pyx_v_provides); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_10represent_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provider, PyObject *__pyx_v_provides) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("represent_provider", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_represent_provider(__pyx_v_provider, __pyx_v_provides, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1500, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.represent_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pyx":1519 + * + * + * cpdef object deepcopy(object instance, dict memo=None): # <<<<<<<<<<<<<< + * """Return full copy of provider or container with providers.""" + * return copy.deepcopy(instance, memo) + */ + +static PyObject *__pyx_pw_19dependency_injector_9providers_13deepcopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_19dependency_injector_9providers_deepcopy(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_deepcopy *__pyx_optional_args) { + PyObject *__pyx_v_memo = ((PyObject*)Py_None); + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("deepcopy", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_memo = __pyx_optional_args->memo; + } + } + + /* "dependency_injector/providers.pyx":1521 + * cpdef object deepcopy(object instance, dict memo=None): + * """Return full copy of provider or container with providers.""" + * return copy.deepcopy(instance, memo) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_instance, __pyx_v_memo}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1521, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_instance, __pyx_v_memo}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1521, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_2) { + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; + } + __Pyx_INCREF(__pyx_v_instance); + __Pyx_GIVEREF(__pyx_v_instance); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_instance); + __Pyx_INCREF(__pyx_v_memo); + __Pyx_GIVEREF(__pyx_v_memo); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_memo); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1521, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pyx":1519 + * + * + * cpdef object deepcopy(object instance, dict memo=None): # <<<<<<<<<<<<<< + * """Return full copy of provider or container with providers.""" + * return copy.deepcopy(instance, memo) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.deepcopy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_19dependency_injector_9providers_13deepcopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_19dependency_injector_9providers_12deepcopy[] = "Return full copy of provider or container with providers."; +static PyObject *__pyx_pw_19dependency_injector_9providers_13deepcopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_instance = 0; + PyObject *__pyx_v_memo = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("deepcopy (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_instance,&__pyx_n_s_memo,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject*)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_instance)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memo); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "deepcopy") < 0)) __PYX_ERR(1, 1519, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_instance = values[0]; + __pyx_v_memo = ((PyObject*)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("deepcopy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1519, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("dependency_injector.providers.deepcopy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_memo), (&PyDict_Type), 1, "memo", 1))) __PYX_ERR(1, 1519, __pyx_L1_error) + __pyx_r = __pyx_pf_19dependency_injector_9providers_12deepcopy(__pyx_self, __pyx_v_instance, __pyx_v_memo); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_19dependency_injector_9providers_12deepcopy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance, PyObject *__pyx_v_memo) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_19dependency_injector_9providers_deepcopy __pyx_t_2; + __Pyx_RefNannySetupContext("deepcopy", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.memo = __pyx_v_memo; + __pyx_t_1 = __pyx_f_19dependency_injector_9providers_deepcopy(__pyx_v_instance, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1519, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("dependency_injector.providers.deepcopy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pxd":158 + * + * # Inline helper functions + * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< + * return self.__name + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_name(struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get_name", 0); + + /* "dependency_injector/providers.pxd":159 + * # Inline helper functions + * cdef inline object __get_name(NamedInjection self): + * return self.__name # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___name); + __pyx_r = __pyx_v_self->__pyx___name; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":158 + * + * # Inline helper functions + * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< + * return self.__name + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pxd":162 + * + * + * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< + * if self.__call == 0: + * return self.__value + */ + +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___get_value(struct __pyx_obj_19dependency_injector_9providers_Injection *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("__get_value", 0); + + /* "dependency_injector/providers.pxd":163 + * + * cdef inline object __get_value(Injection self): + * if self.__call == 0: # <<<<<<<<<<<<<< + * return self.__value + * return self.__value() + */ + __pyx_t_1 = ((__pyx_v_self->__pyx___call == 0) != 0); + if (__pyx_t_1) { + + /* "dependency_injector/providers.pxd":164 + * cdef inline object __get_value(Injection self): + * if self.__call == 0: + * return self.__value # <<<<<<<<<<<<<< + * return self.__value() + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___value); + __pyx_r = __pyx_v_self->__pyx___value; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":163 + * + * cdef inline object __get_value(Injection self): + * if self.__call == 0: # <<<<<<<<<<<<<< + * return self.__value + * return self.__value() + */ + } + + /* "dependency_injector/providers.pxd":165 + * if self.__call == 0: + * return self.__value + * return self.__value() # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self->__pyx___value); + __pyx_t_3 = __pyx_v_self->__pyx___value; __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":162 + * + * + * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< + * if self.__call == 0: + * return self.__value + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("dependency_injector.providers.__get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pxd":170 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< + * tuple inj_args, + * int inj_args_len): + */ + +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provide_positional_args(PyObject *__pyx_v_args, PyObject *__pyx_v_inj_args, int __pyx_v_inj_args_len) { + int __pyx_v_index; + PyObject *__pyx_v_positional_args = 0; + struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *__pyx_v_injection = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("__provide_positional_args", 0); + + /* "dependency_injector/providers.pxd":177 + * cdef PositionalInjection injection + * + * if inj_args_len == 0: # <<<<<<<<<<<<<< + * return args + * + */ + __pyx_t_1 = ((__pyx_v_inj_args_len == 0) != 0); + if (__pyx_t_1) { + + /* "dependency_injector/providers.pxd":178 + * + * if inj_args_len == 0: + * return args # <<<<<<<<<<<<<< + * + * positional_args = list() + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_args); + __pyx_r = __pyx_v_args; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":177 + * cdef PositionalInjection injection + * + * if inj_args_len == 0: # <<<<<<<<<<<<<< + * return args + * + */ + } + + /* "dependency_injector/providers.pxd":180 + * return args + * + * positional_args = list() # <<<<<<<<<<<<<< + * for index in range(inj_args_len): + * injection = inj_args[index] + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_positional_args = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pxd":181 + * + * positional_args = list() + * for index in range(inj_args_len): # <<<<<<<<<<<<<< + * injection = inj_args[index] + * positional_args.append(__get_value(injection)) + */ + __pyx_t_3 = __pyx_v_inj_args_len; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_index = __pyx_t_4; + + /* "dependency_injector/providers.pxd":182 + * positional_args = list() + * for index in range(inj_args_len): + * injection = inj_args[index] # <<<<<<<<<<<<<< + * positional_args.append(__get_value(injection)) + * positional_args.extend(args) + */ + if (unlikely(__pyx_v_inj_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 182, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_inj_args, __pyx_v_index); + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_PositionalInjection *)__pyx_t_2)); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pxd":183 + * for index in range(inj_args_len): + * injection = inj_args[index] + * positional_args.append(__get_value(injection)) # <<<<<<<<<<<<<< + * positional_args.extend(args) + * + */ + __pyx_t_2 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_injection)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_positional_args, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 183, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + + /* "dependency_injector/providers.pxd":184 + * injection = inj_args[index] + * positional_args.append(__get_value(injection)) + * positional_args.extend(args) # <<<<<<<<<<<<<< + * + * return tuple(positional_args) + */ + __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_positional_args, __pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 184, __pyx_L1_error) + + /* "dependency_injector/providers.pxd":186 + * positional_args.extend(args) + * + * return tuple(positional_args) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":170 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< + * tuple inj_args, + * int inj_args_len): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.__provide_positional_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_positional_args); + __Pyx_XDECREF((PyObject *)__pyx_v_injection); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pxd":191 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< + * tuple inj_kwargs, + * int inj_kwargs_len): + */ + +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___provide_keyword_args(PyObject *__pyx_v_kwargs, PyObject *__pyx_v_inj_kwargs, int __pyx_v_inj_kwargs_len) { + int __pyx_v_index; + PyObject *__pyx_v_name = 0; + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_kw_injection = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __Pyx_RefNannySetupContext("__provide_keyword_args", 0); + + /* "dependency_injector/providers.pxd":198 + * cdef NamedInjection kw_injection + * + * if len(kwargs) == 0: # <<<<<<<<<<<<<< + * for index in range(inj_kwargs_len): + * kw_injection = inj_kwargs[index] + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(0, 198, __pyx_L1_error) + } + __pyx_t_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_2 = ((__pyx_t_1 == 0) != 0); + if (__pyx_t_2) { + + /* "dependency_injector/providers.pxd":199 + * + * if len(kwargs) == 0: + * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< + * kw_injection = inj_kwargs[index] + * name = __get_name(kw_injection) + */ + __pyx_t_3 = __pyx_v_inj_kwargs_len; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_index = __pyx_t_4; + + /* "dependency_injector/providers.pxd":200 + * if len(kwargs) == 0: + * for index in range(inj_kwargs_len): + * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< + * name = __get_name(kw_injection) + * kwargs[name] = __get_value(kw_injection) + */ + if (unlikely(__pyx_v_inj_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 200, __pyx_L1_error) + } + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); + __Pyx_INCREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "dependency_injector/providers.pxd":201 + * for index in range(inj_kwargs_len): + * kw_injection = inj_kwargs[index] + * name = __get_name(kw_injection) # <<<<<<<<<<<<<< + * kwargs[name] = __get_value(kw_injection) + * else: + */ + __pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); + __pyx_t_5 = 0; + + /* "dependency_injector/providers.pxd":202 + * kw_injection = inj_kwargs[index] + * name = __get_name(kw_injection) + * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< + * else: + * for index in range(inj_kwargs_len): + */ + __pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 202, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + + /* "dependency_injector/providers.pxd":198 + * cdef NamedInjection kw_injection + * + * if len(kwargs) == 0: # <<<<<<<<<<<<<< + * for index in range(inj_kwargs_len): + * kw_injection = inj_kwargs[index] + */ + goto __pyx_L3; + } + + /* "dependency_injector/providers.pxd":204 + * kwargs[name] = __get_value(kw_injection) + * else: + * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< + * kw_injection = inj_kwargs[index] + * name = __get_name(kw_injection) + */ + /*else*/ { + __pyx_t_3 = __pyx_v_inj_kwargs_len; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_index = __pyx_t_4; + + /* "dependency_injector/providers.pxd":205 + * else: + * for index in range(inj_kwargs_len): + * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< + * name = __get_name(kw_injection) + * if name not in kwargs: + */ + if (unlikely(__pyx_v_inj_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 205, __pyx_L1_error) + } + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); + __Pyx_INCREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_5)); + __pyx_t_5 = 0; + + /* "dependency_injector/providers.pxd":206 + * for index in range(inj_kwargs_len): + * kw_injection = inj_kwargs[index] + * name = __get_name(kw_injection) # <<<<<<<<<<<<<< + * if name not in kwargs: + * kwargs[name] = __get_value(kw_injection) + */ + __pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); + __pyx_t_5 = 0; + + /* "dependency_injector/providers.pxd":207 + * kw_injection = inj_kwargs[index] + * name = __get_name(kw_injection) + * if name not in kwargs: # <<<<<<<<<<<<<< + * kwargs[name] = __get_value(kw_injection) + * + */ + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 207, __pyx_L1_error) + } + __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_6 = (__pyx_t_2 != 0); + if (__pyx_t_6) { + + /* "dependency_injector/providers.pxd":208 + * name = __get_name(kw_injection) + * if name not in kwargs: + * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< + * + * return kwargs + */ + __pyx_t_5 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__pyx_v_kwargs == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 208, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "dependency_injector/providers.pxd":207 + * kw_injection = inj_kwargs[index] + * name = __get_name(kw_injection) + * if name not in kwargs: # <<<<<<<<<<<<<< + * kwargs[name] = __get_value(kw_injection) + * + */ + } + } + } + __pyx_L3:; + + /* "dependency_injector/providers.pxd":210 + * kwargs[name] = __get_value(kw_injection) + * + * return kwargs # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_kwargs); + __pyx_r = __pyx_v_kwargs; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":191 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< + * tuple inj_kwargs, + * int inj_kwargs_len): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("dependency_injector.providers.__provide_keyword_args", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF((PyObject *)__pyx_v_kw_injection); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pxd":215 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< + * tuple attributes, + * int attributes_len): + */ + +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___inject_attributes(PyObject *__pyx_v_instance, PyObject *__pyx_v_attributes, int __pyx_v_attributes_len) { + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *__pyx_v_attr_injection = 0; + int __pyx_v_index; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("__inject_attributes", 0); + + /* "dependency_injector/providers.pxd":219 + * int attributes_len): + * cdef NamedInjection attr_injection + * for index in range(attributes_len): # <<<<<<<<<<<<<< + * attr_injection = attributes[index] + * setattr(instance, + */ + __pyx_t_1 = __pyx_v_attributes_len; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_index = __pyx_t_2; + + /* "dependency_injector/providers.pxd":220 + * cdef NamedInjection attr_injection + * for index in range(attributes_len): + * attr_injection = attributes[index] # <<<<<<<<<<<<<< + * setattr(instance, + * __get_name(attr_injection), + */ + if (unlikely(__pyx_v_attributes == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(0, 220, __pyx_L1_error) + } + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_v_attributes, __pyx_v_index); + __Pyx_INCREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_attr_injection, ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pxd":222 + * attr_injection = attributes[index] + * setattr(instance, + * __get_name(attr_injection), # <<<<<<<<<<<<<< + * __get_value(attr_injection)) + * + */ + __pyx_t_3 = __pyx_f_19dependency_injector_9providers___get_name(__pyx_v_attr_injection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "dependency_injector/providers.pxd":223 + * setattr(instance, + * __get_name(attr_injection), + * __get_value(attr_injection)) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = __pyx_f_19dependency_injector_9providers___get_value(((struct __pyx_obj_19dependency_injector_9providers_Injection *)__pyx_v_attr_injection)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "dependency_injector/providers.pxd":221 + * for index in range(attributes_len): + * attr_injection = attributes[index] + * setattr(instance, # <<<<<<<<<<<<<< + * __get_name(attr_injection), + * __get_value(attr_injection)) + */ + __pyx_t_5 = PyObject_SetAttr(__pyx_v_instance, __pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 221, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + + /* "dependency_injector/providers.pxd":215 + * @cython.boundscheck(False) + * @cython.wraparound(False) + * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< + * tuple attributes, + * int attributes_len): + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("dependency_injector.providers.__inject_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_attr_injection); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pxd":226 + * + * + * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * cdef tuple positional_args + * cdef dict keyword_args + */ + +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___callable_call(struct __pyx_obj_19dependency_injector_9providers_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_positional_args = 0; + PyObject *__pyx_v_keyword_args = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__callable_call", 0); + + /* "dependency_injector/providers.pxd":231 + * + * positional_args = __provide_positional_args(args, + * self.__args, # <<<<<<<<<<<<<< + * self.__args_len) + * keyword_args = __provide_keyword_args(kwargs, + */ + __pyx_t_1 = __pyx_v_self->__pyx___args; + __Pyx_INCREF(__pyx_t_1); + + /* "dependency_injector/providers.pxd":230 + * cdef dict keyword_args + * + * positional_args = __provide_positional_args(args, # <<<<<<<<<<<<<< + * self.__args, + * self.__args_len) + */ + __pyx_t_2 = __pyx_f_19dependency_injector_9providers___provide_positional_args(__pyx_v_args, ((PyObject*)__pyx_t_1), __pyx_v_self->__pyx___args_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_positional_args = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pxd":234 + * self.__args_len) + * keyword_args = __provide_keyword_args(kwargs, + * self.__kwargs, # <<<<<<<<<<<<<< + * self.__kwargs_len) + * + */ + __pyx_t_2 = __pyx_v_self->__pyx___kwargs; + __Pyx_INCREF(__pyx_t_2); + + /* "dependency_injector/providers.pxd":233 + * self.__args, + * self.__args_len) + * keyword_args = __provide_keyword_args(kwargs, # <<<<<<<<<<<<<< + * self.__kwargs, + * self.__kwargs_len) + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_keyword_args = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "dependency_injector/providers.pxd":237 + * self.__kwargs_len) + * + * return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(__pyx_v_positional_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + __PYX_ERR(0, 237, __pyx_L1_error) + } + if (unlikely(__pyx_v_keyword_args == Py_None)) { + PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); + __PYX_ERR(0, 237, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->__pyx___provides, __pyx_v_positional_args, __pyx_v_keyword_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":226 + * + * + * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * cdef tuple positional_args + * cdef dict keyword_args + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.__callable_call", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_positional_args); + __Pyx_XDECREF(__pyx_v_keyword_args); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "dependency_injector/providers.pxd":240 + * + * + * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * cdef object instance + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers___factory_call(struct __pyx_obj_19dependency_injector_9providers_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { + PyObject *__pyx_v_instance = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_RefNannySetupContext("__factory_call", 0); + + /* "dependency_injector/providers.pxd":243 + * cdef object instance + * + * instance = __callable_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<< + * + * if self.__attributes_len > 0: + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instantiator); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = __pyx_f_19dependency_injector_9providers___callable_call(((struct __pyx_obj_19dependency_injector_9providers_Callable *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_instance = __pyx_t_2; + __pyx_t_2 = 0; + + /* "dependency_injector/providers.pxd":245 + * instance = __callable_call(self.__instantiator, args, kwargs) + * + * if self.__attributes_len > 0: # <<<<<<<<<<<<<< + * __inject_attributes(instance, + * self.__attributes, + */ + __pyx_t_3 = ((__pyx_v_self->__pyx___attributes_len > 0) != 0); + if (__pyx_t_3) { + + /* "dependency_injector/providers.pxd":247 + * if self.__attributes_len > 0: + * __inject_attributes(instance, + * self.__attributes, # <<<<<<<<<<<<<< + * self.__attributes_len) + * + */ + __pyx_t_2 = __pyx_v_self->__pyx___attributes; + __Pyx_INCREF(__pyx_t_2); + + /* "dependency_injector/providers.pxd":246 + * + * if self.__attributes_len > 0: + * __inject_attributes(instance, # <<<<<<<<<<<<<< + * self.__attributes, + * self.__attributes_len) + */ + __pyx_t_1 = __pyx_f_19dependency_injector_9providers___inject_attributes(__pyx_v_instance, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___attributes_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pxd":245 + * instance = __callable_call(self.__instantiator, args, kwargs) + * + * if self.__attributes_len > 0: # <<<<<<<<<<<<<< + * __inject_attributes(instance, + * self.__attributes, + */ + } + + /* "dependency_injector/providers.pxd":250 + * self.__attributes_len) + * + * return instance # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_instance); + __pyx_r = __pyx_v_instance; + goto __pyx_L0; + + /* "dependency_injector/providers.pxd":240 + * + * + * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * cdef object instance + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("dependency_injector.providers.__factory_call", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_instance); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_19dependency_injector_9providers_Provider __pyx_vtable_19dependency_injector_9providers_Provider; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Provider(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Provider *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Provider *)o); + p->__pyx_vtab = __pyx_vtabptr_19dependency_injector_9providers_Provider; + p->__pyx___overridden = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_Provider(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_Provider *p = (struct __pyx_obj_19dependency_injector_9providers_Provider *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___overridden); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_Provider(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_Provider *p = (struct __pyx_obj_19dependency_injector_9providers_Provider *)o; + if (p->__pyx___overridden) { + e = (*v)(p->__pyx___overridden, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_Provider(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_Provider *p = (struct __pyx_obj_19dependency_injector_9providers_Provider *)o; + tmp = ((PyObject*)p->__pyx___overridden); + p->__pyx___overridden = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_8Provider_overridden(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_8Provider_10overridden_1__get__(o); +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_Provider[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_5__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_8Provider_4__deepcopy__}, + {"override", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_11override, METH_O, __pyx_doc_19dependency_injector_9providers_8Provider_10override}, + {"reset_last_overriding", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_13reset_last_overriding, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_8Provider_12reset_last_overriding}, + {"reset_override", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_15reset_override, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_8Provider_14reset_override}, + {"delegate", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_17delegate, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_8Provider_16delegate}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_19_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_8Provider_18_provide}, + {"_call_last_overriding", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Provider_21_call_last_overriding, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_8Provider_20_call_last_overriding}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_Provider[] = { + {(char *)"overridden", __pyx_getprop_19dependency_injector_9providers_8Provider_overridden, 0, (char *)"Return tuple of overriding providers.", 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Provider = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Provider", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Provider), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Provider, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + __pyx_pw_19dependency_injector_9providers_8Provider_7__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Base provider class.\n\n :py:class:`Provider` is callable (implements ``__call__`` method). Every\n call to provider object returns provided result, according to the providing\n strategy of particular provider. This ``callable`` functionality is a\n regular part of providers API and it should be the same for all provider's\n subclasses.\n\n Implementation of particular providing strategy should be done in\n :py:meth:`Provider._provide` of :py:class:`Provider` subclass. Current\n method is called every time when not overridden provider is called.\n\n :py:class:`Provider` implements provider overriding logic that should be\n also common for all providers:\n\n .. code-block:: python\n\n provider1 = Factory(SomeClass)\n provider2 = Factory(ChildSomeClass)\n\n provider1.override(provider2)\n\n some_instance = provider1()\n assert isinstance(some_instance, ChildSomeClass)\n\n Also :py:class:`Provider` implements helper function for creating its\n delegates:\n\n .. code-block:: python\n\n provider = Factory(object)\n delegate = provider.delegate()\n\n delegated = delegate()\n\n assert provider is delegated\n\n All providers should extend this class.\n\n .. py:attribute:: overridden\n\n Tuple of overriding providers, if any.\n\n :type: tuple[:py:class:`Provider`] | None\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Provider, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Provider, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_Provider, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19dependency_injector_9providers_Provider, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_8Provider_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Provider, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Object __pyx_vtable_19dependency_injector_9providers_Object; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Object(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Object *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Provider(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Object *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_Object; + p->__pyx___provides = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_Object(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_Object *p = (struct __pyx_obj_19dependency_injector_9providers_Object *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___provides); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_Provider(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_Object(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_Object *p = (struct __pyx_obj_19dependency_injector_9providers_Object *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_Provider(o, v, a); if (e) return e; + if (p->__pyx___provides) { + e = (*v)(p->__pyx___provides, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_Object(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_Object *p = (struct __pyx_obj_19dependency_injector_9providers_Object *)o; + __pyx_tp_clear_19dependency_injector_9providers_Provider(o); + tmp = ((PyObject*)p->__pyx___provides); + p->__pyx___provides = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_Object[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_6Object_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_6Object_2__deepcopy__}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_6Object_9_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_6Object_8_provide}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Object = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Object", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Object), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Object, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_19dependency_injector_9providers_6Object_7__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + __pyx_pw_19dependency_injector_9providers_6Object_5__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Object provider returns provided instance \"as is\".\n\n .. py:attribute:: provides\n\n Value that have to be provided.\n\n :type: object\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Object, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Object, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_Object, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_6Object_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Object, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Delegate __pyx_vtable_19dependency_injector_9providers_Delegate; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Delegate(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Delegate *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Object(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Delegate *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_Delegate; + return o; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_Delegate[] = { + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Delegate = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Delegate", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Delegate), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Object, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_6Object_7__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_6Object_5__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Delegate provider returns provider \"as is\".\n\n .. py:attribute:: provides\n\n Value that have to be provided.\n\n :type: object\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Object, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Object, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_Delegate, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_8Delegate_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Delegate, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_ExternalDependency __pyx_vtable_19dependency_injector_9providers_ExternalDependency; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_ExternalDependency(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Provider(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_ExternalDependency; + p->__pyx___instance_of = ((PyTypeObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_ExternalDependency(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *p = (struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___instance_of); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_Provider(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_ExternalDependency(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *p = (struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_Provider(o, v, a); if (e) return e; + if (p->__pyx___instance_of) { + e = (*v)(p->__pyx___instance_of, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_ExternalDependency(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *p = (struct __pyx_obj_19dependency_injector_9providers_ExternalDependency *)o; + __pyx_tp_clear_19dependency_injector_9providers_Provider(o); + tmp = ((PyObject*)p->__pyx___instance_of); + p->__pyx___instance_of = ((PyTypeObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_18ExternalDependency_instance_of(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_18ExternalDependency_11instance_of_1__get__(o); +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_ExternalDependency[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_18ExternalDependency_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_18ExternalDependency_2__deepcopy__}, + {"provided_by", (PyCFunction)__pyx_pw_19dependency_injector_9providers_18ExternalDependency_11provided_by, METH_O, __pyx_doc_19dependency_injector_9providers_18ExternalDependency_10provided_by}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_ExternalDependency[] = { + {(char *)"instance_of", __pyx_getprop_19dependency_injector_9providers_18ExternalDependency_instance_of, 0, (char *)"Return class of required dependency.", 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_ExternalDependency = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.ExternalDependency", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_ExternalDependency), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_ExternalDependency, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + __pyx_pw_19dependency_injector_9providers_18ExternalDependency_9__repr__, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + __pyx_pw_19dependency_injector_9providers_18ExternalDependency_5__call__, /*tp_call*/ + __pyx_pw_19dependency_injector_9providers_18ExternalDependency_7__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + ":py:class:`ExternalDependency` provider describes dependency interface.\n\n This provider is used for description of dependency interface. That might\n be useful when dependency could be provided in the client's code only,\n but it's interface is known. Such situations could happen when required\n dependency has non-determenistic list of dependencies itself.\n\n .. code-block:: python\n\n database_provider = ExternalDependency(sqlite3.dbapi2.Connection)\n database_provider.override(Factory(sqlite3.connect, ':memory:'))\n\n database = database_provider()\n\n .. py:attribute:: instance_of\n\n Class of required dependency.\n\n :type: type\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_ExternalDependency, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_ExternalDependency, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_ExternalDependency, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19dependency_injector_9providers_ExternalDependency, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_18ExternalDependency_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_ExternalDependency, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_OverridingContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_OverridingContext *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_OverridingContext *)o); + p->__pyx___overridden = ((struct __pyx_obj_19dependency_injector_9providers_Provider *)Py_None); Py_INCREF(Py_None); + p->__pyx___overriding = ((struct __pyx_obj_19dependency_injector_9providers_Provider *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_OverridingContext(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_OverridingContext *p = (struct __pyx_obj_19dependency_injector_9providers_OverridingContext *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___overridden); + Py_CLEAR(p->__pyx___overriding); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_OverridingContext(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_OverridingContext *p = (struct __pyx_obj_19dependency_injector_9providers_OverridingContext *)o; + if (p->__pyx___overridden) { + e = (*v)(((PyObject*)p->__pyx___overridden), a); if (e) return e; + } + if (p->__pyx___overriding) { + e = (*v)(((PyObject*)p->__pyx___overriding), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_OverridingContext(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_OverridingContext *p = (struct __pyx_obj_19dependency_injector_9providers_OverridingContext *)o; + tmp = ((PyObject*)p->__pyx___overridden); + p->__pyx___overridden = ((struct __pyx_obj_19dependency_injector_9providers_Provider *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx___overriding); + p->__pyx___overriding = ((struct __pyx_obj_19dependency_injector_9providers_Provider *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_OverridingContext[] = { + {"__enter__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_17OverridingContext_3__enter__, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_17OverridingContext_2__enter__}, + {"__exit__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_17OverridingContext_5__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_17OverridingContext_4__exit__}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_OverridingContext = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.OverridingContext", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_OverridingContext), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_OverridingContext, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Provider overriding context.\n\n :py:class:`OverridingContext` is used by :py:meth:`Provider.override` for\n implemeting ``with`` contexts. When :py:class:`OverridingContext` is\n closed, overriding that was created in this context is dropped also.\n\n .. code-block:: python\n\n with provider.override(another_provider):\n assert provider.overridden\n assert not provider.overridden\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_OverridingContext, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_OverridingContext, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_OverridingContext, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_17OverridingContext_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_OverridingContext, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Callable __pyx_vtable_19dependency_injector_9providers_Callable; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Callable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Callable *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Provider(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Callable *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_Callable; + p->__pyx___provides = Py_None; Py_INCREF(Py_None); + p->__pyx___args = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->__pyx___kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_Callable(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_Callable *p = (struct __pyx_obj_19dependency_injector_9providers_Callable *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___provides); + Py_CLEAR(p->__pyx___args); + Py_CLEAR(p->__pyx___kwargs); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_Provider(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_Callable(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_Callable *p = (struct __pyx_obj_19dependency_injector_9providers_Callable *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_Provider(o, v, a); if (e) return e; + if (p->__pyx___provides) { + e = (*v)(p->__pyx___provides, a); if (e) return e; + } + if (p->__pyx___args) { + e = (*v)(p->__pyx___args, a); if (e) return e; + } + if (p->__pyx___kwargs) { + e = (*v)(p->__pyx___kwargs, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_Callable(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_Callable *p = (struct __pyx_obj_19dependency_injector_9providers_Callable *)o; + __pyx_tp_clear_19dependency_injector_9providers_Provider(o); + tmp = ((PyObject*)p->__pyx___provides); + p->__pyx___provides = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx___args); + p->__pyx___args = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx___kwargs); + p->__pyx___kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_8Callable_provides(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_8Callable_8provides_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_8Callable_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_8Callable_4args_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_8Callable_kwargs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_8Callable_6kwargs_1__get__(o); +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_Callable[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_8Callable_2__deepcopy__}, + {"add_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_7add_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_8Callable_6add_args}, + {"set_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_9set_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_8Callable_8set_args}, + {"clear_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_11clear_args, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_8Callable_10clear_args}, + {"add_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_13add_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_8Callable_12add_kwargs}, + {"set_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_15set_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_8Callable_14set_kwargs}, + {"clear_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_17clear_kwargs, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_8Callable_16clear_kwargs}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_8Callable_19_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_8Callable_18_provide}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_Callable[] = { + {(char *)"provides", __pyx_getprop_19dependency_injector_9providers_8Callable_provides, 0, (char *)"Return wrapped callable.", 0}, + {(char *)"args", __pyx_getprop_19dependency_injector_9providers_8Callable_args, 0, (char *)"Return positional argument injections.", 0}, + {(char *)"kwargs", __pyx_getprop_19dependency_injector_9providers_8Callable_kwargs, 0, (char *)"Return keyword argument injections.", 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Callable = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Callable", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Callable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Callable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + __pyx_pw_19dependency_injector_9providers_8Callable_5__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Callable provider calls wrapped callable on every call.\n\n Callable supports positional and keyword argument injections:\n\n .. code-block:: python\n\n some_function = Callable(some_function,\n 'positional_arg1', 'positional_arg2',\n keyword_argument1=3, keyword_argument=4)\n\n # or\n\n some_function = Callable(some_function) \\\n .add_args('positional_arg1', 'positional_arg2') \\\n .add_kwargs(keyword_argument1=3, keyword_argument=4)\n\n # or\n\n some_function = Callable(some_function)\n some_function.add_args('positional_arg1', 'positional_arg2')\n some_function.add_kwargs(keyword_argument1=3, keyword_argument=4)\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Callable, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Callable, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_Callable, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19dependency_injector_9providers_Callable, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_8Callable_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Callable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedCallable __pyx_vtable_19dependency_injector_9providers_DelegatedCallable; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedCallable(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_DelegatedCallable *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Callable(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_DelegatedCallable *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_DelegatedCallable; + return o; +} + +static PyTypeObject __pyx_type_19dependency_injector_9providers_DelegatedCallable = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.DelegatedCallable", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedCallable), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Callable, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Callable_5__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Callable that is injected \"as is\".\n\n DelegatedCallable is a :py:class:`Callable`, that is injected \"as is\".\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Callable, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Callable, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Callable_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_DelegatedCallable, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Configuration __pyx_vtable_19dependency_injector_9providers_Configuration; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Configuration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Configuration *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Provider(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Configuration *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_Configuration; + p->__pyx___name = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->__pyx___value = Py_None; Py_INCREF(Py_None); + p->__pyx___children = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_Configuration(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_Configuration *p = (struct __pyx_obj_19dependency_injector_9providers_Configuration *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___name); + Py_CLEAR(p->__pyx___value); + Py_CLEAR(p->__pyx___children); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_Provider(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_Configuration(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_Configuration *p = (struct __pyx_obj_19dependency_injector_9providers_Configuration *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_Provider(o, v, a); if (e) return e; + if (p->__pyx___value) { + e = (*v)(p->__pyx___value, a); if (e) return e; + } + if (p->__pyx___children) { + e = (*v)(p->__pyx___children, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_Configuration(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_Configuration *p = (struct __pyx_obj_19dependency_injector_9providers_Configuration *)o; + __pyx_tp_clear_19dependency_injector_9providers_Provider(o); + tmp = ((PyObject*)p->__pyx___value); + p->__pyx___value = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx___children); + p->__pyx___children = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_tp_getattro_19dependency_injector_9providers_Configuration(PyObject *o, PyObject *n) { + PyObject *v = PyObject_GenericGetAttr(o, n); + if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + v = __pyx_pw_19dependency_injector_9providers_13Configuration_7__getattr__(o, n); + } + return v; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_Configuration[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_13Configuration_2__deepcopy__}, + {"__getattr__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_7__getattr__, METH_O|METH_COEXIST, __pyx_doc_19dependency_injector_9providers_13Configuration_6__getattr__}, + {"get_name", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_9get_name, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_13Configuration_8get_name}, + {"update", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_11update, METH_O, __pyx_doc_19dependency_injector_9providers_13Configuration_10update}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_13_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13Configuration_12_provide}, + {"_get_child_name", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13Configuration_15_get_child_name, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Configuration = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Configuration", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Configuration), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Configuration, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + __pyx_pw_19dependency_injector_9providers_13Configuration_5__str__, /*tp_str*/ + __pyx_tp_getattro_19dependency_injector_9providers_Configuration, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Configuration provider.\n\n Configuration provider helps with implementing late static binding of\n configuration options - use first, define later.\n\n .. code-block:: python\n\n config = Configuration('config')\n\n print(config.section1.option1()) # None\n print(config.section1.option2()) # None\n\n config.update({'section1': {'option1': 1,\n 'option2': 2}})\n\n print(config.section1.option1()) # 1\n print(config.section1.option2()) # 2\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Configuration, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Configuration, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_Configuration, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_13Configuration_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Configuration, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Factory __pyx_vtable_19dependency_injector_9providers_Factory; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Factory(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Factory *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Provider(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Factory *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_Factory; + p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_Callable *)Py_None); Py_INCREF(Py_None); + p->__pyx___attributes = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_Factory(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_Factory *p = (struct __pyx_obj_19dependency_injector_9providers_Factory *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___instantiator); + Py_CLEAR(p->__pyx___attributes); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_Provider(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_Factory(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_Factory *p = (struct __pyx_obj_19dependency_injector_9providers_Factory *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_Provider(o, v, a); if (e) return e; + if (p->__pyx___instantiator) { + e = (*v)(((PyObject*)p->__pyx___instantiator), a); if (e) return e; + } + if (p->__pyx___attributes) { + e = (*v)(p->__pyx___attributes, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_Factory(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_Factory *p = (struct __pyx_obj_19dependency_injector_9providers_Factory *)o; + __pyx_tp_clear_19dependency_injector_9providers_Provider(o); + tmp = ((PyObject*)p->__pyx___instantiator); + p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_Callable *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx___attributes); + p->__pyx___attributes = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_7Factory_cls(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_7Factory_3cls_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_7Factory_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_7Factory_4args_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_7Factory_kwargs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_7Factory_6kwargs_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_7Factory_attributes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_7Factory_10attributes_1__get__(o); +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_Factory[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_7Factory_2__deepcopy__}, + {"add_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_7add_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_7Factory_6add_args}, + {"set_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_9set_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_7Factory_8set_args}, + {"clear_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_11clear_args, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_7Factory_10clear_args}, + {"add_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_13add_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_7Factory_12add_kwargs}, + {"set_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_15set_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_7Factory_14set_kwargs}, + {"clear_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_17clear_kwargs, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_7Factory_16clear_kwargs}, + {"add_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_19add_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_7Factory_18add_attributes}, + {"set_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_21set_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_7Factory_20set_attributes}, + {"clear_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_23clear_attributes, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_7Factory_22clear_attributes}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7Factory_25_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_7Factory_24_provide}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_Factory[] = { + {(char *)"cls", __pyx_getprop_19dependency_injector_9providers_7Factory_cls, 0, (char *)"Return provided type.", 0}, + {(char *)"args", __pyx_getprop_19dependency_injector_9providers_7Factory_args, 0, (char *)"Return positional argument injections.", 0}, + {(char *)"kwargs", __pyx_getprop_19dependency_injector_9providers_7Factory_kwargs, 0, (char *)"Return keyword argument injections.", 0}, + {(char *)"attributes", __pyx_getprop_19dependency_injector_9providers_7Factory_attributes, 0, (char *)"Return attribute injections.", 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Factory = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Factory", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Factory), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Factory, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + __pyx_pw_19dependency_injector_9providers_7Factory_5__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Factory provider creates new instance on every call.\n\n :py:class:`Factory` supports positional & keyword argument injections,\n as well as attribute injections.\n\n Positional and keyword argument injections could be defined like this:\n\n .. code-block:: python\n\n factory = Factory(SomeClass,\n 'positional_arg1', 'positional_arg2',\n keyword_argument1=3, keyword_argument=4)\n\n # or\n\n factory = Factory(SomeClass) \\\n .add_args('positional_arg1', 'positional_arg2') \\\n .add_kwargs(keyword_argument1=3, keyword_argument=4)\n\n # or\n\n factory = Factory(SomeClass)\n factory.add_args('positional_arg1', 'positional_arg2')\n factory.add_kwargs(keyword_argument1=3, keyword_argument=4)\n\n\n Attribute injections are defined by using\n :py:meth:`Factory.add_attributes`:\n\n .. code-block:: python\n\n factory = Factory(SomeClass) \\\n .add_attributes(attribute1=1, attribute2=2)\n\n Retrieving of provided instance can be performed via calling\n :py:class:`Factory` object:\n\n .. code-block:: python\n\n factory = Factory(SomeClass)\n some_object = factory()\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Factory, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Factory, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_Factory, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19dependency_injector_9providers_Factory, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_7Factory_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Factory, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedFactory __pyx_vtable_19dependency_injector_9providers_DelegatedFactory; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedFactory(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_DelegatedFactory *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Factory(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_DelegatedFactory *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_DelegatedFactory; + return o; +} + +static PyTypeObject __pyx_type_19dependency_injector_9providers_DelegatedFactory = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.DelegatedFactory", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedFactory), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Factory, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_7Factory_5__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Factory that is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Factory, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Factory, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_7Factory_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_DelegatedFactory, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_BaseSingleton __pyx_vtable_19dependency_injector_9providers_BaseSingleton; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_BaseSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Provider(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton; + p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_Factory *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_BaseSingleton(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___instantiator); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_Provider(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_BaseSingleton(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_Provider(o, v, a); if (e) return e; + if (p->__pyx___instantiator) { + e = (*v)(((PyObject*)p->__pyx___instantiator), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_BaseSingleton(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_BaseSingleton *)o; + __pyx_tp_clear_19dependency_injector_9providers_Provider(o); + tmp = ((PyObject*)p->__pyx___instantiator); + p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_Factory *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_13BaseSingleton_cls(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3cls_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_13BaseSingleton_args(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_13BaseSingleton_4args_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_13BaseSingleton_kwargs(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_13BaseSingleton_6kwargs_1__get__(o); +} + +static PyObject *__pyx_getprop_19dependency_injector_9providers_13BaseSingleton_attributes(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_19dependency_injector_9providers_13BaseSingleton_10attributes_1__get__(o); +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_BaseSingleton[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_5__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_4__deepcopy__}, + {"add_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_7add_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_6add_args}, + {"set_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_9set_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_8set_args}, + {"clear_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_11clear_args, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_10clear_args}, + {"add_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_13add_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_12add_kwargs}, + {"set_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_15set_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_14set_kwargs}, + {"clear_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_17clear_kwargs, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_16clear_kwargs}, + {"add_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_19add_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_18add_attributes}, + {"set_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_21set_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_20set_attributes}, + {"clear_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_23clear_attributes, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_22clear_attributes}, + {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13BaseSingleton_25reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_13BaseSingleton_24reset}, + {0, 0, 0, 0} +}; + +static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_BaseSingleton[] = { + {(char *)"cls", __pyx_getprop_19dependency_injector_9providers_13BaseSingleton_cls, 0, (char *)"Return provided type.", 0}, + {(char *)"args", __pyx_getprop_19dependency_injector_9providers_13BaseSingleton_args, 0, (char *)"Return positional argument injections.", 0}, + {(char *)"kwargs", __pyx_getprop_19dependency_injector_9providers_13BaseSingleton_kwargs, 0, (char *)"Return keyword argument injections.", 0}, + {(char *)"attributes", __pyx_getprop_19dependency_injector_9providers_13BaseSingleton_attributes, 0, (char *)"Return attribute injections.", 0}, + {0, 0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_BaseSingleton = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.BaseSingleton", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_BaseSingleton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_BaseSingleton, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Base class of singleton providers.", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_BaseSingleton, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_BaseSingleton, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_BaseSingleton, /*tp_methods*/ + 0, /*tp_members*/ + __pyx_getsets_19dependency_injector_9providers_BaseSingleton, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_BaseSingleton, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_Singleton __pyx_vtable_19dependency_injector_9providers_Singleton; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Singleton(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Singleton *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_BaseSingleton(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Singleton *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_Singleton; + p->__pyx___storage = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_Singleton(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_Singleton *p = (struct __pyx_obj_19dependency_injector_9providers_Singleton *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___storage); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_BaseSingleton(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_Singleton(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_Singleton *p = (struct __pyx_obj_19dependency_injector_9providers_Singleton *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_BaseSingleton(o, v, a); if (e) return e; + if (p->__pyx___storage) { + e = (*v)(p->__pyx___storage, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_Singleton(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_Singleton *p = (struct __pyx_obj_19dependency_injector_9providers_Singleton *)o; + __pyx_tp_clear_19dependency_injector_9providers_BaseSingleton(o); + tmp = ((PyObject*)p->__pyx___storage); + p->__pyx___storage = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_Singleton[] = { + {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Singleton_3reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_9Singleton_2reset}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9Singleton_5_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9Singleton_4_provide}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Singleton = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Singleton", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Singleton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Singleton, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Singleton provider returns same instance on every call.\n\n :py:class:`Singleton` provider creates instance once and returns it on\n every call. :py:class:`Singleton` extends :py:class:`Factory`, so, please\n follow :py:class:`Factory` documentation for getting familiar with\n injections syntax.\n\n Retrieving of provided instance can be performed via calling\n :py:class:`Singleton` object:\n\n .. code-block:: python\n\n singleton = Singleton(SomeClass)\n some_object = singleton()\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Singleton, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Singleton, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_Singleton, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_9Singleton_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Singleton, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedSingleton __pyx_vtable_19dependency_injector_9providers_DelegatedSingleton; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Singleton(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton; + return o; +} + +static PyTypeObject __pyx_type_19dependency_injector_9providers_DelegatedSingleton = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.DelegatedSingleton", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedSingleton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Singleton, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Delegated singleton is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Singleton, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Singleton, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_9Singleton_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_DelegatedSingleton, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadSafeSingleton __pyx_vtable_19dependency_injector_9providers_ThreadSafeSingleton; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_ThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_BaseSingleton(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton; + p->__pyx___storage = Py_None; Py_INCREF(Py_None); + p->__pyx___lock = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_ThreadSafeSingleton(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___storage); + Py_CLEAR(p->__pyx___lock); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_BaseSingleton(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_ThreadSafeSingleton(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_BaseSingleton(o, v, a); if (e) return e; + if (p->__pyx___storage) { + e = (*v)(p->__pyx___storage, a); if (e) return e; + } + if (p->__pyx___lock) { + e = (*v)(p->__pyx___lock, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_ThreadSafeSingleton(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton *)o; + __pyx_tp_clear_19dependency_injector_9providers_BaseSingleton(o); + tmp = ((PyObject*)p->__pyx___storage); + p->__pyx___storage = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx___lock); + p->__pyx___lock = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_ThreadSafeSingleton[] = { + {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_3reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_19ThreadSafeSingleton_2reset}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_5_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_19ThreadSafeSingleton_4_provide}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_ThreadSafeSingleton = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.ThreadSafeSingleton", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_ThreadSafeSingleton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Thread-safe singleton provider.", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadSafeSingleton __pyx_vtable_19dependency_injector_9providers_DelegatedThreadSafeSingleton; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_ThreadSafeSingleton(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton; + return o; +} + +static PyTypeObject __pyx_type_19dependency_injector_9providers_DelegatedThreadSafeSingleton = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.DelegatedThreadSafeSingleton", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadSafeSingleton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Delegated thread-safe singleton is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_ThreadSafeSingleton, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_19ThreadSafeSingleton_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_DelegatedThreadSafeSingleton, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_ThreadLocalSingleton __pyx_vtable_19dependency_injector_9providers_ThreadLocalSingleton; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_ThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_BaseSingleton(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton; + p->__pyx___storage = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_ThreadLocalSingleton(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___storage); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_BaseSingleton(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_ThreadLocalSingleton(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_BaseSingleton(o, v, a); if (e) return e; + if (p->__pyx___storage) { + e = (*v)(p->__pyx___storage, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_ThreadLocalSingleton(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton *)o; + __pyx_tp_clear_19dependency_injector_9providers_BaseSingleton(o); + tmp = ((PyObject*)p->__pyx___storage); + p->__pyx___storage = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_ThreadLocalSingleton[] = { + {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_3reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_20ThreadLocalSingleton_2reset}, + {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_5_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_20ThreadLocalSingleton_4_provide}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_ThreadLocalSingleton = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.ThreadLocalSingleton", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_ThreadLocalSingleton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Thread-local singleton provides single objects in scope of thread.\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; +static struct __pyx_vtabstruct_19dependency_injector_9providers_DelegatedThreadLocalSingleton __pyx_vtable_19dependency_injector_9providers_DelegatedThreadLocalSingleton; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_DelegatedThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_ThreadLocalSingleton(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton *)o); + p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_Provider*)__pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadLocalSingleton; + return o; +} + +static PyTypeObject __pyx_type_19dependency_injector_9providers_DelegatedThreadLocalSingleton = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.DelegatedThreadLocalSingleton", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_DelegatedThreadLocalSingleton), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_9__repr__, /*tp_repr*/ + #else + 0, /*tp_repr*/ + #endif + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_8Provider_3__call__, /*tp_call*/ + #else + 0, /*tp_call*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_13BaseSingleton_3__str__, /*tp_str*/ + #else + 0, /*tp_str*/ + #endif + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Delegated thread-local singleton is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_ThreadLocalSingleton, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_19dependency_injector_9providers_20ThreadLocalSingleton_1__init__, /*tp_init*/ + #else + 0, /*tp_init*/ + #endif + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_DelegatedThreadLocalSingleton, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_Injection(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_Injection *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_Injection *)o); + p->__pyx___value = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_Injection(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_Injection *p = (struct __pyx_obj_19dependency_injector_9providers_Injection *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___value); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_Injection(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_Injection *p = (struct __pyx_obj_19dependency_injector_9providers_Injection *)o; + if (p->__pyx___value) { + e = (*v)(p->__pyx___value, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_Injection(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_Injection *p = (struct __pyx_obj_19dependency_injector_9providers_Injection *)o; + tmp = ((PyObject*)p->__pyx___value); + p->__pyx___value = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyTypeObject __pyx_type_19dependency_injector_9providers_Injection = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.Injection", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_Injection), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Injection, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Abstract injection class.", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Injection, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Injection, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_Injection, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_PositionalInjection(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Injection(t, a, k); + if (unlikely(!o)) return 0; + return o; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_PositionalInjection[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_19PositionalInjection_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_19PositionalInjection_2__deepcopy__}, + {"get_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_19PositionalInjection_5get_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_19PositionalInjection_4get_value}, + {"get_original_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_19PositionalInjection_7get_original_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_19PositionalInjection_6get_original_value}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_PositionalInjection = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.PositionalInjection", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_PositionalInjection), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_Injection, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Positional injection class.", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_Injection, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_Injection, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_PositionalInjection, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_19PositionalInjection_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_PositionalInjection, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyObject *__pyx_tp_new_19dependency_injector_9providers_NamedInjection(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *p; + PyObject *o = __pyx_tp_new_19dependency_injector_9providers_Injection(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)o); + p->__pyx___name = Py_None; Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_19dependency_injector_9providers_NamedInjection(PyObject *o) { + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *p = (struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx___name); + PyObject_GC_Track(o); + __pyx_tp_dealloc_19dependency_injector_9providers_Injection(o); +} + +static int __pyx_tp_traverse_19dependency_injector_9providers_NamedInjection(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *p = (struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)o; + e = __pyx_tp_traverse_19dependency_injector_9providers_Injection(o, v, a); if (e) return e; + if (p->__pyx___name) { + e = (*v)(p->__pyx___name, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_19dependency_injector_9providers_NamedInjection(PyObject *o) { + PyObject* tmp; + struct __pyx_obj_19dependency_injector_9providers_NamedInjection *p = (struct __pyx_obj_19dependency_injector_9providers_NamedInjection *)o; + __pyx_tp_clear_19dependency_injector_9providers_Injection(o); + tmp = ((PyObject*)p->__pyx___name); + p->__pyx___name = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_19dependency_injector_9providers_NamedInjection[] = { + {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_14NamedInjection_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_14NamedInjection_2__deepcopy__}, + {"get_name", (PyCFunction)__pyx_pw_19dependency_injector_9providers_14NamedInjection_5get_name, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_14NamedInjection_4get_name}, + {"get_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_14NamedInjection_7get_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_14NamedInjection_6get_value}, + {"get_original_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_14NamedInjection_9get_original_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_14NamedInjection_8get_original_value}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_19dependency_injector_9providers_NamedInjection = { + PyVarObject_HEAD_INIT(0, 0) + "dependency_injector.providers.NamedInjection", /*tp_name*/ + sizeof(struct __pyx_obj_19dependency_injector_9providers_NamedInjection), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_19dependency_injector_9providers_NamedInjection, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + "Keyword injection class.", /*tp_doc*/ + __pyx_tp_traverse_19dependency_injector_9providers_NamedInjection, /*tp_traverse*/ + __pyx_tp_clear_19dependency_injector_9providers_NamedInjection, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_19dependency_injector_9providers_NamedInjection, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_19dependency_injector_9providers_14NamedInjection_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_19dependency_injector_9providers_NamedInjection, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {"parse_positional_injections", (PyCFunction)__pyx_pw_19dependency_injector_9providers_1parse_positional_injections, METH_O, __pyx_doc_19dependency_injector_9providers_parse_positional_injections}, + {"parse_named_injections", (PyCFunction)__pyx_pw_19dependency_injector_9providers_3parse_named_injections, METH_O, __pyx_doc_19dependency_injector_9providers_2parse_named_injections}, + {"is_provider", (PyCFunction)__pyx_pw_19dependency_injector_9providers_5is_provider, METH_O, __pyx_doc_19dependency_injector_9providers_4is_provider}, + {"ensure_is_provider", (PyCFunction)__pyx_pw_19dependency_injector_9providers_7ensure_is_provider, METH_O, __pyx_doc_19dependency_injector_9providers_6ensure_is_provider}, + {"is_delegated", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9is_delegated, METH_O, __pyx_doc_19dependency_injector_9providers_8is_delegated}, + {"represent_provider", (PyCFunction)__pyx_pw_19dependency_injector_9providers_11represent_provider, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10represent_provider}, + {"deepcopy", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13deepcopy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_12deepcopy}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + "providers", + __pyx_k_Dependency_injector_providers_Po, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_0_can_provide_only_1_instances, __pyx_k_0_can_provide_only_1_instances, sizeof(__pyx_k_0_can_provide_only_1_instances), 0, 0, 1, 0}, + {&__pyx_kp_s_0_is_not_an, __pyx_k_0_is_not_an, sizeof(__pyx_k_0_is_not_an), 0, 0, 1, 0}, + {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1}, + {&__pyx_n_s_CLASS_TYPES, __pyx_k_CLASS_TYPES, sizeof(__pyx_k_CLASS_TYPES), 0, 0, 1, 1}, + {&__pyx_n_s_ClassType, __pyx_k_ClassType, sizeof(__pyx_k_ClassType), 0, 0, 1, 1}, + {&__pyx_kp_s_Dependency_is_not_defined, __pyx_k_Dependency_is_not_defined, sizeof(__pyx_k_Dependency_is_not_defined), 0, 0, 1, 0}, + {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, + {&__pyx_kp_s_Expected_provider_instance_got_0, __pyx_k_Expected_provider_instance_got_0, sizeof(__pyx_k_Expected_provider_instance_got_0), 0, 0, 1, 0}, + {&__pyx_n_s_GLOBAL_LOCK, __pyx_k_GLOBAL_LOCK, sizeof(__pyx_k_GLOBAL_LOCK), 0, 0, 1, 1}, + {&__pyx_n_s_IS_DELEGATED, __pyx_k_IS_DELEGATED, sizeof(__pyx_k_IS_DELEGATED), 0, 0, 1, 1}, + {&__pyx_n_s_IS_PROVIDER, __pyx_k_IS_PROVIDER, sizeof(__pyx_k_IS_PROVIDER), 0, 0, 1, 1}, + {&__pyx_n_s_MethodType, __pyx_k_MethodType, sizeof(__pyx_k_MethodType), 0, 0, 1, 1}, + {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, + {&__pyx_kp_s_Provider_0_could_not_be_overridd, __pyx_k_Provider_0_could_not_be_overridd, sizeof(__pyx_k_Provider_0_could_not_be_overridd), 0, 0, 1, 0}, + {&__pyx_kp_s_Provider_0_expected_to_get_calla, __pyx_k_Provider_0_expected_to_get_calla, sizeof(__pyx_k_Provider_0_expected_to_get_calla), 0, 0, 1, 0}, + {&__pyx_kp_s_Provider_0_is_not_overridden, __pyx_k_Provider_0_is_not_overridden, sizeof(__pyx_k_Provider_0_is_not_overridden), 0, 0, 1, 0}, + {&__pyx_n_s_RLock, __pyx_k_RLock, sizeof(__pyx_k_RLock), 0, 0, 1, 1}, + {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, + {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0}, + {&__pyx_n_s_add_args, __pyx_k_add_args, sizeof(__pyx_k_add_args), 0, 0, 1, 1}, + {&__pyx_n_s_add_attributes, __pyx_k_add_attributes, sizeof(__pyx_k_add_attributes), 0, 0, 1, 1}, + {&__pyx_n_s_add_kwargs, __pyx_k_add_kwargs, sizeof(__pyx_k_add_kwargs), 0, 0, 1, 1}, + {&__pyx_n_s_address, __pyx_k_address, sizeof(__pyx_k_address), 0, 0, 1, 1}, + {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, + {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, + {&__pyx_n_s_call_last_overriding, __pyx_k_call_last_overriding, sizeof(__pyx_k_call_last_overriding), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_n_s_clear_args, __pyx_k_clear_args, sizeof(__pyx_k_clear_args), 0, 0, 1, 1}, + {&__pyx_n_s_clear_attributes, __pyx_k_clear_attributes, sizeof(__pyx_k_clear_attributes), 0, 0, 1, 1}, + {&__pyx_n_s_clear_kwargs, __pyx_k_clear_kwargs, sizeof(__pyx_k_clear_kwargs), 0, 0, 1, 1}, + {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_deepcopy, __pyx_k_deepcopy, sizeof(__pyx_k_deepcopy), 0, 0, 1, 1}, + {&__pyx_n_s_deepcopy_dispatch, __pyx_k_deepcopy_dispatch, sizeof(__pyx_k_deepcopy_dispatch), 0, 0, 1, 1}, + {&__pyx_n_s_dependency_injector_providers, __pyx_k_dependency_injector_providers, sizeof(__pyx_k_dependency_injector_providers), 0, 0, 1, 1}, + {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, + {&__pyx_n_s_errors, __pyx_k_errors, sizeof(__pyx_k_errors), 0, 0, 1, 1}, + {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_get_child_name, __pyx_k_get_child_name, sizeof(__pyx_k_get_child_name), 0, 0, 1, 1}, + {&__pyx_n_s_get_name, __pyx_k_get_name, sizeof(__pyx_k_get_name), 0, 0, 1, 1}, + {&__pyx_n_s_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_im_class, __pyx_k_im_class, sizeof(__pyx_k_im_class), 0, 0, 1, 1}, + {&__pyx_n_s_im_func, __pyx_k_im_func, sizeof(__pyx_k_im_func), 0, 0, 1, 1}, + {&__pyx_n_s_im_self, __pyx_k_im_self, sizeof(__pyx_k_im_self), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_s_instance, __pyx_k_instance, sizeof(__pyx_k_instance), 0, 0, 1, 1}, + {&__pyx_n_s_instance_of, __pyx_k_instance_of, sizeof(__pyx_k_instance_of), 0, 0, 1, 1}, + {&__pyx_kp_s_instance_of_0, __pyx_k_instance_of_0, sizeof(__pyx_k_instance_of_0), 0, 0, 1, 0}, + {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, + {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, + {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, + {&__pyx_n_s_lambda, __pyx_k_lambda, sizeof(__pyx_k_lambda), 0, 0, 1, 1}, + {&__pyx_n_s_local, __pyx_k_local, sizeof(__pyx_k_local), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_memo, __pyx_k_memo, sizeof(__pyx_k_memo), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_overridden, __pyx_k_overridden, sizeof(__pyx_k_overridden), 0, 0, 1, 1}, + {&__pyx_n_s_override, __pyx_k_override, sizeof(__pyx_k_override), 0, 0, 1, 1}, + {&__pyx_n_s_overriding, __pyx_k_overriding, sizeof(__pyx_k_overriding), 0, 0, 1, 1}, + {&__pyx_n_s_provide, __pyx_k_provide, sizeof(__pyx_k_provide), 0, 0, 1, 1}, + {&__pyx_n_s_provided_type, __pyx_k_provided_type, sizeof(__pyx_k_provided_type), 0, 0, 1, 1}, + {&__pyx_n_s_provider, __pyx_k_provider, sizeof(__pyx_k_provider), 0, 0, 1, 1}, + {&__pyx_kp_s_provider_provides_at_address, __pyx_k_provider_provides_at_address, sizeof(__pyx_k_provider_provides_at_address), 0, 0, 1, 0}, + {&__pyx_n_s_provides, __pyx_k_provides, sizeof(__pyx_k_provides), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reset_last_overriding, __pyx_k_reset_last_overriding, sizeof(__pyx_k_reset_last_overriding), 0, 0, 1, 1}, + {&__pyx_n_s_set_args, __pyx_k_set_args, sizeof(__pyx_k_set_args), 0, 0, 1, 1}, + {&__pyx_n_s_set_attributes, __pyx_k_set_attributes, sizeof(__pyx_k_set_attributes), 0, 0, 1, 1}, + {&__pyx_n_s_set_kwargs, __pyx_k_set_kwargs, sizeof(__pyx_k_set_kwargs), 0, 0, 1, 1}, + {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, + {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1}, + {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(1, 77, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 90, __pyx_L1_error) + __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(1, 181, __pyx_L1_error) + __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(1, 1318, __pyx_L1_error) + __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s_hex); if (!__pyx_builtin_hex) __PYX_ERR(1, 1516, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "dependency_injector/providers.pyx":326 + * + * if self.__overridden_len == 0: + * raise Error('Dependency is not defined') # <<<<<<<<<<<<<< + * + * instance = self._call_last_overriding(args, kwargs) + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Dependency_is_not_defined); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 326, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "dependency_injector/providers.pyx":1244 + * cpdef object _provide(self, tuple args, dict kwargs): + * """Return single instance.""" + * with self.__lock: # <<<<<<<<<<<<<< + * if self.__storage is None: + * self.__storage = __factory_call(self.__instantiator, + */ + __pyx_tuple__4 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 1244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error); + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(1, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initproviders(void); /*proto*/ +PyMODINIT_FUNC initproviders(void) +#else +PyMODINIT_FUNC PyInit_providers(void); /*proto*/ +PyMODINIT_FUNC PyInit_providers(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_providers(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("providers", __pyx_methods, __pyx_k_Dependency_injector_providers_Po, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error) + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error); + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_dependency_injector__providers) { + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "dependency_injector.providers")) { + if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + /*--- Global init code ---*/ + __pyx_v_19dependency_injector_9providers_CLASS_TYPES = Py_None; Py_INCREF(Py_None); + /*--- Variable export code ---*/ + if (__Pyx_ExportVoidPtr(__pyx_n_s_CLASS_TYPES, (void *)&__pyx_v_19dependency_injector_9providers_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("parse_positional_injections", (void (*)(void))__pyx_f_19dependency_injector_9providers_parse_positional_injections, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("parse_named_injections", (void (*)(void))__pyx_f_19dependency_injector_9providers_parse_named_injections, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("is_provider", (void (*)(void))__pyx_f_19dependency_injector_9providers_is_provider, "int (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("ensure_is_provider", (void (*)(void))__pyx_f_19dependency_injector_9providers_ensure_is_provider, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("is_delegated", (void (*)(void))__pyx_f_19dependency_injector_9providers_is_delegated, "int (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("represent_provider", (void (*)(void))__pyx_f_19dependency_injector_9providers_represent_provider, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + if (__Pyx_ExportFunction("deepcopy", (void (*)(void))__pyx_f_19dependency_injector_9providers_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) + /*--- Type init code ---*/ + __pyx_vtabptr_19dependency_injector_9providers_Provider = &__pyx_vtable_19dependency_injector_9providers_Provider; + __pyx_vtable_19dependency_injector_9providers_Provider._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_8Provider__provide; + __pyx_vtable_19dependency_injector_9providers_Provider._call_last_overriding = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_8Provider__call_last_overriding; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Provider) < 0) __PYX_ERR(1, 24, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Provider.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Provider, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 24, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_8Provider___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_8Provider___init__.doc = __pyx_doc_19dependency_injector_9providers_8Provider___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_8Provider___init__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Provider, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(1, 24, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_8Provider_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_8Provider_2__call__.doc = __pyx_doc_19dependency_injector_9providers_8Provider_2__call__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_8Provider_2__call__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Provider, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(1, 24, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_8Provider_6__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_8Provider_6__str__.doc = __pyx_doc_19dependency_injector_9providers_8Provider_6__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_8Provider_6__str__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Provider, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(1, 24, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_8Provider_8__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_8Provider_8__repr__.doc = __pyx_doc_19dependency_injector_9providers_8Provider_8__repr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_8Provider_8__repr__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_Provider.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_Provider) < 0) __PYX_ERR(1, 24, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Provider", (PyObject *)&__pyx_type_19dependency_injector_9providers_Provider) < 0) __PYX_ERR(1, 24, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Provider = &__pyx_type_19dependency_injector_9providers_Provider; + __pyx_vtabptr_19dependency_injector_9providers_Object = &__pyx_vtable_19dependency_injector_9providers_Object; + __pyx_vtable_19dependency_injector_9providers_Object.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Provider; + __pyx_vtable_19dependency_injector_9providers_Object.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_6Object__provide; + __pyx_type_19dependency_injector_9providers_Object.tp_base = __pyx_ptype_19dependency_injector_9providers_Provider; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Object) < 0) __PYX_ERR(1, 191, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Object.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Object, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 191, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_6Object___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_6Object___init__.doc = __pyx_doc_19dependency_injector_9providers_6Object___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_6Object___init__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Object, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(1, 191, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_6Object_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_6Object_4__str__.doc = __pyx_doc_19dependency_injector_9providers_6Object_4__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_6Object_4__str__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Object, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(1, 191, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_6Object_6__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_6Object_6__repr__.doc = __pyx_doc_19dependency_injector_9providers_6Object_6__repr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_6Object_6__repr__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_Object.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_Object) < 0) __PYX_ERR(1, 191, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Object", (PyObject *)&__pyx_type_19dependency_injector_9providers_Object) < 0) __PYX_ERR(1, 191, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Object = &__pyx_type_19dependency_injector_9providers_Object; + __pyx_vtabptr_19dependency_injector_9providers_Delegate = &__pyx_vtable_19dependency_injector_9providers_Delegate; + __pyx_vtable_19dependency_injector_9providers_Delegate.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Object; + __pyx_type_19dependency_injector_9providers_Delegate.tp_base = __pyx_ptype_19dependency_injector_9providers_Object; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Delegate) < 0) __PYX_ERR(1, 251, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Delegate.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Delegate, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 251, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_8Delegate___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_8Delegate___init__.doc = __pyx_doc_19dependency_injector_9providers_8Delegate___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_8Delegate___init__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_Delegate.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_Delegate) < 0) __PYX_ERR(1, 251, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Delegate", (PyObject *)&__pyx_type_19dependency_injector_9providers_Delegate) < 0) __PYX_ERR(1, 251, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Delegate = &__pyx_type_19dependency_injector_9providers_Delegate; + __pyx_vtabptr_19dependency_injector_9providers_ExternalDependency = &__pyx_vtable_19dependency_injector_9providers_ExternalDependency; + __pyx_vtable_19dependency_injector_9providers_ExternalDependency.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Provider; + __pyx_type_19dependency_injector_9providers_ExternalDependency.tp_base = __pyx_ptype_19dependency_injector_9providers_Provider; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_ExternalDependency) < 0) __PYX_ERR(1, 270, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_ExternalDependency.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_ExternalDependency, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 270, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency___init__.doc = __pyx_doc_19dependency_injector_9providers_18ExternalDependency___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency___init__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_ExternalDependency, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(1, 270, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_4__call__.doc = __pyx_doc_19dependency_injector_9providers_18ExternalDependency_4__call__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_4__call__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_ExternalDependency, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(1, 270, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_6__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_6__str__.doc = __pyx_doc_19dependency_injector_9providers_18ExternalDependency_6__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_6__str__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_ExternalDependency, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(1, 270, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_8__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_8__repr__.doc = __pyx_doc_19dependency_injector_9providers_18ExternalDependency_8__repr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_18ExternalDependency_8__repr__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_ExternalDependency.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_ExternalDependency) < 0) __PYX_ERR(1, 270, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "ExternalDependency", (PyObject *)&__pyx_type_19dependency_injector_9providers_ExternalDependency) < 0) __PYX_ERR(1, 270, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_ExternalDependency = &__pyx_type_19dependency_injector_9providers_ExternalDependency; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_OverridingContext) < 0) __PYX_ERR(1, 366, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_OverridingContext.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_OverridingContext, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 366, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_17OverridingContext___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_17OverridingContext___init__.doc = __pyx_doc_19dependency_injector_9providers_17OverridingContext___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_17OverridingContext___init__; + } + } + #endif + if (PyObject_SetAttrString(__pyx_m, "OverridingContext", (PyObject *)&__pyx_type_19dependency_injector_9providers_OverridingContext) < 0) __PYX_ERR(1, 366, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_OverridingContext = &__pyx_type_19dependency_injector_9providers_OverridingContext; + __pyx_vtabptr_19dependency_injector_9providers_Callable = &__pyx_vtable_19dependency_injector_9providers_Callable; + __pyx_vtable_19dependency_injector_9providers_Callable.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Provider; + __pyx_vtable_19dependency_injector_9providers_Callable.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_8Callable__provide; + __pyx_type_19dependency_injector_9providers_Callable.tp_base = __pyx_ptype_19dependency_injector_9providers_Provider; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Callable) < 0) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Callable.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Callable, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 402, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_8Callable___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_8Callable___init__.doc = __pyx_doc_19dependency_injector_9providers_8Callable___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_8Callable___init__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Callable, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(1, 402, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_8Callable_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_8Callable_4__str__.doc = __pyx_doc_19dependency_injector_9providers_8Callable_4__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_8Callable_4__str__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_Callable.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_Callable) < 0) __PYX_ERR(1, 402, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Callable", (PyObject *)&__pyx_type_19dependency_injector_9providers_Callable) < 0) __PYX_ERR(1, 402, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Callable = &__pyx_type_19dependency_injector_9providers_Callable; + __pyx_vtabptr_19dependency_injector_9providers_DelegatedCallable = &__pyx_vtable_19dependency_injector_9providers_DelegatedCallable; + __pyx_vtable_19dependency_injector_9providers_DelegatedCallable.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Callable; + __pyx_type_19dependency_injector_9providers_DelegatedCallable.tp_base = __pyx_ptype_19dependency_injector_9providers_Callable; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_DelegatedCallable) < 0) __PYX_ERR(1, 583, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_DelegatedCallable.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_DelegatedCallable.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_DelegatedCallable) < 0) __PYX_ERR(1, 583, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "DelegatedCallable", (PyObject *)&__pyx_type_19dependency_injector_9providers_DelegatedCallable) < 0) __PYX_ERR(1, 583, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_DelegatedCallable = &__pyx_type_19dependency_injector_9providers_DelegatedCallable; + __pyx_vtabptr_19dependency_injector_9providers_Configuration = &__pyx_vtable_19dependency_injector_9providers_Configuration; + __pyx_vtable_19dependency_injector_9providers_Configuration.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Provider; + __pyx_vtable_19dependency_injector_9providers_Configuration.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13Configuration__provide; + __pyx_vtable_19dependency_injector_9providers_Configuration.get_name = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Configuration *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13Configuration_get_name; + __pyx_vtable_19dependency_injector_9providers_Configuration.update = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Configuration *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13Configuration_update; + __pyx_vtable_19dependency_injector_9providers_Configuration._get_child_name = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Configuration *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13Configuration__get_child_name; + __pyx_type_19dependency_injector_9providers_Configuration.tp_base = __pyx_ptype_19dependency_injector_9providers_Provider; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Configuration) < 0) __PYX_ERR(1, 592, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Configuration.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Configuration, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 592, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_13Configuration___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_13Configuration___init__.doc = __pyx_doc_19dependency_injector_9providers_13Configuration___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13Configuration___init__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Configuration, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(1, 592, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_13Configuration_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_13Configuration_4__str__.doc = __pyx_doc_19dependency_injector_9providers_13Configuration_4__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13Configuration_4__str__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Configuration, "__getattr__"); if (unlikely(!wrapper)) __PYX_ERR(1, 592, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_13Configuration_6__getattr__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_13Configuration_6__getattr__.doc = __pyx_doc_19dependency_injector_9providers_13Configuration_6__getattr__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13Configuration_6__getattr__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_Configuration.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_Configuration) < 0) __PYX_ERR(1, 592, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Configuration", (PyObject *)&__pyx_type_19dependency_injector_9providers_Configuration) < 0) __PYX_ERR(1, 592, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Configuration = &__pyx_type_19dependency_injector_9providers_Configuration; + __pyx_vtabptr_19dependency_injector_9providers_Factory = &__pyx_vtable_19dependency_injector_9providers_Factory; + __pyx_vtable_19dependency_injector_9providers_Factory.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Provider; + __pyx_vtable_19dependency_injector_9providers_Factory.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_7Factory__provide; + __pyx_type_19dependency_injector_9providers_Factory.tp_base = __pyx_ptype_19dependency_injector_9providers_Provider; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Factory) < 0) __PYX_ERR(1, 706, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Factory.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Factory, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 706, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_7Factory___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_7Factory___init__.doc = __pyx_doc_19dependency_injector_9providers_7Factory___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_7Factory___init__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Factory, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(1, 706, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_7Factory_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_7Factory_4__str__.doc = __pyx_doc_19dependency_injector_9providers_7Factory_4__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_7Factory_4__str__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_Factory.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_Factory) < 0) __PYX_ERR(1, 706, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Factory", (PyObject *)&__pyx_type_19dependency_injector_9providers_Factory) < 0) __PYX_ERR(1, 706, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Factory = &__pyx_type_19dependency_injector_9providers_Factory; + __pyx_vtabptr_19dependency_injector_9providers_DelegatedFactory = &__pyx_vtable_19dependency_injector_9providers_DelegatedFactory; + __pyx_vtable_19dependency_injector_9providers_DelegatedFactory.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Factory; + __pyx_type_19dependency_injector_9providers_DelegatedFactory.tp_base = __pyx_ptype_19dependency_injector_9providers_Factory; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_DelegatedFactory) < 0) __PYX_ERR(1, 939, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_DelegatedFactory.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_DelegatedFactory.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_DelegatedFactory) < 0) __PYX_ERR(1, 939, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "DelegatedFactory", (PyObject *)&__pyx_type_19dependency_injector_9providers_DelegatedFactory) < 0) __PYX_ERR(1, 939, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_DelegatedFactory = &__pyx_type_19dependency_injector_9providers_DelegatedFactory; + __pyx_vtabptr_19dependency_injector_9providers_BaseSingleton = &__pyx_vtable_19dependency_injector_9providers_BaseSingleton; + __pyx_vtable_19dependency_injector_9providers_BaseSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Provider; + __pyx_type_19dependency_injector_9providers_BaseSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_Provider; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_BaseSingleton) < 0) __PYX_ERR(1, 960, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_BaseSingleton.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_BaseSingleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 960, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton___init__.doc = __pyx_doc_19dependency_injector_9providers_13BaseSingleton___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton___init__; + } + } + #endif + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_BaseSingleton, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(1, 960, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton_2__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton_2__str__.doc = __pyx_doc_19dependency_injector_9providers_13BaseSingleton_2__str__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13BaseSingleton_2__str__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_BaseSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_BaseSingleton) < 0) __PYX_ERR(1, 960, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "BaseSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_BaseSingleton) < 0) __PYX_ERR(1, 960, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_BaseSingleton = &__pyx_type_19dependency_injector_9providers_BaseSingleton; + __pyx_vtabptr_19dependency_injector_9providers_Singleton = &__pyx_vtable_19dependency_injector_9providers_Singleton; + __pyx_vtable_19dependency_injector_9providers_Singleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton; + __pyx_vtable_19dependency_injector_9providers_Singleton.__pyx_base.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_9Singleton__provide; + __pyx_type_19dependency_injector_9providers_Singleton.tp_base = __pyx_ptype_19dependency_injector_9providers_BaseSingleton; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Singleton) < 0) __PYX_ERR(1, 1134, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Singleton.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_Singleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1134, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_9Singleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_9Singleton___init__.doc = __pyx_doc_19dependency_injector_9providers_9Singleton___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_9Singleton___init__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_Singleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_Singleton) < 0) __PYX_ERR(1, 1134, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Singleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_Singleton) < 0) __PYX_ERR(1, 1134, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Singleton = &__pyx_type_19dependency_injector_9providers_Singleton; + __pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton = &__pyx_vtable_19dependency_injector_9providers_DelegatedSingleton; + __pyx_vtable_19dependency_injector_9providers_DelegatedSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_Singleton; + __pyx_type_19dependency_injector_9providers_DelegatedSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_Singleton; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_DelegatedSingleton) < 0) __PYX_ERR(1, 1195, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_DelegatedSingleton.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_DelegatedSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_DelegatedSingleton) < 0) __PYX_ERR(1, 1195, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "DelegatedSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_DelegatedSingleton) < 0) __PYX_ERR(1, 1195, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_DelegatedSingleton = &__pyx_type_19dependency_injector_9providers_DelegatedSingleton; + __pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton = &__pyx_vtable_19dependency_injector_9providers_ThreadSafeSingleton; + __pyx_vtable_19dependency_injector_9providers_ThreadSafeSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton; + __pyx_vtable_19dependency_injector_9providers_ThreadSafeSingleton.__pyx_base.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_19ThreadSafeSingleton__provide; + __pyx_type_19dependency_injector_9providers_ThreadSafeSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_BaseSingleton; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_ThreadSafeSingleton) < 0) __PYX_ERR(1, 1216, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_ThreadSafeSingleton.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_ThreadSafeSingleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1216, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_19ThreadSafeSingleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_19ThreadSafeSingleton___init__.doc = __pyx_doc_19dependency_injector_9providers_19ThreadSafeSingleton___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_19ThreadSafeSingleton___init__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_ThreadSafeSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton) < 0) __PYX_ERR(1, 1216, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "ThreadSafeSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_ThreadSafeSingleton) < 0) __PYX_ERR(1, 1216, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton = &__pyx_type_19dependency_injector_9providers_ThreadSafeSingleton; + __pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton = &__pyx_vtable_19dependency_injector_9providers_DelegatedThreadSafeSingleton; + __pyx_vtable_19dependency_injector_9providers_DelegatedThreadSafeSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_ThreadSafeSingleton; + __pyx_type_19dependency_injector_9providers_DelegatedThreadSafeSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_ThreadSafeSingleton; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_DelegatedThreadSafeSingleton) < 0) __PYX_ERR(1, 1251, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_DelegatedThreadSafeSingleton.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_DelegatedThreadSafeSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadSafeSingleton) < 0) __PYX_ERR(1, 1251, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "DelegatedThreadSafeSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_DelegatedThreadSafeSingleton) < 0) __PYX_ERR(1, 1251, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton = &__pyx_type_19dependency_injector_9providers_DelegatedThreadSafeSingleton; + __pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton = &__pyx_vtable_19dependency_injector_9providers_ThreadLocalSingleton; + __pyx_vtable_19dependency_injector_9providers_ThreadLocalSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_BaseSingleton; + __pyx_vtable_19dependency_injector_9providers_ThreadLocalSingleton.__pyx_base.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_20ThreadLocalSingleton__provide; + __pyx_type_19dependency_injector_9providers_ThreadLocalSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_BaseSingleton; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_ThreadLocalSingleton) < 0) __PYX_ERR(1, 1272, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_ThreadLocalSingleton.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_ThreadLocalSingleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1272, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_20ThreadLocalSingleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_20ThreadLocalSingleton___init__.doc = __pyx_doc_19dependency_injector_9providers_20ThreadLocalSingleton___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_20ThreadLocalSingleton___init__; + } + } + #endif + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_ThreadLocalSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton) < 0) __PYX_ERR(1, 1272, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "ThreadLocalSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_ThreadLocalSingleton) < 0) __PYX_ERR(1, 1272, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton = &__pyx_type_19dependency_injector_9providers_ThreadLocalSingleton; + __pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadLocalSingleton = &__pyx_vtable_19dependency_injector_9providers_DelegatedThreadLocalSingleton; + __pyx_vtable_19dependency_injector_9providers_DelegatedThreadLocalSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_ThreadLocalSingleton; + __pyx_type_19dependency_injector_9providers_DelegatedThreadLocalSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_ThreadLocalSingleton; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_DelegatedThreadLocalSingleton) < 0) __PYX_ERR(1, 1325, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_DelegatedThreadLocalSingleton.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_DelegatedThreadLocalSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_DelegatedThreadLocalSingleton) < 0) __PYX_ERR(1, 1325, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "DelegatedThreadLocalSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_DelegatedThreadLocalSingleton) < 0) __PYX_ERR(1, 1325, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton = &__pyx_type_19dependency_injector_9providers_DelegatedThreadLocalSingleton; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_Injection) < 0) __PYX_ERR(1, 1346, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_Injection.tp_print = 0; + if (PyObject_SetAttrString(__pyx_m, "Injection", (PyObject *)&__pyx_type_19dependency_injector_9providers_Injection) < 0) __PYX_ERR(1, 1346, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_Injection = &__pyx_type_19dependency_injector_9providers_Injection; + __pyx_type_19dependency_injector_9providers_PositionalInjection.tp_base = __pyx_ptype_19dependency_injector_9providers_Injection; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_PositionalInjection) < 0) __PYX_ERR(1, 1350, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_PositionalInjection.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_PositionalInjection, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1350, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_19PositionalInjection___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_19PositionalInjection___init__.doc = __pyx_doc_19dependency_injector_9providers_19PositionalInjection___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_19PositionalInjection___init__; + } + } + #endif + if (PyObject_SetAttrString(__pyx_m, "PositionalInjection", (PyObject *)&__pyx_type_19dependency_injector_9providers_PositionalInjection) < 0) __PYX_ERR(1, 1350, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_PositionalInjection = &__pyx_type_19dependency_injector_9providers_PositionalInjection; + __pyx_type_19dependency_injector_9providers_NamedInjection.tp_base = __pyx_ptype_19dependency_injector_9providers_Injection; + if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_NamedInjection) < 0) __PYX_ERR(1, 1378, __pyx_L1_error) + __pyx_type_19dependency_injector_9providers_NamedInjection.tp_print = 0; + #if CYTHON_COMPILING_IN_CPYTHON + { + PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_NamedInjection, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 1378, __pyx_L1_error) + if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { + __pyx_wrapperbase_19dependency_injector_9providers_14NamedInjection___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; + __pyx_wrapperbase_19dependency_injector_9providers_14NamedInjection___init__.doc = __pyx_doc_19dependency_injector_9providers_14NamedInjection___init__; + ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_14NamedInjection___init__; + } + } + #endif + if (PyObject_SetAttrString(__pyx_m, "NamedInjection", (PyObject *)&__pyx_type_19dependency_injector_9providers_NamedInjection) < 0) __PYX_ERR(1, 1378, __pyx_L1_error) + __pyx_ptype_19dependency_injector_9providers_NamedInjection = &__pyx_type_19dependency_injector_9providers_NamedInjection; + /*--- Type import code ---*/ + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + + /* "dependency_injector/providers.pyx":7 + * + * + * import copy # <<<<<<<<<<<<<< + * import sys + * import types + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_copy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy, __pyx_t_1) < 0) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":8 + * + * import copy + * import sys # <<<<<<<<<<<<<< + * import types + * import threading + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":9 + * import copy + * import sys + * import types # <<<<<<<<<<<<<< + * import threading + * + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_types, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_types, __pyx_t_1) < 0) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":10 + * import sys + * import types + * import threading # <<<<<<<<<<<<<< + * + * from .errors import Error + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(1, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "dependency_injector/providers.pyx":12 + * import threading + * + * from .errors import Error # <<<<<<<<<<<<<< + * + * cimport cython + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_Error); + __Pyx_GIVEREF(__pyx_n_s_Error); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_errors, __pyx_t_1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_1) < 0) __PYX_ERR(1, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":17 + * + * + * GLOBAL_LOCK = threading.RLock() # <<<<<<<<<<<<<< + * """Global reentrant lock. + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_RLock); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_GLOBAL_LOCK, __pyx_t_2) < 0) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "dependency_injector/providers.pyx":71 + * """ + * + * __IS_PROVIDER__ = True # <<<<<<<<<<<<<< + * + * def __init__(self): + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_Provider->tp_dict, __pyx_n_s_IS_PROVIDER, Py_True) < 0) __PYX_ERR(1, 71, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_Provider); + + /* "dependency_injector/providers.pyx":589 + * """ + * + * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_DelegatedCallable->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(1, 589, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_DelegatedCallable); + + /* "dependency_injector/providers.pyx":757 + * """ + * + * provided_type = None # <<<<<<<<<<<<<< + * + * def __init__(self, provides, *args, **kwargs): + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_Factory->tp_dict, __pyx_n_s_provided_type, Py_None) < 0) __PYX_ERR(1, 757, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_Factory); + + /* "dependency_injector/providers.pyx":957 + * """ + * + * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_DelegatedFactory->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(1, 957, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_DelegatedFactory); + + /* "dependency_injector/providers.pyx":963 + * """Base class of singleton providers.""" + * + * provided_type = None # <<<<<<<<<<<<<< + * + * def __init__(self, provides, *args, **kwargs): + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_BaseSingleton->tp_dict, __pyx_n_s_provided_type, Py_None) < 0) __PYX_ERR(1, 963, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_BaseSingleton); + + /* "dependency_injector/providers.pyx":1213 + * """ + * + * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(1, 1213, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_DelegatedSingleton); + + /* "dependency_injector/providers.pyx":1269 + * """ + * + * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(1, 1269, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_DelegatedThreadSafeSingleton); + + /* "dependency_injector/providers.pyx":1343 + * """ + * + * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< + * + * + */ + if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(1, 1343, __pyx_L1_error) + PyType_Modified(__pyx_ptype_19dependency_injector_9providers_DelegatedThreadLocalSingleton); + + /* "dependency_injector/providers.pyx":1448 + * + * + * if sys.version_info[0] == 3: # pragma: no cover # <<<<<<<<<<<<<< + * CLASS_TYPES = (type,) + * else: # pragma: no cover + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_version_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1448, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 1448, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "dependency_injector/providers.pyx":1449 + * + * if sys.version_info[0] == 3: # pragma: no cover + * CLASS_TYPES = (type,) # <<<<<<<<<<<<<< + * else: # pragma: no cover + * CLASS_TYPES = (type, types.ClassType) + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)(&PyType_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyType_Type))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyType_Type))); + __Pyx_XGOTREF(__pyx_v_19dependency_injector_9providers_CLASS_TYPES); + __Pyx_DECREF_SET(__pyx_v_19dependency_injector_9providers_CLASS_TYPES, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1448 + * + * + * if sys.version_info[0] == 3: # pragma: no cover # <<<<<<<<<<<<<< + * CLASS_TYPES = (type,) + * else: # pragma: no cover + */ + goto __pyx_L2; + } + + /* "dependency_injector/providers.pyx":1451 + * CLASS_TYPES = (type,) + * else: # pragma: no cover + * CLASS_TYPES = (type, types.ClassType) # <<<<<<<<<<<<<< + * + * copy._deepcopy_dispatch[types.MethodType] = \ + */ + /*else*/ { + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ClassType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1451, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)(&PyType_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyType_Type))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyType_Type))); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_2 = 0; + __Pyx_XGOTREF(__pyx_v_19dependency_injector_9providers_CLASS_TYPES); + __Pyx_DECREF_SET(__pyx_v_19dependency_injector_9providers_CLASS_TYPES, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + + /* "dependency_injector/providers.pyx":1454 + * + * copy._deepcopy_dispatch[types.MethodType] = \ + * lambda obj, memo: type(obj)(obj.im_func, # <<<<<<<<<<<<<< + * copy.deepcopy(obj.im_self, memo), + * obj.im_class) + */ + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_19dependency_injector_9providers_14lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_dependency_injector_providers, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "dependency_injector/providers.pyx":1453 + * CLASS_TYPES = (type, types.ClassType) + * + * copy._deepcopy_dispatch[types.MethodType] = \ # <<<<<<<<<<<<<< + * lambda obj, memo: type(obj)(obj.im_func, + * copy.deepcopy(obj.im_self, memo), + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_deepcopy_dispatch); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_MethodType); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1453, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(1, 1453, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_L2:; + + /* "dependency_injector/providers.pyx":1 + * """Dependency injector providers. # <<<<<<<<<<<<<< + * + * Powered by Cython. + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "dependency_injector/providers.pxd":240 + * + * + * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< + * cdef object instance + * + */ + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_d) { + __Pyx_AddTraceback("init dependency_injector.providers", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +/* GetModuleGlobalName */ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS + result = PyDict_GetItem(__pyx_d, name); + if (likely(result)) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +/* PyFunctionFastCall */ + #if CYTHON_FAST_PYCALL +#include "frameobject.h" +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = PyThreadState_GET(); + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = f->f_localsplus; + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif // CPython < 3.6 +#endif // CYTHON_FAST_PYCALL + +/* PyCFunctionFastCall */ + #if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); +} +#endif // CYTHON_FAST_PYCCALL + +/* PyObjectCall */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* KeywordStringCheck */ + static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* PyObjectCallMethO */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ + #if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* PyObjectCallNoArg */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + +/* PyErrFetchRestore */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + +/* RaiseException */ + #if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + __Pyx_PyThreadState_declare + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#endif + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +/* SliceTupleAndList */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) { + Py_ssize_t start = *_start, stop = *_stop, length = *_length; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + stop += length; + else if (stop > length) + stop = length; + *_length = stop - start; + *_start = start; + *_stop = stop; +} +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice( + PyObject* src, Py_ssize_t start, Py_ssize_t stop) { + PyObject* dest; + Py_ssize_t length = PyList_GET_SIZE(src); + __Pyx_crop_slice(&start, &stop, &length); + if (unlikely(length <= 0)) + return PyList_New(0); + dest = PyList_New(length); + if (unlikely(!dest)) + return NULL; + __Pyx_copy_object_array( + ((PyListObject*)src)->ob_item + start, + ((PyListObject*)dest)->ob_item, + length); + return dest; +} +static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice( + PyObject* src, Py_ssize_t start, Py_ssize_t stop) { + PyObject* dest; + Py_ssize_t length = PyTuple_GET_SIZE(src); + __Pyx_crop_slice(&start, &stop, &length); + if (unlikely(length <= 0)) + return PyTuple_New(0); + dest = PyTuple_New(length); + if (unlikely(!dest)) + return NULL; + __Pyx_copy_object_array( + ((PyTupleObject*)src)->ob_item + start, + ((PyTupleObject*)dest)->ob_item, + length); + return dest; +} +#endif + +/* ArgTypeTest */ + static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); +} +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (likely(Py_TYPE(obj) == type)) return 1; + #if PY_MAJOR_VERSION == 2 + else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(PyObject_TypeCheck(obj, type))) return 1; + } + __Pyx_RaiseArgumentTypeInvalid(name, obj, type); + return 0; +} + +/* StringJoin */ + #if !CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { + return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); +} +#endif + +/* GetItemInt */ + static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ExtTypeTest */ + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +/* dict_getitem_default */ + static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + PyObject* value; +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (unlikely(PyErr_Occurred())) + return NULL; + value = default_value; + } + Py_INCREF(value); +#else + if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { + value = PyDict_GetItem(d, key); + if (unlikely(!value)) { + value = default_value; + } + Py_INCREF(value); + } else { + if (default_value == Py_None) + default_value = NULL; + value = PyObject_CallMethodObjArgs( + d, __pyx_n_s_get, key, default_value, NULL); + } +#endif + return value; +} + +/* SaveResetException */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +} +static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +#endif + +/* GetException */ + #if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { +#endif + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +/* PyErrExceptionMatches */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { + PyObject *exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; + return PyErr_GivenExceptionMatches(exc_type, err); +} +#endif + +/* SwapException */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#else +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} +#endif + +/* None */ + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* UnpackUnboundCMethod */ + static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION >= 3 + if (likely(PyObject_TypeCheck(method, &PyMethodDescr_Type))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + } +#endif + return 0; +} + +/* CallUnboundCMethod0 */ + static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { + PyObject *args, *result = NULL; + if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_ASSUME_SAFE_MACROS + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); +#else + args = PyTuple_Pack(1, self); + if (unlikely(!args)) goto bad; +#endif + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + Py_DECREF(args); +bad: + return result; +} + +/* py_dict_items */ + static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { + if (PY_MAJOR_VERSION >= 3) + return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d); + else + return PyDict_Items(d); +} + +/* RaiseTooManyValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* RaiseNeedMoreValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* IterFinish */ + static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +/* UnpackItemEndCheck */ + static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +/* GetAttr */ + static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_COMPILING_IN_CPYTHON +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetAttr3 */ + static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r = __Pyx_GetAttr(o, n); + if (unlikely(!r)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + goto bad; + PyErr_Clear(); + r = d; + Py_INCREF(d); + } + return r; +bad: + return NULL; +} + +/* WriteUnraisableException */ + static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback, CYTHON_UNUSED int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; +#endif +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* SetVTable */ + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +/* Import */ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +/* ImportFrom */ + static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* PyIntBinop */ + #if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { + if (op1 == op2) { + Py_RETURN_TRUE; + } + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long a = PyInt_AS_LONG(op1); + if (a == b) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a; + const digit* digits = ((PyLongObject*)op1)->ob_digit; + const Py_ssize_t size = Py_SIZE(op1); + if (likely(__Pyx_sst_abs(size) <= 1)) { + a = likely(size) ? digits[0] : 0; + if (size == -1) a = -a; + } else { + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case 2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case -3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case 3: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case -4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + case 4: + if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); + break; + } + #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 + default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); + #else + default: Py_RETURN_FALSE; + #endif + } + } + if (a == b) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = PyFloat_AS_DOUBLE(op1); + if ((double)a == (double)b) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } + } + return PyObject_RichCompare(op1, op2, Py_EQ); +} +#endif + +/* FetchCommonType */ + static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* fake_module; + PyTypeObject* cached_type = NULL; + fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); + if (!fake_module) return NULL; + Py_INCREF(fake_module); + cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + if (cached_type) { + if (!PyType_Check((PyObject*)cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", + type->tp_name); + goto bad; + } + if (cached_type->tp_basicsize != type->tp_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + type->tp_name); + goto bad; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; + } +done: + Py_DECREF(fake_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CythonFunction */ + static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) { +#else + if (unlikely(value == NULL || !PyString_Check(value))) { +#endif + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) +{ + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) +#endif +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return __Pyx_PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + Py_ssize_t size; + switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 0)) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 1)) { + PyObject *result, *arg0 = PySequence_ITEM(arg, 0); + if (unlikely(!arg0)) return NULL; + result = (*meth)(self, arg0); + Py_DECREF(arg0); + return result; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; + argc = PyTuple_GET_SIZE(args); + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, + 0, + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_CyFunction_descr_get, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +}; +static int __pyx_CyFunction_init(void) { + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); + if (__pyx_CyFunctionType == NULL) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (!m->defaults) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CodeObjectCache */ + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +/* AddTraceback */ + #include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = (int) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + +/* CIntFromPyVerify */ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = (int) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntFromPy */ + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { + return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { + return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { + return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (long) 0; + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) + case -2: + if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(long) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(long) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(long) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { + return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); + } + } + break; + } +#endif + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (long) -1; + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CheckBinaryVersion */ + static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + return PyErr_WarnEx(NULL, message, 1); + } + return 0; +} + +/* VoidPtrExport */ + static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) { + PyObject *d; + PyObject *cobj = 0; + d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi); + Py_XINCREF(d); + if (!d) { + d = PyDict_New(); + if (!d) + goto bad; + if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0) + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 + cobj = PyCapsule_New(p, sig, 0); +#else + cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0); +#endif + if (!cobj) + goto bad; + if (PyDict_SetItem(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + return -1; +} + +/* FunctionExport */ + static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); + if (!d) { + PyErr_Clear(); + d = PyDict_New(); + if (!d) + goto bad; + Py_INCREF(d); + if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) + goto bad; + } + tmp.fp = f; +#if PY_VERSION_HEX >= 0x02070000 + cobj = PyCapsule_New(tmp.p, sig, 0); +#else + cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); +#endif + if (!cobj) + goto bad; + if (PyDict_SetItemString(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + return -1; +} + +/* InitStrings */ + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else + if (__Pyx_PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +#endif + } else +#endif +#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + #if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } + #else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } + #endif +#else + res = PyNumber_Int(x); +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(x); + } +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)b)->ob_digit; + const Py_ssize_t size = Py_SIZE(b); + if (likely(__Pyx_sst_abs(size) <= 1)) { + ival = likely(size) ? digits[0] : 0; + if (size == -1) ival = -ival; + return ival; + } else { + switch (size) { + case 2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -2: + if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -3: + if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case 4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + case -4: + if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { + return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + break; + } + } + #endif + return PyLong_AsSsize_t(b); + } + x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers.pxd b/src/dependency_injector/providers.pxd new file mode 100644 index 00000000..cd13cec2 --- /dev/null +++ b/src/dependency_injector/providers.pxd @@ -0,0 +1,250 @@ +"""Dependency injector providers. + +Powered by Cython. +""" + +cimport cython + + +# Base providers +cdef class Provider(object): + cdef tuple __overridden + cdef int __overridden_len + + cpdef object _provide(self, tuple args, dict kwargs) + cpdef object _call_last_overriding(self, tuple args, dict kwargs) + + +cdef class Object(Provider): + cdef object __provides + + cpdef object _provide(self, tuple args, dict kwargs) + + +cdef class Delegate(Object): + pass + + +cdef class ExternalDependency(Provider): + cdef type __instance_of + + +cdef class OverridingContext(object): + cdef Provider __overridden + cdef Provider __overriding + + +# Callable providers +cdef class Callable(Provider): + cdef object __provides + + cdef tuple __args + cdef int __args_len + + cdef tuple __kwargs + cdef int __kwargs_len + + cpdef object _provide(self, tuple args, dict kwargs) + + +cdef class DelegatedCallable(Callable): + pass + + +# Configuration providers +cdef class Configuration(Provider): + cdef str __name + cdef object __value + cdef dict __children + + cpdef str get_name(self) + cpdef object update(self, object value) + cpdef object _provide(self, tuple args, dict kwargs) + cpdef str _get_child_name(self, str child_name) + + +# Factory providers +cdef class Factory(Provider): + cdef Callable __instantiator + + cdef tuple __attributes + cdef int __attributes_len + + cpdef object _provide(self, tuple args, dict kwargs) + + +cdef class DelegatedFactory(Factory): + pass + + +# Singleton providers +cdef class BaseSingleton(Provider): + cdef Factory __instantiator + + +cdef class Singleton(BaseSingleton): + cdef object __storage + + cpdef object _provide(self, tuple args, dict kwargs) + + +cdef class DelegatedSingleton(Singleton): + pass + + +cdef class ThreadSafeSingleton(BaseSingleton): + cdef object __storage + cdef object __lock + + cpdef object _provide(self, tuple args, dict kwargs) + + +cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): + pass + + +cdef class ThreadLocalSingleton(BaseSingleton): + cdef object __storage + + cpdef object _provide(self, tuple args, dict kwargs) + + +cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): + pass + + +# Injections +cdef class Injection(object): + cdef object __value + cdef int __is_provider + cdef int __is_delegated + cdef int __call + + +cdef class PositionalInjection(Injection): + pass + + +cdef class NamedInjection(Injection): + cdef object __name + + +cpdef tuple parse_positional_injections(tuple args) + + +cpdef tuple parse_named_injections(dict kwargs) + + +# Utils +cdef object CLASS_TYPES + + +cpdef bint is_provider(object instance) + + +cpdef object ensure_is_provider(object instance) + + +cpdef bint is_delegated(object instance) + + +cpdef str represent_provider(object provider, object provides) + + +cpdef object deepcopy(object instance, dict memo=*) + + +# Inline helper functions +cdef inline object __get_name(NamedInjection self): + return self.__name + + +cdef inline object __get_value(Injection self): + if self.__call == 0: + return self.__value + return self.__value() + + +@cython.boundscheck(False) +@cython.wraparound(False) +cdef inline tuple __provide_positional_args(tuple args, + tuple inj_args, + int inj_args_len): + cdef int index + cdef list positional_args + cdef PositionalInjection injection + + if inj_args_len == 0: + return args + + positional_args = list() + for index in range(inj_args_len): + injection = inj_args[index] + positional_args.append(__get_value(injection)) + positional_args.extend(args) + + return tuple(positional_args) + + +@cython.boundscheck(False) +@cython.wraparound(False) +cdef inline dict __provide_keyword_args(dict kwargs, + tuple inj_kwargs, + int inj_kwargs_len): + cdef int index + cdef object name + cdef NamedInjection kw_injection + + if len(kwargs) == 0: + for index in range(inj_kwargs_len): + kw_injection = inj_kwargs[index] + name = __get_name(kw_injection) + kwargs[name] = __get_value(kw_injection) + else: + for index in range(inj_kwargs_len): + kw_injection = inj_kwargs[index] + name = __get_name(kw_injection) + if name not in kwargs: + kwargs[name] = __get_value(kw_injection) + + return kwargs + + +@cython.boundscheck(False) +@cython.wraparound(False) +cdef inline object __inject_attributes(object instance, + tuple attributes, + int attributes_len): + cdef NamedInjection attr_injection + for index in range(attributes_len): + attr_injection = attributes[index] + setattr(instance, + __get_name(attr_injection), + __get_value(attr_injection)) + + +cdef inline object __callable_call(Callable self, tuple args, dict kwargs): + cdef tuple positional_args + cdef dict keyword_args + + positional_args = __provide_positional_args(args, + self.__args, + self.__args_len) + keyword_args = __provide_keyword_args(kwargs, + self.__kwargs, + self.__kwargs_len) + + return self.__provides(*positional_args, **keyword_args) + + +cdef inline object __factory_call(Factory self, tuple args, dict kwargs): + cdef object instance + + instance = __callable_call(self.__instantiator, args, kwargs) + + if self.__attributes_len > 0: + __inject_attributes(instance, + self.__attributes, + self.__attributes_len) + + return instance diff --git a/src/dependency_injector/providers.pyx b/src/dependency_injector/providers.pyx new file mode 100644 index 00000000..40adb959 --- /dev/null +++ b/src/dependency_injector/providers.pyx @@ -0,0 +1,1521 @@ +"""Dependency injector providers. + +Powered by Cython. +""" + + +import copy +import sys +import types +import threading + +from .errors import Error + +cimport cython + + +GLOBAL_LOCK = threading.RLock() +"""Global reentrant lock. + +:type: :py:class:`threading.RLock` +""" + + +cdef class Provider(object): + """Base provider class. + + :py:class:`Provider` is callable (implements ``__call__`` method). Every + call to provider object returns provided result, according to the providing + strategy of particular provider. This ``callable`` functionality is a + regular part of providers API and it should be the same for all provider's + subclasses. + + Implementation of particular providing strategy should be done in + :py:meth:`Provider._provide` of :py:class:`Provider` subclass. Current + method is called every time when not overridden provider is called. + + :py:class:`Provider` implements provider overriding logic that should be + also common for all providers: + + .. code-block:: python + + provider1 = Factory(SomeClass) + provider2 = Factory(ChildSomeClass) + + provider1.override(provider2) + + some_instance = provider1() + assert isinstance(some_instance, ChildSomeClass) + + Also :py:class:`Provider` implements helper function for creating its + delegates: + + .. code-block:: python + + provider = Factory(object) + delegate = provider.delegate() + + delegated = delegate() + + assert provider is delegated + + All providers should extend this class. + + .. py:attribute:: overridden + + Tuple of overriding providers, if any. + + :type: tuple[:py:class:`Provider`] | None + """ + + __IS_PROVIDER__ = True + + def __init__(self): + """Initializer.""" + self.__overridden = tuple() + self.__overridden_len = 0 + super(Provider, self).__init__() + + def __call__(self, *args, **kwargs): + """Return provided object. + + Callable interface implementation. + """ + if self.__overridden_len != 0: + return self._call_last_overriding(args, kwargs) + return self._provide(args, kwargs) + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + + copied = self.__class__() + + for overriding_provider in self.overridden: + copied.override(deepcopy(overriding_provider, memo)) + + return copied + + def __str__(self): + """Return string representation of provider. + + :rtype: str + """ + return represent_provider(provider=self, provides=None) + + def __repr__(self): + """Return string representation of provider. + + :rtype: str + """ + return self.__str__() + + @property + def overridden(self): + """Return tuple of overriding providers.""" + return self.__overridden + + def override(self, provider): + """Override provider with another provider. + + :param provider: Overriding provider. + :type provider: :py:class:`Provider` + + :raise: :py:exc:`dependency_injector.errors.Error` + + :return: Overriding context. + :rtype: :py:class:`OverridingContext` + """ + if provider is self: + raise Error('Provider {0} could not be overridden ' + 'with itself'.format(self)) + + if not is_provider(provider): + provider = Object(provider) + + self.__overridden += (provider,) + self.__overridden_len += 1 + + return OverridingContext(self, provider) + + @cython.boundscheck(False) + @cython.wraparound(False) + def reset_last_overriding(self): + """Reset last overriding provider. + + :raise: :py:exc:`dependency_injector.errors.Error` if provider is not + overridden. + + :rtype: None + """ + if self.__overridden_len == 0: + raise Error('Provider {0} is not overridden'.format(str(self))) + + self.__overridden = self.__overridden[:self.__overridden_len - 1] + self.__overridden_len -= 1 + + def reset_override(self): + """Reset all overriding providers. + + :rtype: None + """ + self.__overridden = tuple() + self.__overridden_len = 0 + + def delegate(self): + """Return provider's delegate. + + :rtype: :py:class:`Delegate` + """ + return Delegate(self) + + cpdef object _provide(self, tuple args, dict kwargs): + """Providing strategy implementation. + + Abstract protected method that implements providing strategy of + particular provider. Current method is called every time when not + overridden provider is called. Need to be overridden in subclasses. + """ + raise NotImplementedError() + + @cython.boundscheck(False) + @cython.wraparound(False) + cpdef object _call_last_overriding(self, tuple args, dict kwargs): + """Call last overriding provider and return result.""" + return self.__overridden[self.__overridden_len - 1](*args, + **kwargs) + + +cdef class Object(Provider): + """Object provider returns provided instance "as is". + + .. py:attribute:: provides + + Value that have to be provided. + + :type: object + """ + + def __init__(self, provides): + """Initializer. + + :param provides: Value that have to be provided. + :type provides: object + """ + self.__provides = provides + super(Object, self).__init__() + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + + copied = self.__class__(deepcopy(self.__provides, memo)) + + for overriding_provider in self.overridden: + copied.override(deepcopy(overriding_provider, memo)) + + return copied + + def __str__(self): + """Return string representation of provider. + + :rtype: str + """ + return represent_provider(provider=self, provides=self.__provides) + + def __repr__(self): + """Return string representation of provider. + + :rtype: str + """ + return self.__str__() + + cpdef object _provide(self, tuple args, dict kwargs): + """Return provided instance. + + :param args: Tuple of context positional arguments. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword arguments. + :type kwargs: dict[str, object] + + :rtype: object + """ + return self.__provides + + +cdef class Delegate(Object): + """Delegate provider returns provider "as is". + + .. py:attribute:: provides + + Value that have to be provided. + + :type: object + """ + + def __init__(self, provides): + """Initializer. + + :param provides: Value that have to be provided. + :type provides: object + """ + super(Delegate, self).__init__(ensure_is_provider(provides)) + + +cdef class ExternalDependency(Provider): + """:py:class:`ExternalDependency` provider describes dependency interface. + + This provider is used for description of dependency interface. That might + be useful when dependency could be provided in the client's code only, + but it's interface is known. Such situations could happen when required + dependency has non-determenistic list of dependencies itself. + + .. code-block:: python + + database_provider = ExternalDependency(sqlite3.dbapi2.Connection) + database_provider.override(Factory(sqlite3.connect, ':memory:')) + + database = database_provider() + + .. py:attribute:: instance_of + + Class of required dependency. + + :type: type + """ + + def __init__(self, type instance_of): + """Initializer.""" + self.__instance_of = instance_of + super(ExternalDependency, self).__init__() + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + + copied = self.__class__(self.__instance_of) + + for overriding_provider in self.overridden: + copied.override(deepcopy(overriding_provider, memo)) + + return copied + + def __call__(self, *args, **kwargs): + """Return provided instance. + + :param args: Tuple of context positional arguments. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword arguments. + :type kwargs: dict[str, object] + + :raise: :py:exc:`dependency_injector.errors.Error` + + :rtype: object + """ + cdef object instance + + if self.__overridden_len == 0: + raise Error('Dependency is not defined') + + instance = self._call_last_overriding(args, kwargs) + + if not isinstance(instance, self.instance_of): + raise Error('{0} is not an '.format(instance) + + 'instance of {0}'.format(self.instance_of)) + + return instance + + def __str__(self): + """Return string representation of provider. + + :rtype: str + """ + return represent_provider(provider=self, provides=self.__instance_of) + + def __repr__(self): + """Return string representation of provider. + + :rtype: str + """ + return self.__str__() + + @property + def instance_of(self): + """Return class of required dependency.""" + return self.__instance_of + + def provided_by(self, provider): + """Set external dependency provider. + + :param provider: Provider that provides required dependency. + :type provider: :py:class:`Provider` + + :rtype: None + """ + return self.override(provider) + + +cdef class OverridingContext(object): + """Provider overriding context. + + :py:class:`OverridingContext` is used by :py:meth:`Provider.override` for + implemeting ``with`` contexts. When :py:class:`OverridingContext` is + closed, overriding that was created in this context is dropped also. + + .. code-block:: python + + with provider.override(another_provider): + assert provider.overridden + assert not provider.overridden + """ + + def __init__(self, Provider overridden, Provider overriding): + """Initializer. + + :param overridden: Overridden provider. + :type overridden: :py:class:`Provider` + + :param overriding: Overriding provider. + :type overriding: :py:class:`Provider` + """ + self.__overridden = overridden + self.__overriding = overriding + super(OverridingContext, self).__init__() + + def __enter__(self): + """Do nothing.""" + return self.__overriding + + def __exit__(self, *_): + """Exit overriding context.""" + self.__overridden.reset_last_overriding() + + +cdef class Callable(Provider): + r"""Callable provider calls wrapped callable on every call. + + Callable supports positional and keyword argument injections: + + .. code-block:: python + + some_function = Callable(some_function, + 'positional_arg1', 'positional_arg2', + keyword_argument1=3, keyword_argument=4) + + # or + + some_function = Callable(some_function) \ + .add_args('positional_arg1', 'positional_arg2') \ + .add_kwargs(keyword_argument1=3, keyword_argument=4) + + # or + + some_function = Callable(some_function) + some_function.add_args('positional_arg1', 'positional_arg2') + some_function.add_kwargs(keyword_argument1=3, keyword_argument=4) + """ + + def __init__(self, provides, *args, **kwargs): + """Initializer. + + :param provides: Wrapped callable. + :type provides: callable + + :param args: Tuple of positional argument injections. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword argument injections. + :type kwargs: dict[str, object] + """ + if not callable(provides): + raise Error('Provider {0} expected to get callable, ' + 'got {0}'.format('.'.join((self.__class__.__module__, + self.__class__.__name__)), + provides)) + self.__provides = provides + + self.__args = tuple() + self.__args_len = 0 + self.set_args(*args) + + self.__kwargs = tuple() + self.__kwargs_len = 0 + self.set_kwargs(**kwargs) + + super(Callable, self).__init__() + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + + copied = self.__class__(self.provides, + *deepcopy(self.args, memo), + **deepcopy(self.kwargs, memo)) + + for overriding_provider in self.overridden: + copied.override(deepcopy(overriding_provider, memo)) + + return copied + + def __str__(self): + """Return string representation of provider. + + :rtype: str + """ + return represent_provider(provider=self, provides=self.__provides) + + @property + def provides(self): + """Return wrapped callable.""" + return self.__provides + + @property + def args(self): + """Return positional argument injections.""" + cdef int index + cdef PositionalInjection arg + cdef list args + + args = list() + for index in range(self.__args_len): + arg = self.__args[index] + args.append(arg.__value) + return tuple(args) + + def add_args(self, *args): + """Add postional argument injections. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__args += parse_positional_injections(args) + self.__args_len = len(self.__args) + return self + + def set_args(self, *args): + """Set postional argument injections. + + Existing positional argument injections are dropped. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__args = parse_positional_injections(args) + self.__args_len = len(self.__args) + return self + + def clear_args(self): + """Drop postional argument injections. + + :return: Reference ``self`` + """ + self.__args = tuple() + self.__args_len = len(self.__args) + return self + + @property + def kwargs(self): + """Return keyword argument injections.""" + cdef int index + cdef NamedInjection kwarg + cdef dict kwargs + + kwargs = dict() + for index in range(self.__kwargs_len): + kwarg = self.__kwargs[index] + kwargs[kwarg.__name] = kwarg.__value + return kwargs + + def add_kwargs(self, **kwargs): + """Add keyword argument injections. + + :param kwargs: Dictionary of injections. + :type kwargs: dict + + :return: Reference ``self`` + """ + self.__kwargs += parse_named_injections(kwargs) + self.__kwargs_len = len(self.__kwargs) + return self + + def set_kwargs(self, **kwargs): + """Set keyword argument injections. + + Existing keyword argument injections are dropped. + + :param kwargs: Dictionary of injections. + :type kwargs: dict + + :return: Reference ``self`` + """ + self.__kwargs = parse_named_injections(kwargs) + self.__kwargs_len = len(self.__kwargs) + return self + + def clear_kwargs(self): + """Drop keyword argument injections. + + :return: Reference ``self`` + """ + self.__kwargs = tuple() + self.__kwargs_len = len(self.__kwargs) + return self + + cpdef object _provide(self, tuple args, dict kwargs): + """Return result of provided callable's call.""" + return __callable_call(self, args, kwargs) + + +cdef class DelegatedCallable(Callable): + """Callable that is injected "as is". + + DelegatedCallable is a :py:class:`Callable`, that is injected "as is". + """ + + __IS_DELEGATED__ = True + + +cdef class Configuration(Provider): + """Configuration provider. + + Configuration provider helps with implementing late static binding of + configuration options - use first, define later. + + .. code-block:: python + + config = Configuration('config') + + print(config.section1.option1()) # None + print(config.section1.option2()) # None + + config.update({'section1': {'option1': 1, + 'option2': 2}}) + + print(config.section1.option1()) # 1 + print(config.section1.option2()) # 2 + """ + + def __init__(self, name): + """Initializer. + + :param name: Name of configuration unit. + :type name: str + """ + self.__name = name + self.__value = None + self.__children = dict() + super(Configuration, self).__init__() + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + + copied = self.__class__(self.__name) + copied.update(deepcopy(self.__value)) + + for overriding_provider in self.overridden: + copied.override(deepcopy(overriding_provider, memo)) + + return copied + + def __str__(self): + """Return string representation of provider. + + :rtype: str + """ + return represent_provider(provider=self, provides=self.__name) + + def __getattr__(self, name): + """Return child configuration provider.""" + cdef Configuration child_provider + cdef object value + + child_provider = self.__children.get(name) + + if child_provider is None: + child_provider = self.__class__(self._get_child_name(name)) + + if isinstance(self.__value, dict): + child_provider.update(self.__value.get(name)) + + self.__children[name] = child_provider + + return child_provider + + cpdef str get_name(self): + """Name of configuration unit.""" + return self.__name + + cpdef object update(self, value): + """Set configuration options. + + :param value: Value of configuration option. + :type value: object | dict + + :rtype: None + """ + cdef Configuration child_provider + cdef object child_value + + self.__value = value + + if not isinstance(self.__value, dict): + return + + for name in self.__value: + child_provider = self.__children.get(name) + + if child_provider is None: + continue + + child_provider.update(self.__value.get(name)) + + cpdef object _provide(self, tuple args, dict kwargs): + """Return result of provided callable's call.""" + return self.__value + + cpdef str _get_child_name(self, str child_name): + cdef str child_full_name + + child_full_name = '' + + if self.__name: + child_full_name += self.__name + '.' + + child_full_name += child_name + + return child_full_name + + +cdef class Factory(Provider): + r"""Factory provider creates new instance on every call. + + :py:class:`Factory` supports positional & keyword argument injections, + as well as attribute injections. + + Positional and keyword argument injections could be defined like this: + + .. code-block:: python + + factory = Factory(SomeClass, + 'positional_arg1', 'positional_arg2', + keyword_argument1=3, keyword_argument=4) + + # or + + factory = Factory(SomeClass) \ + .add_args('positional_arg1', 'positional_arg2') \ + .add_kwargs(keyword_argument1=3, keyword_argument=4) + + # or + + factory = Factory(SomeClass) + factory.add_args('positional_arg1', 'positional_arg2') + factory.add_kwargs(keyword_argument1=3, keyword_argument=4) + + + Attribute injections are defined by using + :py:meth:`Factory.add_attributes`: + + .. code-block:: python + + factory = Factory(SomeClass) \ + .add_attributes(attribute1=1, attribute2=2) + + Retrieving of provided instance can be performed via calling + :py:class:`Factory` object: + + .. code-block:: python + + factory = Factory(SomeClass) + some_object = factory() + + .. py:attribute:: provided_type + + If provided type is defined, provider checks that providing class is + its subclass. + + :type: type | None + """ + + provided_type = None + + def __init__(self, provides, *args, **kwargs): + """Initializer. + + :param provides: Provided type. + :type provides: type + + :param args: Tuple of positional argument injections. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword argument injections. + :type kwargs: dict[str, object] + """ + if (self.__class__.provided_type and + not issubclass(provides, self.__class__.provided_type)): + raise Error('{0} can provide only {1} instances'.format( + self.__class__, self.__class__.provided_type)) + + self.__instantiator = Callable(provides, *args, **kwargs) + + self.__attributes = tuple() + self.__attributes_len = 0 + + super(Factory, self).__init__() + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + + copied = self.__class__(self.cls, + *deepcopy(self.args, memo), + **deepcopy(self.kwargs, memo)) + copied.set_attributes(**deepcopy(self.attributes, memo)) + + for overriding_provider in self.overridden: + copied.override(deepcopy(overriding_provider, memo)) + + return copied + + def __str__(self): + """Return string representation of provider. + + :rtype: str + """ + return represent_provider(provider=self, + provides=self.__instantiator.provides) + + @property + def cls(self): + """Return provided type.""" + return self.__instantiator.provides + + @property + def args(self): + """Return positional argument injections.""" + return self.__instantiator.args + + def add_args(self, *args): + """Add __init__ postional argument injections. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__instantiator.add_args(*args) + return self + + def set_args(self, *args): + """Set __init__ postional argument injections. + + Existing __init__ positional argument injections are dropped. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__instantiator.set_args(*args) + return self + + def clear_args(self): + """Drop __init__ postional argument injections. + + :return: Reference ``self`` + """ + self.__instantiator.clear_args() + return self + + @property + def kwargs(self): + """Return keyword argument injections.""" + return self.__instantiator.kwargs + + def add_kwargs(self, **kwargs): + """Add __init__ keyword argument injections. + + :param kwargs: Dictionary of injections. + :type kwargs: dict + + :return: Reference ``self`` + """ + self.__instantiator.add_kwargs(**kwargs) + return self + + def set_kwargs(self, **kwargs): + """Set __init__ keyword argument injections. + + Existing __init__ keyword argument injections are dropped. + + :param kwargs: Dictionary of injections. + :type kwargs: dict + + :return: Reference ``self`` + """ + self.__instantiator.set_kwargs(**kwargs) + return self + + def clear_kwargs(self): + """Drop __init__ keyword argument injections. + + :return: Reference ``self`` + """ + self.__instantiator.clear_kwargs() + return self + + @property + def attributes(self): + """Return attribute injections.""" + cdef int index + cdef NamedInjection attribute + cdef dict attributes + + attributes = dict() + for index in range(self.__attributes_len): + attribute = self.__attributes[index] + attributes[attribute.__name] = attribute.__value + return attributes + + def add_attributes(self, **kwargs): + """Add attribute injections. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__attributes += parse_named_injections(kwargs) + self.__attributes_len = len(self.__attributes) + return self + + def set_attributes(self, **kwargs): + """Set attribute injections. + + Existing attribute injections are dropped. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__attributes = parse_named_injections(kwargs) + self.__attributes_len = len(self.__attributes) + return self + + def clear_attributes(self): + """Drop attribute injections. + + :return: Reference ``self`` + """ + self.__attributes = tuple() + self.__attributes_len = len(self.__attributes) + return self + + cpdef object _provide(self, tuple args, dict kwargs): + """Return new instance.""" + return __factory_call(self, args, kwargs) + + +cdef class DelegatedFactory(Factory): + """Factory that is injected "as is". + + .. py:attribute:: provided_type + + If provided type is defined, provider checks that providing class is + its subclass. + + :type: type | None + + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attr:`provides`. + + :type: type + """ + + __IS_DELEGATED__ = True + + +cdef class BaseSingleton(Provider): + """Base class of singleton providers.""" + + provided_type = None + + def __init__(self, provides, *args, **kwargs): + """Initializer. + + :param provides: Provided type. + :type provides: type + + :param args: Tuple of positional argument injections. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword argument injections. + :type kwargs: dict[str, object] + """ + if (self.__class__.provided_type and + not issubclass(provides, self.__class__.provided_type)): + raise Error('{0} can provide only {1} instances'.format( + self.__class__, self.__class__.provided_type)) + + self.__instantiator = Factory(provides, *args, **kwargs) + + super(BaseSingleton, self).__init__() + + def __str__(self): + """Return string representation of provider. + + :rtype: str + """ + return represent_provider(provider=self, + provides=self.__instantiator.cls) + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + + copied = self.__class__(self.cls, + *deepcopy(self.args, memo), + **deepcopy(self.kwargs, memo)) + copied.set_attributes(**deepcopy(self.attributes, memo)) + + for overriding_provider in self.overridden: + copied.override(deepcopy(overriding_provider, memo)) + + return copied + + @property + def cls(self): + """Return provided type.""" + return self.__instantiator.cls + + @property + def args(self): + """Return positional argument injections.""" + return self.__instantiator.args + + def add_args(self, *args): + """Add __init__ postional argument injections. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__instantiator.add_args(*args) + return self + + def set_args(self, *args): + """Set __init__ postional argument injections. + + Existing __init__ positional argument injections are dropped. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__instantiator.set_args(*args) + return self + + def clear_args(self): + """Drop __init__ postional argument injections. + + :return: Reference ``self`` + """ + self.__instantiator.clear_args() + return self + + @property + def kwargs(self): + """Return keyword argument injections.""" + return self.__instantiator.kwargs + + def add_kwargs(self, **kwargs): + """Add __init__ keyword argument injections. + + :param kwargs: Dictionary of injections. + :type kwargs: dict + + :return: Reference ``self`` + """ + self.__instantiator.add_kwargs(**kwargs) + return self + + def set_kwargs(self, **kwargs): + """Set __init__ keyword argument injections. + + Existing __init__ keyword argument injections are dropped. + + :param kwargs: Dictionary of injections. + :type kwargs: dict + + :return: Reference ``self`` + """ + self.__instantiator.set_kwargs(**kwargs) + return self + + def clear_kwargs(self): + """Drop __init__ keyword argument injections. + + :return: Reference ``self`` + """ + self.__instantiator.clear_kwargs() + return self + + @property + def attributes(self): + """Return attribute injections.""" + return self.__instantiator.attributes + + def add_attributes(self, **kwargs): + """Add attribute injections. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__instantiator.add_attributes(**kwargs) + return self + + def set_attributes(self, **kwargs): + """Set attribute injections. + + Existing attribute injections are dropped. + + :param args: Tuple of injections. + :type args: tuple + + :return: Reference ``self`` + """ + self.__instantiator.set_attributes(**kwargs) + return self + + def clear_attributes(self): + """Drop attribute injections. + + :return: Reference ``self`` + """ + self.__instantiator.clear_attributes() + return self + + def reset(self): + """Reset cached instance, if any. + + :rtype: None + """ + raise NotImplementedError() + + +cdef class Singleton(BaseSingleton): + """Singleton provider returns same instance on every call. + + :py:class:`Singleton` provider creates instance once and returns it on + every call. :py:class:`Singleton` extends :py:class:`Factory`, so, please + follow :py:class:`Factory` documentation for getting familiar with + injections syntax. + + Retrieving of provided instance can be performed via calling + :py:class:`Singleton` object: + + .. code-block:: python + + singleton = Singleton(SomeClass) + some_object = singleton() + + .. py:attribute:: provided_type + + If provided type is defined, provider checks that providing class is + its subclass. + + :type: type | None + + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attr:`provides`. + + :type: type + """ + + def __init__(self, provides, *args, **kwargs): + """Initializer. + + :param provides: Provided type. + :type provides: type + + :param args: Tuple of positional argument injections. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword argument injections. + :type kwargs: dict[str, object] + """ + self.__storage = None + super(Singleton, self).__init__(provides, *args, **kwargs) + + def reset(self): + """Reset cached instance, if any. + + :rtype: None + """ + self.__storage = None + + cpdef object _provide(self, tuple args, dict kwargs): + """Return single instance.""" + if self.__storage is None: + self.__storage = __factory_call(self.__instantiator, + args, kwargs) + return self.__storage + + +cdef class DelegatedSingleton(Singleton): + """Delegated singleton is injected "as is". + + .. py:attribute:: provided_type + + If provided type is defined, provider checks that providing class is + its subclass. + + :type: type | None + + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attr:`provides`. + + :type: type + """ + + __IS_DELEGATED__ = True + + +cdef class ThreadSafeSingleton(BaseSingleton): + """Thread-safe singleton provider.""" + + def __init__(self, provides, *args, **kwargs): + """Initializer. + + :param provides: Provided type. + :type provides: type + + :param args: Tuple of positional argument injections. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword argument injections. + :type kwargs: dict[str, object] + """ + self.__storage = None + self.__lock = GLOBAL_LOCK + super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) + + def reset(self): + """Reset cached instance, if any. + + :rtype: None + """ + self.__storage = None + + cpdef object _provide(self, tuple args, dict kwargs): + """Return single instance.""" + with self.__lock: + if self.__storage is None: + self.__storage = __factory_call(self.__instantiator, + args, kwargs) + return self.__storage + + +cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): + """Delegated thread-safe singleton is injected "as is". + + .. py:attribute:: provided_type + + If provided type is defined, provider checks that providing class is + its subclass. + + :type: type | None + + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attr:`provides`. + + :type: type + """ + + __IS_DELEGATED__ = True + + +cdef class ThreadLocalSingleton(BaseSingleton): + """Thread-local singleton provides single objects in scope of thread. + + .. py:attribute:: provided_type + + If provided type is defined, provider checks that providing class is + its subclass. + + :type: type | None + + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attr:`provides`. + + :type: type + """ + + def __init__(self, provides, *args, **kwargs): + """Initializer. + + :param provides: Provided type. + :type provides: type + + :param args: Tuple of positional argument injections. + :type args: tuple[object] + + :param kwargs: Dictionary of context keyword argument injections. + :type kwargs: dict[str, object] + """ + self.__storage = threading.local() + super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) + + def reset(self): + """Reset cached instance, if any. + + :rtype: None + """ + self.__storage.instance = None + + cpdef object _provide(self, tuple args, dict kwargs): + """Return single instance.""" + cdef object instance + + try: + instance = self.__storage.instance + except AttributeError: + instance = __factory_call(self.__instantiator, args, kwargs) + self.__storage.instance = instance + finally: + return instance + + +cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): + """Delegated thread-local singleton is injected "as is". + + .. py:attribute:: provided_type + + If provided type is defined, provider checks that providing class is + its subclass. + + :type: type | None + + .. py:attribute:: cls + + Class that provides object. + Alias for :py:attr:`provides`. + + :type: type + """ + + __IS_DELEGATED__ = True + + +cdef class Injection(object): + """Abstract injection class.""" + + +cdef class PositionalInjection(Injection): + """Positional injection class.""" + + def __init__(self, value): + """Initializer.""" + self.__value = value + self.__is_provider = is_provider(value) + self.__is_delegated = is_delegated(value) + self.__call = (self.__is_provider == 1 and + self.__is_delegated == 0) + super(PositionalInjection, self).__init__() + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + return self.__class__(deepcopy(self.__value, memo)) + + def get_value(self): + """Return injection value.""" + return __get_value(self) + + def get_original_value(self): + """Return original value.""" + return self.__value + + +cdef class NamedInjection(Injection): + """Keyword injection class.""" + + def __init__(self, name, value): + """Initializer.""" + self.__name = name + self.__value = value + self.__is_provider = is_provider(value) + self.__is_delegated = is_delegated(value) + self.__call = (self.__is_provider == 1 and + self.__is_delegated == 0) + super(NamedInjection, self).__init__() + + def __deepcopy__(self, memo): + """Create and return full copy of provider.""" + copied = memo.get(id(self)) + if copied is not None: + return copied + return self.__class__(deepcopy(self.__name, memo), + deepcopy(self.__value, memo)) + + def get_name(self): + """Return injection value.""" + return __get_name(self) + + def get_value(self): + """Return injection value.""" + return __get_value(self) + + def get_original_value(self): + """Return original value.""" + return self.__value + + +@cython.boundscheck(False) +@cython.wraparound(False) +cpdef tuple parse_positional_injections(tuple args): + """Parse positional injections.""" + cdef list injections = list() + cdef int args_len = len(args) + + cdef int index + cdef object arg + cdef PositionalInjection injection + + for index in range(args_len): + arg = args[index] + injection = PositionalInjection(arg) + injections.append(injection) + + return tuple(injections) + + +@cython.boundscheck(False) +@cython.wraparound(False) +cpdef tuple parse_named_injections(dict kwargs): + """Parse named injections.""" + cdef list injections = list() + + cdef object name + cdef object arg + cdef NamedInjection injection + + for name, arg in kwargs.items(): + injection = NamedInjection(name, arg) + injections.append(injection) + + 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. + + :param instance: Instance to be checked. + :type instance: object + + :rtype: bool + """ + return (not isinstance(instance, CLASS_TYPES) and + getattr(instance, '__IS_PROVIDER__', False) is True) + + +cpdef object ensure_is_provider(object instance): + """Check if instance is provider instance and return it. + + :param instance: Instance to be checked. + :type instance: object + + :raise: :py:exc:`dependency_injector.errors.Error` if provided instance is + not provider. + + :rtype: :py:class:`dependency_injector.providers.Provider` + """ + if not is_provider(instance): + raise Error('Expected provider instance, ' + 'got {0}'.format(str(instance))) + return instance + + +cpdef bint is_delegated(object instance): + """Check if instance is delegated provider. + + :param instance: Instance to be checked. + :type instance: object + + :rtype: bool + """ + return (not isinstance(instance, CLASS_TYPES) and + getattr(instance, '__IS_DELEGATED__', False) is True) + + +cpdef str represent_provider(object provider, object provides): + """Return string representation of provider. + + :param provider: Provider object + :type provider: :py:class:`dependency_injector.providers.Provider` + + :param provides: Object that provider provides + :type provider: object + + :return: String representation of provider + :rtype: str + """ + return '<{provider}({provides}) at {address}>'.format( + provider='.'.join((provider.__class__.__module__, + provider.__class__.__name__)), + provides=repr(provides) if provides is not None else '', + address=hex(id(provider))) + + +cpdef object deepcopy(object instance, dict memo=None): + """Return full copy of provider or container with providers.""" + return copy.deepcopy(instance, memo) diff --git a/src/dependency_injector/providers/__init__.py b/src/dependency_injector/providers/__init__.py deleted file mode 100644 index 9bd45faf..00000000 --- a/src/dependency_injector/providers/__init__.py +++ /dev/null @@ -1,82 +0,0 @@ -"""Dependency injector providers.""" - -from .base import ( - Provider, - Object, - Delegate, - ExternalDependency, - OverridingContext, -) -from .configuration import ( - Configuration, -) -from .callables import ( - Callable, - DelegatedCallable, -) -from .factories import ( - Factory, - DelegatedFactory, -) -from .singletons import ( - BaseSingleton, - - Singleton, - DelegatedSingleton, - - ThreadSafeSingleton, - DelegatedThreadSafeSingleton, - - ThreadLocalSingleton, - DelegatedThreadLocalSingleton, -) -from .injections import ( - Injection, - PositionalInjection, - NamedInjection, -) -from .utils import ( - is_provider, - ensure_is_provider, - is_delegated, - represent_provider, - deepcopy, -) - - -__all__ = ( - 'Provider', - 'Object', - 'Delegate', - 'ExternalDependency', - 'OverridingContext', - - 'Configuration', - - 'Callable', - 'DelegatedCallable', - - 'Factory', - 'DelegatedFactory', - - 'BaseSingleton', - - 'Singleton', - 'DelegatedSingleton', - - 'ThreadSafeSingleton', - 'DelegatedThreadSafeSingleton', - - 'ThreadLocalSingleton', - 'DelegatedThreadLocalSingleton', - - 'Injection', - 'PositionalInjection', - 'NamedInjection', - - 'is_provider', - 'ensure_is_provider', - 'is_delegated', - 'represent_provider', - 'deepcopy', -) diff --git a/src/dependency_injector/providers/base.c b/src/dependency_injector/providers/base.c deleted file mode 100644 index 0cb41f36..00000000 --- a/src/dependency_injector/providers/base.c +++ /dev/null @@ -1,8279 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__dependency_injector__providers__base -#define __PYX_HAVE_API__dependency_injector__providers__base -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/dependency_injector/providers/base.pyx", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider; -struct __pyx_obj_19dependency_injector_9providers_4base_Object; -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate; -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency; -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext; -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy; - -/* "utils.pxd":21 - * - * - * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< - */ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy { - int __pyx_n; - PyObject *memo; -}; - -/* "dependency_injector/providers/base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider { - PyObject_HEAD - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtab; - PyObject *__pyx___overridden; - int __pyx___overridden_len; -}; - - -/* "dependency_injector/providers/base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Object { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; -}; - - -/* "dependency_injector/providers/base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate { - struct __pyx_obj_19dependency_injector_9providers_4base_Object __pyx_base; -}; - - -/* "dependency_injector/providers/base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyTypeObject *__pyx___instance_of; -}; - - -/* "dependency_injector/providers/base.pxd":29 - * - * - * cdef class OverridingContext(object): # <<<<<<<<<<<<<< - * cdef Provider __overridden - * cdef Provider __overriding - */ -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext { - PyObject_HEAD - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overridden; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overriding; -}; - - - -/* "dependency_injector/providers/base.pyx":19 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * """Base provider class. - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider { - PyObject *(*_provide)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*_call_last_overriding)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - - -/* "dependency_injector/providers/base.pyx":186 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * """Object provider returns provided instance "as is". - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object *__pyx_vtabptr_19dependency_injector_9providers_4base_Object; - - -/* "dependency_injector/providers/base.pyx":246 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * """Delegate provider returns provider "as is". - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate *__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate; - - -/* "dependency_injector/providers/base.pyx":265 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * """:py:class:`ExternalDependency` provider describes dependency interface. - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency *__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* KeywordStringCheck.proto */ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* SliceTupleAndList.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); -static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); -#else -#define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) -#define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) -#endif - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); - -/* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -static PyObject *__pyx_f_19dependency_injector_9providers_4base_8Provider__provide(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_4base_8Provider__call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_4base_6Object__provide(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ - -/* Module declarations from 'cython' */ - -/* Module declarations from 'dependency_injector.providers.utils' */ -static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0; -#define __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES (*__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES) -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_represent_provider)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_deepcopy)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.base' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Provider = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Object = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Delegate = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = 0; -#define __Pyx_MODULE_NAME "dependency_injector.providers.base" -int __pyx_module_is_main_dependency_injector__providers__base = 0; - -/* Implementation of 'dependency_injector.providers.base' */ -static PyObject *__pyx_builtin_super; -static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_NotImplementedError; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_str[] = "__str__"; -static const char __pyx_k_args[] = "args"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_Error[] = "Error"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_super[] = "super"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_kwargs[] = "kwargs"; -static const char __pyx_k_provide[] = "_provide"; -static const char __pyx_k_override[] = "override"; -static const char __pyx_k_provides[] = "provides"; -static const char __pyx_k_overridden[] = "overridden"; -static const char __pyx_k_overriding[] = "overriding"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_0_is_not_an[] = "{0} is not an "; -static const char __pyx_k_IS_PROVIDER[] = "__IS_PROVIDER__"; -static const char __pyx_k_instance_of[] = "instance_of"; -static const char __pyx_k_instance_of_0[] = "instance of {0}"; -static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; -static const char __pyx_k_call_last_overriding[] = "_call_last_overriding"; -static const char __pyx_k_reset_last_overriding[] = "reset_last_overriding"; -static const char __pyx_k_Dependency_is_not_defined[] = "Dependency is not defined"; -static const char __pyx_k_dependency_injector_errors[] = "dependency_injector.errors"; -static const char __pyx_k_Provider_0_is_not_overridden[] = "Provider {0} is not overridden"; -static const char __pyx_k_Dependency_injector_base_provide[] = "Dependency injector base providers.\n\nPowered by Cython.\n"; -static const char __pyx_k_Provider_0_could_not_be_overridd[] = "Provider {0} could not be overridden with itself"; -static PyObject *__pyx_kp_s_0_is_not_an; -static PyObject *__pyx_kp_s_Dependency_is_not_defined; -static PyObject *__pyx_n_s_Error; -static PyObject *__pyx_n_s_IS_PROVIDER; -static PyObject *__pyx_n_s_NotImplementedError; -static PyObject *__pyx_kp_s_Provider_0_could_not_be_overridd; -static PyObject *__pyx_kp_s_Provider_0_is_not_overridden; -static PyObject *__pyx_n_s_args; -static PyObject *__pyx_n_s_call_last_overriding; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_dependency_injector_errors; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_instance_of; -static PyObject *__pyx_kp_s_instance_of_0; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_overridden; -static PyObject *__pyx_n_s_override; -static PyObject *__pyx_n_s_overriding; -static PyObject *__pyx_n_s_provide; -static PyObject *__pyx_n_s_provides; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_reset_last_overriding; -static PyObject *__pyx_n_s_str; -static PyObject *__pyx_n_s_super; -static PyObject *__pyx_n_s_test; -static int __pyx_pf_19dependency_injector_9providers_4base_8Provider___init__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_2__call__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_6__str__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_8__repr__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_10overridden___get__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_10override(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_provider); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_12reset_last_overriding(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_14reset_override(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_16delegate(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_18_provide(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_20_call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_4base_6Object___init__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, PyObject *__pyx_v_provides); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_4__str__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_6__repr__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_8_provide(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_4base_8Delegate___init__(struct __pyx_obj_19dependency_injector_9providers_4base_Delegate *__pyx_v_self, PyObject *__pyx_v_provides); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency___init__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyTypeObject *__pyx_v_instance_of); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_4__call__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_6__str__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_11instance_of___get__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_10provided_by(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_provider); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_4base_17OverridingContext___init__(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *__pyx_v_self, struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_overridden, struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_overriding); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_17OverridingContext_2__enter__(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_17OverridingContext_4__exit__(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v__); /* proto */ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_Provider(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_Object(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_Delegate(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_ExternalDependency(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_OverridingContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tuple_; - -/* "dependency_injector/providers/base.pyx":68 - * __IS_PROVIDER__ = True - * - * def __init__(self): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__overridden = tuple() - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_4base_8Provider_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider___init__[] = "Initializer."; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_4base_8Provider_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider___init__(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_4base_8Provider___init__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/base.pyx":70 - * def __init__(self): - * """Initializer.""" - * self.__overridden = tuple() # <<<<<<<<<<<<<< - * self.__overridden_len = 0 - * super(Provider, self).__init__() - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); - __Pyx_DECREF(__pyx_v_self->__pyx___overridden); - __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":71 - * """Initializer.""" - * self.__overridden = tuple() - * self.__overridden_len = 0 # <<<<<<<<<<<<<< - * super(Provider, self).__init__() - * - */ - __pyx_v_self->__pyx___overridden_len = 0; - - /* "dependency_injector/providers/base.pyx":72 - * self.__overridden = tuple() - * self.__overridden_len = 0 - * super(Provider, self).__init__() # <<<<<<<<<<<<<< - * - * def __call__(self, *args, **kwargs): - */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Provider)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Provider)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Provider)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":68 - * __IS_PROVIDER__ = True - * - * def __init__(self): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__overridden = tuple() - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":74 - * super(Provider, self).__init__() - * - * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< - * """Return provided object. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_2__call__[] = "Return provided object.\n\n Callable interface implementation.\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_2__call__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL; - __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_2__call__(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_2__call__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__call__", 0); - - /* "dependency_injector/providers/base.pyx":79 - * Callable interface implementation. - * """ - * if self.__overridden_len != 0: # <<<<<<<<<<<<<< - * return self._call_last_overriding(args, kwargs) - * return self._provide(args, kwargs) - */ - __pyx_t_1 = ((__pyx_v_self->__pyx___overridden_len != 0) != 0); - if (__pyx_t_1) { - - /* "dependency_injector/providers/base.pyx":80 - * """ - * if self.__overridden_len != 0: - * return self._call_last_overriding(args, kwargs) # <<<<<<<<<<<<<< - * return self._provide(args, kwargs) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *)__pyx_v_self->__pyx_vtab)->_call_last_overriding(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":79 - * Callable interface implementation. - * """ - * if self.__overridden_len != 0: # <<<<<<<<<<<<<< - * return self._call_last_overriding(args, kwargs) - * return self._provide(args, kwargs) - */ - } - - /* "dependency_injector/providers/base.pyx":81 - * if self.__overridden_len != 0: - * return self._call_last_overriding(args, kwargs) - * return self._provide(args, kwargs) # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *)__pyx_v_self->__pyx_vtab)->_provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":74 - * super(Provider, self).__init__() - * - * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< - * """Return provided object. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":83 - * return self._provide(args, kwargs) - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_4__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_4__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_v_overriding_provider = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/base.pyx":85 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":86 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/base.pyx":87 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * - * copied = self.__class__() - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":86 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - } - - /* "dependency_injector/providers/base.pyx":89 - * return copied - * - * copied = self.__class__() # <<<<<<<<<<<<<< - * - * for overriding_provider in self.overridden: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":91 - * copied = self.__class__() - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 91, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 91, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 91, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 91, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":92 - * - * for overriding_provider in self.overridden: - * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< - * - * return copied - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 92, __pyx_L1_error) - __pyx_t_10.__pyx_n = 1; - __pyx_t_10.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":91 - * copied = self.__class__() - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/base.pyx":94 - * copied.override(deepcopy(overriding_provider, memo)) - * - * return copied # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":83 - * return self._provide(args, kwargs) - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XDECREF(__pyx_v_overriding_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":96 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_7__str__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_6__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_6__str__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_7__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_6__str__(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_6__str__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "dependency_injector/providers/base.pyx":101 - * :rtype: str - * """ - * return represent_provider(provider=self, provides=None) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(((PyObject *)__pyx_v_self), Py_None, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":96 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":103 - * return represent_provider(provider=self, provides=None) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_9__repr__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_8__repr__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_8__repr__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_9__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_8__repr__(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_8__repr__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "dependency_injector/providers/base.pyx":108 - * :rtype: str - * """ - * return self.__str__() # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":103 - * return represent_provider(provider=self, provides=None) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":111 - * - * @property - * def overridden(self): # <<<<<<<<<<<<<< - * """Return tuple of overriding providers.""" - * return self.__overridden - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_10overridden_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_10overridden_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_10overridden___get__(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_10overridden___get__(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/base.pyx":113 - * def overridden(self): - * """Return tuple of overriding providers.""" - * return self.__overridden # <<<<<<<<<<<<<< - * - * def override(self, provider): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___overridden); - __pyx_r = __pyx_v_self->__pyx___overridden; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":111 - * - * @property - * def overridden(self): # <<<<<<<<<<<<<< - * """Return tuple of overriding providers.""" - * return self.__overridden - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":115 - * return self.__overridden - * - * def override(self, provider): # <<<<<<<<<<<<<< - * """Override provider with another provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_11override(PyObject *__pyx_v_self, PyObject *__pyx_v_provider); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_10override[] = "Override provider with another provider.\n\n :param provider: Overriding provider.\n :type provider: :py:class:`Provider`\n\n :raise: :py:exc:`dependency_injector.errors.Error`\n\n :return: Overriding context.\n :rtype: :py:class:`OverridingContext`\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_11override(PyObject *__pyx_v_self, PyObject *__pyx_v_provider) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("override (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_10override(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self), ((PyObject *)__pyx_v_provider)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_10override(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_provider) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("override", 0); - __Pyx_INCREF(__pyx_v_provider); - - /* "dependency_injector/providers/base.pyx":126 - * :rtype: :py:class:`OverridingContext` - * """ - * if provider is self: # <<<<<<<<<<<<<< - * raise Error('Provider {0} could not be overridden ' - * 'with itself'.format(self)) - */ - __pyx_t_1 = (__pyx_v_provider == ((PyObject *)__pyx_v_self)); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "dependency_injector/providers/base.pyx":127 - * """ - * if provider is self: - * raise Error('Provider {0} could not be overridden ' # <<<<<<<<<<<<<< - * 'with itself'.format(self)) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "dependency_injector/providers/base.pyx":128 - * if provider is self: - * raise Error('Provider {0} could not be overridden ' - * 'with itself'.format(self)) # <<<<<<<<<<<<<< - * - * if not is_provider(provider): - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Provider_0_could_not_be_overridd, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_7) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, ((PyObject *)__pyx_v_self)}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, ((PyObject *)__pyx_v_self)}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, ((PyObject *)__pyx_v_self)); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 127, __pyx_L1_error) - - /* "dependency_injector/providers/base.pyx":126 - * :rtype: :py:class:`OverridingContext` - * """ - * if provider is self: # <<<<<<<<<<<<<< - * raise Error('Provider {0} could not be overridden ' - * 'with itself'.format(self)) - */ - } - - /* "dependency_injector/providers/base.pyx":130 - * 'with itself'.format(self)) - * - * if not is_provider(provider): # <<<<<<<<<<<<<< - * provider = Object(provider) - * - */ - __pyx_t_2 = ((!(__pyx_f_19dependency_injector_9providers_5utils_is_provider(__pyx_v_provider, 0) != 0)) != 0); - if (__pyx_t_2) { - - /* "dependency_injector/providers/base.pyx":131 - * - * if not is_provider(provider): - * provider = Object(provider) # <<<<<<<<<<<<<< - * - * self.__overridden += (provider,) - */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_provider); - __Pyx_GIVEREF(__pyx_v_provider); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_provider); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Object), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_provider, __pyx_t_4); - __pyx_t_4 = 0; - - /* "dependency_injector/providers/base.pyx":130 - * 'with itself'.format(self)) - * - * if not is_provider(provider): # <<<<<<<<<<<<<< - * provider = Object(provider) - * - */ - } - - /* "dependency_injector/providers/base.pyx":133 - * provider = Object(provider) - * - * self.__overridden += (provider,) # <<<<<<<<<<<<<< - * self.__overridden_len += 1 - * - */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_provider); - __Pyx_GIVEREF(__pyx_v_provider); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_provider); - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___overridden, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); - __Pyx_DECREF(__pyx_v_self->__pyx___overridden); - __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "dependency_injector/providers/base.pyx":134 - * - * self.__overridden += (provider,) - * self.__overridden_len += 1 # <<<<<<<<<<<<<< - * - * return OverridingContext(self, provider) - */ - __pyx_v_self->__pyx___overridden_len = (__pyx_v_self->__pyx___overridden_len + 1); - - /* "dependency_injector/providers/base.pyx":136 - * self.__overridden_len += 1 - * - * return OverridingContext(self, provider) # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __Pyx_INCREF(__pyx_v_provider); - __Pyx_GIVEREF(__pyx_v_provider); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_provider); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":115 - * return self.__overridden - * - * def override(self, provider): # <<<<<<<<<<<<<< - * """Override provider with another provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.override", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":140 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def reset_last_overriding(self): # <<<<<<<<<<<<<< - * """Reset last overriding provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_13reset_last_overriding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_12reset_last_overriding[] = "Reset last overriding provider.\n\n :raise: :py:exc:`dependency_injector.errors.Error` if provider is not\n overridden.\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_13reset_last_overriding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset_last_overriding (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_12reset_last_overriding(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_12reset_last_overriding(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("reset_last_overriding", 0); - - /* "dependency_injector/providers/base.pyx":148 - * :rtype: None - * """ - * if self.__overridden_len == 0: # <<<<<<<<<<<<<< - * raise Error('Provider {0} is not overridden'.format(str(self))) - * - */ - __pyx_t_1 = ((__pyx_v_self->__pyx___overridden_len == 0) != 0); - if (__pyx_t_1) { - - /* "dependency_injector/providers/base.pyx":149 - * """ - * if self.__overridden_len == 0: - * raise Error('Provider {0} is not overridden'.format(str(self))) # <<<<<<<<<<<<<< - * - * self.__overridden = self.__overridden[:self.__overridden_len - 1] - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Provider_0_is_not_overridden, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 149, __pyx_L1_error) - - /* "dependency_injector/providers/base.pyx":148 - * :rtype: None - * """ - * if self.__overridden_len == 0: # <<<<<<<<<<<<<< - * raise Error('Provider {0} is not overridden'.format(str(self))) - * - */ - } - - /* "dependency_injector/providers/base.pyx":151 - * raise Error('Provider {0} is not overridden'.format(str(self))) - * - * self.__overridden = self.__overridden[:self.__overridden_len - 1] # <<<<<<<<<<<<<< - * self.__overridden_len -= 1 - * - */ - if (unlikely(__pyx_v_self->__pyx___overridden == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 151, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyTuple_GetSlice(__pyx_v_self->__pyx___overridden, 0, (__pyx_v_self->__pyx___overridden_len - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); - __Pyx_DECREF(__pyx_v_self->__pyx___overridden); - __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/base.pyx":152 - * - * self.__overridden = self.__overridden[:self.__overridden_len - 1] - * self.__overridden_len -= 1 # <<<<<<<<<<<<<< - * - * def reset_override(self): - */ - __pyx_v_self->__pyx___overridden_len = (__pyx_v_self->__pyx___overridden_len - 1); - - /* "dependency_injector/providers/base.pyx":140 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * def reset_last_overriding(self): # <<<<<<<<<<<<<< - * """Reset last overriding provider. - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.reset_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":154 - * self.__overridden_len -= 1 - * - * def reset_override(self): # <<<<<<<<<<<<<< - * """Reset all overriding providers. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_15reset_override(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_14reset_override[] = "Reset all overriding providers.\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_15reset_override(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset_override (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_14reset_override(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_14reset_override(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("reset_override", 0); - - /* "dependency_injector/providers/base.pyx":159 - * :rtype: None - * """ - * self.__overridden = tuple() # <<<<<<<<<<<<<< - * self.__overridden_len = 0 - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); - __Pyx_DECREF(__pyx_v_self->__pyx___overridden); - __pyx_v_self->__pyx___overridden = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":160 - * """ - * self.__overridden = tuple() - * self.__overridden_len = 0 # <<<<<<<<<<<<<< - * - * def delegate(self): - */ - __pyx_v_self->__pyx___overridden_len = 0; - - /* "dependency_injector/providers/base.pyx":154 - * self.__overridden_len -= 1 - * - * def reset_override(self): # <<<<<<<<<<<<<< - * """Reset all overriding providers. - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.reset_override", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":162 - * self.__overridden_len = 0 - * - * def delegate(self): # <<<<<<<<<<<<<< - * """Return provider's delegate. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_17delegate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_16delegate[] = "Return provider's delegate.\n\n :rtype: :py:class:`Delegate`\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_17delegate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("delegate (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_16delegate(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_16delegate(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("delegate", 0); - - /* "dependency_injector/providers/base.pyx":167 - * :rtype: :py:class:`Delegate` - * """ - * return Delegate(self) # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Delegate), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":162 - * self.__overridden_len = 0 - * - * def delegate(self): # <<<<<<<<<<<<<< - * """Return provider's delegate. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider.delegate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":169 - * return Delegate(self) - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Providing strategy implementation. - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_4base_8Provider__provide(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_19_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/base.pyx":176 - * overridden provider is called. Need to be overridden in subclasses. - * """ - * raise NotImplementedError() # <<<<<<<<<<<<<< - * - * @cython.boundscheck(False) - */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 176, __pyx_L1_error) - - /* "dependency_injector/providers/base.pyx":169 - * return Delegate(self) - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Providing strategy implementation. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_18_provide[] = "Providing strategy implementation.\n\n Abstract protected method that implements providing strategy of\n particular provider. Current method is called every time when not\n overridden provider is called. Need to be overridden in subclasses.\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 169, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 169, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 169, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.base.Provider._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 169, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 169, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_18_provide(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_18_provide(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_4base_8Provider__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":180 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef object _call_last_overriding(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Call last overriding provider and return result.""" - * return self.__overridden[self.__overridden_len - 1](*args, - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_21_call_last_overriding(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_4base_8Provider__call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - long __pyx_t_7; - __Pyx_RefNannySetupContext("_call_last_overriding", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_call_last_overriding); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_21_call_last_overriding)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/base.pyx":182 - * cpdef object _call_last_overriding(self, tuple args, dict kwargs): - * """Call last overriding provider and return result.""" - * return self.__overridden[self.__overridden_len - 1](*args, # <<<<<<<<<<<<<< - * **kwargs) - * - */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(__pyx_v_self->__pyx___overridden == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 182, __pyx_L1_error) - } - __pyx_t_7 = (__pyx_v_self->__pyx___overridden_len - 1); - if (unlikely(__pyx_v_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 182, __pyx_L1_error) - } - - /* "dependency_injector/providers/base.pyx":183 - * """Call last overriding provider and return result.""" - * return self.__overridden[self.__overridden_len - 1](*args, - * **kwargs) # <<<<<<<<<<<<<< - * - * - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 183, __pyx_L1_error) - } - - /* "dependency_injector/providers/base.pyx":182 - * cpdef object _call_last_overriding(self, tuple args, dict kwargs): - * """Call last overriding provider and return result.""" - * return self.__overridden[self.__overridden_len - 1](*args, # <<<<<<<<<<<<<< - * **kwargs) - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(PyTuple_GET_ITEM(__pyx_v_self->__pyx___overridden, __pyx_t_7), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __pyx_r = __pyx_t_1; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":180 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef object _call_last_overriding(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Call last overriding provider and return result.""" - * return self.__overridden[self.__overridden_len - 1](*args, - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider._call_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_21_call_last_overriding(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Provider_20_call_last_overriding[] = "Call last overriding provider and return result."; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_8Provider_21_call_last_overriding(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_call_last_overriding (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_call_last_overriding", 1, 2, 2, 1); __PYX_ERR(0, 180, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_call_last_overriding") < 0)) __PYX_ERR(0, 180, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_call_last_overriding", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.base.Provider._call_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 180, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 180, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Provider_20_call_last_overriding(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_8Provider_20_call_last_overriding(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_call_last_overriding", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_4base_8Provider__call_last_overriding(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.base.Provider._call_last_overriding", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":196 - * """ - * - * def __init__(self, provides): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_4base_6Object_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_6Object___init__[] = "Initializer.\n\n :param provides: Value that have to be provided.\n :type provides: object\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_4base_6Object_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 196, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 196, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.base.Object.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_6Object___init__(((struct __pyx_obj_19dependency_injector_9providers_4base_Object *)__pyx_v_self), __pyx_v_provides); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_4base_6Object___init__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, PyObject *__pyx_v_provides) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/base.pyx":202 - * :type provides: object - * """ - * self.__provides = provides # <<<<<<<<<<<<<< - * super(Object, self).__init__() - * - */ - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - __Pyx_GOTREF(__pyx_v_self->__pyx___provides); - __Pyx_DECREF(__pyx_v_self->__pyx___provides); - __pyx_v_self->__pyx___provides = __pyx_v_provides; - - /* "dependency_injector/providers/base.pyx":203 - * """ - * self.__provides = provides - * super(Object, self).__init__() # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Object)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Object)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Object)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":196 - * """ - * - * def __init__(self, provides): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.Object.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":205 - * super(Object, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_6Object_2__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_6Object_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_4base_Object *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_v_overriding_provider = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/base.pyx":207 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":208 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/base.pyx":209 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * - * copied = self.__class__(deepcopy(self.__provides, memo)) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":208 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - } - - /* "dependency_injector/providers/base.pyx":211 - * return copied - * - * copied = self.__class__(deepcopy(self.__provides, memo)) # <<<<<<<<<<<<<< - * - * for overriding_provider in self.overridden: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __pyx_v_self->__pyx___provides; - __Pyx_INCREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 211, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":213 - * copied = self.__class__(deepcopy(self.__provides, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 213, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 213, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 213, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_10(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 213, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":214 - * - * for overriding_provider in self.overridden: - * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< - * - * return copied - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 214, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":213 - * copied = self.__class__(deepcopy(self.__provides, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/base.pyx":216 - * copied.override(deepcopy(overriding_provider, memo)) - * - * return copied # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":205 - * super(Object, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("dependency_injector.providers.base.Object.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XDECREF(__pyx_v_overriding_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":218 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_5__str__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_6Object_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_4__str__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_5__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_6Object_4__str__(((struct __pyx_obj_19dependency_injector_9providers_4base_Object *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_4__str__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "dependency_injector/providers/base.pyx":223 - * :rtype: str - * """ - * return represent_provider(provider=self, provides=self.__provides) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_self->__pyx___provides; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":218 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.base.Object.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":225 - * return represent_provider(provider=self, provides=self.__provides) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_7__repr__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_6Object_6__repr__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_6__repr__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_7__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_6Object_6__repr__(((struct __pyx_obj_19dependency_injector_9providers_4base_Object *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_6__repr__(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "dependency_injector/providers/base.pyx":230 - * :rtype: str - * """ - * return self.__str__() # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":225 - * return represent_provider(provider=self, provides=self.__provides) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.Object.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":232 - * return self.__str__() - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return provided instance. - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_9_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_4base_6Object__provide(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_6Object_9_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/base.pyx":243 - * :rtype: object - * """ - * return self.__provides # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___provides); - __pyx_r = __pyx_v_self->__pyx___provides; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":232 - * return self.__str__() - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return provided instance. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.base.Object._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_9_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_6Object_8_provide[] = "Return provided instance.\n\n :param args: Tuple of context positional arguments.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword arguments.\n :type kwargs: dict[str, object]\n\n :rtype: object\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_6Object_9_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 232, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 232, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 232, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.base.Object._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 232, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 232, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_6Object_8_provide(((struct __pyx_obj_19dependency_injector_9providers_4base_Object *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_6Object_8_provide(struct __pyx_obj_19dependency_injector_9providers_4base_Object *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_4base_6Object__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.base.Object._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":256 - * """ - * - * def __init__(self, provides): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_4base_8Delegate_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_8Delegate___init__[] = "Initializer.\n\n :param provides: Value that have to be provided.\n :type provides: object\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_8Delegate___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_4base_8Delegate_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 256, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 256, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.base.Delegate.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_8Delegate___init__(((struct __pyx_obj_19dependency_injector_9providers_4base_Delegate *)__pyx_v_self), __pyx_v_provides); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_4base_8Delegate___init__(struct __pyx_obj_19dependency_injector_9providers_4base_Delegate *__pyx_v_self, PyObject *__pyx_v_provides) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/base.pyx":262 - * :type provides: object - * """ - * super(Delegate, self).__init__(ensure_is_provider(provides)) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Delegate)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Delegate)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Delegate)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_5utils_ensure_is_provider(__pyx_v_provides, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":256 - * """ - * - * def __init__(self, provides): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.base.Delegate.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":287 - * """ - * - * def __init__(self, type instance_of): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__instance_of = instance_of - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency___init__[] = "Initializer."; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyTypeObject *__pyx_v_instance_of = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_instance_of,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_instance_of)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 287, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_instance_of = ((PyTypeObject*)values[0]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 287, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.base.ExternalDependency.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_instance_of), (&PyType_Type), 1, "instance_of", 1))) __PYX_ERR(0, 287, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency___init__(((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self), __pyx_v_instance_of); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency___init__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyTypeObject *__pyx_v_instance_of) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/base.pyx":289 - * def __init__(self, type instance_of): - * """Initializer.""" - * self.__instance_of = instance_of # <<<<<<<<<<<<<< - * super(ExternalDependency, self).__init__() - * - */ - __Pyx_INCREF(((PyObject *)__pyx_v_instance_of)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_instance_of)); - __Pyx_GOTREF(__pyx_v_self->__pyx___instance_of); - __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); - __pyx_v_self->__pyx___instance_of = __pyx_v_instance_of; - - /* "dependency_injector/providers/base.pyx":290 - * """Initializer.""" - * self.__instance_of = instance_of - * super(ExternalDependency, self).__init__() # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":287 - * """ - * - * def __init__(self, type instance_of): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__instance_of = instance_of - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.ExternalDependency.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":292 - * super(ExternalDependency, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_2__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_v_overriding_provider = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/base.pyx":294 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":295 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/base.pyx":296 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * - * copied = self.__class__(self.__instance_of) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":295 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - } - - /* "dependency_injector/providers/base.pyx":298 - * return copied - * - * copied = self.__class__(self.__instance_of) # <<<<<<<<<<<<<< - * - * for overriding_provider in self.overridden: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_self->__pyx___instance_of)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self->__pyx___instance_of)}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self->__pyx___instance_of)}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_self->__pyx___instance_of)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":300 - * copied = self.__class__(self.__instance_of) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 300, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 300, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 300, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 300, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":301 - * - * for overriding_provider in self.overridden: - * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< - * - * return copied - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 301, __pyx_L1_error) - __pyx_t_10.__pyx_n = 1; - __pyx_t_10.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":300 - * copied = self.__class__(self.__instance_of) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/base.pyx":303 - * copied.override(deepcopy(overriding_provider, memo)) - * - * return copied # <<<<<<<<<<<<<< - * - * def __call__(self, *args, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":292 - * super(ExternalDependency, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("dependency_injector.providers.base.ExternalDependency.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XDECREF(__pyx_v_overriding_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":305 - * return copied - * - * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< - * """Return provided instance. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_4__call__[] = "Return provided instance.\n\n :param args: Tuple of context positional arguments.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword arguments.\n :type kwargs: dict[str, object]\n\n :raise: :py:exc:`dependency_injector.errors.Error`\n\n :rtype: object\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_4__call__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_5__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__call__ (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL; - __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_4__call__(((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_4__call__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_v_instance = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - __Pyx_RefNannySetupContext("__call__", 0); - - /* "dependency_injector/providers/base.pyx":320 - * cdef object instance - * - * if self.__overridden_len == 0: # <<<<<<<<<<<<<< - * raise Error('Dependency is not defined') - * - */ - __pyx_t_1 = ((__pyx_v_self->__pyx_base.__pyx___overridden_len == 0) != 0); - if (__pyx_t_1) { - - /* "dependency_injector/providers/base.pyx":321 - * - * if self.__overridden_len == 0: - * raise Error('Dependency is not defined') # <<<<<<<<<<<<<< - * - * instance = self._call_last_overriding(args, kwargs) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 321, __pyx_L1_error) - - /* "dependency_injector/providers/base.pyx":320 - * cdef object instance - * - * if self.__overridden_len == 0: # <<<<<<<<<<<<<< - * raise Error('Dependency is not defined') - * - */ - } - - /* "dependency_injector/providers/base.pyx":323 - * raise Error('Dependency is not defined') - * - * instance = self._call_last_overriding(args, kwargs) # <<<<<<<<<<<<<< - * - * if not isinstance(instance, self.instance_of): - */ - __pyx_t_3 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._call_last_overriding(((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_instance = __pyx_t_3; - __pyx_t_3 = 0; - - /* "dependency_injector/providers/base.pyx":325 - * instance = self._call_last_overriding(args, kwargs) - * - * if not isinstance(instance, self.instance_of): # <<<<<<<<<<<<<< - * raise Error('{0} is not an '.format(instance) + - * 'instance of {0}'.format(self.instance_of)) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_instance_of); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_IsInstance(__pyx_v_instance, __pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 325, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_4) { - - /* "dependency_injector/providers/base.pyx":326 - * - * if not isinstance(instance, self.instance_of): - * raise Error('{0} is not an '.format(instance) + # <<<<<<<<<<<<<< - * 'instance of {0}'.format(self.instance_of)) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_is_not_an, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_7) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_instance); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_instance}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_instance}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_instance); - __Pyx_GIVEREF(__pyx_v_instance); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_instance); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "dependency_injector/providers/base.pyx":327 - * if not isinstance(instance, self.instance_of): - * raise Error('{0} is not an '.format(instance) + - * 'instance of {0}'.format(self.instance_of)) # <<<<<<<<<<<<<< - * - * return instance - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_instance_of_0, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_instance_of); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (!__pyx_t_9) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "dependency_injector/providers/base.pyx":326 - * - * if not isinstance(instance, self.instance_of): - * raise Error('{0} is not an '.format(instance) + # <<<<<<<<<<<<<< - * 'instance of {0}'.format(self.instance_of)) - * - */ - __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_8}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 326, __pyx_L1_error) - - /* "dependency_injector/providers/base.pyx":325 - * instance = self._call_last_overriding(args, kwargs) - * - * if not isinstance(instance, self.instance_of): # <<<<<<<<<<<<<< - * raise Error('{0} is not an '.format(instance) + - * 'instance of {0}'.format(self.instance_of)) - */ - } - - /* "dependency_injector/providers/base.pyx":329 - * 'instance of {0}'.format(self.instance_of)) - * - * return instance # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_instance); - __pyx_r = __pyx_v_instance; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":305 - * return copied - * - * def __call__(self, *args, **kwargs): # <<<<<<<<<<<<<< - * """Return provided instance. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("dependency_injector.providers.base.ExternalDependency.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_instance); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":331 - * return instance - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_7__str__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_6__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_6__str__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_7__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_6__str__(((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_6__str__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "dependency_injector/providers/base.pyx":336 - * :rtype: str - * """ - * return represent_provider(provider=self, provides=self.__instance_of) # <<<<<<<<<<<<<< - * - * def __repr__(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instance_of); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 336, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":331 - * return instance - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.base.ExternalDependency.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":338 - * return represent_provider(provider=self, provides=self.__instance_of) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_9__repr__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_9__repr__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__(((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__repr__", 0); - - /* "dependency_injector/providers/base.pyx":343 - * :rtype: str - * """ - * return self.__str__() # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":338 - * return represent_provider(provider=self, provides=self.__instance_of) - * - * def __repr__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.ExternalDependency.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":346 - * - * @property - * def instance_of(self): # <<<<<<<<<<<<<< - * """Return class of required dependency.""" - * return self.__instance_of - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_11instance_of_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_11instance_of_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_11instance_of___get__(((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_11instance_of___get__(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/base.pyx":348 - * def instance_of(self): - * """Return class of required dependency.""" - * return self.__instance_of # <<<<<<<<<<<<<< - * - * def provided_by(self, provider): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx___instance_of)); - __pyx_r = ((PyObject *)__pyx_v_self->__pyx___instance_of); - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":346 - * - * @property - * def instance_of(self): # <<<<<<<<<<<<<< - * """Return class of required dependency.""" - * return self.__instance_of - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":350 - * return self.__instance_of - * - * def provided_by(self, provider): # <<<<<<<<<<<<<< - * """Set external dependency provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_11provided_by(PyObject *__pyx_v_self, PyObject *__pyx_v_provider); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_10provided_by[] = "Set external dependency provider.\n\n :param provider: Provider that provides required dependency.\n :type provider: :py:class:`Provider`\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_11provided_by(PyObject *__pyx_v_self, PyObject *__pyx_v_provider) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("provided_by (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_10provided_by(((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)__pyx_v_self), ((PyObject *)__pyx_v_provider)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_18ExternalDependency_10provided_by(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *__pyx_v_self, PyObject *__pyx_v_provider) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("provided_by", 0); - - /* "dependency_injector/providers/base.pyx":358 - * :rtype: None - * """ - * return self.override(provider) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_override); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_provider); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_provider}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_provider}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_provider); - __Pyx_GIVEREF(__pyx_v_provider); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_provider); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":350 - * return self.__instance_of - * - * def provided_by(self, provider): # <<<<<<<<<<<<<< - * """Set external dependency provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.base.ExternalDependency.provided_by", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":375 - * """ - * - * def __init__(self, Provider overridden, Provider overriding): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_17OverridingContext___init__[] = "Initializer.\n\n :param overridden: Overridden provider.\n :type overridden: :py:class:`Provider`\n\n :param overriding: Overriding provider.\n :type overriding: :py:class:`Provider`\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_4base_17OverridingContext___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_overridden = 0; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_overriding = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_overridden,&__pyx_n_s_overriding,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overridden)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_overriding)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 375, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 375, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_overridden = ((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)values[0]); - __pyx_v_overriding = ((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 375, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.base.OverridingContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_overridden), __pyx_ptype_19dependency_injector_9providers_4base_Provider, 1, "overridden", 0))) __PYX_ERR(0, 375, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_overriding), __pyx_ptype_19dependency_injector_9providers_4base_Provider, 1, "overriding", 0))) __PYX_ERR(0, 375, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_17OverridingContext___init__(((struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *)__pyx_v_self), __pyx_v_overridden, __pyx_v_overriding); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_4base_17OverridingContext___init__(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *__pyx_v_self, struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_overridden, struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx_v_overriding) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/base.pyx":384 - * :type overriding: :py:class:`Provider` - * """ - * self.__overridden = overridden # <<<<<<<<<<<<<< - * self.__overriding = overriding - * super(OverridingContext, self).__init__() - */ - __Pyx_INCREF(((PyObject *)__pyx_v_overridden)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_overridden)); - __Pyx_GOTREF(__pyx_v_self->__pyx___overridden); - __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___overridden)); - __pyx_v_self->__pyx___overridden = __pyx_v_overridden; - - /* "dependency_injector/providers/base.pyx":385 - * """ - * self.__overridden = overridden - * self.__overriding = overriding # <<<<<<<<<<<<<< - * super(OverridingContext, self).__init__() - * - */ - __Pyx_INCREF(((PyObject *)__pyx_v_overriding)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_overriding)); - __Pyx_GOTREF(__pyx_v_self->__pyx___overriding); - __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___overriding)); - __pyx_v_self->__pyx___overriding = __pyx_v_overriding; - - /* "dependency_injector/providers/base.pyx":386 - * self.__overridden = overridden - * self.__overriding = overriding - * super(OverridingContext, self).__init__() # <<<<<<<<<<<<<< - * - * def __enter__(self): - */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":375 - * """ - * - * def __init__(self, Provider overridden, Provider overriding): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.OverridingContext.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":388 - * super(OverridingContext, self).__init__() - * - * def __enter__(self): # <<<<<<<<<<<<<< - * """Do nothing.""" - * return self.__overriding - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_17OverridingContext_2__enter__[] = "Do nothing."; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_3__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_17OverridingContext_2__enter__(((struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_17OverridingContext_2__enter__(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__", 0); - - /* "dependency_injector/providers/base.pyx":390 - * def __enter__(self): - * """Do nothing.""" - * return self.__overriding # <<<<<<<<<<<<<< - * - * def __exit__(self, *_): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx___overriding)); - __pyx_r = ((PyObject *)__pyx_v_self->__pyx___overriding); - goto __pyx_L0; - - /* "dependency_injector/providers/base.pyx":388 - * super(OverridingContext, self).__init__() - * - * def __enter__(self): # <<<<<<<<<<<<<< - * """Do nothing.""" - * return self.__overriding - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/base.pyx":392 - * return self.__overriding - * - * def __exit__(self, *_): # <<<<<<<<<<<<<< - * """Exit overriding context.""" - * self.__overridden.reset_last_overriding() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_4base_17OverridingContext_4__exit__[] = "Exit overriding context."; -static PyObject *__pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_5__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v__ = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__exit__", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v__ = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_4base_17OverridingContext_4__exit__(((struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *)__pyx_v_self), __pyx_v__); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v__); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_4base_17OverridingContext_4__exit__(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v__) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__exit__", 0); - - /* "dependency_injector/providers/base.pyx":394 - * def __exit__(self, *_): - * """Exit overriding context.""" - * self.__overridden.reset_last_overriding() # <<<<<<<<<<<<<< - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___overridden), __pyx_n_s_reset_last_overriding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/base.pyx":392 - * return self.__overriding - * - * def __exit__(self, *_): # <<<<<<<<<<<<<< - * """Exit overriding context.""" - * self.__overridden.reset_last_overriding() - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.base.OverridingContext.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_vtable_19dependency_injector_9providers_4base_Provider; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_Provider(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)o); - p->__pyx_vtab = __pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - p->__pyx___overridden = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_4base_Provider(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *p = (struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___overridden); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_4base_Provider(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *p = (struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)o; - if (p->__pyx___overridden) { - e = (*v)(p->__pyx___overridden, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_4base_Provider(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *p = (struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)o; - tmp = ((PyObject*)p->__pyx___overridden); - p->__pyx___overridden = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_4base_8Provider_overridden(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_4base_8Provider_10overridden_1__get__(o); -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_4base_Provider[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_5__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_4base_8Provider_4__deepcopy__}, - {"override", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_11override, METH_O, __pyx_doc_19dependency_injector_9providers_4base_8Provider_10override}, - {"reset_last_overriding", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_13reset_last_overriding, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_4base_8Provider_12reset_last_overriding}, - {"reset_override", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_15reset_override, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_4base_8Provider_14reset_override}, - {"delegate", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_17delegate, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_4base_8Provider_16delegate}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_19_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_4base_8Provider_18_provide}, - {"_call_last_overriding", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_8Provider_21_call_last_overriding, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_4base_8Provider_20_call_last_overriding}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_4base_Provider[] = { - {(char *)"overridden", __pyx_getprop_19dependency_injector_9providers_4base_8Provider_overridden, 0, (char *)"Return tuple of overriding providers.", 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_4base_Provider = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.base.Provider", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Provider), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_4base_Provider, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_pw_19dependency_injector_9providers_4base_8Provider_9__repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - __pyx_pw_19dependency_injector_9providers_4base_8Provider_3__call__, /*tp_call*/ - __pyx_pw_19dependency_injector_9providers_4base_8Provider_7__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Base provider class.\n\n :py:class:`Provider` is callable (implements ``__call__`` method). Every\n call to provider object returns provided result, according to the providing\n strategy of particular provider. This ``callable`` functionality is a\n regular part of providers API and it should be the same for all provider's\n subclasses.\n\n Implementation of particular providing strategy should be done in\n :py:meth:`Provider._provide` of :py:class:`Provider` subclass. Current\n method is called every time when not overridden provider is called.\n\n :py:class:`Provider` implements provider overriding logic that should be\n also common for all providers:\n\n .. code-block:: python\n\n provider1 = Factory(SomeClass)\n provider2 = Factory(ChildSomeClass)\n\n provider1.override(provider2)\n\n some_instance = provider1()\n assert isinstance(some_instance, ChildSomeClass)\n\n Also :py:class:`Provider` implements helper function for creating its\n delegates:\n\n .. code-block:: python\n\n provider = Factory(object)\n delegate = provider.delegate()\n\n delegated = delegate()\n\n assert provider is delegated\n\n All providers should extend this class.\n\n .. py:attribute:: overridden\n\n Tuple of overriding providers, if any.\n\n :type: tuple[:py:class:`Provider`] | None\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_4base_Provider, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_4base_Provider, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_4base_Provider, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19dependency_injector_9providers_4base_Provider, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_4base_8Provider_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_4base_Provider, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object __pyx_vtable_19dependency_injector_9providers_4base_Object; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_Object(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_4base_Object *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_4base_Provider(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_4base_Object *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_4base_Object; - p->__pyx___provides = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_4base_Object(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_4base_Object *p = (struct __pyx_obj_19dependency_injector_9providers_4base_Object *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___provides); - PyObject_GC_Track(o); - __pyx_tp_dealloc_19dependency_injector_9providers_4base_Provider(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_4base_Object(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_4base_Object *p = (struct __pyx_obj_19dependency_injector_9providers_4base_Object *)o; - e = __pyx_tp_traverse_19dependency_injector_9providers_4base_Provider(o, v, a); if (e) return e; - if (p->__pyx___provides) { - e = (*v)(p->__pyx___provides, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_4base_Object(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_4base_Object *p = (struct __pyx_obj_19dependency_injector_9providers_4base_Object *)o; - __pyx_tp_clear_19dependency_injector_9providers_4base_Provider(o); - tmp = ((PyObject*)p->__pyx___provides); - p->__pyx___provides = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_4base_Object[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_6Object_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_4base_6Object_2__deepcopy__}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_6Object_9_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_4base_6Object_8_provide}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_4base_Object = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.base.Object", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Object), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_4base_Object, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_pw_19dependency_injector_9providers_4base_6Object_7__repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_4base_8Provider_3__call__, /*tp_call*/ - #else - 0, /*tp_call*/ - #endif - __pyx_pw_19dependency_injector_9providers_4base_6Object_5__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Object provider returns provided instance \"as is\".\n\n .. py:attribute:: provides\n\n Value that have to be provided.\n\n :type: object\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_4base_Object, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_4base_Object, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_4base_Object, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_4base_6Object_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_4base_Object, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate __pyx_vtable_19dependency_injector_9providers_4base_Delegate; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_Delegate(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_4base_Delegate *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_4base_Object(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_4base_Delegate *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate; - return o; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_4base_Delegate[] = { - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_4base_Delegate = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.base.Delegate", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Delegate), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_4base_Object, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_4base_6Object_7__repr__, /*tp_repr*/ - #else - 0, /*tp_repr*/ - #endif - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_4base_8Provider_3__call__, /*tp_call*/ - #else - 0, /*tp_call*/ - #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_4base_6Object_5__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Delegate provider returns provider \"as is\".\n\n .. py:attribute:: provides\n\n Value that have to be provided.\n\n :type: object\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_4base_Object, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_4base_Object, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_4base_Delegate, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_4base_8Delegate_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_4base_Delegate, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency __pyx_vtable_19dependency_injector_9providers_4base_ExternalDependency; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_ExternalDependency(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_4base_Provider(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency; - p->__pyx___instance_of = ((PyTypeObject*)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_4base_ExternalDependency(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *p = (struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___instance_of); - PyObject_GC_Track(o); - __pyx_tp_dealloc_19dependency_injector_9providers_4base_Provider(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_4base_ExternalDependency(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *p = (struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)o; - e = __pyx_tp_traverse_19dependency_injector_9providers_4base_Provider(o, v, a); if (e) return e; - if (p->__pyx___instance_of) { - e = (*v)(p->__pyx___instance_of, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_4base_ExternalDependency(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *p = (struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency *)o; - __pyx_tp_clear_19dependency_injector_9providers_4base_Provider(o); - tmp = ((PyObject*)p->__pyx___instance_of); - p->__pyx___instance_of = ((PyTypeObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_4base_18ExternalDependency_instance_of(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_11instance_of_1__get__(o); -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_4base_ExternalDependency[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_2__deepcopy__}, - {"provided_by", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_11provided_by, METH_O, __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_10provided_by}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_4base_ExternalDependency[] = { - {(char *)"instance_of", __pyx_getprop_19dependency_injector_9providers_4base_18ExternalDependency_instance_of, 0, (char *)"Return class of required dependency.", 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_4base_ExternalDependency = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.base.ExternalDependency", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_4base_ExternalDependency, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - __pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_9__repr__, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - __pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_5__call__, /*tp_call*/ - __pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_7__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - ":py:class:`ExternalDependency` provider describes dependency interface.\n\n This provider is used for description of dependency interface. That might\n be useful when dependency could be provided in the client's code only,\n but it's interface is known. Such situations could happen when required\n dependency has non-determenistic list of dependencies itself.\n\n .. code-block:: python\n\n database_provider = ExternalDependency(sqlite3.dbapi2.Connection)\n database_provider.override(Factory(sqlite3.connect, ':memory:'))\n\n database = database_provider()\n\n .. py:attribute:: instance_of\n\n Class of required dependency.\n\n :type: type\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_4base_ExternalDependency, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_4base_ExternalDependency, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_4base_ExternalDependency, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19dependency_injector_9providers_4base_ExternalDependency, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_4base_18ExternalDependency_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_4base_ExternalDependency, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_4base_OverridingContext(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *)o); - p->__pyx___overridden = ((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)Py_None); Py_INCREF(Py_None); - p->__pyx___overriding = ((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_4base_OverridingContext(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *p = (struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___overridden); - Py_CLEAR(p->__pyx___overriding); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_4base_OverridingContext(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *p = (struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *)o; - if (p->__pyx___overridden) { - e = (*v)(((PyObject*)p->__pyx___overridden), a); if (e) return e; - } - if (p->__pyx___overriding) { - e = (*v)(((PyObject*)p->__pyx___overriding), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_4base_OverridingContext(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *p = (struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext *)o; - tmp = ((PyObject*)p->__pyx___overridden); - p->__pyx___overridden = ((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx___overriding); - p->__pyx___overriding = ((struct __pyx_obj_19dependency_injector_9providers_4base_Provider *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_4base_OverridingContext[] = { - {"__enter__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_3__enter__, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_4base_17OverridingContext_2__enter__}, - {"__exit__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_5__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_4base_17OverridingContext_4__exit__}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_4base_OverridingContext = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.base.OverridingContext", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_4base_OverridingContext, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Provider overriding context.\n\n :py:class:`OverridingContext` is used by :py:meth:`Provider.override` for\n implemeting ``with`` contexts. When :py:class:`OverridingContext` is\n closed, overriding that was created in this context is dropped also.\n\n .. code-block:: python\n\n with provider.override(another_provider):\n assert provider.overridden\n assert not provider.overridden\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_4base_OverridingContext, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_4base_OverridingContext, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_4base_OverridingContext, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_4base_17OverridingContext_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_4base_OverridingContext, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "base", - __pyx_k_Dependency_injector_base_provide, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_0_is_not_an, __pyx_k_0_is_not_an, sizeof(__pyx_k_0_is_not_an), 0, 0, 1, 0}, - {&__pyx_kp_s_Dependency_is_not_defined, __pyx_k_Dependency_is_not_defined, sizeof(__pyx_k_Dependency_is_not_defined), 0, 0, 1, 0}, - {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, - {&__pyx_n_s_IS_PROVIDER, __pyx_k_IS_PROVIDER, sizeof(__pyx_k_IS_PROVIDER), 0, 0, 1, 1}, - {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, - {&__pyx_kp_s_Provider_0_could_not_be_overridd, __pyx_k_Provider_0_could_not_be_overridd, sizeof(__pyx_k_Provider_0_could_not_be_overridd), 0, 0, 1, 0}, - {&__pyx_kp_s_Provider_0_is_not_overridden, __pyx_k_Provider_0_is_not_overridden, sizeof(__pyx_k_Provider_0_is_not_overridden), 0, 0, 1, 0}, - {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, - {&__pyx_n_s_call_last_overriding, __pyx_k_call_last_overriding, sizeof(__pyx_k_call_last_overriding), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_dependency_injector_errors, __pyx_k_dependency_injector_errors, sizeof(__pyx_k_dependency_injector_errors), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_instance_of, __pyx_k_instance_of, sizeof(__pyx_k_instance_of), 0, 0, 1, 1}, - {&__pyx_kp_s_instance_of_0, __pyx_k_instance_of_0, sizeof(__pyx_k_instance_of_0), 0, 0, 1, 0}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_overridden, __pyx_k_overridden, sizeof(__pyx_k_overridden), 0, 0, 1, 1}, - {&__pyx_n_s_override, __pyx_k_override, sizeof(__pyx_k_override), 0, 0, 1, 1}, - {&__pyx_n_s_overriding, __pyx_k_overriding, sizeof(__pyx_k_overriding), 0, 0, 1, 1}, - {&__pyx_n_s_provide, __pyx_k_provide, sizeof(__pyx_k_provide), 0, 0, 1, 1}, - {&__pyx_n_s_provides, __pyx_k_provides, sizeof(__pyx_k_provides), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_reset_last_overriding, __pyx_k_reset_last_overriding, sizeof(__pyx_k_reset_last_overriding), 0, 0, 1, 1}, - {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, - {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 72, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 85, __pyx_L1_error) - __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 176, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "dependency_injector/providers/base.pyx":321 - * - * if self.__overridden_len == 0: - * raise Error('Dependency is not defined') # <<<<<<<<<<<<<< - * - * instance = self._call_last_overriding(args, kwargs) - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Dependency_is_not_defined); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initbase(void); /*proto*/ -PyMODINIT_FUNC initbase(void) -#else -PyMODINIT_FUNC PyInit_base(void); /*proto*/ -PyMODINIT_FUNC PyInit_base(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_base(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("base", __pyx_methods, __pyx_k_Dependency_injector_base_provide, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_dependency_injector__providers__base) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "dependency_injector.providers.base")) { - if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers.base", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - __pyx_vtabptr_19dependency_injector_9providers_4base_Provider = &__pyx_vtable_19dependency_injector_9providers_4base_Provider; - __pyx_vtable_19dependency_injector_9providers_4base_Provider._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_4base_8Provider__provide; - __pyx_vtable_19dependency_injector_9providers_4base_Provider._call_last_overriding = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_4base_8Provider__call_last_overriding; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_4base_Provider) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_4base_Provider.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Provider, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 19, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider___init__.doc = __pyx_doc_19dependency_injector_9providers_4base_8Provider___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider___init__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Provider, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 19, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_2__call__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_2__call__.doc = __pyx_doc_19dependency_injector_9providers_4base_8Provider_2__call__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_2__call__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Provider, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 19, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_6__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_6__str__.doc = __pyx_doc_19dependency_injector_9providers_4base_8Provider_6__str__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_6__str__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Provider, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 19, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_8__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_8__repr__.doc = __pyx_doc_19dependency_injector_9providers_4base_8Provider_8__repr__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_8Provider_8__repr__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_4base_Provider.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_4base_Provider) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Provider", (PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Provider) < 0) __PYX_ERR(0, 19, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_Provider = &__pyx_type_19dependency_injector_9providers_4base_Provider; - __pyx_vtabptr_19dependency_injector_9providers_4base_Object = &__pyx_vtable_19dependency_injector_9providers_4base_Object; - __pyx_vtable_19dependency_injector_9providers_4base_Object.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - __pyx_vtable_19dependency_injector_9providers_4base_Object.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_4base_6Object__provide; - __pyx_type_19dependency_injector_9providers_4base_Object.tp_base = __pyx_ptype_19dependency_injector_9providers_4base_Provider; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_4base_Object) < 0) __PYX_ERR(0, 186, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_4base_Object.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Object, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 186, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object___init__.doc = __pyx_doc_19dependency_injector_9providers_4base_6Object___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_6Object___init__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Object, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 186, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_4__str__.doc = __pyx_doc_19dependency_injector_9providers_4base_6Object_4__str__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_4__str__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Object, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 186, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_6__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_6__repr__.doc = __pyx_doc_19dependency_injector_9providers_4base_6Object_6__repr__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_6Object_6__repr__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_4base_Object.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_4base_Object) < 0) __PYX_ERR(0, 186, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Object", (PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Object) < 0) __PYX_ERR(0, 186, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_Object = &__pyx_type_19dependency_injector_9providers_4base_Object; - __pyx_vtabptr_19dependency_injector_9providers_4base_Delegate = &__pyx_vtable_19dependency_injector_9providers_4base_Delegate; - __pyx_vtable_19dependency_injector_9providers_4base_Delegate.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_4base_Object; - __pyx_type_19dependency_injector_9providers_4base_Delegate.tp_base = __pyx_ptype_19dependency_injector_9providers_4base_Object; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_4base_Delegate) < 0) __PYX_ERR(0, 246, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_4base_Delegate.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Delegate, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 246, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Delegate___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_8Delegate___init__.doc = __pyx_doc_19dependency_injector_9providers_4base_8Delegate___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_8Delegate___init__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_4base_Delegate.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_4base_Delegate) < 0) __PYX_ERR(0, 246, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Delegate", (PyObject *)&__pyx_type_19dependency_injector_9providers_4base_Delegate) < 0) __PYX_ERR(0, 246, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_Delegate = &__pyx_type_19dependency_injector_9providers_4base_Delegate; - __pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency = &__pyx_vtable_19dependency_injector_9providers_4base_ExternalDependency; - __pyx_vtable_19dependency_injector_9providers_4base_ExternalDependency.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - __pyx_type_19dependency_injector_9providers_4base_ExternalDependency.tp_base = __pyx_ptype_19dependency_injector_9providers_4base_Provider; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_4base_ExternalDependency) < 0) __PYX_ERR(0, 265, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_4base_ExternalDependency.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_ExternalDependency, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 265, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency___init__.doc = __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency___init__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_ExternalDependency, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(0, 265, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_4__call__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_4__call__.doc = __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_4__call__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_4__call__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_ExternalDependency, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 265, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_6__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_6__str__.doc = __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_6__str__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_6__str__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_ExternalDependency, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 265, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__.doc = __pyx_doc_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_18ExternalDependency_8__repr__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_4base_ExternalDependency.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency) < 0) __PYX_ERR(0, 265, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "ExternalDependency", (PyObject *)&__pyx_type_19dependency_injector_9providers_4base_ExternalDependency) < 0) __PYX_ERR(0, 265, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = &__pyx_type_19dependency_injector_9providers_4base_ExternalDependency; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_4base_OverridingContext) < 0) __PYX_ERR(0, 361, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_4base_OverridingContext.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_4base_OverridingContext, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 361, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_4base_17OverridingContext___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_4base_17OverridingContext___init__.doc = __pyx_doc_19dependency_injector_9providers_4base_17OverridingContext___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_4base_17OverridingContext___init__; - } - } - #endif - if (PyObject_SetAttrString(__pyx_m, "OverridingContext", (PyObject *)&__pyx_type_19dependency_injector_9providers_4base_OverridingContext) < 0) __PYX_ERR(0, 361, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = &__pyx_type_19dependency_injector_9providers_4base_OverridingContext; - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "CLASS_TYPES", (void **)&__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*--- Function import code ---*/ - __pyx_t_2 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "is_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_is_provider, "int (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "ensure_is_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_ensure_is_provider, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "represent_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_represent_provider, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "deepcopy", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "dependency_injector/providers/base.pyx":8 - * cimport cython - * - * from dependency_injector.errors import Error # <<<<<<<<<<<<<< - * - * from .utils cimport ( - */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_n_s_Error); - __Pyx_GIVEREF(__pyx_n_s_Error); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Error); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_dependency_injector_errors, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_3) < 0) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "dependency_injector/providers/base.pyx":66 - * """ - * - * __IS_PROVIDER__ = True # <<<<<<<<<<<<<< - * - * def __init__(self): - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dict, __pyx_n_s_IS_PROVIDER, Py_True) < 0) __PYX_ERR(0, 66, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_4base_Provider); - - /* "dependency_injector/providers/base.pyx":1 - * """Dependency injector base providers. # <<<<<<<<<<<<<< - * - * Powered by Cython. - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init dependency_injector.providers.base", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers.base"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* KeywordStringCheck */ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* SliceTupleAndList */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) { - Py_ssize_t start = *_start, stop = *_stop, length = *_length; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - stop += length; - else if (stop > length) - stop = length; - *_length = stop - start; - *_start = start; - *_stop = stop; -} -static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { - PyObject *v; - Py_ssize_t i; - for (i = 0; i < length; i++) { - v = dest[i] = src[i]; - Py_INCREF(v); - } -} -static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice( - PyObject* src, Py_ssize_t start, Py_ssize_t stop) { - PyObject* dest; - Py_ssize_t length = PyList_GET_SIZE(src); - __Pyx_crop_slice(&start, &stop, &length); - if (unlikely(length <= 0)) - return PyList_New(0); - dest = PyList_New(length); - if (unlikely(!dest)) - return NULL; - __Pyx_copy_object_array( - ((PyListObject*)src)->ob_item + start, - ((PyListObject*)dest)->ob_item, - length); - return dest; -} -static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice( - PyObject* src, Py_ssize_t start, Py_ssize_t stop) { - PyObject* dest; - Py_ssize_t length = PyTuple_GET_SIZE(src); - __Pyx_crop_slice(&start, &stop, &length); - if (unlikely(length <= 0)) - return PyTuple_New(0); - dest = PyTuple_New(length); - if (unlikely(!dest)) - return NULL; - __Pyx_copy_object_array( - ((PyTupleObject*)src)->ob_item + start, - ((PyTupleObject*)dest)->ob_item, - length); - return dest; -} -#endif - -/* RaiseDoubleKeywords */ - static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ - static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* VoidPtrImport */ - #ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, name); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C variable %.200s", - PyModule_GetName(module), name); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); - goto bad; - } - *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif - if (!(*p)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* FunctionImport */ - #ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, funcname); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C function %.200s", - PyModule_GetName(module), funcname); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); - goto bad; - } - tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif - *f = tmp.fp; - if (!(*f)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers/base.pxd b/src/dependency_injector/providers/base.pxd deleted file mode 100644 index 29f895c3..00000000 --- a/src/dependency_injector/providers/base.pxd +++ /dev/null @@ -1,31 +0,0 @@ -"""Dependency injector base providers. - -Powered by Cython. -""" - - -cdef class Provider(object): - cdef tuple __overridden - cdef int __overridden_len - - cpdef object _provide(self, tuple args, dict kwargs) - cpdef object _call_last_overriding(self, tuple args, dict kwargs) - - -cdef class Object(Provider): - cdef object __provides - - cpdef object _provide(self, tuple args, dict kwargs) - - -cdef class Delegate(Object): - pass - - -cdef class ExternalDependency(Provider): - cdef type __instance_of - - -cdef class OverridingContext(object): - cdef Provider __overridden - cdef Provider __overriding diff --git a/src/dependency_injector/providers/base.pyx b/src/dependency_injector/providers/base.pyx deleted file mode 100644 index 1d072a5a..00000000 --- a/src/dependency_injector/providers/base.pyx +++ /dev/null @@ -1,394 +0,0 @@ -"""Dependency injector base providers. - -Powered by Cython. -""" - -cimport cython - -from dependency_injector.errors import Error - -from .utils cimport ( - CLASS_TYPES, - is_provider, - ensure_is_provider, - represent_provider, - deepcopy, -) - - -cdef class Provider(object): - """Base provider class. - - :py:class:`Provider` is callable (implements ``__call__`` method). Every - call to provider object returns provided result, according to the providing - strategy of particular provider. This ``callable`` functionality is a - regular part of providers API and it should be the same for all provider's - subclasses. - - Implementation of particular providing strategy should be done in - :py:meth:`Provider._provide` of :py:class:`Provider` subclass. Current - method is called every time when not overridden provider is called. - - :py:class:`Provider` implements provider overriding logic that should be - also common for all providers: - - .. code-block:: python - - provider1 = Factory(SomeClass) - provider2 = Factory(ChildSomeClass) - - provider1.override(provider2) - - some_instance = provider1() - assert isinstance(some_instance, ChildSomeClass) - - Also :py:class:`Provider` implements helper function for creating its - delegates: - - .. code-block:: python - - provider = Factory(object) - delegate = provider.delegate() - - delegated = delegate() - - assert provider is delegated - - All providers should extend this class. - - .. py:attribute:: overridden - - Tuple of overriding providers, if any. - - :type: tuple[:py:class:`Provider`] | None - """ - - __IS_PROVIDER__ = True - - def __init__(self): - """Initializer.""" - self.__overridden = tuple() - self.__overridden_len = 0 - super(Provider, self).__init__() - - def __call__(self, *args, **kwargs): - """Return provided object. - - Callable interface implementation. - """ - if self.__overridden_len != 0: - return self._call_last_overriding(args, kwargs) - return self._provide(args, kwargs) - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - - copied = self.__class__() - - for overriding_provider in self.overridden: - copied.override(deepcopy(overriding_provider, memo)) - - return copied - - def __str__(self): - """Return string representation of provider. - - :rtype: str - """ - return represent_provider(provider=self, provides=None) - - def __repr__(self): - """Return string representation of provider. - - :rtype: str - """ - return self.__str__() - - @property - def overridden(self): - """Return tuple of overriding providers.""" - return self.__overridden - - def override(self, provider): - """Override provider with another provider. - - :param provider: Overriding provider. - :type provider: :py:class:`Provider` - - :raise: :py:exc:`dependency_injector.errors.Error` - - :return: Overriding context. - :rtype: :py:class:`OverridingContext` - """ - if provider is self: - raise Error('Provider {0} could not be overridden ' - 'with itself'.format(self)) - - if not is_provider(provider): - provider = Object(provider) - - self.__overridden += (provider,) - self.__overridden_len += 1 - - return OverridingContext(self, provider) - - @cython.boundscheck(False) - @cython.wraparound(False) - def reset_last_overriding(self): - """Reset last overriding provider. - - :raise: :py:exc:`dependency_injector.errors.Error` if provider is not - overridden. - - :rtype: None - """ - if self.__overridden_len == 0: - raise Error('Provider {0} is not overridden'.format(str(self))) - - self.__overridden = self.__overridden[:self.__overridden_len - 1] - self.__overridden_len -= 1 - - def reset_override(self): - """Reset all overriding providers. - - :rtype: None - """ - self.__overridden = tuple() - self.__overridden_len = 0 - - def delegate(self): - """Return provider's delegate. - - :rtype: :py:class:`Delegate` - """ - return Delegate(self) - - cpdef object _provide(self, tuple args, dict kwargs): - """Providing strategy implementation. - - Abstract protected method that implements providing strategy of - particular provider. Current method is called every time when not - overridden provider is called. Need to be overridden in subclasses. - """ - raise NotImplementedError() - - @cython.boundscheck(False) - @cython.wraparound(False) - cpdef object _call_last_overriding(self, tuple args, dict kwargs): - """Call last overriding provider and return result.""" - return self.__overridden[self.__overridden_len - 1](*args, - **kwargs) - - -cdef class Object(Provider): - """Object provider returns provided instance "as is". - - .. py:attribute:: provides - - Value that have to be provided. - - :type: object - """ - - def __init__(self, provides): - """Initializer. - - :param provides: Value that have to be provided. - :type provides: object - """ - self.__provides = provides - super(Object, self).__init__() - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - - copied = self.__class__(deepcopy(self.__provides, memo)) - - for overriding_provider in self.overridden: - copied.override(deepcopy(overriding_provider, memo)) - - return copied - - def __str__(self): - """Return string representation of provider. - - :rtype: str - """ - return represent_provider(provider=self, provides=self.__provides) - - def __repr__(self): - """Return string representation of provider. - - :rtype: str - """ - return self.__str__() - - cpdef object _provide(self, tuple args, dict kwargs): - """Return provided instance. - - :param args: Tuple of context positional arguments. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword arguments. - :type kwargs: dict[str, object] - - :rtype: object - """ - return self.__provides - - -cdef class Delegate(Object): - """Delegate provider returns provider "as is". - - .. py:attribute:: provides - - Value that have to be provided. - - :type: object - """ - - def __init__(self, provides): - """Initializer. - - :param provides: Value that have to be provided. - :type provides: object - """ - super(Delegate, self).__init__(ensure_is_provider(provides)) - - -cdef class ExternalDependency(Provider): - """:py:class:`ExternalDependency` provider describes dependency interface. - - This provider is used for description of dependency interface. That might - be useful when dependency could be provided in the client's code only, - but it's interface is known. Such situations could happen when required - dependency has non-determenistic list of dependencies itself. - - .. code-block:: python - - database_provider = ExternalDependency(sqlite3.dbapi2.Connection) - database_provider.override(Factory(sqlite3.connect, ':memory:')) - - database = database_provider() - - .. py:attribute:: instance_of - - Class of required dependency. - - :type: type - """ - - def __init__(self, type instance_of): - """Initializer.""" - self.__instance_of = instance_of - super(ExternalDependency, self).__init__() - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - - copied = self.__class__(self.__instance_of) - - for overriding_provider in self.overridden: - copied.override(deepcopy(overriding_provider, memo)) - - return copied - - def __call__(self, *args, **kwargs): - """Return provided instance. - - :param args: Tuple of context positional arguments. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword arguments. - :type kwargs: dict[str, object] - - :raise: :py:exc:`dependency_injector.errors.Error` - - :rtype: object - """ - cdef object instance - - if self.__overridden_len == 0: - raise Error('Dependency is not defined') - - instance = self._call_last_overriding(args, kwargs) - - if not isinstance(instance, self.instance_of): - raise Error('{0} is not an '.format(instance) + - 'instance of {0}'.format(self.instance_of)) - - return instance - - def __str__(self): - """Return string representation of provider. - - :rtype: str - """ - return represent_provider(provider=self, provides=self.__instance_of) - - def __repr__(self): - """Return string representation of provider. - - :rtype: str - """ - return self.__str__() - - @property - def instance_of(self): - """Return class of required dependency.""" - return self.__instance_of - - def provided_by(self, provider): - """Set external dependency provider. - - :param provider: Provider that provides required dependency. - :type provider: :py:class:`Provider` - - :rtype: None - """ - return self.override(provider) - - -cdef class OverridingContext(object): - """Provider overriding context. - - :py:class:`OverridingContext` is used by :py:meth:`Provider.override` for - implemeting ``with`` contexts. When :py:class:`OverridingContext` is - closed, overriding that was created in this context is dropped also. - - .. code-block:: python - - with provider.override(another_provider): - assert provider.overridden - assert not provider.overridden - """ - - def __init__(self, Provider overridden, Provider overriding): - """Initializer. - - :param overridden: Overridden provider. - :type overridden: :py:class:`Provider` - - :param overriding: Overriding provider. - :type overriding: :py:class:`Provider` - """ - self.__overridden = overridden - self.__overriding = overriding - super(OverridingContext, self).__init__() - - def __enter__(self): - """Do nothing.""" - return self.__overriding - - def __exit__(self, *_): - """Exit overriding context.""" - self.__overridden.reset_last_overriding() diff --git a/src/dependency_injector/providers/callables.c b/src/dependency_injector/providers/callables.c deleted file mode 100644 index b852aa20..00000000 --- a/src/dependency_injector/providers/callables.c +++ /dev/null @@ -1,6540 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__dependency_injector__providers__callables -#define __PYX_HAVE_API__dependency_injector__providers__callables -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/dependency_injector/providers/callables.pyx", - "src/dependency_injector/providers/injections.pxd", - "src/dependency_injector/providers/callables.pxd", - "src/dependency_injector/providers/base.pxd", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider; -struct __pyx_obj_19dependency_injector_9providers_4base_Object; -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate; -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency; -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext; -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection; -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection; -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection; -struct __pyx_obj_19dependency_injector_9providers_9callables_Callable; -struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable; -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy; - -/* "utils.pxd":21 - * - * - * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< - */ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy { - int __pyx_n; - PyObject *memo; -}; - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider { - PyObject_HEAD - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtab; - PyObject *__pyx___overridden; - int __pyx___overridden_len; -}; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Object { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; -}; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate { - struct __pyx_obj_19dependency_injector_9providers_4base_Object __pyx_base; -}; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyTypeObject *__pyx___instance_of; -}; - - -/* "base.pxd":29 - * - * - * cdef class OverridingContext(object): # <<<<<<<<<<<<<< - * cdef Provider __overridden - * cdef Provider __overriding - */ -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext { - PyObject_HEAD - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overridden; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overriding; -}; - - -/* "injections.pxd":9 - * - * - * cdef class Injection(object): # <<<<<<<<<<<<<< - * cdef object __value - * cdef int __is_provider - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection { - PyObject_HEAD - PyObject *__pyx___value; - int __pyx___is_provider; - int __pyx___is_delegated; - int __pyx___call; -}; - - -/* "injections.pxd":16 - * - * - * cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; -}; - - -/* "injections.pxd":20 - * - * - * cdef class NamedInjection(Injection): # <<<<<<<<<<<<<< - * cdef object __name - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; - PyObject *__pyx___name; -}; - - -/* "dependency_injector/providers/callables.pxd":16 - * - * - * cdef class Callable(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_9callables_Callable { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; - PyObject *__pyx___args; - int __pyx___args_len; - PyObject *__pyx___kwargs; - int __pyx___kwargs_len; -}; - - -/* "dependency_injector/providers/callables.pxd":28 - * - * - * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable { - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable __pyx_base; -}; - - - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider { - PyObject *(*_provide)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*_call_last_overriding)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object *__pyx_vtabptr_19dependency_injector_9providers_4base_Object; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate *__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency *__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency; - - -/* "dependency_injector/providers/callables.pyx":21 - * - * - * cdef class Callable(Provider): # <<<<<<<<<<<<<< - * r"""Callable provider calls wrapped callable on every call. - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable *__pyx_vtabptr_19dependency_injector_9providers_9callables_Callable; - - -/* "dependency_injector/providers/callables.pyx":202 - * - * - * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< - * """Callable that is injected "as is". - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable { - struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable *__pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* CallableCheck.proto */ -#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) -#else -#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) -#endif - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* StringJoin.proto */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyString_Join __Pyx_PyBytes_Join -#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) -#else -#define __Pyx_PyString_Join PyUnicode_Join -#define __Pyx_PyBaseString_Join PyUnicode_Join -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION < 3 - #define __Pyx_PyBytes_Join _PyString_Join - #else - #define __Pyx_PyBytes_Join _PyBytes_Join - #endif -#else -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -/* KeywordStringCheck.proto */ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* PyDictContains.proto */ -static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { - int result = PyDict_Contains(dict, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* CallNextTpDealloc.proto */ -static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); - -/* CallNextTpTraverse.proto */ -static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); - -/* CallNextTpClear.proto */ -static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); - -/* GetVTable.proto */ -static void* __Pyx_GetVtable(PyObject *dict); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -/* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); - -/* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -static PyObject *__pyx_f_19dependency_injector_9providers_9callables_8Callable__provide(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ - -/* Module declarations from 'dependency_injector.providers.base' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Provider = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Object = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Delegate = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = 0; - -/* Module declarations from 'cython' */ - -/* Module declarations from 'dependency_injector.providers.injections' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_Injection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(PyObject *, PyObject *, int); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(PyObject *, PyObject *, int); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections)(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_10injections_parse_named_injections)(PyObject *, int __pyx_skip_dispatch); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.utils' */ -static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0; -#define __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES (*__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES) -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_represent_provider)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_deepcopy)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.callables' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_Callable = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *, PyObject *, PyObject *); /*proto*/ -#define __Pyx_MODULE_NAME "dependency_injector.providers.callables" -int __pyx_module_is_main_dependency_injector__providers__callables = 0; - -/* Implementation of 'dependency_injector.providers.callables' */ -static PyObject *__pyx_builtin_super; -static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_range; -static const char __pyx_k_[] = "."; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_args[] = "args"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_join[] = "join"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_Error[] = "Error"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_super[] = "super"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_kwargs[] = "kwargs"; -static const char __pyx_k_module[] = "__module__"; -static const char __pyx_k_provide[] = "_provide"; -static const char __pyx_k_override[] = "override"; -static const char __pyx_k_provides[] = "provides"; -static const char __pyx_k_set_args[] = "set_args"; -static const char __pyx_k_overridden[] = "overridden"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_set_kwargs[] = "set_kwargs"; -static const char __pyx_k_IS_DELEGATED[] = "__IS_DELEGATED__"; -static const char __pyx_k_dependency_injector_errors[] = "dependency_injector.errors"; -static const char __pyx_k_Dependency_injector_callable_pro[] = "Dependency injector callable providers.\n\nPowered by Cython.\n"; -static const char __pyx_k_Provider_0_expected_to_get_calla[] = "Provider {0} expected to get callable, got {0}"; -static PyObject *__pyx_kp_s_; -static PyObject *__pyx_n_s_Error; -static PyObject *__pyx_n_s_IS_DELEGATED; -static PyObject *__pyx_kp_s_Provider_0_expected_to_get_calla; -static PyObject *__pyx_n_s_args; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_dependency_injector_errors; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_join; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_overridden; -static PyObject *__pyx_n_s_override; -static PyObject *__pyx_n_s_provide; -static PyObject *__pyx_n_s_provides; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_set_args; -static PyObject *__pyx_n_s_set_kwargs; -static PyObject *__pyx_n_s_super; -static PyObject *__pyx_n_s_test; -static int __pyx_pf_19dependency_injector_9providers_9callables_8Callable___init__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_4__str__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_8provides___get__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_4args___get__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_6add_args(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_8set_args(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_10clear_args(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_18_provide(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9callables_Callable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9callables_DelegatedCallable(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ - -/* "dependency_injector/providers/callables.pyx":45 - * """ - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_9callables_8Callable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable___init__[] = "Initializer.\n\n :param provides: Wrapped callable.\n :type provides: callable\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_9callables_8Callable_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 45, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 45, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable___init__(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_9callables_8Callable___init__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/callables.pyx":57 - * :type kwargs: dict[str, object] - * """ - * if not callable(provides): # <<<<<<<<<<<<<< - * raise Error('Provider {0} expected to get callable, ' - * 'got {0}'.format('.'.join((self.__class__.__module__, - */ - __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_provides); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 57, __pyx_L1_error) - __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); - if (__pyx_t_2) { - - /* "dependency_injector/providers/callables.pyx":58 - * """ - * if not callable(provides): - * raise Error('Provider {0} expected to get callable, ' # <<<<<<<<<<<<<< - * 'got {0}'.format('.'.join((self.__class__.__module__, - * self.__class__.__name__)), - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "dependency_injector/providers/callables.pyx":59 - * if not callable(provides): - * raise Error('Provider {0} expected to get callable, ' - * 'got {0}'.format('.'.join((self.__class__.__module__, # <<<<<<<<<<<<<< - * self.__class__.__name__)), - * provides)) - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Provider_0_expected_to_get_calla, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_module); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "dependency_injector/providers/callables.pyx":60 - * raise Error('Provider {0} expected to get callable, ' - * 'got {0}'.format('.'.join((self.__class__.__module__, - * self.__class__.__name__)), # <<<<<<<<<<<<<< - * provides)) - * self.__provides = provides - */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_name); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "dependency_injector/providers/callables.pyx":59 - * if not callable(provides): - * raise Error('Provider {0} expected to get callable, ' - * 'got {0}'.format('.'.join((self.__class__.__module__, # <<<<<<<<<<<<<< - * self.__class__.__name__)), - * provides)) - */ - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9); - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "dependency_injector/providers/callables.pyx":61 - * 'got {0}'.format('.'.join((self.__class__.__module__, - * self.__class__.__name__)), - * provides)) # <<<<<<<<<<<<<< - * self.__provides = provides - * - */ - __pyx_t_7 = NULL; - __pyx_t_10 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_10 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_v_provides}; - __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_9, __pyx_v_provides}; - __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_t_9); - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_v_provides); - __pyx_t_9 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 58, __pyx_L1_error) - - /* "dependency_injector/providers/callables.pyx":57 - * :type kwargs: dict[str, object] - * """ - * if not callable(provides): # <<<<<<<<<<<<<< - * raise Error('Provider {0} expected to get callable, ' - * 'got {0}'.format('.'.join((self.__class__.__module__, - */ - } - - /* "dependency_injector/providers/callables.pyx":62 - * self.__class__.__name__)), - * provides)) - * self.__provides = provides # <<<<<<<<<<<<<< - * - * self.__args = tuple() - */ - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - __Pyx_GOTREF(__pyx_v_self->__pyx___provides); - __Pyx_DECREF(__pyx_v_self->__pyx___provides); - __pyx_v_self->__pyx___provides = __pyx_v_provides; - - /* "dependency_injector/providers/callables.pyx":64 - * self.__provides = provides - * - * self.__args = tuple() # <<<<<<<<<<<<<< - * self.__args_len = 0 - * self.set_args(*args) - */ - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_v_self->__pyx___args); - __Pyx_DECREF(__pyx_v_self->__pyx___args); - __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "dependency_injector/providers/callables.pyx":65 - * - * self.__args = tuple() - * self.__args_len = 0 # <<<<<<<<<<<<<< - * self.set_args(*args) - * - */ - __pyx_v_self->__pyx___args_len = 0; - - /* "dependency_injector/providers/callables.pyx":66 - * self.__args = tuple() - * self.__args_len = 0 - * self.set_args(*args) # <<<<<<<<<<<<<< - * - * self.__kwargs = tuple() - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_v_args, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "dependency_injector/providers/callables.pyx":68 - * self.set_args(*args) - * - * self.__kwargs = tuple() # <<<<<<<<<<<<<< - * self.__kwargs_len = 0 - * self.set_kwargs(**kwargs) - */ - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); - __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); - __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; - - /* "dependency_injector/providers/callables.pyx":69 - * - * self.__kwargs = tuple() - * self.__kwargs_len = 0 # <<<<<<<<<<<<<< - * self.set_kwargs(**kwargs) - * - */ - __pyx_v_self->__pyx___kwargs_len = 0; - - /* "dependency_injector/providers/callables.pyx":70 - * self.__kwargs = tuple() - * self.__kwargs_len = 0 - * self.set_kwargs(**kwargs) # <<<<<<<<<<<<<< - * - * super(Callable, self).__init__() - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/callables.pyx":72 - * self.set_kwargs(**kwargs) - * - * super(Callable, self).__init__() # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_9callables_Callable)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_9callables_Callable)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_9callables_Callable)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_8) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/callables.pyx":45 - * """ - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":74 - * super(Callable, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_2__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_v_overriding_provider = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/callables.pyx":76 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":77 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/callables.pyx":78 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * - * copied = self.__class__(self.provides, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":77 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - } - - /* "dependency_injector/providers/callables.pyx":80 - * return copied - * - * copied = self.__class__(self.provides, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provides); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/callables.pyx":81 - * - * copied = self.__class__(self.provides, - * *deepcopy(self.args, memo), # <<<<<<<<<<<<<< - * **deepcopy(self.kwargs, memo)) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 81, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_2, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/callables.pyx":80 - * return copied - * - * copied = self.__class__(self.provides, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/callables.pyx":82 - * copied = self.__class__(self.provides, - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) # <<<<<<<<<<<<<< - * - * for overriding_provider in self.overridden: - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 82, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_t_3 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 82, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_t_3))) { - __pyx_t_2 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "dependency_injector/providers/callables.pyx":80 - * return copied - * - * copied = self.__class__(self.provides, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_3); - __pyx_t_3 = 0; - - /* "dependency_injector/providers/callables.pyx":84 - * **deepcopy(self.kwargs, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 84, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 84, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_10(__pyx_t_2); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 84, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_3); - __pyx_t_3 = 0; - - /* "dependency_injector/providers/callables.pyx":85 - * - * for overriding_provider in self.overridden: - * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< - * - * return copied - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 85, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/callables.pyx":84 - * **deepcopy(self.kwargs, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/callables.pyx":87 - * copied.override(deepcopy(overriding_provider, memo)) - * - * return copied # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":74 - * super(Callable, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XDECREF(__pyx_v_overriding_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":89 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_5__str__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable_4__str__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_5__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_4__str__(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_4__str__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "dependency_injector/providers/callables.pyx":94 - * :rtype: str - * """ - * return represent_provider(provider=self, provides=self.__provides) # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_self->__pyx___provides; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":89 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":97 - * - * @property - * def provides(self): # <<<<<<<<<<<<<< - * """Return wrapped callable.""" - * return self.__provides - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_8provides_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_8provides_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_8provides___get__(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_8provides___get__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/callables.pyx":99 - * def provides(self): - * """Return wrapped callable.""" - * return self.__provides # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___provides); - __pyx_r = __pyx_v_self->__pyx___provides; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":97 - * - * @property - * def provides(self): # <<<<<<<<<<<<<< - * """Return wrapped callable.""" - * return self.__provides - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":102 - * - * @property - * def args(self): # <<<<<<<<<<<<<< - * """Return positional argument injections.""" - * cdef int index - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_4args_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_4args___get__(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_4args___get__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self) { - int __pyx_v_index; - struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_arg = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/callables.pyx":108 - * cdef list args - * - * args = list() # <<<<<<<<<<<<<< - * for index in range(self.__args_len): - * arg = self.__args[index] - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_args = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":109 - * - * args = list() - * for index in range(self.__args_len): # <<<<<<<<<<<<<< - * arg = self.__args[index] - * args.append(arg.__value) - */ - __pyx_t_2 = __pyx_v_self->__pyx___args_len; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_index = __pyx_t_3; - - /* "dependency_injector/providers/callables.pyx":110 - * args = list() - * for index in range(self.__args_len): - * arg = self.__args[index] # <<<<<<<<<<<<<< - * args.append(arg.__value) - * return tuple(args) - */ - if (unlikely(__pyx_v_self->__pyx___args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 110, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->__pyx___args, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection))))) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_arg, ((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_t_1)); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":111 - * for index in range(self.__args_len): - * arg = self.__args[index] - * args.append(arg.__value) # <<<<<<<<<<<<<< - * return tuple(args) - * - */ - __pyx_t_1 = __pyx_v_arg->__pyx_base.__pyx___value; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_args, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 111, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/callables.pyx":112 - * arg = self.__args[index] - * args.append(arg.__value) - * return tuple(args) # <<<<<<<<<<<<<< - * - * def add_args(self, *args): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":102 - * - * @property - * def args(self): # <<<<<<<<<<<<<< - * """Return positional argument injections.""" - * cdef int index - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.args.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_arg); - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":114 - * return tuple(args) - * - * def add_args(self, *args): # <<<<<<<<<<<<<< - * """Add postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_6add_args[] = "Add postional argument injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_args (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_args", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_6add_args(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_6add_args(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - __Pyx_RefNannySetupContext("add_args", 0); - - /* "dependency_injector/providers/callables.pyx":122 - * :return: Reference ``self`` - * """ - * self.__args += parse_positional_injections(args) # <<<<<<<<<<<<<< - * self.__args_len = len(self.__args) - * return self - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections(__pyx_v_args, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___args, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___args); - __Pyx_DECREF(__pyx_v_self->__pyx___args); - __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/callables.pyx":123 - * """ - * self.__args += parse_positional_injections(args) - * self.__args_len = len(self.__args) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___args; - __Pyx_INCREF(__pyx_t_2); - if (unlikely(__pyx_t_2 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 123, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->__pyx___args_len = __pyx_t_3; - - /* "dependency_injector/providers/callables.pyx":124 - * self.__args += parse_positional_injections(args) - * self.__args_len = len(self.__args) - * return self # <<<<<<<<<<<<<< - * - * def set_args(self, *args): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":114 - * return tuple(args) - * - * def add_args(self, *args): # <<<<<<<<<<<<<< - * """Add postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.add_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":126 - * return self - * - * def set_args(self, *args): # <<<<<<<<<<<<<< - * """Set postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_8set_args[] = "Set postional argument injections.\n\n Existing positional argument injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_args (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_args", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_8set_args(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_8set_args(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - __Pyx_RefNannySetupContext("set_args", 0); - - /* "dependency_injector/providers/callables.pyx":136 - * :return: Reference ``self`` - * """ - * self.__args = parse_positional_injections(args) # <<<<<<<<<<<<<< - * self.__args_len = len(self.__args) - * return self - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections(__pyx_v_args, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___args); - __Pyx_DECREF(__pyx_v_self->__pyx___args); - __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":137 - * """ - * self.__args = parse_positional_injections(args) - * self.__args_len = len(self.__args) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___args; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 137, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx___args_len = __pyx_t_2; - - /* "dependency_injector/providers/callables.pyx":138 - * self.__args = parse_positional_injections(args) - * self.__args_len = len(self.__args) - * return self # <<<<<<<<<<<<<< - * - * def clear_args(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":126 - * return self - * - * def set_args(self, *args): # <<<<<<<<<<<<<< - * """Set postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.set_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":140 - * return self - * - * def clear_args(self): # <<<<<<<<<<<<<< - * """Drop postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_10clear_args[] = "Drop postional argument injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_args (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_10clear_args(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_10clear_args(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - __Pyx_RefNannySetupContext("clear_args", 0); - - /* "dependency_injector/providers/callables.pyx":145 - * :return: Reference ``self`` - * """ - * self.__args = tuple() # <<<<<<<<<<<<<< - * self.__args_len = len(self.__args) - * return self - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___args); - __Pyx_DECREF(__pyx_v_self->__pyx___args); - __pyx_v_self->__pyx___args = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":146 - * """ - * self.__args = tuple() - * self.__args_len = len(self.__args) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___args; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 146, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx___args_len = __pyx_t_2; - - /* "dependency_injector/providers/callables.pyx":147 - * self.__args = tuple() - * self.__args_len = len(self.__args) - * return self # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":140 - * return self - * - * def clear_args(self): # <<<<<<<<<<<<<< - * """Drop postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.clear_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":150 - * - * @property - * def kwargs(self): # <<<<<<<<<<<<<< - * """Return keyword argument injections.""" - * cdef int index - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_6kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_6kwargs_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_6kwargs___get__(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self) { - int __pyx_v_index; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_kwarg = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/callables.pyx":156 - * cdef dict kwargs - * - * kwargs = dict() # <<<<<<<<<<<<<< - * for index in range(self.__kwargs_len): - * kwarg = self.__kwargs[index] - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_kwargs = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":157 - * - * kwargs = dict() - * for index in range(self.__kwargs_len): # <<<<<<<<<<<<<< - * kwarg = self.__kwargs[index] - * kwargs[kwarg.__name] = kwarg.__value - */ - __pyx_t_2 = __pyx_v_self->__pyx___kwargs_len; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_index = __pyx_t_3; - - /* "dependency_injector/providers/callables.pyx":158 - * kwargs = dict() - * for index in range(self.__kwargs_len): - * kwarg = self.__kwargs[index] # <<<<<<<<<<<<<< - * kwargs[kwarg.__name] = kwarg.__value - * return kwargs - */ - if (unlikely(__pyx_v_self->__pyx___kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 158, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->__pyx___kwargs, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection))))) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_kwarg, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_1)); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":159 - * for index in range(self.__kwargs_len): - * kwarg = self.__kwargs[index] - * kwargs[kwarg.__name] = kwarg.__value # <<<<<<<<<<<<<< - * return kwargs - * - */ - __pyx_t_1 = __pyx_v_kwarg->__pyx_base.__pyx___value; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_kwarg->__pyx___name, __pyx_t_1) < 0)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/callables.pyx":160 - * kwarg = self.__kwargs[index] - * kwargs[kwarg.__name] = kwarg.__value - * return kwargs # <<<<<<<<<<<<<< - * - * def add_kwargs(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_kwargs); - __pyx_r = __pyx_v_kwargs; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":150 - * - * @property - * def kwargs(self): # <<<<<<<<<<<<<< - * """Return keyword argument injections.""" - * cdef int index - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.kwargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_kwarg); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":162 - * return kwargs - * - * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Add keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_12add_kwargs[] = "Add keyword argument injections.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_kwargs (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("add_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_kwargs", 1))) return NULL; - __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_12add_kwargs(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - __Pyx_RefNannySetupContext("add_kwargs", 0); - - /* "dependency_injector/providers/callables.pyx":170 - * :return: Reference ``self`` - * """ - * self.__kwargs += parse_named_injections(kwargs) # <<<<<<<<<<<<<< - * self.__kwargs_len = len(self.__kwargs) - * return self - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___kwargs, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); - __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); - __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/callables.pyx":171 - * """ - * self.__kwargs += parse_named_injections(kwargs) - * self.__kwargs_len = len(self.__kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___kwargs; - __Pyx_INCREF(__pyx_t_2); - if (unlikely(__pyx_t_2 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 171, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 171, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->__pyx___kwargs_len = __pyx_t_3; - - /* "dependency_injector/providers/callables.pyx":172 - * self.__kwargs += parse_named_injections(kwargs) - * self.__kwargs_len = len(self.__kwargs) - * return self # <<<<<<<<<<<<<< - * - * def set_kwargs(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":162 - * return kwargs - * - * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Add keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.add_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":174 - * return self - * - * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Set keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_14set_kwargs[] = "Set keyword argument injections.\n\n Existing keyword argument injections are dropped.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_kwargs (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("set_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_kwargs", 1))) return NULL; - __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_14set_kwargs(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - __Pyx_RefNannySetupContext("set_kwargs", 0); - - /* "dependency_injector/providers/callables.pyx":184 - * :return: Reference ``self`` - * """ - * self.__kwargs = parse_named_injections(kwargs) # <<<<<<<<<<<<<< - * self.__kwargs_len = len(self.__kwargs) - * return self - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); - __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); - __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":185 - * """ - * self.__kwargs = parse_named_injections(kwargs) - * self.__kwargs_len = len(self.__kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___kwargs; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 185, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 185, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx___kwargs_len = __pyx_t_2; - - /* "dependency_injector/providers/callables.pyx":186 - * self.__kwargs = parse_named_injections(kwargs) - * self.__kwargs_len = len(self.__kwargs) - * return self # <<<<<<<<<<<<<< - * - * def clear_kwargs(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":174 - * return self - * - * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Set keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.set_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":188 - * return self - * - * def clear_kwargs(self): # <<<<<<<<<<<<<< - * """Drop keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_16clear_kwargs[] = "Drop keyword argument injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_kwargs (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_16clear_kwargs(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - __Pyx_RefNannySetupContext("clear_kwargs", 0); - - /* "dependency_injector/providers/callables.pyx":193 - * :return: Reference ``self`` - * """ - * self.__kwargs = tuple() # <<<<<<<<<<<<<< - * self.__kwargs_len = len(self.__kwargs) - * return self - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___kwargs); - __Pyx_DECREF(__pyx_v_self->__pyx___kwargs); - __pyx_v_self->__pyx___kwargs = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pyx":194 - * """ - * self.__kwargs = tuple() - * self.__kwargs_len = len(self.__kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___kwargs; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 194, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx___kwargs_len = __pyx_t_2; - - /* "dependency_injector/providers/callables.pyx":195 - * self.__kwargs = tuple() - * self.__kwargs_len = len(self.__kwargs) - * return self # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":188 - * return self - * - * def clear_kwargs(self): # <<<<<<<<<<<<<< - * """Drop keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable.clear_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pyx":197 - * return self - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return result of provided callable's call.""" - * return __callable_call(self, args, kwargs) - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_9callables_8Callable__provide(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_19_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/callables.pyx":199 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return result of provided callable's call.""" - * return __callable_call(self, args, kwargs) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_9callables___callable_call(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pyx":197 - * return self - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return result of provided callable's call.""" - * return __callable_call(self, args, kwargs) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9callables_8Callable_18_provide[] = "Return result of provided callable's call."; -static PyObject *__pyx_pw_19dependency_injector_9providers_9callables_8Callable_19_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 197, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 197, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 197, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 197, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 197, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_9callables_8Callable_18_provide(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9callables_8Callable_18_provide(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_9callables_8Callable__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.callables.Callable._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get_name", 0); - - /* "injections.pxd":25 - * - * cdef inline object __get_name(NamedInjection self): - * return self.__name # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___name); - __pyx_r = __pyx_v_self->__pyx___name; - goto __pyx_L0; - - /* "injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__get_value", 0); - - /* "injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - __pyx_t_1 = ((__pyx_v_self->__pyx___call == 0) != 0); - if (__pyx_t_1) { - - /* "injections.pxd":30 - * cdef inline object __get_value(Injection self): - * if self.__call == 0: - * return self.__value # <<<<<<<<<<<<<< - * return self.__value() - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_r = __pyx_v_self->__pyx___value; - goto __pyx_L0; - - /* "injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - } - - /* "injections.pxd":31 - * if self.__call == 0: - * return self.__value - * return self.__value() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_t_3 = __pyx_v_self->__pyx___value; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(PyObject *__pyx_v_args, PyObject *__pyx_v_inj_args, int __pyx_v_inj_args_len) { - int __pyx_v_index; - PyObject *__pyx_v_positional_args = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__provide_positional_args", 0); - - /* "injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - __pyx_t_1 = ((__pyx_v_inj_args_len == 0) != 0); - if (__pyx_t_1) { - - /* "injections.pxd":44 - * - * if inj_args_len == 0: - * return args # <<<<<<<<<<<<<< - * - * positional_args = list() - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_args); - __pyx_r = __pyx_v_args; - goto __pyx_L0; - - /* "injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - } - - /* "injections.pxd":46 - * return args - * - * positional_args = list() # <<<<<<<<<<<<<< - * for index in range(inj_args_len): - * injection = inj_args[index] - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_positional_args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "injections.pxd":47 - * - * positional_args = list() - * for index in range(inj_args_len): # <<<<<<<<<<<<<< - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - */ - __pyx_t_3 = __pyx_v_inj_args_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":48 - * positional_args = list() - * for index in range(inj_args_len): - * injection = inj_args[index] # <<<<<<<<<<<<<< - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) - */ - if (unlikely(__pyx_v_inj_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 48, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_inj_args, __pyx_v_index); - __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "injections.pxd":49 - * for index in range(inj_args_len): - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) # <<<<<<<<<<<<<< - * positional_args.extend(args) - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_injection)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_positional_args, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "injections.pxd":50 - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) # <<<<<<<<<<<<<< - * - * return tuple(positional_args) - */ - __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_positional_args, __pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 50, __pyx_L1_error) - - /* "injections.pxd":52 - * positional_args.extend(args) - * - * return tuple(positional_args) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_positional_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_positional_args); - __Pyx_XDECREF((PyObject *)__pyx_v_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(PyObject *__pyx_v_kwargs, PyObject *__pyx_v_inj_kwargs, int __pyx_v_inj_kwargs_len) { - int __pyx_v_index; - PyObject *__pyx_v_name = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_kw_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("__provide_keyword_args", 0); - - /* "injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 64, __pyx_L1_error) - } - __pyx_t_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 64, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_1 == 0) != 0); - if (__pyx_t_2) { - - /* "injections.pxd":65 - * - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":66 - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 66, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "injections.pxd":67 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * else: - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "injections.pxd":68 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * else: - * for index in range(inj_kwargs_len): - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 68, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 68, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - - /* "injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - goto __pyx_L3; - } - - /* "injections.pxd":70 - * kwargs[name] = __get_value(kw_injection) - * else: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - /*else*/ { - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":71 - * else: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * if name not in kwargs: - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 71, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "injections.pxd":72 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 73, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 73, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_2 != 0); - if (__pyx_t_6) { - - /* "injections.pxd":74 - * name = __get_name(kw_injection) - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * - * return kwargs - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 74, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - } - } - } - __pyx_L3:; - - /* "injections.pxd":76 - * kwargs[name] = __get_value(kw_injection) - * - * return kwargs # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_kwargs); - __pyx_r = __pyx_v_kwargs; - goto __pyx_L0; - - /* "injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_keyword_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF((PyObject *)__pyx_v_kw_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___inject_attributes(PyObject *__pyx_v_instance, PyObject *__pyx_v_attributes, int __pyx_v_attributes_len) { - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_attr_injection = 0; - int __pyx_v_index; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__inject_attributes", 0); - - /* "injections.pxd":85 - * int attributes_len): - * cdef NamedInjection attr_injection - * for index in range(attributes_len): # <<<<<<<<<<<<<< - * attr_injection = attributes[index] - * setattr(instance, - */ - __pyx_t_1 = __pyx_v_attributes_len; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_index = __pyx_t_2; - - /* "injections.pxd":86 - * cdef NamedInjection attr_injection - * for index in range(attributes_len): - * attr_injection = attributes[index] # <<<<<<<<<<<<<< - * setattr(instance, - * __get_name(attr_injection), - */ - if (unlikely(__pyx_v_attributes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 86, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_v_attributes, __pyx_v_index); - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_attr_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "injections.pxd":88 - * attr_injection = attributes[index] - * setattr(instance, - * __get_name(attr_injection), # <<<<<<<<<<<<<< - * __get_value(attr_injection)) - * - */ - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_attr_injection); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "injections.pxd":89 - * setattr(instance, - * __get_name(attr_injection), - * __get_value(attr_injection)) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_attr_injection)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "injections.pxd":87 - * for index in range(attributes_len): - * attr_injection = attributes[index] - * setattr(instance, # <<<<<<<<<<<<<< - * __get_name(attr_injection), - * __get_value(attr_injection)) - */ - __pyx_t_5 = PyObject_SetAttr(__pyx_v_instance, __pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 87, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - - /* "injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__inject_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_attr_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_v_positional_args = 0; - PyObject *__pyx_v_keyword_args = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__callable_call", 0); - - /* "dependency_injector/providers/callables.pxd":37 - * - * positional_args = __provide_positional_args(args, - * self.__args, # <<<<<<<<<<<<<< - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, - */ - __pyx_t_1 = __pyx_v_self->__pyx___args; - __Pyx_INCREF(__pyx_t_1); - - /* "dependency_injector/providers/callables.pxd":36 - * cdef dict keyword_args - * - * positional_args = __provide_positional_args(args, # <<<<<<<<<<<<<< - * self.__args, - * self.__args_len) - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(__pyx_v_args, ((PyObject*)__pyx_t_1), __pyx_v_self->__pyx___args_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_positional_args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/callables.pxd":40 - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, - * self.__kwargs, # <<<<<<<<<<<<<< - * self.__kwargs_len) - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___kwargs; - __Pyx_INCREF(__pyx_t_2); - - /* "dependency_injector/providers/callables.pxd":39 - * self.__args, - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, # <<<<<<<<<<<<<< - * self.__kwargs, - * self.__kwargs_len) - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_keyword_args = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/callables.pxd":43 - * self.__kwargs_len) - * - * return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(__pyx_v_positional_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(2, 43, __pyx_L1_error) - } - if (unlikely(__pyx_v_keyword_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(2, 43, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->__pyx___provides, __pyx_v_positional_args, __pyx_v_keyword_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.callables.__callable_call", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_positional_args); - __Pyx_XDECREF(__pyx_v_keyword_args); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable __pyx_vtable_19dependency_injector_9providers_9callables_Callable; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9callables_Callable(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *p; - PyObject *o = __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_new(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_9callables_Callable; - p->__pyx___provides = Py_None; Py_INCREF(Py_None); - p->__pyx___args = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->__pyx___kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_9callables_Callable(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *p = (struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___provides); - Py_CLEAR(p->__pyx___args); - Py_CLEAR(p->__pyx___kwargs); - PyObject_GC_Track(o); - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_19dependency_injector_9providers_9callables_Callable); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_9callables_Callable(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *p = (struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)o; - e = ((likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) ? ((__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse) ? __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_19dependency_injector_9providers_9callables_Callable)); if (e) return e; - if (p->__pyx___provides) { - e = (*v)(p->__pyx___provides, a); if (e) return e; - } - if (p->__pyx___args) { - e = (*v)(p->__pyx___args, a); if (e) return e; - } - if (p->__pyx___kwargs) { - e = (*v)(p->__pyx___kwargs, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_9callables_Callable(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *p = (struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)o; - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) { if (__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_19dependency_injector_9providers_9callables_Callable); - tmp = ((PyObject*)p->__pyx___provides); - p->__pyx___provides = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx___args); - p->__pyx___args = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx___kwargs); - p->__pyx___kwargs = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_9callables_8Callable_provides(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_9callables_8Callable_8provides_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_9callables_8Callable_args(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_9callables_8Callable_4args_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_9callables_8Callable_kwargs(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_9callables_8Callable_6kwargs_1__get__(o); -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_9callables_Callable[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_2__deepcopy__}, - {"add_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_7add_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_6add_args}, - {"set_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_9set_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_8set_args}, - {"clear_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_11clear_args, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_10clear_args}, - {"add_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_13add_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_12add_kwargs}, - {"set_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_15set_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_14set_kwargs}, - {"clear_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_17clear_kwargs, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_16clear_kwargs}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9callables_8Callable_19_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9callables_8Callable_18_provide}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_9callables_Callable[] = { - {(char *)"provides", __pyx_getprop_19dependency_injector_9providers_9callables_8Callable_provides, 0, (char *)"Return wrapped callable.", 0}, - {(char *)"args", __pyx_getprop_19dependency_injector_9providers_9callables_8Callable_args, 0, (char *)"Return positional argument injections.", 0}, - {(char *)"kwargs", __pyx_getprop_19dependency_injector_9providers_9callables_8Callable_kwargs, 0, (char *)"Return keyword argument injections.", 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_9callables_Callable = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.callables.Callable", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_9callables_Callable, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_19dependency_injector_9providers_9callables_8Callable_5__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Callable provider calls wrapped callable on every call.\n\n Callable supports positional and keyword argument injections:\n\n .. code-block:: python\n\n some_function = Callable(some_function,\n 'positional_arg1', 'positional_arg2',\n keyword_argument1=3, keyword_argument=4)\n\n # or\n\n some_function = Callable(some_function) \\\n .add_args('positional_arg1', 'positional_arg2') \\\n .add_kwargs(keyword_argument1=3, keyword_argument=4)\n\n # or\n\n some_function = Callable(some_function)\n some_function.add_args('positional_arg1', 'positional_arg2')\n some_function.add_kwargs(keyword_argument1=3, keyword_argument=4)\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_9callables_Callable, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_9callables_Callable, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_9callables_Callable, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19dependency_injector_9providers_9callables_Callable, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_9callables_8Callable_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_9callables_Callable, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable __pyx_vtable_19dependency_injector_9providers_9callables_DelegatedCallable; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9callables_DelegatedCallable(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_9callables_Callable(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable; - return o; -} - -static PyTypeObject __pyx_type_19dependency_injector_9providers_9callables_DelegatedCallable = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.callables.DelegatedCallable", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_9callables_Callable, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_9callables_8Callable_5__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Callable that is injected \"as is\".\n\n DelegatedCallable is a :py:class:`Callable`, that is injected \"as is\".\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_9callables_Callable, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_9callables_Callable, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_9callables_8Callable_1__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_9callables_DelegatedCallable, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "callables", - __pyx_k_Dependency_injector_callable_pro, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, - {&__pyx_n_s_IS_DELEGATED, __pyx_k_IS_DELEGATED, sizeof(__pyx_k_IS_DELEGATED), 0, 0, 1, 1}, - {&__pyx_kp_s_Provider_0_expected_to_get_calla, __pyx_k_Provider_0_expected_to_get_calla, sizeof(__pyx_k_Provider_0_expected_to_get_calla), 0, 0, 1, 0}, - {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_dependency_injector_errors, __pyx_k_dependency_injector_errors, sizeof(__pyx_k_dependency_injector_errors), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_overridden, __pyx_k_overridden, sizeof(__pyx_k_overridden), 0, 0, 1, 1}, - {&__pyx_n_s_override, __pyx_k_override, sizeof(__pyx_k_override), 0, 0, 1, 1}, - {&__pyx_n_s_provide, __pyx_k_provide, sizeof(__pyx_k_provide), 0, 0, 1, 1}, - {&__pyx_n_s_provides, __pyx_k_provides, sizeof(__pyx_k_provides), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_set_args, __pyx_k_set_args, sizeof(__pyx_k_set_args), 0, 0, 1, 1}, - {&__pyx_n_s_set_kwargs, __pyx_k_set_kwargs, sizeof(__pyx_k_set_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 72, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 76, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 109, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initcallables(void); /*proto*/ -PyMODINIT_FUNC initcallables(void) -#else -PyMODINIT_FUNC PyInit_callables(void); /*proto*/ -PyMODINIT_FUNC PyInit_callables(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_callables(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("callables", __pyx_methods, __pyx_k_Dependency_injector_callable_pro, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_dependency_injector__providers__callables) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "dependency_injector.providers.callables")) { - if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers.callables", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Provider = __Pyx_ImportType("dependency_injector.providers.base", "Provider", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Provider), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Provider = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9callables_Callable = &__pyx_vtable_19dependency_injector_9providers_9callables_Callable; - __pyx_vtable_19dependency_injector_9providers_9callables_Callable.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - __pyx_vtable_19dependency_injector_9providers_9callables_Callable.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_9callables_8Callable__provide; - __pyx_type_19dependency_injector_9providers_9callables_Callable.tp_base = __pyx_ptype_19dependency_injector_9providers_4base_Provider; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_9callables_Callable) < 0) __PYX_ERR(0, 21, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_9callables_Callable.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_9callables_Callable, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 21, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable___init__.doc = __pyx_doc_19dependency_injector_9providers_9callables_8Callable___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable___init__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_9callables_Callable, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 21, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable_4__str__.doc = __pyx_doc_19dependency_injector_9providers_9callables_8Callable_4__str__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_9callables_8Callable_4__str__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_9callables_Callable.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_9callables_Callable) < 0) __PYX_ERR(0, 21, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Callable", (PyObject *)&__pyx_type_19dependency_injector_9providers_9callables_Callable) < 0) __PYX_ERR(0, 21, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9callables_Callable = &__pyx_type_19dependency_injector_9providers_9callables_Callable; - __pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable = &__pyx_vtable_19dependency_injector_9providers_9callables_DelegatedCallable; - __pyx_vtable_19dependency_injector_9providers_9callables_DelegatedCallable.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_9callables_Callable; - __pyx_type_19dependency_injector_9providers_9callables_DelegatedCallable.tp_base = __pyx_ptype_19dependency_injector_9providers_9callables_Callable; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_9callables_DelegatedCallable) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_9callables_DelegatedCallable.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_9callables_DelegatedCallable.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "DelegatedCallable", (PyObject *)&__pyx_type_19dependency_injector_9providers_9callables_DelegatedCallable) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = &__pyx_type_19dependency_injector_9providers_9callables_DelegatedCallable; - /*--- Type import code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Object = __Pyx_ImportType("dependency_injector.providers.base", "Object", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Object), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Object)) __PYX_ERR(3, 15, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Object = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Object->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Object)) __PYX_ERR(3, 15, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_Delegate = __Pyx_ImportType("dependency_injector.providers.base", "Delegate", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Delegate), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(3, 21, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Delegate = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Delegate->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(3, 21, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = __Pyx_ImportType("dependency_injector.providers.base", "ExternalDependency", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(3, 25, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(3, 25, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = __Pyx_ImportType("dependency_injector.providers.base", "OverridingContext", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext)) __PYX_ERR(3, 29, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_Injection = __Pyx_ImportType("dependency_injector.providers.injections", "Injection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_Injection)) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = __Pyx_ImportType("dependency_injector.providers.injections", "PositionalInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection)) __PYX_ERR(1, 16, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = __Pyx_ImportType("dependency_injector.providers.injections", "NamedInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection)) __PYX_ERR(1, 20, __pyx_L1_error) - /*--- Variable import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "CLASS_TYPES", (void **)&__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*--- Function import code ---*/ - __pyx_t_2 = __Pyx_ImportModule("dependency_injector.providers.injections"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "parse_positional_injections", (void (**)(void))&__pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "parse_named_injections", (void (**)(void))&__pyx_f_19dependency_injector_9providers_10injections_parse_named_injections, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_3) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_3, "represent_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_represent_provider, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_3, "deepcopy", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "dependency_injector/providers/callables.pyx":6 - * """ - * - * from dependency_injector.errors import Error # <<<<<<<<<<<<<< - * - * from .base cimport Provider - */ - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_n_s_Error); - __Pyx_GIVEREF(__pyx_n_s_Error); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Error); - __pyx_t_5 = __Pyx_Import(__pyx_n_s_dependency_injector_errors, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_4) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/callables.pyx":208 - * """ - * - * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(0, 208, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable); - - /* "dependency_injector/providers/callables.pyx":1 - * """Dependency injector callable providers. # <<<<<<<<<<<<<< - * - * Powered by Cython. - */ - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init dependency_injector.providers.callables", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers.callables"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* GetModuleGlobalName */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* StringJoin */ - #if !CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { - return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); -} -#endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -/* KeywordStringCheck */ - static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -/* CallNextTpDealloc */ - static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_dealloc != current_tp_dealloc) - type = type->tp_base; - while (type && type->tp_dealloc == current_tp_dealloc) - type = type->tp_base; - if (type) - type->tp_dealloc(obj); -} - -/* CallNextTpTraverse */ - static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_traverse != current_tp_traverse) - type = type->tp_base; - while (type && type->tp_traverse == current_tp_traverse) - type = type->tp_base; - if (type && type->tp_traverse) - return type->tp_traverse(obj, v, a); - return 0; -} - -/* CallNextTpClear */ - static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_clear != current_tp_clear) - type = type->tp_base; - while (type && type->tp_clear == current_tp_clear) - type = type->tp_base; - if (type && type->tp_clear) - type->tp_clear(obj); -} - -/* GetVTable */ - static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - size_t size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -/* VoidPtrImport */ - #ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, name); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C variable %.200s", - PyModule_GetName(module), name); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); - goto bad; - } - *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif - if (!(*p)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* FunctionImport */ - #ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, funcname); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C function %.200s", - PyModule_GetName(module), funcname); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); - goto bad; - } - tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif - *f = tmp.fp; - if (!(*f)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers/callables.pxd b/src/dependency_injector/providers/callables.pxd deleted file mode 100644 index b01cdcb0..00000000 --- a/src/dependency_injector/providers/callables.pxd +++ /dev/null @@ -1,43 +0,0 @@ -"""Dependency injector callable providers. - -Powered by Cython. -""" - -from .base cimport Provider -from .injections cimport ( - PositionalInjection, - NamedInjection, - __provide_positional_args, - __provide_keyword_args, -) - - - -cdef class Callable(Provider): - cdef object __provides - - cdef tuple __args - cdef int __args_len - - cdef tuple __kwargs - cdef int __kwargs_len - - cpdef object _provide(self, tuple args, dict kwargs) - - -cdef class DelegatedCallable(Callable): - pass - - -cdef inline object __callable_call(Callable self, tuple args, dict kwargs): - cdef tuple positional_args - cdef dict keyword_args - - positional_args = __provide_positional_args(args, - self.__args, - self.__args_len) - keyword_args = __provide_keyword_args(kwargs, - self.__kwargs, - self.__kwargs_len) - - return self.__provides(*positional_args, **keyword_args) diff --git a/src/dependency_injector/providers/callables.pyx b/src/dependency_injector/providers/callables.pyx deleted file mode 100644 index 44f9137f..00000000 --- a/src/dependency_injector/providers/callables.pyx +++ /dev/null @@ -1,208 +0,0 @@ -"""Dependency injector callable providers. - -Powered by Cython. -""" - -from dependency_injector.errors import Error - -from .base cimport Provider -from .injections cimport ( - PositionalInjection, - NamedInjection, - parse_positional_injections, - parse_named_injections, -) -from .utils cimport ( - represent_provider, - deepcopy, -) - - -cdef class Callable(Provider): - r"""Callable provider calls wrapped callable on every call. - - Callable supports positional and keyword argument injections: - - .. code-block:: python - - some_function = Callable(some_function, - 'positional_arg1', 'positional_arg2', - keyword_argument1=3, keyword_argument=4) - - # or - - some_function = Callable(some_function) \ - .add_args('positional_arg1', 'positional_arg2') \ - .add_kwargs(keyword_argument1=3, keyword_argument=4) - - # or - - some_function = Callable(some_function) - some_function.add_args('positional_arg1', 'positional_arg2') - some_function.add_kwargs(keyword_argument1=3, keyword_argument=4) - """ - - def __init__(self, provides, *args, **kwargs): - """Initializer. - - :param provides: Wrapped callable. - :type provides: callable - - :param args: Tuple of positional argument injections. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword argument injections. - :type kwargs: dict[str, object] - """ - if not callable(provides): - raise Error('Provider {0} expected to get callable, ' - 'got {0}'.format('.'.join((self.__class__.__module__, - self.__class__.__name__)), - provides)) - self.__provides = provides - - self.__args = tuple() - self.__args_len = 0 - self.set_args(*args) - - self.__kwargs = tuple() - self.__kwargs_len = 0 - self.set_kwargs(**kwargs) - - super(Callable, self).__init__() - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - - copied = self.__class__(self.provides, - *deepcopy(self.args, memo), - **deepcopy(self.kwargs, memo)) - - for overriding_provider in self.overridden: - copied.override(deepcopy(overriding_provider, memo)) - - return copied - - def __str__(self): - """Return string representation of provider. - - :rtype: str - """ - return represent_provider(provider=self, provides=self.__provides) - - @property - def provides(self): - """Return wrapped callable.""" - return self.__provides - - @property - def args(self): - """Return positional argument injections.""" - cdef int index - cdef PositionalInjection arg - cdef list args - - args = list() - for index in range(self.__args_len): - arg = self.__args[index] - args.append(arg.__value) - return tuple(args) - - def add_args(self, *args): - """Add postional argument injections. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__args += parse_positional_injections(args) - self.__args_len = len(self.__args) - return self - - def set_args(self, *args): - """Set postional argument injections. - - Existing positional argument injections are dropped. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__args = parse_positional_injections(args) - self.__args_len = len(self.__args) - return self - - def clear_args(self): - """Drop postional argument injections. - - :return: Reference ``self`` - """ - self.__args = tuple() - self.__args_len = len(self.__args) - return self - - @property - def kwargs(self): - """Return keyword argument injections.""" - cdef int index - cdef NamedInjection kwarg - cdef dict kwargs - - kwargs = dict() - for index in range(self.__kwargs_len): - kwarg = self.__kwargs[index] - kwargs[kwarg.__name] = kwarg.__value - return kwargs - - def add_kwargs(self, **kwargs): - """Add keyword argument injections. - - :param kwargs: Dictionary of injections. - :type kwargs: dict - - :return: Reference ``self`` - """ - self.__kwargs += parse_named_injections(kwargs) - self.__kwargs_len = len(self.__kwargs) - return self - - def set_kwargs(self, **kwargs): - """Set keyword argument injections. - - Existing keyword argument injections are dropped. - - :param kwargs: Dictionary of injections. - :type kwargs: dict - - :return: Reference ``self`` - """ - self.__kwargs = parse_named_injections(kwargs) - self.__kwargs_len = len(self.__kwargs) - return self - - def clear_kwargs(self): - """Drop keyword argument injections. - - :return: Reference ``self`` - """ - self.__kwargs = tuple() - self.__kwargs_len = len(self.__kwargs) - return self - - cpdef object _provide(self, tuple args, dict kwargs): - """Return result of provided callable's call.""" - return __callable_call(self, args, kwargs) - - -cdef class DelegatedCallable(Callable): - """Callable that is injected "as is". - - DelegatedCallable is a :py:class:`Callable`, that is injected "as is". - """ - - __IS_DELEGATED__ = True diff --git a/src/dependency_injector/providers/configuration.c b/src/dependency_injector/providers/configuration.c deleted file mode 100644 index d3fb2ca1..00000000 --- a/src/dependency_injector/providers/configuration.c +++ /dev/null @@ -1,4875 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__dependency_injector__providers__configuration -#define __PYX_HAVE_API__dependency_injector__providers__configuration -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/dependency_injector/providers/configuration.pyx", - "src/dependency_injector/providers/base.pxd", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider; -struct __pyx_obj_19dependency_injector_9providers_4base_Object; -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate; -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency; -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext; -struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration; -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy; - -/* "utils.pxd":21 - * - * - * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< - */ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy { - int __pyx_n; - PyObject *memo; -}; - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider { - PyObject_HEAD - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtab; - PyObject *__pyx___overridden; - int __pyx___overridden_len; -}; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Object { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; -}; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate { - struct __pyx_obj_19dependency_injector_9providers_4base_Object __pyx_base; -}; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyTypeObject *__pyx___instance_of; -}; - - -/* "base.pxd":29 - * - * - * cdef class OverridingContext(object): # <<<<<<<<<<<<<< - * cdef Provider __overridden - * cdef Provider __overriding - */ -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext { - PyObject_HEAD - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overridden; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overriding; -}; - - -/* "dependency_injector/providers/configuration.pxd":11 - * - * - * cdef class Configuration(Provider): # <<<<<<<<<<<<<< - * cdef str __name - * cdef object __value - */ -struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___name; - PyObject *__pyx___value; - PyObject *__pyx___children; -}; - - - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider { - PyObject *(*_provide)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*_call_last_overriding)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object *__pyx_vtabptr_19dependency_injector_9providers_4base_Object; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate *__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency *__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency; - - -/* "dependency_injector/providers/configuration.pyx":15 - * - * - * cdef class Configuration(Provider): # <<<<<<<<<<<<<< - * """Configuration provider. - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_13configuration_Configuration { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *(*get_name)(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *, int __pyx_skip_dispatch); - PyObject *(*update)(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*_get_child_name)(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *, PyObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_13configuration_Configuration *__pyx_vtabptr_19dependency_injector_9providers_13configuration_Configuration; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* dict_getitem_default.proto */ -static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -/* CallNextTpDealloc.proto */ -static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); - -/* CallNextTpTraverse.proto */ -static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); - -/* CallNextTpClear.proto */ -static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); - -/* GetVTable.proto */ -static void* __Pyx_GetVtable(PyObject *dict); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -/* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); - -/* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration_get_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration_update(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch); /* proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration__provide(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration__get_child_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name, int __pyx_skip_dispatch); /* proto*/ - -/* Module declarations from 'dependency_injector.providers.base' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Provider = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Object = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Delegate = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = 0; - -/* Module declarations from 'dependency_injector.providers.utils' */ -static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0; -#define __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES (*__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES) -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_represent_provider)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_deepcopy)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.configuration' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_13configuration_Configuration = 0; -#define __Pyx_MODULE_NAME "dependency_injector.providers.configuration" -int __pyx_module_is_main_dependency_injector__providers__configuration = 0; - -/* Implementation of 'dependency_injector.providers.configuration' */ -static PyObject *__pyx_builtin_super; -static PyObject *__pyx_builtin_id; -static const char __pyx_k_[] = ""; -static const char __pyx_k__2[] = "."; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_args[] = "args"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "name"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_super[] = "super"; -static const char __pyx_k_kwargs[] = "kwargs"; -static const char __pyx_k_update[] = "update"; -static const char __pyx_k_provide[] = "_provide"; -static const char __pyx_k_get_name[] = "get_name"; -static const char __pyx_k_override[] = "override"; -static const char __pyx_k_overridden[] = "overridden"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_get_child_name[] = "_get_child_name"; -static const char __pyx_k_Dependency_injector_configuratio[] = "Dependency injector configuration providers.\n\nPowered by Cython.\n"; -static PyObject *__pyx_kp_s_; -static PyObject *__pyx_kp_s__2; -static PyObject *__pyx_n_s_args; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_get_child_name; -static PyObject *__pyx_n_s_get_name; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_overridden; -static PyObject *__pyx_n_s_override; -static PyObject *__pyx_n_s_provide; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_super; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_update; -static int __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration___init__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_4__str__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_8get_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_10update(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_12_provide(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_14_get_child_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name); /* proto */ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_13configuration_Configuration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ - -/* "dependency_injector/providers/configuration.pyx":35 - * """ - * - * def __init__(self, name): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration___init__[] = "Initializer.\n\n :param name: Name of configuration unit.\n :type name: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 35, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_name = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration___init__(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self), __pyx_v_name); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration___init__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_name) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/configuration.pyx":41 - * :type name: str - * """ - * self.__name = name # <<<<<<<<<<<<<< - * self.__value = None - * self.__children = dict() - */ - if (!(likely(PyString_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 41, __pyx_L1_error) - __pyx_t_1 = __pyx_v_name; - __Pyx_INCREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___name); - __Pyx_DECREF(__pyx_v_self->__pyx___name); - __pyx_v_self->__pyx___name = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":42 - * """ - * self.__name = name - * self.__value = None # <<<<<<<<<<<<<< - * self.__children = dict() - * super(Configuration, self).__init__() - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->__pyx___value); - __Pyx_DECREF(__pyx_v_self->__pyx___value); - __pyx_v_self->__pyx___value = Py_None; - - /* "dependency_injector/providers/configuration.pyx":43 - * self.__name = name - * self.__value = None - * self.__children = dict() # <<<<<<<<<<<<<< - * super(Configuration, self).__init__() - * - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___children); - __Pyx_DECREF(__pyx_v_self->__pyx___children); - __pyx_v_self->__pyx___children = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":44 - * self.__value = None - * self.__children = dict() - * super(Configuration, self).__init__() # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_13configuration_Configuration)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_13configuration_Configuration)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_13configuration_Configuration)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":35 - * """ - * - * def __init__(self, name): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/configuration.pyx":46 - * super(Configuration, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_2__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_v_overriding_provider = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/configuration.pyx":48 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":49 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/configuration.pyx":50 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * - * copied = self.__class__(self.__name) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":49 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - } - - /* "dependency_injector/providers/configuration.pyx":52 - * return copied - * - * copied = self.__class__(self.__name) # <<<<<<<<<<<<<< - * copied.update(deepcopy(self.__value)) - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self->__pyx___name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_self->__pyx___name}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_self->__pyx___name}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_self->__pyx___name); - __Pyx_GIVEREF(__pyx_v_self->__pyx___name); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self->__pyx___name); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":53 - * - * copied = self.__class__(self.__name) - * copied.update(deepcopy(self.__value)) # <<<<<<<<<<<<<< - * - * for overriding_provider in self.overridden: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __pyx_v_self->__pyx___value; - __Pyx_INCREF(__pyx_t_4); - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_4, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":55 - * copied.update(deepcopy(self.__value)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 55, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 55, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 55, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_9(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 55, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":56 - * - * for overriding_provider in self.overridden: - * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< - * - * return copied - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 56, __pyx_L1_error) - __pyx_t_10.__pyx_n = 1; - __pyx_t_10.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":55 - * copied.update(deepcopy(self.__value)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/configuration.pyx":58 - * copied.override(deepcopy(overriding_provider, memo)) - * - * return copied # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":46 - * super(Configuration, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XDECREF(__pyx_v_overriding_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/configuration.pyx":60 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_5__str__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_4__str__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_5__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_4__str__(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_4__str__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "dependency_injector/providers/configuration.pyx":65 - * :rtype: str - * """ - * return represent_provider(provider=self, provides=self.__name) # <<<<<<<<<<<<<< - * - * def __getattr__(self, name): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_v_self->__pyx___name; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":60 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/configuration.pyx":67 - * return represent_provider(provider=self, provides=self.__name) - * - * def __getattr__(self, name): # <<<<<<<<<<<<<< - * """Return child configuration provider.""" - * cdef Configuration child_provider - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_7__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__[] = "Return child configuration provider."; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_7__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self), ((PyObject *)__pyx_v_name)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_name) { - struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_child_provider = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("__getattr__", 0); - - /* "dependency_injector/providers/configuration.pyx":72 - * cdef object value - * - * child_provider = self.__children.get(name) # <<<<<<<<<<<<<< - * - * if child_provider is None: - */ - if (unlikely(__pyx_v_self->__pyx___children == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); - __PYX_ERR(0, 72, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->__pyx___children, __pyx_v_name, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_13configuration_Configuration))))) __PYX_ERR(0, 72, __pyx_L1_error) - __pyx_v_child_provider = ((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":74 - * child_provider = self.__children.get(name) - * - * if child_provider is None: # <<<<<<<<<<<<<< - * child_provider = self.__class__(self._get_child_name(name)) - * - */ - __pyx_t_2 = (((PyObject *)__pyx_v_child_provider) == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { - - /* "dependency_injector/providers/configuration.pyx":75 - * - * if child_provider is None: - * child_provider = self.__class__(self._get_child_name(name)) # <<<<<<<<<<<<<< - * - * if isinstance(self.__value, dict): - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyString_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 75, __pyx_L1_error) - __pyx_t_5 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self->__pyx_base.__pyx_vtab)->_get_child_name(__pyx_v_self, ((PyObject*)__pyx_v_name), 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_13configuration_Configuration))))) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_DECREF_SET(__pyx_v_child_provider, ((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_t_1)); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":77 - * child_provider = self.__class__(self._get_child_name(name)) - * - * if isinstance(self.__value, dict): # <<<<<<<<<<<<<< - * child_provider.update(self.__value.get(name)) - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___value; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = PyDict_Check(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { - - /* "dependency_injector/providers/configuration.pyx":78 - * - * if isinstance(self.__value, dict): - * child_provider.update(self.__value.get(name)) # <<<<<<<<<<<<<< - * - * self.__children[name] = child_provider - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___value, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_name}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_name}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_name); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_child_provider->__pyx_base.__pyx_vtab)->update(__pyx_v_child_provider, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "dependency_injector/providers/configuration.pyx":77 - * child_provider = self.__class__(self._get_child_name(name)) - * - * if isinstance(self.__value, dict): # <<<<<<<<<<<<<< - * child_provider.update(self.__value.get(name)) - * - */ - } - - /* "dependency_injector/providers/configuration.pyx":80 - * child_provider.update(self.__value.get(name)) - * - * self.__children[name] = child_provider # <<<<<<<<<<<<<< - * - * return child_provider - */ - if (unlikely(__pyx_v_self->__pyx___children == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 80, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_self->__pyx___children, __pyx_v_name, ((PyObject *)__pyx_v_child_provider)) < 0)) __PYX_ERR(0, 80, __pyx_L1_error) - - /* "dependency_injector/providers/configuration.pyx":74 - * child_provider = self.__children.get(name) - * - * if child_provider is None: # <<<<<<<<<<<<<< - * child_provider = self.__class__(self._get_child_name(name)) - * - */ - } - - /* "dependency_injector/providers/configuration.pyx":82 - * self.__children[name] = child_provider - * - * return child_provider # <<<<<<<<<<<<<< - * - * cpdef str get_name(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_child_provider)); - __pyx_r = ((PyObject *)__pyx_v_child_provider); - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":67 - * return represent_provider(provider=self, provides=self.__name) - * - * def __getattr__(self, name): # <<<<<<<<<<<<<< - * """Return child configuration provider.""" - * cdef Configuration child_provider - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_child_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/configuration.pyx":84 - * return child_provider - * - * cpdef str get_name(self): # <<<<<<<<<<<<<< - * """Name of configuration unit.""" - * return self.__name - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration_get_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("get_name", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_9get_name)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 84, __pyx_L1_error) - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/configuration.pyx":86 - * cpdef str get_name(self): - * """Name of configuration unit.""" - * return self.__name # <<<<<<<<<<<<<< - * - * cpdef object update(self, value): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___name); - __pyx_r = __pyx_v_self->__pyx___name; - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":84 - * return child_provider - * - * cpdef str get_name(self): # <<<<<<<<<<<<<< - * """Name of configuration unit.""" - * return self.__name - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_8get_name[] = "Name of configuration unit."; -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_9get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_name (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_8get_name(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_8get_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_name", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13configuration_13Configuration_get_name(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/configuration.pyx":88 - * return self.__name - * - * cpdef object update(self, value): # <<<<<<<<<<<<<< - * """Set configuration options. - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_11update(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration_update(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_value, int __pyx_skip_dispatch) { - struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_child_provider = 0; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); - __Pyx_RefNannySetupContext("update", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_update); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_11update)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_value}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_value}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_value); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/configuration.pyx":99 - * cdef object child_value - * - * self.__value = value # <<<<<<<<<<<<<< - * - * if not isinstance(self.__value, dict): - */ - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->__pyx___value); - __Pyx_DECREF(__pyx_v_self->__pyx___value); - __pyx_v_self->__pyx___value = __pyx_v_value; - - /* "dependency_injector/providers/configuration.pyx":101 - * self.__value = value - * - * if not isinstance(self.__value, dict): # <<<<<<<<<<<<<< - * return - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___value; - __Pyx_INCREF(__pyx_t_1); - __pyx_t_6 = PyDict_Check(__pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = ((!(__pyx_t_6 != 0)) != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/configuration.pyx":102 - * - * if not isinstance(self.__value, dict): - * return # <<<<<<<<<<<<<< - * - * for name in self.__value: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":101 - * self.__value = value - * - * if not isinstance(self.__value, dict): # <<<<<<<<<<<<<< - * return - * - */ - } - - /* "dependency_injector/providers/configuration.pyx":104 - * return - * - * for name in self.__value: # <<<<<<<<<<<<<< - * child_provider = self.__children.get(name) - * - */ - if (likely(PyList_CheckExact(__pyx_v_self->__pyx___value)) || PyTuple_CheckExact(__pyx_v_self->__pyx___value)) { - __pyx_t_1 = __pyx_v_self->__pyx___value; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->__pyx___value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 104, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 104, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 104, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/configuration.pyx":105 - * - * for name in self.__value: - * child_provider = self.__children.get(name) # <<<<<<<<<<<<<< - * - * if child_provider is None: - */ - if (unlikely(__pyx_v_self->__pyx___children == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); - __PYX_ERR(0, 105, __pyx_L1_error) - } - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->__pyx___children, __pyx_v_name, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_19dependency_injector_9providers_13configuration_Configuration))))) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_child_provider, ((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/configuration.pyx":107 - * child_provider = self.__children.get(name) - * - * if child_provider is None: # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_7 = (((PyObject *)__pyx_v_child_provider) == Py_None); - __pyx_t_6 = (__pyx_t_7 != 0); - if (__pyx_t_6) { - - /* "dependency_injector/providers/configuration.pyx":108 - * - * if child_provider is None: - * continue # <<<<<<<<<<<<<< - * - * child_provider.update(self.__value.get(name)) - */ - goto __pyx_L4_continue; - - /* "dependency_injector/providers/configuration.pyx":107 - * child_provider = self.__children.get(name) - * - * if child_provider is None: # <<<<<<<<<<<<<< - * continue - * - */ - } - - /* "dependency_injector/providers/configuration.pyx":110 - * continue - * - * child_provider.update(self.__value.get(name)) # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___value, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_name}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_name}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_name); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = ((struct __pyx_vtabstruct_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_child_provider->__pyx_base.__pyx_vtab)->update(__pyx_v_child_provider, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/configuration.pyx":104 - * return - * - * for name in self.__value: # <<<<<<<<<<<<<< - * child_provider = self.__children.get(name) - * - */ - __pyx_L4_continue:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/configuration.pyx":88 - * return self.__name - * - * cpdef object update(self, value): # <<<<<<<<<<<<<< - * """Set configuration options. - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.update", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_child_provider); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_11update(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_10update[] = "Set configuration options.\n\n :param value: Value of configuration option.\n :type value: object | dict\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_11update(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("update (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_10update(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self), ((PyObject *)__pyx_v_value)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_10update(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_value) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("update", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13configuration_13Configuration_update(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration.update", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/configuration.pyx":112 - * child_provider.update(self.__value.get(name)) - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return result of provided callable's call.""" - * return self.__value - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_13_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration__provide(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_13_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/configuration.pyx":114 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return result of provided callable's call.""" - * return self.__value # <<<<<<<<<<<<<< - * - * cpdef str _get_child_name(self, str child_name): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_r = __pyx_v_self->__pyx___value; - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":112 - * child_provider.update(self.__value.get(name)) - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return result of provided callable's call.""" - * return self.__value - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_13_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_12_provide[] = "Return result of provided callable's call."; -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_13_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 112, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 112, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 112, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 112, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 112, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_12_provide(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_12_provide(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13configuration_13Configuration__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/configuration.pyx":116 - * return self.__value - * - * cpdef str _get_child_name(self, str child_name): # <<<<<<<<<<<<<< - * cdef str child_full_name - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_15_get_child_name(PyObject *__pyx_v_self, PyObject *__pyx_v_child_name); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_13configuration_13Configuration__get_child_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name, int __pyx_skip_dispatch) { - PyObject *__pyx_v_child_full_name = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("_get_child_name", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_child_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_15_get_child_name)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_child_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_child_name}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_child_name}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_child_name); - __Pyx_GIVEREF(__pyx_v_child_name); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_child_name); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 116, __pyx_L1_error) - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/configuration.pyx":119 - * cdef str child_full_name - * - * child_full_name = '' # <<<<<<<<<<<<<< - * - * if self.__name: - */ - __Pyx_INCREF(__pyx_kp_s_); - __pyx_v_child_full_name = __pyx_kp_s_; - - /* "dependency_injector/providers/configuration.pyx":121 - * child_full_name = '' - * - * if self.__name: # <<<<<<<<<<<<<< - * child_full_name += self.__name + '.' - * - */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_self->__pyx___name); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 121, __pyx_L1_error) - if (__pyx_t_6) { - - /* "dependency_injector/providers/configuration.pyx":122 - * - * if self.__name: - * child_full_name += self.__name + '.' # <<<<<<<<<<<<<< - * - * child_full_name += child_name - */ - __pyx_t_1 = PyNumber_Add(__pyx_v_self->__pyx___name, __pyx_kp_s__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_child_full_name, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_child_full_name, ((PyObject*)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/configuration.pyx":121 - * child_full_name = '' - * - * if self.__name: # <<<<<<<<<<<<<< - * child_full_name += self.__name + '.' - * - */ - } - - /* "dependency_injector/providers/configuration.pyx":124 - * child_full_name += self.__name + '.' - * - * child_full_name += child_name # <<<<<<<<<<<<<< - * - * return child_full_name - */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_child_full_name, __pyx_v_child_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_child_full_name, ((PyObject*)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/configuration.pyx":126 - * child_full_name += child_name - * - * return child_full_name # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_child_full_name); - __pyx_r = __pyx_v_child_full_name; - goto __pyx_L0; - - /* "dependency_injector/providers/configuration.pyx":116 - * return self.__value - * - * cpdef str _get_child_name(self, str child_name): # <<<<<<<<<<<<<< - * cdef str child_full_name - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration._get_child_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_child_full_name); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_15_get_child_name(PyObject *__pyx_v_self, PyObject *__pyx_v_child_name); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_15_get_child_name(PyObject *__pyx_v_self, PyObject *__pyx_v_child_name) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_get_child_name (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child_name), (&PyString_Type), 1, "child_name", 1))) __PYX_ERR(0, 116, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_14_get_child_name(((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)__pyx_v_self), ((PyObject*)__pyx_v_child_name)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_13configuration_13Configuration_14_get_child_name(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *__pyx_v_self, PyObject *__pyx_v_child_name) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_get_child_name", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_13configuration_13Configuration__get_child_name(__pyx_v_self, __pyx_v_child_name, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.configuration.Configuration._get_child_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_19dependency_injector_9providers_13configuration_Configuration __pyx_vtable_19dependency_injector_9providers_13configuration_Configuration; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_13configuration_Configuration(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *p; - PyObject *o = __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_new(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_13configuration_Configuration; - p->__pyx___name = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->__pyx___value = Py_None; Py_INCREF(Py_None); - p->__pyx___children = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_13configuration_Configuration(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *p = (struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___name); - Py_CLEAR(p->__pyx___value); - Py_CLEAR(p->__pyx___children); - PyObject_GC_Track(o); - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_19dependency_injector_9providers_13configuration_Configuration); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_13configuration_Configuration(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *p = (struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)o; - e = ((likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) ? ((__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse) ? __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_19dependency_injector_9providers_13configuration_Configuration)); if (e) return e; - if (p->__pyx___value) { - e = (*v)(p->__pyx___value, a); if (e) return e; - } - if (p->__pyx___children) { - e = (*v)(p->__pyx___children, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_13configuration_Configuration(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *p = (struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *)o; - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) { if (__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_19dependency_injector_9providers_13configuration_Configuration); - tmp = ((PyObject*)p->__pyx___value); - p->__pyx___value = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx___children); - p->__pyx___children = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_tp_getattro_19dependency_injector_9providers_13configuration_Configuration(PyObject *o, PyObject *n) { - PyObject *v = PyObject_GenericGetAttr(o, n); - if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - v = __pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_7__getattr__(o, n); - } - return v; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_13configuration_Configuration[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_2__deepcopy__}, - {"__getattr__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_7__getattr__, METH_O|METH_COEXIST, __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__}, - {"get_name", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_9get_name, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_8get_name}, - {"update", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_11update, METH_O, __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_10update}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_13_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_12_provide}, - {"_get_child_name", (PyCFunction)__pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_15_get_child_name, METH_O, 0}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_13configuration_Configuration = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.configuration.Configuration", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_13configuration_Configuration, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_5__str__, /*tp_str*/ - __pyx_tp_getattro_19dependency_injector_9providers_13configuration_Configuration, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Configuration provider.\n\n Configuration provider helps with implementing late static binding of\n configuration options - use first, define later.\n\n .. code-block:: python\n\n config = Configuration('config')\n\n print(config.section1.option1()) # None\n print(config.section1.option2()) # None\n\n config.update({'section1': {'option1': 1,\n 'option2': 2}})\n\n print(config.section1.option1()) # 1\n print(config.section1.option2()) # 2\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_13configuration_Configuration, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_13configuration_Configuration, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_13configuration_Configuration, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_13configuration_13Configuration_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_13configuration_Configuration, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "configuration", - __pyx_k_Dependency_injector_configuratio, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, - {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_get_child_name, __pyx_k_get_child_name, sizeof(__pyx_k_get_child_name), 0, 0, 1, 1}, - {&__pyx_n_s_get_name, __pyx_k_get_name, sizeof(__pyx_k_get_name), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_overridden, __pyx_k_overridden, sizeof(__pyx_k_overridden), 0, 0, 1, 1}, - {&__pyx_n_s_override, __pyx_k_override, sizeof(__pyx_k_override), 0, 0, 1, 1}, - {&__pyx_n_s_provide, __pyx_k_provide, sizeof(__pyx_k_provide), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 44, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 48, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initconfiguration(void); /*proto*/ -PyMODINIT_FUNC initconfiguration(void) -#else -PyMODINIT_FUNC PyInit_configuration(void); /*proto*/ -PyMODINIT_FUNC PyInit_configuration(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_configuration(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("configuration", __pyx_methods, __pyx_k_Dependency_injector_configuratio, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_dependency_injector__providers__configuration) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "dependency_injector.providers.configuration")) { - if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers.configuration", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Provider = __Pyx_ImportType("dependency_injector.providers.base", "Provider", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Provider), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Provider = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_13configuration_Configuration = &__pyx_vtable_19dependency_injector_9providers_13configuration_Configuration; - __pyx_vtable_19dependency_injector_9providers_13configuration_Configuration.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - __pyx_vtable_19dependency_injector_9providers_13configuration_Configuration.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13configuration_13Configuration__provide; - __pyx_vtable_19dependency_injector_9providers_13configuration_Configuration.get_name = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13configuration_13Configuration_get_name; - __pyx_vtable_19dependency_injector_9providers_13configuration_Configuration.update = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13configuration_13Configuration_update; - __pyx_vtable_19dependency_injector_9providers_13configuration_Configuration._get_child_name = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_13configuration_Configuration *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_13configuration_13Configuration__get_child_name; - __pyx_type_19dependency_injector_9providers_13configuration_Configuration.tp_base = __pyx_ptype_19dependency_injector_9providers_4base_Provider; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_13configuration_Configuration) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_13configuration_Configuration.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_13configuration_Configuration, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 15, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration___init__.doc = __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration___init__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_13configuration_Configuration, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 15, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_4__str__.doc = __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_4__str__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_4__str__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_13configuration_Configuration, "__getattr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 15, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__.doc = __pyx_doc_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_13configuration_13Configuration_6__getattr__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_13configuration_Configuration.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_13configuration_Configuration) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Configuration", (PyObject *)&__pyx_type_19dependency_injector_9providers_13configuration_Configuration) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_13configuration_Configuration = &__pyx_type_19dependency_injector_9providers_13configuration_Configuration; - /*--- Type import code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Object = __Pyx_ImportType("dependency_injector.providers.base", "Object", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Object), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Object)) __PYX_ERR(1, 15, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Object = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Object->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Object)) __PYX_ERR(1, 15, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_Delegate = __Pyx_ImportType("dependency_injector.providers.base", "Delegate", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Delegate), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(1, 21, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Delegate = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Delegate->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(1, 21, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = __Pyx_ImportType("dependency_injector.providers.base", "ExternalDependency", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = __Pyx_ImportType("dependency_injector.providers.base", "OverridingContext", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext)) __PYX_ERR(1, 29, __pyx_L1_error) - /*--- Variable import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "CLASS_TYPES", (void **)&__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*--- Function import code ---*/ - __pyx_t_2 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "represent_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_represent_provider, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "deepcopy", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "dependency_injector/providers/configuration.pyx":1 - * """Dependency injector configuration providers. # <<<<<<<<<<<<<< - * - * Powered by Cython. - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init dependency_injector.providers.configuration", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers.configuration"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* dict_getitem_default */ - static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { - PyObject* value; -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (unlikely(PyErr_Occurred())) - return NULL; - value = default_value; - } - Py_INCREF(value); -#else - if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { - value = PyDict_GetItem(d, key); - if (unlikely(!value)) { - value = default_value; - } - Py_INCREF(value); - } else { - if (default_value == Py_None) - default_value = NULL; - value = PyObject_CallMethodObjArgs( - d, __pyx_n_s_get, key, default_value, NULL); - } -#endif - return value; -} - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -/* CallNextTpDealloc */ - static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_dealloc != current_tp_dealloc) - type = type->tp_base; - while (type && type->tp_dealloc == current_tp_dealloc) - type = type->tp_base; - if (type) - type->tp_dealloc(obj); -} - -/* CallNextTpTraverse */ - static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_traverse != current_tp_traverse) - type = type->tp_base; - while (type && type->tp_traverse == current_tp_traverse) - type = type->tp_base; - if (type && type->tp_traverse) - return type->tp_traverse(obj, v, a); - return 0; -} - -/* CallNextTpClear */ - static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_clear != current_tp_clear) - type = type->tp_base; - while (type && type->tp_clear == current_tp_clear) - type = type->tp_base; - if (type && type->tp_clear) - type->tp_clear(obj); -} - -/* GetVTable */ - static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - size_t size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -/* VoidPtrImport */ - #ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, name); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C variable %.200s", - PyModule_GetName(module), name); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); - goto bad; - } - *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif - if (!(*p)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* FunctionImport */ - #ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, funcname); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C function %.200s", - PyModule_GetName(module), funcname); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); - goto bad; - } - tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif - *f = tmp.fp; - if (!(*f)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers/configuration.pxd b/src/dependency_injector/providers/configuration.pxd deleted file mode 100644 index 5d9caf47..00000000 --- a/src/dependency_injector/providers/configuration.pxd +++ /dev/null @@ -1,19 +0,0 @@ -"""Dependency injector configuration providers. - -Powered by Cython. -""" - -from .base cimport ( - Provider, -) - - -cdef class Configuration(Provider): - cdef str __name - cdef object __value - cdef dict __children - - cpdef str get_name(self) - cpdef object update(self, object value) - cpdef object _provide(self, tuple args, dict kwargs) - cpdef str _get_child_name(self, str child_name) diff --git a/src/dependency_injector/providers/configuration.pyx b/src/dependency_injector/providers/configuration.pyx deleted file mode 100644 index 23028c82..00000000 --- a/src/dependency_injector/providers/configuration.pyx +++ /dev/null @@ -1,126 +0,0 @@ -"""Dependency injector configuration providers. - -Powered by Cython. -""" - -from .base cimport ( - Provider, -) -from .utils cimport ( - represent_provider, - deepcopy, -) - - -cdef class Configuration(Provider): - """Configuration provider. - - Configuration provider helps with implementing late static binding of - configuration options - use first, define later. - - .. code-block:: python - - config = Configuration('config') - - print(config.section1.option1()) # None - print(config.section1.option2()) # None - - config.update({'section1': {'option1': 1, - 'option2': 2}}) - - print(config.section1.option1()) # 1 - print(config.section1.option2()) # 2 - """ - - def __init__(self, name): - """Initializer. - - :param name: Name of configuration unit. - :type name: str - """ - self.__name = name - self.__value = None - self.__children = dict() - super(Configuration, self).__init__() - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - - copied = self.__class__(self.__name) - copied.update(deepcopy(self.__value)) - - for overriding_provider in self.overridden: - copied.override(deepcopy(overriding_provider, memo)) - - return copied - - def __str__(self): - """Return string representation of provider. - - :rtype: str - """ - return represent_provider(provider=self, provides=self.__name) - - def __getattr__(self, name): - """Return child configuration provider.""" - cdef Configuration child_provider - cdef object value - - child_provider = self.__children.get(name) - - if child_provider is None: - child_provider = self.__class__(self._get_child_name(name)) - - if isinstance(self.__value, dict): - child_provider.update(self.__value.get(name)) - - self.__children[name] = child_provider - - return child_provider - - cpdef str get_name(self): - """Name of configuration unit.""" - return self.__name - - cpdef object update(self, value): - """Set configuration options. - - :param value: Value of configuration option. - :type value: object | dict - - :rtype: None - """ - cdef Configuration child_provider - cdef object child_value - - self.__value = value - - if not isinstance(self.__value, dict): - return - - for name in self.__value: - child_provider = self.__children.get(name) - - if child_provider is None: - continue - - child_provider.update(self.__value.get(name)) - - cpdef object _provide(self, tuple args, dict kwargs): - """Return result of provided callable's call.""" - return self.__value - - cpdef str _get_child_name(self, str child_name): - cdef str child_full_name - - child_full_name = '' - - if self.__name: - child_full_name += self.__name + '.' - - child_full_name += child_name - - return child_full_name diff --git a/src/dependency_injector/providers/factories.c b/src/dependency_injector/providers/factories.c deleted file mode 100644 index 84297a8c..00000000 --- a/src/dependency_injector/providers/factories.c +++ /dev/null @@ -1,6949 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__dependency_injector__providers__factories -#define __PYX_HAVE_API__dependency_injector__providers__factories -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/dependency_injector/providers/factories.pyx", - "src/dependency_injector/providers/injections.pxd", - "src/dependency_injector/providers/factories.pxd", - "src/dependency_injector/providers/callables.pxd", - "src/dependency_injector/providers/base.pxd", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider; -struct __pyx_obj_19dependency_injector_9providers_4base_Object; -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate; -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency; -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext; -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection; -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection; -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection; -struct __pyx_obj_19dependency_injector_9providers_9callables_Callable; -struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable; -struct __pyx_obj_19dependency_injector_9providers_9factories_Factory; -struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory; -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy; - -/* "utils.pxd":21 - * - * - * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< - */ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy { - int __pyx_n; - PyObject *memo; -}; - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider { - PyObject_HEAD - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtab; - PyObject *__pyx___overridden; - int __pyx___overridden_len; -}; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Object { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; -}; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate { - struct __pyx_obj_19dependency_injector_9providers_4base_Object __pyx_base; -}; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyTypeObject *__pyx___instance_of; -}; - - -/* "base.pxd":29 - * - * - * cdef class OverridingContext(object): # <<<<<<<<<<<<<< - * cdef Provider __overridden - * cdef Provider __overriding - */ -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext { - PyObject_HEAD - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overridden; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overriding; -}; - - -/* "injections.pxd":9 - * - * - * cdef class Injection(object): # <<<<<<<<<<<<<< - * cdef object __value - * cdef int __is_provider - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection { - PyObject_HEAD - PyObject *__pyx___value; - int __pyx___is_provider; - int __pyx___is_delegated; - int __pyx___call; -}; - - -/* "injections.pxd":16 - * - * - * cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; -}; - - -/* "injections.pxd":20 - * - * - * cdef class NamedInjection(Injection): # <<<<<<<<<<<<<< - * cdef object __name - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; - PyObject *__pyx___name; -}; - - -/* "callables.pxd":16 - * - * - * cdef class Callable(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_9callables_Callable { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; - PyObject *__pyx___args; - int __pyx___args_len; - PyObject *__pyx___kwargs; - int __pyx___kwargs_len; -}; - - -/* "callables.pxd":28 - * - * - * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable { - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable __pyx_base; -}; - - -/* "dependency_injector/providers/factories.pxd":14 - * - * - * cdef class Factory(Provider): # <<<<<<<<<<<<<< - * cdef Callable __instantiator - * - */ -struct __pyx_obj_19dependency_injector_9providers_9factories_Factory { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx___instantiator; - PyObject *__pyx___attributes; - int __pyx___attributes_len; -}; - - -/* "dependency_injector/providers/factories.pxd":23 - * - * - * cdef class DelegatedFactory(Factory): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory { - struct __pyx_obj_19dependency_injector_9providers_9factories_Factory __pyx_base; -}; - - - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider { - PyObject *(*_provide)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*_call_last_overriding)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object *__pyx_vtabptr_19dependency_injector_9providers_4base_Object; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate *__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency *__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency; - - -/* "callables.pxd":16 - * - * - * cdef class Callable(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable *__pyx_vtabptr_19dependency_injector_9providers_9callables_Callable; - - -/* "callables.pxd":28 - * - * - * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< - * pass - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable { - struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable *__pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable; - - -/* "dependency_injector/providers/factories.pyx":20 - * - * - * cdef class Factory(Provider): # <<<<<<<<<<<<<< - * r"""Factory provider creates new instance on every call. - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory *__pyx_vtabptr_19dependency_injector_9providers_9factories_Factory; - - -/* "dependency_injector/providers/factories.pyx":253 - * - * - * cdef class DelegatedFactory(Factory): # <<<<<<<<<<<<<< - * """Factory that is injected "as is". - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_DelegatedFactory { - struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_DelegatedFactory *__pyx_vtabptr_19dependency_injector_9providers_9factories_DelegatedFactory; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* KeywordStringCheck.proto */ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* ExtTypeTest.proto */ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); - -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* PyDictContains.proto */ -static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { - int result = PyDict_Contains(dict, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* CallNextTpDealloc.proto */ -static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); - -/* CallNextTpTraverse.proto */ -static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); - -/* CallNextTpClear.proto */ -static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); - -/* GetVTable.proto */ -static void* __Pyx_GetVtable(PyObject *dict); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -/* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); - -/* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -static PyObject *__pyx_f_19dependency_injector_9providers_9factories_7Factory__provide(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ - -/* Module declarations from 'dependency_injector.providers.base' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Provider = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Object = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Delegate = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = 0; - -/* Module declarations from 'cython' */ - -/* Module declarations from 'dependency_injector.providers.injections' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_Injection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(PyObject *, PyObject *, int); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(PyObject *, PyObject *, int); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___inject_attributes(PyObject *, PyObject *, int); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_10injections_parse_named_injections)(PyObject *, int __pyx_skip_dispatch); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.callables' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_Callable = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *, PyObject *, PyObject *); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.utils' */ -static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0; -#define __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES (*__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES) -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_represent_provider)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_deepcopy)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.factories' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_Factory = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___factory_call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *, PyObject *, PyObject *); /*proto*/ -#define __Pyx_MODULE_NAME "dependency_injector.providers.factories" -int __pyx_module_is_main_dependency_injector__providers__factories = 0; - -/* Implementation of 'dependency_injector.providers.factories' */ -static PyObject *__pyx_builtin_super; -static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_range; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k_cls[] = "cls"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_args[] = "args"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_Error[] = "Error"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_super[] = "super"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_kwargs[] = "kwargs"; -static const char __pyx_k_provide[] = "_provide"; -static const char __pyx_k_add_args[] = "add_args"; -static const char __pyx_k_override[] = "override"; -static const char __pyx_k_provides[] = "provides"; -static const char __pyx_k_set_args[] = "set_args"; -static const char __pyx_k_add_kwargs[] = "add_kwargs"; -static const char __pyx_k_attributes[] = "attributes"; -static const char __pyx_k_clear_args[] = "clear_args"; -static const char __pyx_k_overridden[] = "overridden"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_set_kwargs[] = "set_kwargs"; -static const char __pyx_k_IS_DELEGATED[] = "__IS_DELEGATED__"; -static const char __pyx_k_clear_kwargs[] = "clear_kwargs"; -static const char __pyx_k_provided_type[] = "provided_type"; -static const char __pyx_k_set_attributes[] = "set_attributes"; -static const char __pyx_k_dependency_injector_errors[] = "dependency_injector.errors"; -static const char __pyx_k_0_can_provide_only_1_instances[] = "{0} can provide only {1} instances"; -static const char __pyx_k_Dependency_injector_factory_prov[] = "Dependency injector factory providers.\n\nPowered by Cython.\n"; -static PyObject *__pyx_kp_s_0_can_provide_only_1_instances; -static PyObject *__pyx_n_s_Error; -static PyObject *__pyx_n_s_IS_DELEGATED; -static PyObject *__pyx_n_s_add_args; -static PyObject *__pyx_n_s_add_kwargs; -static PyObject *__pyx_n_s_args; -static PyObject *__pyx_n_s_attributes; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_clear_args; -static PyObject *__pyx_n_s_clear_kwargs; -static PyObject *__pyx_n_s_cls; -static PyObject *__pyx_n_s_dependency_injector_errors; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_overridden; -static PyObject *__pyx_n_s_override; -static PyObject *__pyx_n_s_provide; -static PyObject *__pyx_n_s_provided_type; -static PyObject *__pyx_n_s_provides; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_set_args; -static PyObject *__pyx_n_s_set_attributes; -static PyObject *__pyx_n_s_set_kwargs; -static PyObject *__pyx_n_s_super; -static PyObject *__pyx_n_s_test; -static int __pyx_pf_19dependency_injector_9providers_9factories_7Factory___init__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_4__str__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_4args___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_6add_args(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_8set_args(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_10clear_args(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_24_provide(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9factories_Factory(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9factories_DelegatedFactory(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ - -/* "dependency_injector/providers/factories.pyx":73 - * provided_type = None - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_9factories_7Factory_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_9factories_7Factory_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 73, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 73, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory___init__(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_9factories_7Factory___init__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/factories.pyx":85 - * :type kwargs: dict[str, object] - * """ - * if (self.__class__.provided_type and # <<<<<<<<<<<<<< - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - - /* "dependency_injector/providers/factories.pyx":86 - * """ - * if (self.__class__.provided_type and - * not issubclass(provides, self.__class__.provided_type)): # <<<<<<<<<<<<<< - * raise Error('{0} can provide only {1} instances'.format( - * self.__class__, self.__class__.provided_type)) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = PyObject_IsSubclass(__pyx_v_provides, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - - /* "dependency_injector/providers/factories.pyx":85 - * :type kwargs: dict[str, object] - * """ - * if (self.__class__.provided_type and # <<<<<<<<<<<<<< - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - */ - if (__pyx_t_1) { - - /* "dependency_injector/providers/factories.pyx":87 - * if (self.__class__.provided_type and - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( # <<<<<<<<<<<<<< - * self.__class__, self.__class__.provided_type)) - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_can_provide_only_1_instances, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - - /* "dependency_injector/providers/factories.pyx":88 - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - * self.__class__, self.__class__.provided_type)) # <<<<<<<<<<<<<< - * - * self.__instantiator = Callable(provides, *args, **kwargs) - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10); - __pyx_t_8 = 0; - __pyx_t_10 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_7) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 87, __pyx_L1_error) - - /* "dependency_injector/providers/factories.pyx":85 - * :type kwargs: dict[str, object] - * """ - * if (self.__class__.provided_type and # <<<<<<<<<<<<<< - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - */ - } - - /* "dependency_injector/providers/factories.pyx":90 - * self.__class__, self.__class__.provided_type)) - * - * self.__instantiator = Callable(provides, *args, **kwargs) # <<<<<<<<<<<<<< - * - * self.__attributes = tuple() - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_9callables_Callable), __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___instantiator); - __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___instantiator)); - __pyx_v_self->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":92 - * self.__instantiator = Callable(provides, *args, **kwargs) - * - * self.__attributes = tuple() # <<<<<<<<<<<<<< - * self.__attributes_len = 0 - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); - __Pyx_DECREF(__pyx_v_self->__pyx___attributes); - __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":93 - * - * self.__attributes = tuple() - * self.__attributes_len = 0 # <<<<<<<<<<<<<< - * - * super(Factory, self).__init__() - */ - __pyx_v_self->__pyx___attributes_len = 0; - - /* "dependency_injector/providers/factories.pyx":95 - * self.__attributes_len = 0 - * - * super(Factory, self).__init__() # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_9factories_Factory)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_9factories_Factory)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_9factories_Factory)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_12) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":73 - * provided_type = None - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":97 - * super(Factory, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_2__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_v_overriding_provider = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/factories.pyx":99 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":100 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/factories.pyx":101 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * - * copied = self.__class__(self.cls, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":100 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - } - - /* "dependency_injector/providers/factories.pyx":103 - * return copied - * - * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cls); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":104 - * - * copied = self.__class__(self.cls, - * *deepcopy(self.args, memo), # <<<<<<<<<<<<<< - * **deepcopy(self.kwargs, memo)) - * copied.set_attributes(**deepcopy(self.attributes, memo)) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 104, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_2, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":103 - * return copied - * - * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":105 - * copied = self.__class__(self.cls, - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) # <<<<<<<<<<<<<< - * copied.set_attributes(**deepcopy(self.attributes, memo)) - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 105, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_t_3 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 105, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_t_3))) { - __pyx_t_2 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "dependency_injector/providers/factories.pyx":103 - * return copied - * - * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_3); - __pyx_t_3 = 0; - - /* "dependency_injector/providers/factories.pyx":106 - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - * copied.set_attributes(**deepcopy(self.attributes, memo)) # <<<<<<<<<<<<<< - * - * for overriding_provider in self.overridden: - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_set_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 106, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_4, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 106, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_t_1))) { - __pyx_t_2 = PyDict_Copy(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":108 - * copied.set_attributes(**deepcopy(self.attributes, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 108, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 108, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 108, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_10(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 108, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":109 - * - * for overriding_provider in self.overridden: - * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< - * - * return copied - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 109, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":108 - * copied.set_attributes(**deepcopy(self.attributes, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":111 - * copied.override(deepcopy(overriding_provider, memo)) - * - * return copied # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":97 - * super(Factory, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XDECREF(__pyx_v_overriding_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":113 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_5__str__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_4__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory_4__str__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_5__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_4__str__(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_4__str__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "dependency_injector/providers/factories.pyx":118 - * :rtype: str - * """ - * return represent_provider(provider=self, # <<<<<<<<<<<<<< - * provides=self.__instantiator.provides) - * - */ - __Pyx_XDECREF(__pyx_r); - - /* "dependency_injector/providers/factories.pyx":119 - * """ - * return represent_provider(provider=self, - * provides=self.__instantiator.provides) # <<<<<<<<<<<<<< - * - * @property - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_provides); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - - /* "dependency_injector/providers/factories.pyx":118 - * :rtype: str - * """ - * return represent_provider(provider=self, # <<<<<<<<<<<<<< - * provides=self.__instantiator.provides) - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":113 - * return copied - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":122 - * - * @property - * def cls(self): # <<<<<<<<<<<<<< - * """Return provided type.""" - * return self.__instantiator.provides - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_3cls_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_3cls_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_3cls___get__(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/factories.pyx":124 - * def cls(self): - * """Return provided type.""" - * return self.__instantiator.provides # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_provides); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":122 - * - * @property - * def cls(self): # <<<<<<<<<<<<<< - * """Return provided type.""" - * return self.__instantiator.provides - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.cls.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":127 - * - * @property - * def args(self): # <<<<<<<<<<<<<< - * """Return positional argument injections.""" - * return self.__instantiator.args - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_4args_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_4args___get__(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_4args___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/factories.pyx":129 - * def args(self): - * """Return positional argument injections.""" - * return self.__instantiator.args # <<<<<<<<<<<<<< - * - * def add_args(self, *args): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":127 - * - * @property - * def args(self): # <<<<<<<<<<<<<< - * """Return positional argument injections.""" - * return self.__instantiator.args - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.args.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":131 - * return self.__instantiator.args - * - * def add_args(self, *args): # <<<<<<<<<<<<<< - * """Add __init__ postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_6add_args[] = "Add __init__ postional argument injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_args (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_args", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_6add_args(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_6add_args(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("add_args", 0); - - /* "dependency_injector/providers/factories.pyx":139 - * :return: Reference ``self`` - * """ - * self.__instantiator.add_args(*args) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":140 - * """ - * self.__instantiator.add_args(*args) - * return self # <<<<<<<<<<<<<< - * - * def set_args(self, *args): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":131 - * return self.__instantiator.args - * - * def add_args(self, *args): # <<<<<<<<<<<<<< - * """Add __init__ postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.add_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":142 - * return self - * - * def set_args(self, *args): # <<<<<<<<<<<<<< - * """Set __init__ postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_8set_args[] = "Set __init__ postional argument injections.\n\n Existing __init__ positional argument injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_args (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_args", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_8set_args(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_8set_args(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_args", 0); - - /* "dependency_injector/providers/factories.pyx":152 - * :return: Reference ``self`` - * """ - * self.__instantiator.set_args(*args) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":153 - * """ - * self.__instantiator.set_args(*args) - * return self # <<<<<<<<<<<<<< - * - * def clear_args(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":142 - * return self - * - * def set_args(self, *args): # <<<<<<<<<<<<<< - * """Set __init__ postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.set_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":155 - * return self - * - * def clear_args(self): # <<<<<<<<<<<<<< - * """Drop __init__ postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_10clear_args[] = "Drop __init__ postional argument injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_args (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_10clear_args(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_10clear_args(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("clear_args", 0); - - /* "dependency_injector/providers/factories.pyx":160 - * :return: Reference ``self`` - * """ - * self.__instantiator.clear_args() # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":161 - * """ - * self.__instantiator.clear_args() - * return self # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":155 - * return self - * - * def clear_args(self): # <<<<<<<<<<<<<< - * """Drop __init__ postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.clear_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":164 - * - * @property - * def kwargs(self): # <<<<<<<<<<<<<< - * """Return keyword argument injections.""" - * return self.__instantiator.kwargs - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_6kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_6kwargs_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_6kwargs___get__(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/factories.pyx":166 - * def kwargs(self): - * """Return keyword argument injections.""" - * return self.__instantiator.kwargs # <<<<<<<<<<<<<< - * - * def add_kwargs(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":164 - * - * @property - * def kwargs(self): # <<<<<<<<<<<<<< - * """Return keyword argument injections.""" - * return self.__instantiator.kwargs - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.kwargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":168 - * return self.__instantiator.kwargs - * - * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Add __init__ keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_12add_kwargs[] = "Add __init__ keyword argument injections.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_kwargs (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("add_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_kwargs", 1))) return NULL; - if (__pyx_kwds) { - __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - } else { - __pyx_v_kwargs = NULL; - } - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_12add_kwargs(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("add_kwargs", 0); - - /* "dependency_injector/providers/factories.pyx":176 - * :return: Reference ``self`` - * """ - * self.__instantiator.add_kwargs(**kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":177 - * """ - * self.__instantiator.add_kwargs(**kwargs) - * return self # <<<<<<<<<<<<<< - * - * def set_kwargs(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":168 - * return self.__instantiator.kwargs - * - * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Add __init__ keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.add_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":179 - * return self - * - * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Set __init__ keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_14set_kwargs[] = "Set __init__ keyword argument injections.\n\n Existing __init__ keyword argument injections are dropped.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_kwargs (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("set_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_kwargs", 1))) return NULL; - if (__pyx_kwds) { - __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - } else { - __pyx_v_kwargs = NULL; - } - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_14set_kwargs(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_kwargs", 0); - - /* "dependency_injector/providers/factories.pyx":189 - * :return: Reference ``self`` - * """ - * self.__instantiator.set_kwargs(**kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":190 - * """ - * self.__instantiator.set_kwargs(**kwargs) - * return self # <<<<<<<<<<<<<< - * - * def clear_kwargs(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":179 - * return self - * - * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Set __init__ keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.set_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":192 - * return self - * - * def clear_kwargs(self): # <<<<<<<<<<<<<< - * """Drop __init__ keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_16clear_kwargs[] = "Drop __init__ keyword argument injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_kwargs (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_16clear_kwargs(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("clear_kwargs", 0); - - /* "dependency_injector/providers/factories.pyx":197 - * :return: Reference ``self`` - * """ - * self.__instantiator.clear_kwargs() # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":198 - * """ - * self.__instantiator.clear_kwargs() - * return self # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":192 - * return self - * - * def clear_kwargs(self): # <<<<<<<<<<<<<< - * """Drop __init__ keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.clear_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":201 - * - * @property - * def attributes(self): # <<<<<<<<<<<<<< - * """Return attribute injections.""" - * cdef int index - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_10attributes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_10attributes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_10attributes___get__(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - int __pyx_v_index; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_attribute = 0; - PyObject *__pyx_v_attributes = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/factories.pyx":207 - * cdef dict attributes - * - * attributes = dict() # <<<<<<<<<<<<<< - * for index in range(self.__attributes_len): - * attribute = self.__attributes[index] - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_attributes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":208 - * - * attributes = dict() - * for index in range(self.__attributes_len): # <<<<<<<<<<<<<< - * attribute = self.__attributes[index] - * attributes[attribute.__name] = attribute.__value - */ - __pyx_t_2 = __pyx_v_self->__pyx___attributes_len; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_index = __pyx_t_3; - - /* "dependency_injector/providers/factories.pyx":209 - * attributes = dict() - * for index in range(self.__attributes_len): - * attribute = self.__attributes[index] # <<<<<<<<<<<<<< - * attributes[attribute.__name] = attribute.__value - * return attributes - */ - if (unlikely(__pyx_v_self->__pyx___attributes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 209, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v_self->__pyx___attributes, __pyx_v_index, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection))))) __PYX_ERR(0, 209, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_attribute, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_1)); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":210 - * for index in range(self.__attributes_len): - * attribute = self.__attributes[index] - * attributes[attribute.__name] = attribute.__value # <<<<<<<<<<<<<< - * return attributes - * - */ - __pyx_t_1 = __pyx_v_attribute->__pyx_base.__pyx___value; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(PyDict_SetItem(__pyx_v_attributes, __pyx_v_attribute->__pyx___name, __pyx_t_1) < 0)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/factories.pyx":211 - * attribute = self.__attributes[index] - * attributes[attribute.__name] = attribute.__value - * return attributes # <<<<<<<<<<<<<< - * - * def add_attributes(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_attributes); - __pyx_r = __pyx_v_attributes; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":201 - * - * @property - * def attributes(self): # <<<<<<<<<<<<<< - * """Return attribute injections.""" - * cdef int index - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.attributes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_attribute); - __Pyx_XDECREF(__pyx_v_attributes); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":213 - * return attributes - * - * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Add attribute injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_18add_attributes[] = "Add attribute injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_attributes (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("add_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_attributes", 1))) return NULL; - __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_18add_attributes(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - __Pyx_RefNannySetupContext("add_attributes", 0); - - /* "dependency_injector/providers/factories.pyx":221 - * :return: Reference ``self`` - * """ - * self.__attributes += parse_named_injections(kwargs) # <<<<<<<<<<<<<< - * self.__attributes_len = len(self.__attributes) - * return self - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_self->__pyx___attributes, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); - __Pyx_DECREF(__pyx_v_self->__pyx___attributes); - __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pyx":222 - * """ - * self.__attributes += parse_named_injections(kwargs) - * self.__attributes_len = len(self.__attributes) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___attributes; - __Pyx_INCREF(__pyx_t_2); - if (unlikely(__pyx_t_2 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 222, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 222, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_self->__pyx___attributes_len = __pyx_t_3; - - /* "dependency_injector/providers/factories.pyx":223 - * self.__attributes += parse_named_injections(kwargs) - * self.__attributes_len = len(self.__attributes) - * return self # <<<<<<<<<<<<<< - * - * def set_attributes(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":213 - * return attributes - * - * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Add attribute injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.add_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":225 - * return self - * - * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Set attribute injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_20set_attributes[] = "Set attribute injections.\n\n Existing attribute injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_attributes (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("set_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_attributes", 1))) return NULL; - __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_20set_attributes(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - __Pyx_RefNannySetupContext("set_attributes", 0); - - /* "dependency_injector/providers/factories.pyx":235 - * :return: Reference ``self`` - * """ - * self.__attributes = parse_named_injections(kwargs) # <<<<<<<<<<<<<< - * self.__attributes_len = len(self.__attributes) - * return self - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); - __Pyx_DECREF(__pyx_v_self->__pyx___attributes); - __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":236 - * """ - * self.__attributes = parse_named_injections(kwargs) - * self.__attributes_len = len(self.__attributes) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___attributes; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 236, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx___attributes_len = __pyx_t_2; - - /* "dependency_injector/providers/factories.pyx":237 - * self.__attributes = parse_named_injections(kwargs) - * self.__attributes_len = len(self.__attributes) - * return self # <<<<<<<<<<<<<< - * - * def clear_attributes(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":225 - * return self - * - * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Set attribute injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.set_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":239 - * return self - * - * def clear_attributes(self): # <<<<<<<<<<<<<< - * """Drop attribute injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_22clear_attributes[] = "Drop attribute injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_attributes (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_22clear_attributes(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - __Pyx_RefNannySetupContext("clear_attributes", 0); - - /* "dependency_injector/providers/factories.pyx":244 - * :return: Reference ``self`` - * """ - * self.__attributes = tuple() # <<<<<<<<<<<<<< - * self.__attributes_len = len(self.__attributes) - * return self - */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyTuple_Type)), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___attributes); - __Pyx_DECREF(__pyx_v_self->__pyx___attributes); - __pyx_v_self->__pyx___attributes = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pyx":245 - * """ - * self.__attributes = tuple() - * self.__attributes_len = len(self.__attributes) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __pyx_v_self->__pyx___attributes; - __Pyx_INCREF(__pyx_t_1); - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 245, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_self->__pyx___attributes_len = __pyx_t_2; - - /* "dependency_injector/providers/factories.pyx":246 - * self.__attributes = tuple() - * self.__attributes_len = len(self.__attributes) - * return self # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":239 - * return self - * - * def clear_attributes(self): # <<<<<<<<<<<<<< - * """Drop attribute injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory.clear_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pyx":248 - * return self - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return new instance.""" - * return __factory_call(self, args, kwargs) - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_25_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_9factories_7Factory__provide(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_25_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/factories.pyx":250 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return new instance.""" - * return __factory_call(self, args, kwargs) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_9factories___factory_call(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pyx":248 - * return self - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return new instance.""" - * return __factory_call(self, args, kwargs) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_25_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_9factories_7Factory_24_provide[] = "Return new instance."; -static PyObject *__pyx_pw_19dependency_injector_9providers_9factories_7Factory_25_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 248, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 248, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 248, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 248, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_9factories_7Factory_24_provide(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_9factories_7Factory_24_provide(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_9factories_7Factory__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.factories.Factory._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get_name", 0); - - /* "injections.pxd":25 - * - * cdef inline object __get_name(NamedInjection self): - * return self.__name # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___name); - __pyx_r = __pyx_v_self->__pyx___name; - goto __pyx_L0; - - /* "injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__get_value", 0); - - /* "injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - __pyx_t_1 = ((__pyx_v_self->__pyx___call == 0) != 0); - if (__pyx_t_1) { - - /* "injections.pxd":30 - * cdef inline object __get_value(Injection self): - * if self.__call == 0: - * return self.__value # <<<<<<<<<<<<<< - * return self.__value() - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_r = __pyx_v_self->__pyx___value; - goto __pyx_L0; - - /* "injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - } - - /* "injections.pxd":31 - * if self.__call == 0: - * return self.__value - * return self.__value() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_t_3 = __pyx_v_self->__pyx___value; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(PyObject *__pyx_v_args, PyObject *__pyx_v_inj_args, int __pyx_v_inj_args_len) { - int __pyx_v_index; - PyObject *__pyx_v_positional_args = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__provide_positional_args", 0); - - /* "injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - __pyx_t_1 = ((__pyx_v_inj_args_len == 0) != 0); - if (__pyx_t_1) { - - /* "injections.pxd":44 - * - * if inj_args_len == 0: - * return args # <<<<<<<<<<<<<< - * - * positional_args = list() - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_args); - __pyx_r = __pyx_v_args; - goto __pyx_L0; - - /* "injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - } - - /* "injections.pxd":46 - * return args - * - * positional_args = list() # <<<<<<<<<<<<<< - * for index in range(inj_args_len): - * injection = inj_args[index] - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_positional_args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "injections.pxd":47 - * - * positional_args = list() - * for index in range(inj_args_len): # <<<<<<<<<<<<<< - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - */ - __pyx_t_3 = __pyx_v_inj_args_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":48 - * positional_args = list() - * for index in range(inj_args_len): - * injection = inj_args[index] # <<<<<<<<<<<<<< - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) - */ - if (unlikely(__pyx_v_inj_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 48, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_inj_args, __pyx_v_index); - __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "injections.pxd":49 - * for index in range(inj_args_len): - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) # <<<<<<<<<<<<<< - * positional_args.extend(args) - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_injection)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_positional_args, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "injections.pxd":50 - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) # <<<<<<<<<<<<<< - * - * return tuple(positional_args) - */ - __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_positional_args, __pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 50, __pyx_L1_error) - - /* "injections.pxd":52 - * positional_args.extend(args) - * - * return tuple(positional_args) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_positional_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_positional_args); - __Pyx_XDECREF((PyObject *)__pyx_v_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(PyObject *__pyx_v_kwargs, PyObject *__pyx_v_inj_kwargs, int __pyx_v_inj_kwargs_len) { - int __pyx_v_index; - PyObject *__pyx_v_name = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_kw_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("__provide_keyword_args", 0); - - /* "injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 64, __pyx_L1_error) - } - __pyx_t_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 64, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_1 == 0) != 0); - if (__pyx_t_2) { - - /* "injections.pxd":65 - * - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":66 - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 66, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "injections.pxd":67 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * else: - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "injections.pxd":68 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * else: - * for index in range(inj_kwargs_len): - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 68, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 68, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - - /* "injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - goto __pyx_L3; - } - - /* "injections.pxd":70 - * kwargs[name] = __get_value(kw_injection) - * else: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - /*else*/ { - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":71 - * else: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * if name not in kwargs: - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 71, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "injections.pxd":72 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 73, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 73, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_2 != 0); - if (__pyx_t_6) { - - /* "injections.pxd":74 - * name = __get_name(kw_injection) - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * - * return kwargs - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 74, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - } - } - } - __pyx_L3:; - - /* "injections.pxd":76 - * kwargs[name] = __get_value(kw_injection) - * - * return kwargs # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_kwargs); - __pyx_r = __pyx_v_kwargs; - goto __pyx_L0; - - /* "injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_keyword_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF((PyObject *)__pyx_v_kw_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___inject_attributes(PyObject *__pyx_v_instance, PyObject *__pyx_v_attributes, int __pyx_v_attributes_len) { - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_attr_injection = 0; - int __pyx_v_index; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__inject_attributes", 0); - - /* "injections.pxd":85 - * int attributes_len): - * cdef NamedInjection attr_injection - * for index in range(attributes_len): # <<<<<<<<<<<<<< - * attr_injection = attributes[index] - * setattr(instance, - */ - __pyx_t_1 = __pyx_v_attributes_len; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_index = __pyx_t_2; - - /* "injections.pxd":86 - * cdef NamedInjection attr_injection - * for index in range(attributes_len): - * attr_injection = attributes[index] # <<<<<<<<<<<<<< - * setattr(instance, - * __get_name(attr_injection), - */ - if (unlikely(__pyx_v_attributes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 86, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_v_attributes, __pyx_v_index); - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_attr_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "injections.pxd":88 - * attr_injection = attributes[index] - * setattr(instance, - * __get_name(attr_injection), # <<<<<<<<<<<<<< - * __get_value(attr_injection)) - * - */ - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_attr_injection); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "injections.pxd":89 - * setattr(instance, - * __get_name(attr_injection), - * __get_value(attr_injection)) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_attr_injection)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "injections.pxd":87 - * for index in range(attributes_len): - * attr_injection = attributes[index] - * setattr(instance, # <<<<<<<<<<<<<< - * __get_name(attr_injection), - * __get_value(attr_injection)) - */ - __pyx_t_5 = PyObject_SetAttr(__pyx_v_instance, __pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 87, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - - /* "injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__inject_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_attr_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/factories.pxd":27 - * - * - * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef object instance - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___factory_call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_v_instance = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - __Pyx_RefNannySetupContext("__factory_call", 0); - - /* "dependency_injector/providers/factories.pxd":30 - * cdef object instance - * - * instance = __callable_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<< - * - * if self.__attributes_len > 0: - */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instantiator); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_9callables___callable_call(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_instance = __pyx_t_2; - __pyx_t_2 = 0; - - /* "dependency_injector/providers/factories.pxd":32 - * instance = __callable_call(self.__instantiator, args, kwargs) - * - * if self.__attributes_len > 0: # <<<<<<<<<<<<<< - * __inject_attributes(instance, - * self.__attributes, - */ - __pyx_t_3 = ((__pyx_v_self->__pyx___attributes_len > 0) != 0); - if (__pyx_t_3) { - - /* "dependency_injector/providers/factories.pxd":34 - * if self.__attributes_len > 0: - * __inject_attributes(instance, - * self.__attributes, # <<<<<<<<<<<<<< - * self.__attributes_len) - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___attributes; - __Pyx_INCREF(__pyx_t_2); - - /* "dependency_injector/providers/factories.pxd":33 - * - * if self.__attributes_len > 0: - * __inject_attributes(instance, # <<<<<<<<<<<<<< - * self.__attributes, - * self.__attributes_len) - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___inject_attributes(__pyx_v_instance, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___attributes_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/factories.pxd":32 - * instance = __callable_call(self.__instantiator, args, kwargs) - * - * if self.__attributes_len > 0: # <<<<<<<<<<<<<< - * __inject_attributes(instance, - * self.__attributes, - */ - } - - /* "dependency_injector/providers/factories.pxd":37 - * self.__attributes_len) - * - * return instance # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_instance); - __pyx_r = __pyx_v_instance; - goto __pyx_L0; - - /* "dependency_injector/providers/factories.pxd":27 - * - * - * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef object instance - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.__factory_call", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_instance); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_v_positional_args = 0; - PyObject *__pyx_v_keyword_args = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__callable_call", 0); - - /* "callables.pxd":37 - * - * positional_args = __provide_positional_args(args, - * self.__args, # <<<<<<<<<<<<<< - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, - */ - __pyx_t_1 = __pyx_v_self->__pyx___args; - __Pyx_INCREF(__pyx_t_1); - - /* "callables.pxd":36 - * cdef dict keyword_args - * - * positional_args = __provide_positional_args(args, # <<<<<<<<<<<<<< - * self.__args, - * self.__args_len) - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(__pyx_v_args, ((PyObject*)__pyx_t_1), __pyx_v_self->__pyx___args_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_positional_args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "callables.pxd":40 - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, - * self.__kwargs, # <<<<<<<<<<<<<< - * self.__kwargs_len) - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___kwargs; - __Pyx_INCREF(__pyx_t_2); - - /* "callables.pxd":39 - * self.__args, - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, # <<<<<<<<<<<<<< - * self.__kwargs, - * self.__kwargs_len) - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_keyword_args = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "callables.pxd":43 - * self.__kwargs_len) - * - * return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(__pyx_v_positional_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(3, 43, __pyx_L1_error) - } - if (unlikely(__pyx_v_keyword_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(3, 43, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->__pyx___provides, __pyx_v_positional_args, __pyx_v_keyword_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.callables.__callable_call", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_positional_args); - __Pyx_XDECREF(__pyx_v_keyword_args); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory __pyx_vtable_19dependency_injector_9providers_9factories_Factory; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9factories_Factory(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *p; - PyObject *o = __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_new(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_9factories_Factory; - p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)Py_None); Py_INCREF(Py_None); - p->__pyx___attributes = ((PyObject*)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_9factories_Factory(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *p = (struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___instantiator); - Py_CLEAR(p->__pyx___attributes); - PyObject_GC_Track(o); - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_19dependency_injector_9providers_9factories_Factory); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_9factories_Factory(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *p = (struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)o; - e = ((likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) ? ((__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse) ? __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_19dependency_injector_9providers_9factories_Factory)); if (e) return e; - if (p->__pyx___instantiator) { - e = (*v)(((PyObject*)p->__pyx___instantiator), a); if (e) return e; - } - if (p->__pyx___attributes) { - e = (*v)(p->__pyx___attributes, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_9factories_Factory(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *p = (struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)o; - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) { if (__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_19dependency_injector_9providers_9factories_Factory); - tmp = ((PyObject*)p->__pyx___instantiator); - p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx___attributes); - p->__pyx___attributes = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_9factories_7Factory_cls(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_9factories_7Factory_3cls_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_9factories_7Factory_args(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_9factories_7Factory_4args_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_9factories_7Factory_kwargs(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_9factories_7Factory_6kwargs_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_9factories_7Factory_attributes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_9factories_7Factory_10attributes_1__get__(o); -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_9factories_Factory[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_2__deepcopy__}, - {"add_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_7add_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_6add_args}, - {"set_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_9set_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_8set_args}, - {"clear_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_11clear_args, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_10clear_args}, - {"add_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_13add_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_12add_kwargs}, - {"set_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_15set_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_14set_kwargs}, - {"clear_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_17clear_kwargs, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_16clear_kwargs}, - {"add_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_19add_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_18add_attributes}, - {"set_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_21set_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_20set_attributes}, - {"clear_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_23clear_attributes, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_22clear_attributes}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_9factories_7Factory_25_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_9factories_7Factory_24_provide}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_9factories_Factory[] = { - {(char *)"cls", __pyx_getprop_19dependency_injector_9providers_9factories_7Factory_cls, 0, (char *)"Return provided type.", 0}, - {(char *)"args", __pyx_getprop_19dependency_injector_9providers_9factories_7Factory_args, 0, (char *)"Return positional argument injections.", 0}, - {(char *)"kwargs", __pyx_getprop_19dependency_injector_9providers_9factories_7Factory_kwargs, 0, (char *)"Return keyword argument injections.", 0}, - {(char *)"attributes", __pyx_getprop_19dependency_injector_9providers_9factories_7Factory_attributes, 0, (char *)"Return attribute injections.", 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_9factories_Factory = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.factories.Factory", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_9factories_Factory, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_19dependency_injector_9providers_9factories_7Factory_5__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Factory provider creates new instance on every call.\n\n :py:class:`Factory` supports positional & keyword argument injections,\n as well as attribute injections.\n\n Positional and keyword argument injections could be defined like this:\n\n .. code-block:: python\n\n factory = Factory(SomeClass,\n 'positional_arg1', 'positional_arg2',\n keyword_argument1=3, keyword_argument=4)\n\n # or\n\n factory = Factory(SomeClass) \\\n .add_args('positional_arg1', 'positional_arg2') \\\n .add_kwargs(keyword_argument1=3, keyword_argument=4)\n\n # or\n\n factory = Factory(SomeClass)\n factory.add_args('positional_arg1', 'positional_arg2')\n factory.add_kwargs(keyword_argument1=3, keyword_argument=4)\n\n\n Attribute injections are defined by using\n :py:meth:`Factory.add_attributes`:\n\n .. code-block:: python\n\n factory = Factory(SomeClass) \\\n .add_attributes(attribute1=1, attribute2=2)\n\n Retrieving of provided instance can be performed via calling\n :py:class:`Factory` object:\n\n .. code-block:: python\n\n factory = Factory(SomeClass)\n some_object = factory()\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_9factories_Factory, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_9factories_Factory, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_9factories_Factory, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19dependency_injector_9providers_9factories_Factory, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_9factories_7Factory_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_9factories_Factory, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_DelegatedFactory __pyx_vtable_19dependency_injector_9providers_9factories_DelegatedFactory; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_9factories_DelegatedFactory(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_9factories_Factory(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_9factories_DelegatedFactory; - return o; -} - -static PyTypeObject __pyx_type_19dependency_injector_9providers_9factories_DelegatedFactory = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.factories.DelegatedFactory", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_9factories_Factory, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_9factories_7Factory_5__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Factory that is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_9factories_Factory, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_9factories_Factory, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_9factories_7Factory_1__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_9factories_DelegatedFactory, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "factories", - __pyx_k_Dependency_injector_factory_prov, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_0_can_provide_only_1_instances, __pyx_k_0_can_provide_only_1_instances, sizeof(__pyx_k_0_can_provide_only_1_instances), 0, 0, 1, 0}, - {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, - {&__pyx_n_s_IS_DELEGATED, __pyx_k_IS_DELEGATED, sizeof(__pyx_k_IS_DELEGATED), 0, 0, 1, 1}, - {&__pyx_n_s_add_args, __pyx_k_add_args, sizeof(__pyx_k_add_args), 0, 0, 1, 1}, - {&__pyx_n_s_add_kwargs, __pyx_k_add_kwargs, sizeof(__pyx_k_add_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, - {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_clear_args, __pyx_k_clear_args, sizeof(__pyx_k_clear_args), 0, 0, 1, 1}, - {&__pyx_n_s_clear_kwargs, __pyx_k_clear_kwargs, sizeof(__pyx_k_clear_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, - {&__pyx_n_s_dependency_injector_errors, __pyx_k_dependency_injector_errors, sizeof(__pyx_k_dependency_injector_errors), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_overridden, __pyx_k_overridden, sizeof(__pyx_k_overridden), 0, 0, 1, 1}, - {&__pyx_n_s_override, __pyx_k_override, sizeof(__pyx_k_override), 0, 0, 1, 1}, - {&__pyx_n_s_provide, __pyx_k_provide, sizeof(__pyx_k_provide), 0, 0, 1, 1}, - {&__pyx_n_s_provided_type, __pyx_k_provided_type, sizeof(__pyx_k_provided_type), 0, 0, 1, 1}, - {&__pyx_n_s_provides, __pyx_k_provides, sizeof(__pyx_k_provides), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_set_args, __pyx_k_set_args, sizeof(__pyx_k_set_args), 0, 0, 1, 1}, - {&__pyx_n_s_set_attributes, __pyx_k_set_attributes, sizeof(__pyx_k_set_attributes), 0, 0, 1, 1}, - {&__pyx_n_s_set_kwargs, __pyx_k_set_kwargs, sizeof(__pyx_k_set_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 95, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 99, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 208, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initfactories(void); /*proto*/ -PyMODINIT_FUNC initfactories(void) -#else -PyMODINIT_FUNC PyInit_factories(void); /*proto*/ -PyMODINIT_FUNC PyInit_factories(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_factories(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("factories", __pyx_methods, __pyx_k_Dependency_injector_factory_prov, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_dependency_injector__providers__factories) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "dependency_injector.providers.factories")) { - if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers.factories", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Provider = __Pyx_ImportType("dependency_injector.providers.base", "Provider", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Provider), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Provider = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9factories_Factory = &__pyx_vtable_19dependency_injector_9providers_9factories_Factory; - __pyx_vtable_19dependency_injector_9providers_9factories_Factory.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - __pyx_vtable_19dependency_injector_9providers_9factories_Factory.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_9factories_7Factory__provide; - __pyx_type_19dependency_injector_9providers_9factories_Factory.tp_base = __pyx_ptype_19dependency_injector_9providers_4base_Provider; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_9factories_Factory) < 0) __PYX_ERR(0, 20, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_9factories_Factory.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_9factories_Factory, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 20, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory___init__.doc = __pyx_doc_19dependency_injector_9providers_9factories_7Factory___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory___init__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_9factories_Factory, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 20, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory_4__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory_4__str__.doc = __pyx_doc_19dependency_injector_9providers_9factories_7Factory_4__str__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_9factories_7Factory_4__str__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_9factories_Factory.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_9factories_Factory) < 0) __PYX_ERR(0, 20, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Factory", (PyObject *)&__pyx_type_19dependency_injector_9providers_9factories_Factory) < 0) __PYX_ERR(0, 20, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9factories_Factory = &__pyx_type_19dependency_injector_9providers_9factories_Factory; - __pyx_vtabptr_19dependency_injector_9providers_9factories_DelegatedFactory = &__pyx_vtable_19dependency_injector_9providers_9factories_DelegatedFactory; - __pyx_vtable_19dependency_injector_9providers_9factories_DelegatedFactory.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_9factories_Factory; - __pyx_type_19dependency_injector_9providers_9factories_DelegatedFactory.tp_base = __pyx_ptype_19dependency_injector_9providers_9factories_Factory; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_9factories_DelegatedFactory) < 0) __PYX_ERR(0, 253, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_9factories_DelegatedFactory.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_9factories_DelegatedFactory.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_9factories_DelegatedFactory) < 0) __PYX_ERR(0, 253, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "DelegatedFactory", (PyObject *)&__pyx_type_19dependency_injector_9providers_9factories_DelegatedFactory) < 0) __PYX_ERR(0, 253, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory = &__pyx_type_19dependency_injector_9providers_9factories_DelegatedFactory; - /*--- Type import code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Object = __Pyx_ImportType("dependency_injector.providers.base", "Object", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Object), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Object)) __PYX_ERR(4, 15, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Object = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Object->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Object)) __PYX_ERR(4, 15, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_Delegate = __Pyx_ImportType("dependency_injector.providers.base", "Delegate", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Delegate), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(4, 21, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Delegate = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Delegate->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(4, 21, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = __Pyx_ImportType("dependency_injector.providers.base", "ExternalDependency", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(4, 25, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(4, 25, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = __Pyx_ImportType("dependency_injector.providers.base", "OverridingContext", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext)) __PYX_ERR(4, 29, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_Injection = __Pyx_ImportType("dependency_injector.providers.injections", "Injection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_Injection)) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = __Pyx_ImportType("dependency_injector.providers.injections", "PositionalInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection)) __PYX_ERR(1, 16, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = __Pyx_ImportType("dependency_injector.providers.injections", "NamedInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection)) __PYX_ERR(1, 20, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9callables_Callable = __Pyx_ImportType("dependency_injector.providers.callables", "Callable", sizeof(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_9callables_Callable)) __PYX_ERR(3, 16, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9callables_Callable = (struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_9callables_Callable->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_9callables_Callable)) __PYX_ERR(3, 16, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = __Pyx_ImportType("dependency_injector.providers.callables", "DelegatedCallable", sizeof(struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable)) __PYX_ERR(3, 28, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable = (struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable)) __PYX_ERR(3, 28, __pyx_L1_error) - /*--- Variable import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "CLASS_TYPES", (void **)&__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*--- Function import code ---*/ - __pyx_t_2 = __Pyx_ImportModule("dependency_injector.providers.injections"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "parse_named_injections", (void (**)(void))&__pyx_f_19dependency_injector_9providers_10injections_parse_named_injections, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_3) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_3, "represent_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_represent_provider, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_3, "deepcopy", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "dependency_injector/providers/factories.pyx":6 - * """ - * - * from dependency_injector.errors import Error # <<<<<<<<<<<<<< - * - * from .base cimport Provider - */ - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_n_s_Error); - __Pyx_GIVEREF(__pyx_n_s_Error); - PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Error); - __pyx_t_5 = __Pyx_Import(__pyx_n_s_dependency_injector_errors, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_4) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/factories.pyx":71 - * """ - * - * provided_type = None # <<<<<<<<<<<<<< - * - * def __init__(self, provides, *args, **kwargs): - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_9factories_Factory->tp_dict, __pyx_n_s_provided_type, Py_None) < 0) __PYX_ERR(0, 71, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_9factories_Factory); - - /* "dependency_injector/providers/factories.pyx":271 - * """ - * - * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(0, 271, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory); - - /* "dependency_injector/providers/factories.pyx":1 - * """Dependency injector factory providers. # <<<<<<<<<<<<<< - * - * Powered by Cython. - */ - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init dependency_injector.providers.factories", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers.factories"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* GetModuleGlobalName */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* KeywordStringCheck */ - static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -/* CallNextTpDealloc */ - static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_dealloc != current_tp_dealloc) - type = type->tp_base; - while (type && type->tp_dealloc == current_tp_dealloc) - type = type->tp_base; - if (type) - type->tp_dealloc(obj); -} - -/* CallNextTpTraverse */ - static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_traverse != current_tp_traverse) - type = type->tp_base; - while (type && type->tp_traverse == current_tp_traverse) - type = type->tp_base; - if (type && type->tp_traverse) - return type->tp_traverse(obj, v, a); - return 0; -} - -/* CallNextTpClear */ - static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_clear != current_tp_clear) - type = type->tp_base; - while (type && type->tp_clear == current_tp_clear) - type = type->tp_base; - if (type && type->tp_clear) - type->tp_clear(obj); -} - -/* GetVTable */ - static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - size_t size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -/* VoidPtrImport */ - #ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, name); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C variable %.200s", - PyModule_GetName(module), name); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); - goto bad; - } - *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif - if (!(*p)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* FunctionImport */ - #ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, funcname); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C function %.200s", - PyModule_GetName(module), funcname); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); - goto bad; - } - tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif - *f = tmp.fp; - if (!(*f)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers/factories.pxd b/src/dependency_injector/providers/factories.pxd deleted file mode 100644 index b8249852..00000000 --- a/src/dependency_injector/providers/factories.pxd +++ /dev/null @@ -1,37 +0,0 @@ -"""Dependency injector factory providers. - -Powered by Cython. -""" - -from .base cimport Provider -from .callables cimport ( - Callable, - __callable_call, -) -from .injections cimport __inject_attributes - - -cdef class Factory(Provider): - cdef Callable __instantiator - - cdef tuple __attributes - cdef int __attributes_len - - cpdef object _provide(self, tuple args, dict kwargs) - - -cdef class DelegatedFactory(Factory): - pass - - -cdef inline object __factory_call(Factory self, tuple args, dict kwargs): - cdef object instance - - instance = __callable_call(self.__instantiator, args, kwargs) - - if self.__attributes_len > 0: - __inject_attributes(instance, - self.__attributes, - self.__attributes_len) - - return instance diff --git a/src/dependency_injector/providers/factories.pyx b/src/dependency_injector/providers/factories.pyx deleted file mode 100644 index 9c096d92..00000000 --- a/src/dependency_injector/providers/factories.pyx +++ /dev/null @@ -1,271 +0,0 @@ -"""Dependency injector factory providers. - -Powered by Cython. -""" - -from dependency_injector.errors import Error - -from .base cimport Provider -from .callables cimport Callable -from .injections cimport ( - NamedInjection, - parse_named_injections, -) -from .utils cimport ( - represent_provider, - deepcopy, -) - - -cdef class Factory(Provider): - r"""Factory provider creates new instance on every call. - - :py:class:`Factory` supports positional & keyword argument injections, - as well as attribute injections. - - Positional and keyword argument injections could be defined like this: - - .. code-block:: python - - factory = Factory(SomeClass, - 'positional_arg1', 'positional_arg2', - keyword_argument1=3, keyword_argument=4) - - # or - - factory = Factory(SomeClass) \ - .add_args('positional_arg1', 'positional_arg2') \ - .add_kwargs(keyword_argument1=3, keyword_argument=4) - - # or - - factory = Factory(SomeClass) - factory.add_args('positional_arg1', 'positional_arg2') - factory.add_kwargs(keyword_argument1=3, keyword_argument=4) - - - Attribute injections are defined by using - :py:meth:`Factory.add_attributes`: - - .. code-block:: python - - factory = Factory(SomeClass) \ - .add_attributes(attribute1=1, attribute2=2) - - Retrieving of provided instance can be performed via calling - :py:class:`Factory` object: - - .. code-block:: python - - factory = Factory(SomeClass) - some_object = factory() - - .. py:attribute:: provided_type - - If provided type is defined, provider checks that providing class is - its subclass. - - :type: type | None - """ - - provided_type = None - - def __init__(self, provides, *args, **kwargs): - """Initializer. - - :param provides: Provided type. - :type provides: type - - :param args: Tuple of positional argument injections. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword argument injections. - :type kwargs: dict[str, object] - """ - if (self.__class__.provided_type and - not issubclass(provides, self.__class__.provided_type)): - raise Error('{0} can provide only {1} instances'.format( - self.__class__, self.__class__.provided_type)) - - self.__instantiator = Callable(provides, *args, **kwargs) - - self.__attributes = tuple() - self.__attributes_len = 0 - - super(Factory, self).__init__() - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - - copied = self.__class__(self.cls, - *deepcopy(self.args, memo), - **deepcopy(self.kwargs, memo)) - copied.set_attributes(**deepcopy(self.attributes, memo)) - - for overriding_provider in self.overridden: - copied.override(deepcopy(overriding_provider, memo)) - - return copied - - def __str__(self): - """Return string representation of provider. - - :rtype: str - """ - return represent_provider(provider=self, - provides=self.__instantiator.provides) - - @property - def cls(self): - """Return provided type.""" - return self.__instantiator.provides - - @property - def args(self): - """Return positional argument injections.""" - return self.__instantiator.args - - def add_args(self, *args): - """Add __init__ postional argument injections. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__instantiator.add_args(*args) - return self - - def set_args(self, *args): - """Set __init__ postional argument injections. - - Existing __init__ positional argument injections are dropped. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__instantiator.set_args(*args) - return self - - def clear_args(self): - """Drop __init__ postional argument injections. - - :return: Reference ``self`` - """ - self.__instantiator.clear_args() - return self - - @property - def kwargs(self): - """Return keyword argument injections.""" - return self.__instantiator.kwargs - - def add_kwargs(self, **kwargs): - """Add __init__ keyword argument injections. - - :param kwargs: Dictionary of injections. - :type kwargs: dict - - :return: Reference ``self`` - """ - self.__instantiator.add_kwargs(**kwargs) - return self - - def set_kwargs(self, **kwargs): - """Set __init__ keyword argument injections. - - Existing __init__ keyword argument injections are dropped. - - :param kwargs: Dictionary of injections. - :type kwargs: dict - - :return: Reference ``self`` - """ - self.__instantiator.set_kwargs(**kwargs) - return self - - def clear_kwargs(self): - """Drop __init__ keyword argument injections. - - :return: Reference ``self`` - """ - self.__instantiator.clear_kwargs() - return self - - @property - def attributes(self): - """Return attribute injections.""" - cdef int index - cdef NamedInjection attribute - cdef dict attributes - - attributes = dict() - for index in range(self.__attributes_len): - attribute = self.__attributes[index] - attributes[attribute.__name] = attribute.__value - return attributes - - def add_attributes(self, **kwargs): - """Add attribute injections. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__attributes += parse_named_injections(kwargs) - self.__attributes_len = len(self.__attributes) - return self - - def set_attributes(self, **kwargs): - """Set attribute injections. - - Existing attribute injections are dropped. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__attributes = parse_named_injections(kwargs) - self.__attributes_len = len(self.__attributes) - return self - - def clear_attributes(self): - """Drop attribute injections. - - :return: Reference ``self`` - """ - self.__attributes = tuple() - self.__attributes_len = len(self.__attributes) - return self - - cpdef object _provide(self, tuple args, dict kwargs): - """Return new instance.""" - return __factory_call(self, args, kwargs) - - -cdef class DelegatedFactory(Factory): - """Factory that is injected "as is". - - .. py:attribute:: provided_type - - If provided type is defined, provider checks that providing class is - its subclass. - - :type: type | None - - .. py:attribute:: cls - - Class that provides object. - Alias for :py:attr:`provides`. - - :type: type - """ - - __IS_DELEGATED__ = True diff --git a/src/dependency_injector/providers/injections.c b/src/dependency_injector/providers/injections.c deleted file mode 100644 index eecd4d2b..00000000 --- a/src/dependency_injector/providers/injections.c +++ /dev/null @@ -1,5361 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__dependency_injector__providers__injections -#define __PYX_HAVE_API__dependency_injector__providers__injections -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/dependency_injector/providers/injections.pxd", - "src/dependency_injector/providers/injections.pyx", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection; -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection; -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection; -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy; - -/* "utils.pxd":21 - * - * - * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< - */ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy { - int __pyx_n; - PyObject *memo; -}; - -/* "dependency_injector/providers/injections.pxd":9 - * - * - * cdef class Injection(object): # <<<<<<<<<<<<<< - * cdef object __value - * cdef int __is_provider - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection { - PyObject_HEAD - PyObject *__pyx___value; - int __pyx___is_provider; - int __pyx___is_delegated; - int __pyx___call; -}; - - -/* "dependency_injector/providers/injections.pxd":16 - * - * - * cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; -}; - - -/* "dependency_injector/providers/injections.pxd":20 - * - * - * cdef class NamedInjection(Injection): # <<<<<<<<<<<<<< - * cdef object __name - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; - PyObject *__pyx___name; -}; - - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -/* py_dict_items.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); - -/* UnpackUnboundCMethod.proto */ -typedef struct { - PyObject *type; - PyObject **method_name; - PyCFunction func; - PyObject *method; - int flag; -} __Pyx_CachedCFunction; - -/* CallUnboundCMethod0.proto */ -static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_CallUnboundCMethod0(cfunc, self)\ - ((likely((cfunc)->func)) ?\ - (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\ - (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\ - ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) :\ - (PY_VERSION_HEX >= 0x030600B1 && (cfunc)->flag == METH_FASTCALL ? (*(__Pyx_PyCFunctionFast)(cfunc)->func)(self, &PyTuple_GET_ITEM(__pyx_empty_tuple, 0), 0, NULL) :\ - __Pyx__CallUnboundCMethod0(cfunc, self))))) :\ - __Pyx__CallUnboundCMethod0(cfunc, self)) -#else -#define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) -#endif - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* UnpackItemEndCheck.proto */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* PyDictContains.proto */ -static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { - int result = PyDict_Contains(dict, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* FunctionExport.proto */ -static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); - -/* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'cython' */ - -/* Module declarations from 'dependency_injector.providers.utils' */ -static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0; -#define __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES (*__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES) -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_delegated)(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_deepcopy)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.injections' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_Injection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10injections_parse_named_injections(PyObject *, int __pyx_skip_dispatch); /*proto*/ -#define __Pyx_MODULE_NAME "dependency_injector.providers.injections" -int __pyx_module_is_main_dependency_injector__providers__injections = 0; - -/* Implementation of 'dependency_injector.providers.injections' */ -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_super; -static PyObject *__pyx_builtin_id; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "name"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_items[] = "items"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_super[] = "super"; -static const char __pyx_k_value[] = "value"; -static const char __pyx_k_Dependency_injector_injections_P[] = "Dependency injector injections.\n\nPowered by Cython.\n"; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_items; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_super; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_value; -static int __pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection___init__(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_4get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_6get_original_value(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection___init__(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_4get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_6get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_8get_original_value(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_parse_positional_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_2parse_named_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10injections_Injection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10injections_PositionalInjection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10injections_NamedInjection(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; - -/* "dependency_injector/providers/injections.pyx":26 - * """Positional injection class.""" - * - * def __init__(self, value): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__value = value - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection___init__[] = "Initializer."; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_10injections_19PositionalInjection___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_value = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 26, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_value = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 26, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.injections.PositionalInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection___init__(((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_v_self), __pyx_v_value); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection___init__(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/injections.pyx":28 - * def __init__(self, value): - * """Initializer.""" - * self.__value = value # <<<<<<<<<<<<<< - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) - */ - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx___value); - __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx___value); - __pyx_v_self->__pyx_base.__pyx___value = __pyx_v_value; - - /* "dependency_injector/providers/injections.pyx":29 - * """Initializer.""" - * self.__value = value - * self.__is_provider = is_provider(value) # <<<<<<<<<<<<<< - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and - */ - __pyx_v_self->__pyx_base.__pyx___is_provider = ((int)__pyx_f_19dependency_injector_9providers_5utils_is_provider(__pyx_v_value, 0)); - - /* "dependency_injector/providers/injections.pyx":30 - * self.__value = value - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) # <<<<<<<<<<<<<< - * self.__call = (self.__is_provider == 1 and - * self.__is_delegated == 0) - */ - __pyx_v_self->__pyx_base.__pyx___is_delegated = ((int)__pyx_f_19dependency_injector_9providers_5utils_is_delegated(__pyx_v_value, 0)); - - /* "dependency_injector/providers/injections.pyx":31 - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< - * self.__is_delegated == 0) - * super(PositionalInjection, self).__init__() - */ - __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_provider == 1); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L3_bool_binop_done; - } - - /* "dependency_injector/providers/injections.pyx":32 - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and - * self.__is_delegated == 0) # <<<<<<<<<<<<<< - * super(PositionalInjection, self).__init__() - * - */ - __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_delegated == 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - - /* "dependency_injector/providers/injections.pyx":31 - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< - * self.__is_delegated == 0) - * super(PositionalInjection, self).__init__() - */ - __pyx_v_self->__pyx_base.__pyx___call = ((int)__pyx_t_1); - - /* "dependency_injector/providers/injections.pyx":33 - * self.__call = (self.__is_provider == 1 and - * self.__is_delegated == 0) - * super(PositionalInjection, self).__init__() # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 33, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 33, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/injections.pyx":26 - * """Positional injection class.""" - * - * def __init__(self, value): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__value = value - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.PositionalInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":35 - * super(PositionalInjection, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection_2__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_8; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/injections.pyx":37 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/injections.pyx":38 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * return self.__class__(deepcopy(self.__value, memo)) - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/injections.pyx":39 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * return self.__class__(deepcopy(self.__value, memo)) - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":38 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * return self.__class__(deepcopy(self.__value, memo)) - */ - } - - /* "dependency_injector/providers/injections.pyx":40 - * if copied is not None: - * return copied - * return self.__class__(deepcopy(self.__value, memo)) # <<<<<<<<<<<<<< - * - * def get_value(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __pyx_v_self->__pyx_base.__pyx___value; - __Pyx_INCREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 40, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":35 - * super(PositionalInjection, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.PositionalInjection.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":42 - * return self.__class__(deepcopy(self.__value, memo)) - * - * def get_value(self): # <<<<<<<<<<<<<< - * """Return injection value.""" - * return __get_value(self) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_5get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection_4get_value[] = "Return injection value."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_5get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_value (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_4get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_4get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_value", 0); - - /* "dependency_injector/providers/injections.pyx":44 - * def get_value(self): - * """Return injection value.""" - * return __get_value(self) # <<<<<<<<<<<<<< - * - * def get_original_value(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":42 - * return self.__class__(deepcopy(self.__value, memo)) - * - * def get_value(self): # <<<<<<<<<<<<<< - * """Return injection value.""" - * return __get_value(self) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.injections.PositionalInjection.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":46 - * return __get_value(self) - * - * def get_original_value(self): # <<<<<<<<<<<<<< - * """Return original value.""" - * return self.__value - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_7get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection_6get_original_value[] = "Return original value."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_7get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_original_value (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_6get_original_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_19PositionalInjection_6get_original_value(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_original_value", 0); - - /* "dependency_injector/providers/injections.pyx":48 - * def get_original_value(self): - * """Return original value.""" - * return self.__value # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx___value); - __pyx_r = __pyx_v_self->__pyx_base.__pyx___value; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":46 - * return __get_value(self) - * - * def get_original_value(self): # <<<<<<<<<<<<<< - * """Return original value.""" - * return self.__value - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":54 - * """Keyword injection class.""" - * - * def __init__(self, name, value): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__name = name - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection___init__[] = "Initializer."; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_10injections_14NamedInjection___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_name = 0; - PyObject *__pyx_v_value = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_value,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(1, 54, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 54, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_name = values[0]; - __pyx_v_value = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 54, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.injections.NamedInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection___init__(((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_v_self), __pyx_v_name, __pyx_v_value); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection___init__(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/injections.pyx":56 - * def __init__(self, name, value): - * """Initializer.""" - * self.__name = name # <<<<<<<<<<<<<< - * self.__value = value - * self.__is_provider = is_provider(value) - */ - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __Pyx_GOTREF(__pyx_v_self->__pyx___name); - __Pyx_DECREF(__pyx_v_self->__pyx___name); - __pyx_v_self->__pyx___name = __pyx_v_name; - - /* "dependency_injector/providers/injections.pyx":57 - * """Initializer.""" - * self.__name = name - * self.__value = value # <<<<<<<<<<<<<< - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) - */ - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - __Pyx_GOTREF(__pyx_v_self->__pyx_base.__pyx___value); - __Pyx_DECREF(__pyx_v_self->__pyx_base.__pyx___value); - __pyx_v_self->__pyx_base.__pyx___value = __pyx_v_value; - - /* "dependency_injector/providers/injections.pyx":58 - * self.__name = name - * self.__value = value - * self.__is_provider = is_provider(value) # <<<<<<<<<<<<<< - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and - */ - __pyx_v_self->__pyx_base.__pyx___is_provider = ((int)__pyx_f_19dependency_injector_9providers_5utils_is_provider(__pyx_v_value, 0)); - - /* "dependency_injector/providers/injections.pyx":59 - * self.__value = value - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) # <<<<<<<<<<<<<< - * self.__call = (self.__is_provider == 1 and - * self.__is_delegated == 0) - */ - __pyx_v_self->__pyx_base.__pyx___is_delegated = ((int)__pyx_f_19dependency_injector_9providers_5utils_is_delegated(__pyx_v_value, 0)); - - /* "dependency_injector/providers/injections.pyx":60 - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< - * self.__is_delegated == 0) - * super(NamedInjection, self).__init__() - */ - __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_provider == 1); - if (__pyx_t_2) { - } else { - __pyx_t_1 = __pyx_t_2; - goto __pyx_L3_bool_binop_done; - } - - /* "dependency_injector/providers/injections.pyx":61 - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and - * self.__is_delegated == 0) # <<<<<<<<<<<<<< - * super(NamedInjection, self).__init__() - * - */ - __pyx_t_2 = (__pyx_v_self->__pyx_base.__pyx___is_delegated == 0); - __pyx_t_1 = __pyx_t_2; - __pyx_L3_bool_binop_done:; - - /* "dependency_injector/providers/injections.pyx":60 - * self.__is_provider = is_provider(value) - * self.__is_delegated = is_delegated(value) - * self.__call = (self.__is_provider == 1 and # <<<<<<<<<<<<<< - * self.__is_delegated == 0) - * super(NamedInjection, self).__init__() - */ - __pyx_v_self->__pyx_base.__pyx___call = ((int)__pyx_t_1); - - /* "dependency_injector/providers/injections.pyx":62 - * self.__call = (self.__is_provider == 1 and - * self.__is_delegated == 0) - * super(NamedInjection, self).__init__() # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_init); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else { - __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 62, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/injections.pyx":54 - * """Keyword injection class.""" - * - * def __init__(self, name, value): # <<<<<<<<<<<<<< - * """Initializer.""" - * self.__name = name - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.NamedInjection.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":64 - * super(NamedInjection, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_2__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_3__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_2__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_2__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/injections.pyx":66 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/injections.pyx":67 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * return self.__class__(deepcopy(self.__name, memo), - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/injections.pyx":68 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * return self.__class__(deepcopy(self.__name, memo), - * deepcopy(self.__value, memo)) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":67 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * return self.__class__(deepcopy(self.__name, memo), - */ - } - - /* "dependency_injector/providers/injections.pyx":69 - * if copied is not None: - * return copied - * return self.__class__(deepcopy(self.__name, memo), # <<<<<<<<<<<<<< - * deepcopy(self.__value, memo)) - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __pyx_v_self->__pyx___name; - __Pyx_INCREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 69, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/injections.pyx":70 - * return copied - * return self.__class__(deepcopy(self.__name, memo), - * deepcopy(self.__value, memo)) # <<<<<<<<<<<<<< - * - * def get_name(self): - */ - __pyx_t_5 = __pyx_v_self->__pyx_base.__pyx___value; - __Pyx_INCREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(1, 70, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - __pyx_t_9 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_9 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_3); - __pyx_t_4 = 0; - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":64 - * super(NamedInjection, self).__init__() - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("dependency_injector.providers.injections.NamedInjection.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":72 - * deepcopy(self.__value, memo)) - * - * def get_name(self): # <<<<<<<<<<<<<< - * """Return injection value.""" - * return __get_name(self) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_5get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_4get_name[] = "Return injection value."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_5get_name(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_name (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_4get_name(((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_4get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_name", 0); - - /* "dependency_injector/providers/injections.pyx":74 - * def get_name(self): - * """Return injection value.""" - * return __get_name(self) # <<<<<<<<<<<<<< - * - * def get_value(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":72 - * deepcopy(self.__value, memo)) - * - * def get_name(self): # <<<<<<<<<<<<<< - * """Return injection value.""" - * return __get_name(self) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.injections.NamedInjection.get_name", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":76 - * return __get_name(self) - * - * def get_value(self): # <<<<<<<<<<<<<< - * """Return injection value.""" - * return __get_value(self) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_7get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_6get_value[] = "Return injection value."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_7get_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_value (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_6get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_6get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("get_value", 0); - - /* "dependency_injector/providers/injections.pyx":78 - * def get_value(self): - * """Return injection value.""" - * return __get_value(self) # <<<<<<<<<<<<<< - * - * def get_original_value(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":76 - * return __get_name(self) - * - * def get_value(self): # <<<<<<<<<<<<<< - * """Return injection value.""" - * return __get_value(self) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.injections.NamedInjection.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":80 - * return __get_value(self) - * - * def get_original_value(self): # <<<<<<<<<<<<<< - * """Return original value.""" - * return self.__value - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_9get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_8get_original_value[] = "Return original value."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_9get_original_value(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_original_value (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_8get_original_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_14NamedInjection_8get_original_value(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_original_value", 0); - - /* "dependency_injector/providers/injections.pyx":82 - * def get_original_value(self): - * """Return original value.""" - * return self.__value # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx_base.__pyx___value); - __pyx_r = __pyx_v_self->__pyx_base.__pyx___value; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":80 - * return __get_value(self) - * - * def get_original_value(self): # <<<<<<<<<<<<<< - * """Return original value.""" - * return self.__value - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":87 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef tuple parse_positional_injections(tuple args): # <<<<<<<<<<<<<< - * """Parse positional injections.""" - * cdef list injections = list() - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_1parse_positional_injections(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections(PyObject *__pyx_v_args, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_v_injections = 0; - int __pyx_v_args_len; - int __pyx_v_index; - PyObject *__pyx_v_arg = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("parse_positional_injections", 0); - - /* "dependency_injector/providers/injections.pyx":89 - * cpdef tuple parse_positional_injections(tuple args): - * """Parse positional injections.""" - * cdef list injections = list() # <<<<<<<<<<<<<< - * cdef int args_len = len(args) - * - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_injections = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/injections.pyx":90 - * """Parse positional injections.""" - * cdef list injections = list() - * cdef int args_len = len(args) # <<<<<<<<<<<<<< - * - * cdef int index - */ - if (unlikely(__pyx_v_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 90, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v_args); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(1, 90, __pyx_L1_error) - __pyx_v_args_len = __pyx_t_2; - - /* "dependency_injector/providers/injections.pyx":96 - * cdef PositionalInjection injection - * - * for index in range(args_len): # <<<<<<<<<<<<<< - * arg = args[index] - * injection = PositionalInjection(arg) - */ - __pyx_t_3 = __pyx_v_args_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "dependency_injector/providers/injections.pyx":97 - * - * for index in range(args_len): - * arg = args[index] # <<<<<<<<<<<<<< - * injection = PositionalInjection(arg) - * injections.append(injection) - */ - if (unlikely(__pyx_v_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 97, __pyx_L1_error) - } - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_v_args, __pyx_v_index); - __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/injections.pyx":98 - * for index in range(args_len): - * arg = args[index] - * injection = PositionalInjection(arg) # <<<<<<<<<<<<<< - * injections.append(injection) - * - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_arg); - __Pyx_GIVEREF(__pyx_v_arg); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arg); - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection), __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "dependency_injector/providers/injections.pyx":99 - * arg = args[index] - * injection = PositionalInjection(arg) - * injections.append(injection) # <<<<<<<<<<<<<< - * - * return tuple(injections) - */ - __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_injections, ((PyObject *)__pyx_v_injection)); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(1, 99, __pyx_L1_error) - } - - /* "dependency_injector/providers/injections.pyx":101 - * injections.append(injection) - * - * return tuple(injections) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyList_AsTuple(__pyx_v_injections); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 101, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_r = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":87 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef tuple parse_positional_injections(tuple args): # <<<<<<<<<<<<<< - * """Parse positional injections.""" - * cdef list injections = list() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.parse_positional_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_injections); - __Pyx_XDECREF(__pyx_v_arg); - __Pyx_XDECREF((PyObject *)__pyx_v_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_1parse_positional_injections(PyObject *__pyx_self, PyObject *__pyx_v_args); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_parse_positional_injections[] = "Parse positional injections."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_1parse_positional_injections(PyObject *__pyx_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("parse_positional_injections (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(1, 87, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_parse_positional_injections(__pyx_self, ((PyObject*)__pyx_v_args)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_parse_positional_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("parse_positional_injections", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections(__pyx_v_args, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.injections.parse_positional_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pyx":106 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef tuple parse_named_injections(dict kwargs): # <<<<<<<<<<<<<< - * """Parse named injections.""" - * cdef list injections = list() - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_3parse_named_injections(PyObject *__pyx_self, PyObject *__pyx_v_kwargs); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10injections_parse_named_injections(PyObject *__pyx_v_kwargs, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_v_injections = 0; - PyObject *__pyx_v_name = 0; - PyObject *__pyx_v_arg = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_t_9; - __Pyx_RefNannySetupContext("parse_named_injections", 0); - - /* "dependency_injector/providers/injections.pyx":108 - * cpdef tuple parse_named_injections(dict kwargs): - * """Parse named injections.""" - * cdef list injections = list() # <<<<<<<<<<<<<< - * - * cdef object name - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_injections = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/injections.pyx":114 - * cdef NamedInjection injection - * - * for name, arg in kwargs.items(): # <<<<<<<<<<<<<< - * injection = NamedInjection(name, arg) - * injections.append(injection) - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "items"); - __PYX_ERR(1, 114, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 114, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 114, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 114, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 114, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 114, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_5 = PyList_GET_ITEM(sequence, 0); - __pyx_t_6 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; - index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(1, 114, __pyx_L1_error) - __pyx_t_8 = NULL; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(1, 114, __pyx_L1_error) - __pyx_L6_unpacking_done:; - } - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_6); - __pyx_t_6 = 0; - - /* "dependency_injector/providers/injections.pyx":115 - * - * for name, arg in kwargs.items(): - * injection = NamedInjection(name, arg) # <<<<<<<<<<<<<< - * injections.append(injection) - * - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_name); - __Pyx_INCREF(__pyx_v_arg); - __Pyx_GIVEREF(__pyx_v_arg); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_arg); - __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_6)); - __pyx_t_6 = 0; - - /* "dependency_injector/providers/injections.pyx":116 - * for name, arg in kwargs.items(): - * injection = NamedInjection(name, arg) - * injections.append(injection) # <<<<<<<<<<<<<< - * - * return tuple(injections) - */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_injections, ((PyObject *)__pyx_v_injection)); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(1, 116, __pyx_L1_error) - - /* "dependency_injector/providers/injections.pyx":114 - * cdef NamedInjection injection - * - * for name, arg in kwargs.items(): # <<<<<<<<<<<<<< - * injection = NamedInjection(name, arg) - * injections.append(injection) - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/injections.pyx":118 - * injections.append(injection) - * - * return tuple(injections) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_AsTuple(__pyx_v_injections); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pyx":106 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cpdef tuple parse_named_injections(dict kwargs): # <<<<<<<<<<<<<< - * """Parse named injections.""" - * cdef list injections = list() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("dependency_injector.providers.injections.parse_named_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_injections); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_arg); - __Pyx_XDECREF((PyObject *)__pyx_v_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_3parse_named_injections(PyObject *__pyx_self, PyObject *__pyx_v_kwargs); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10injections_2parse_named_injections[] = "Parse named injections."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10injections_3parse_named_injections(PyObject *__pyx_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("parse_named_injections (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(1, 106, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_10injections_2parse_named_injections(__pyx_self, ((PyObject*)__pyx_v_kwargs)); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10injections_2parse_named_injections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("parse_named_injections", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections_parse_named_injections(__pyx_v_kwargs, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.injections.parse_named_injections", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get_name", 0); - - /* "dependency_injector/providers/injections.pxd":25 - * - * cdef inline object __get_name(NamedInjection self): - * return self.__name # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___name); - __pyx_r = __pyx_v_self->__pyx___name; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__get_value", 0); - - /* "dependency_injector/providers/injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - __pyx_t_1 = ((__pyx_v_self->__pyx___call == 0) != 0); - if (__pyx_t_1) { - - /* "dependency_injector/providers/injections.pxd":30 - * cdef inline object __get_value(Injection self): - * if self.__call == 0: - * return self.__value # <<<<<<<<<<<<<< - * return self.__value() - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_r = __pyx_v_self->__pyx___value; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - } - - /* "dependency_injector/providers/injections.pxd":31 - * if self.__call == 0: - * return self.__value - * return self.__value() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_t_3 = __pyx_v_self->__pyx___value; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(PyObject *__pyx_v_args, PyObject *__pyx_v_inj_args, int __pyx_v_inj_args_len) { - int __pyx_v_index; - PyObject *__pyx_v_positional_args = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__provide_positional_args", 0); - - /* "dependency_injector/providers/injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - __pyx_t_1 = ((__pyx_v_inj_args_len == 0) != 0); - if (__pyx_t_1) { - - /* "dependency_injector/providers/injections.pxd":44 - * - * if inj_args_len == 0: - * return args # <<<<<<<<<<<<<< - * - * positional_args = list() - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_args); - __pyx_r = __pyx_v_args; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - } - - /* "dependency_injector/providers/injections.pxd":46 - * return args - * - * positional_args = list() # <<<<<<<<<<<<<< - * for index in range(inj_args_len): - * injection = inj_args[index] - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_positional_args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/injections.pxd":47 - * - * positional_args = list() - * for index in range(inj_args_len): # <<<<<<<<<<<<<< - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - */ - __pyx_t_3 = __pyx_v_inj_args_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "dependency_injector/providers/injections.pxd":48 - * positional_args = list() - * for index in range(inj_args_len): - * injection = inj_args[index] # <<<<<<<<<<<<<< - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) - */ - if (unlikely(__pyx_v_inj_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 48, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_inj_args, __pyx_v_index); - __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/injections.pxd":49 - * for index in range(inj_args_len): - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) # <<<<<<<<<<<<<< - * positional_args.extend(args) - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_injection)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_positional_args, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "dependency_injector/providers/injections.pxd":50 - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) # <<<<<<<<<<<<<< - * - * return tuple(positional_args) - */ - __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_positional_args, __pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 50, __pyx_L1_error) - - /* "dependency_injector/providers/injections.pxd":52 - * positional_args.extend(args) - * - * return tuple(positional_args) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_positional_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_positional_args); - __Pyx_XDECREF((PyObject *)__pyx_v_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(PyObject *__pyx_v_kwargs, PyObject *__pyx_v_inj_kwargs, int __pyx_v_inj_kwargs_len) { - int __pyx_v_index; - PyObject *__pyx_v_name = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_kw_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("__provide_keyword_args", 0); - - /* "dependency_injector/providers/injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 64, __pyx_L1_error) - } - __pyx_t_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 64, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_1 == 0) != 0); - if (__pyx_t_2) { - - /* "dependency_injector/providers/injections.pxd":65 - * - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "dependency_injector/providers/injections.pxd":66 - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 66, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "dependency_injector/providers/injections.pxd":67 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * else: - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "dependency_injector/providers/injections.pxd":68 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * else: - * for index in range(inj_kwargs_len): - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 68, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - - /* "dependency_injector/providers/injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - goto __pyx_L3; - } - - /* "dependency_injector/providers/injections.pxd":70 - * kwargs[name] = __get_value(kw_injection) - * else: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - /*else*/ { - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "dependency_injector/providers/injections.pxd":71 - * else: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * if name not in kwargs: - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 71, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "dependency_injector/providers/injections.pxd":72 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "dependency_injector/providers/injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(0, 73, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_2 != 0); - if (__pyx_t_6) { - - /* "dependency_injector/providers/injections.pxd":74 - * name = __get_name(kw_injection) - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * - * return kwargs - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 74, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - } - } - } - __pyx_L3:; - - /* "dependency_injector/providers/injections.pxd":76 - * kwargs[name] = __get_value(kw_injection) - * - * return kwargs # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_kwargs); - __pyx_r = __pyx_v_kwargs; - goto __pyx_L0; - - /* "dependency_injector/providers/injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_keyword_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF((PyObject *)__pyx_v_kw_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___inject_attributes(PyObject *__pyx_v_instance, PyObject *__pyx_v_attributes, int __pyx_v_attributes_len) { - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_attr_injection = 0; - int __pyx_v_index; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__inject_attributes", 0); - - /* "dependency_injector/providers/injections.pxd":85 - * int attributes_len): - * cdef NamedInjection attr_injection - * for index in range(attributes_len): # <<<<<<<<<<<<<< - * attr_injection = attributes[index] - * setattr(instance, - */ - __pyx_t_1 = __pyx_v_attributes_len; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_index = __pyx_t_2; - - /* "dependency_injector/providers/injections.pxd":86 - * cdef NamedInjection attr_injection - * for index in range(attributes_len): - * attr_injection = attributes[index] # <<<<<<<<<<<<<< - * setattr(instance, - * __get_name(attr_injection), - */ - if (unlikely(__pyx_v_attributes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 86, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_v_attributes, __pyx_v_index); - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_attr_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "dependency_injector/providers/injections.pxd":88 - * attr_injection = attributes[index] - * setattr(instance, - * __get_name(attr_injection), # <<<<<<<<<<<<<< - * __get_value(attr_injection)) - * - */ - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_attr_injection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "dependency_injector/providers/injections.pxd":89 - * setattr(instance, - * __get_name(attr_injection), - * __get_value(attr_injection)) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_attr_injection)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "dependency_injector/providers/injections.pxd":87 - * for index in range(attributes_len): - * attr_injection = attributes[index] - * setattr(instance, # <<<<<<<<<<<<<< - * __get_name(attr_injection), - * __get_value(attr_injection)) - */ - __pyx_t_5 = PyObject_SetAttr(__pyx_v_instance, __pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - - /* "dependency_injector/providers/injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__inject_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_attr_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10injections_Injection(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *p; - PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)o); - p->__pyx___value = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_10injections_Injection(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *p = (struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___value); - (*Py_TYPE(o)->tp_free)(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_10injections_Injection(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *p = (struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)o; - if (p->__pyx___value) { - e = (*v)(p->__pyx___value, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_10injections_Injection(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *p = (struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)o; - tmp = ((PyObject*)p->__pyx___value); - p->__pyx___value = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10injections_Injection = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.injections.Injection", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10injections_Injection, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Abstract injection class.", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10injections_Injection, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10injections_Injection, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10injections_Injection, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10injections_PositionalInjection(PyTypeObject *t, PyObject *a, PyObject *k) { - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10injections_Injection(t, a, k); - if (unlikely(!o)) return 0; - return o; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_10injections_PositionalInjection[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection_2__deepcopy__}, - {"get_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_5get_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection_4get_value}, - {"get_original_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_7get_original_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection_6get_original_value}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10injections_PositionalInjection = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.injections.PositionalInjection", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10injections_Injection, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Positional injection class.", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10injections_Injection, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10injections_Injection, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_10injections_PositionalInjection, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_10injections_19PositionalInjection_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10injections_PositionalInjection, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10injections_NamedInjection(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10injections_Injection(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)o); - p->__pyx___name = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_10injections_NamedInjection(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *p = (struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___name); - PyObject_GC_Track(o); - __pyx_tp_dealloc_19dependency_injector_9providers_10injections_Injection(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_10injections_NamedInjection(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *p = (struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)o; - e = __pyx_tp_traverse_19dependency_injector_9providers_10injections_Injection(o, v, a); if (e) return e; - if (p->__pyx___name) { - e = (*v)(p->__pyx___name, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_10injections_NamedInjection(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *p = (struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)o; - __pyx_tp_clear_19dependency_injector_9providers_10injections_Injection(o); - tmp = ((PyObject*)p->__pyx___name); - p->__pyx___name = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_10injections_NamedInjection[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_3__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_2__deepcopy__}, - {"get_name", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_5get_name, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_4get_name}, - {"get_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_7get_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_6get_value}, - {"get_original_value", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_9get_original_value, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection_8get_original_value}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10injections_NamedInjection = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.injections.NamedInjection", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10injections_NamedInjection, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Keyword injection class.", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10injections_NamedInjection, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10injections_NamedInjection, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_10injections_NamedInjection, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_10injections_14NamedInjection_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10injections_NamedInjection, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {"parse_positional_injections", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_1parse_positional_injections, METH_O, __pyx_doc_19dependency_injector_9providers_10injections_parse_positional_injections}, - {"parse_named_injections", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10injections_3parse_named_injections, METH_O, __pyx_doc_19dependency_injector_9providers_10injections_2parse_named_injections}, - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "injections", - __pyx_k_Dependency_injector_injections_P, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 47, __pyx_L1_error) - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(1, 33, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 37, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_InitGlobals(void) { - __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initinjections(void); /*proto*/ -PyMODINIT_FUNC initinjections(void) -#else -PyMODINIT_FUNC PyInit_injections(void); /*proto*/ -PyMODINIT_FUNC PyInit_injections(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_injections(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("injections", __pyx_methods, __pyx_k_Dependency_injector_injections_P, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_dependency_injector__providers__injections) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "dependency_injector.providers.injections")) { - if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers.injections", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - if (__Pyx_ExportFunction("parse_positional_injections", (void (*)(void))__pyx_f_19dependency_injector_9providers_10injections_parse_positional_injections, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("parse_named_injections", (void (*)(void))__pyx_f_19dependency_injector_9providers_10injections_parse_named_injections, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) - /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10injections_Injection) < 0) __PYX_ERR(1, 19, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10injections_Injection.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "Injection", (PyObject *)&__pyx_type_19dependency_injector_9providers_10injections_Injection) < 0) __PYX_ERR(1, 19, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_Injection = &__pyx_type_19dependency_injector_9providers_10injections_Injection; - __pyx_type_19dependency_injector_9providers_10injections_PositionalInjection.tp_base = __pyx_ptype_19dependency_injector_9providers_10injections_Injection; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10injections_PositionalInjection) < 0) __PYX_ERR(1, 23, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10injections_PositionalInjection.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_10injections_PositionalInjection, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 23, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_10injections_19PositionalInjection___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_10injections_19PositionalInjection___init__.doc = __pyx_doc_19dependency_injector_9providers_10injections_19PositionalInjection___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_10injections_19PositionalInjection___init__; - } - } - #endif - if (PyObject_SetAttrString(__pyx_m, "PositionalInjection", (PyObject *)&__pyx_type_19dependency_injector_9providers_10injections_PositionalInjection) < 0) __PYX_ERR(1, 23, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = &__pyx_type_19dependency_injector_9providers_10injections_PositionalInjection; - __pyx_type_19dependency_injector_9providers_10injections_NamedInjection.tp_base = __pyx_ptype_19dependency_injector_9providers_10injections_Injection; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10injections_NamedInjection) < 0) __PYX_ERR(1, 51, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10injections_NamedInjection.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_10injections_NamedInjection, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 51, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_10injections_14NamedInjection___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_10injections_14NamedInjection___init__.doc = __pyx_doc_19dependency_injector_9providers_10injections_14NamedInjection___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_10injections_14NamedInjection___init__; - } - } - #endif - if (PyObject_SetAttrString(__pyx_m, "NamedInjection", (PyObject *)&__pyx_type_19dependency_injector_9providers_10injections_NamedInjection) < 0) __PYX_ERR(1, 51, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = &__pyx_type_19dependency_injector_9providers_10injections_NamedInjection; - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "CLASS_TYPES", (void **)&__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(1, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*--- Function import code ---*/ - __pyx_t_2 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_2) __PYX_ERR(1, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "is_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_is_provider, "int (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "is_delegated", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_is_delegated, "int (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "deepcopy", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - - /* "dependency_injector/providers/injections.pyx":1 - * """Dependency injector injections. # <<<<<<<<<<<<<< - * - * Powered by Cython. - */ - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init dependency_injector.providers.injections", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers.injections"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -/* UnpackUnboundCMethod */ - static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { - PyObject *method; - method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); - if (unlikely(!method)) - return -1; - target->method = method; -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION >= 3 - if (likely(PyObject_TypeCheck(method, &PyMethodDescr_Type))) - #endif - { - PyMethodDescrObject *descr = (PyMethodDescrObject*) method; - target->func = descr->d_method->ml_meth; - target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); - } -#endif - return 0; -} - -/* CallUnboundCMethod0 */ - static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { - PyObject *args, *result = NULL; - if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; -#if CYTHON_ASSUME_SAFE_MACROS - args = PyTuple_New(1); - if (unlikely(!args)) goto bad; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); -#else - args = PyTuple_Pack(1, self); - if (unlikely(!args)) goto bad; -#endif - result = __Pyx_PyObject_Call(cfunc->method, args, NULL); - Py_DECREF(args); -bad: - return result; -} - -/* py_dict_items */ - static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { - if (PY_MAJOR_VERSION >= 3) - return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d); - else - return PyDict_Items(d); -} - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* IterFinish */ - static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = PyThreadState_GET(); - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -/* UnpackItemEndCheck */ - static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* FunctionExport */ - static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); - if (!d) { - PyErr_Clear(); - d = PyDict_New(); - if (!d) - goto bad; - Py_INCREF(d); - if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) - goto bad; - } - tmp.fp = f; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(tmp.p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); -#endif - if (!cobj) - goto bad; - if (PyDict_SetItemString(d, name, cobj) < 0) - goto bad; - Py_DECREF(cobj); - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(cobj); - Py_XDECREF(d); - return -1; -} - -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* VoidPtrImport */ - #ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, name); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C variable %.200s", - PyModule_GetName(module), name); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); - goto bad; - } - *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif - if (!(*p)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* FunctionImport */ - #ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, funcname); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C function %.200s", - PyModule_GetName(module), funcname); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); - goto bad; - } - tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif - *f = tmp.fp; - if (!(*f)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers/injections.pxd b/src/dependency_injector/providers/injections.pxd deleted file mode 100644 index 94c5c31d..00000000 --- a/src/dependency_injector/providers/injections.pxd +++ /dev/null @@ -1,95 +0,0 @@ -"""Dependency injector injections. - -Powered by Cython. -""" - -cimport cython - - -cdef class Injection(object): - cdef object __value - cdef int __is_provider - cdef int __is_delegated - cdef int __call - - -cdef class PositionalInjection(Injection): - pass - - -cdef class NamedInjection(Injection): - cdef object __name - - -cdef inline object __get_name(NamedInjection self): - return self.__name - - -cdef inline object __get_value(Injection self): - if self.__call == 0: - return self.__value - return self.__value() - - -@cython.boundscheck(False) -@cython.wraparound(False) -cdef inline tuple __provide_positional_args(tuple args, - tuple inj_args, - int inj_args_len): - cdef int index - cdef list positional_args - cdef PositionalInjection injection - - if inj_args_len == 0: - return args - - positional_args = list() - for index in range(inj_args_len): - injection = inj_args[index] - positional_args.append(__get_value(injection)) - positional_args.extend(args) - - return tuple(positional_args) - - -@cython.boundscheck(False) -@cython.wraparound(False) -cdef inline dict __provide_keyword_args(dict kwargs, - tuple inj_kwargs, - int inj_kwargs_len): - cdef int index - cdef object name - cdef NamedInjection kw_injection - - if len(kwargs) == 0: - for index in range(inj_kwargs_len): - kw_injection = inj_kwargs[index] - name = __get_name(kw_injection) - kwargs[name] = __get_value(kw_injection) - else: - for index in range(inj_kwargs_len): - kw_injection = inj_kwargs[index] - name = __get_name(kw_injection) - if name not in kwargs: - kwargs[name] = __get_value(kw_injection) - - return kwargs - - -@cython.boundscheck(False) -@cython.wraparound(False) -cdef inline object __inject_attributes(object instance, - tuple attributes, - int attributes_len): - cdef NamedInjection attr_injection - for index in range(attributes_len): - attr_injection = attributes[index] - setattr(instance, - __get_name(attr_injection), - __get_value(attr_injection)) - - -cpdef tuple parse_positional_injections(tuple args) - - -cpdef tuple parse_named_injections(dict kwargs) diff --git a/src/dependency_injector/providers/injections.pyx b/src/dependency_injector/providers/injections.pyx deleted file mode 100644 index 86dd1477..00000000 --- a/src/dependency_injector/providers/injections.pyx +++ /dev/null @@ -1,118 +0,0 @@ -"""Dependency injector injections. - -Powered by Cython. -""" - -cimport cython - -from .injections cimport ( - __get_name, - __get_value, -) -from .utils cimport ( - is_provider, - is_delegated, - deepcopy, -) - - -cdef class Injection(object): - """Abstract injection class.""" - - -cdef class PositionalInjection(Injection): - """Positional injection class.""" - - def __init__(self, value): - """Initializer.""" - self.__value = value - self.__is_provider = is_provider(value) - self.__is_delegated = is_delegated(value) - self.__call = (self.__is_provider == 1 and - self.__is_delegated == 0) - super(PositionalInjection, self).__init__() - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - return self.__class__(deepcopy(self.__value, memo)) - - def get_value(self): - """Return injection value.""" - return __get_value(self) - - def get_original_value(self): - """Return original value.""" - return self.__value - - -cdef class NamedInjection(Injection): - """Keyword injection class.""" - - def __init__(self, name, value): - """Initializer.""" - self.__name = name - self.__value = value - self.__is_provider = is_provider(value) - self.__is_delegated = is_delegated(value) - self.__call = (self.__is_provider == 1 and - self.__is_delegated == 0) - super(NamedInjection, self).__init__() - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - return self.__class__(deepcopy(self.__name, memo), - deepcopy(self.__value, memo)) - - def get_name(self): - """Return injection value.""" - return __get_name(self) - - def get_value(self): - """Return injection value.""" - return __get_value(self) - - def get_original_value(self): - """Return original value.""" - return self.__value - - -@cython.boundscheck(False) -@cython.wraparound(False) -cpdef tuple parse_positional_injections(tuple args): - """Parse positional injections.""" - cdef list injections = list() - cdef int args_len = len(args) - - cdef int index - cdef object arg - cdef PositionalInjection injection - - for index in range(args_len): - arg = args[index] - injection = PositionalInjection(arg) - injections.append(injection) - - return tuple(injections) - - -@cython.boundscheck(False) -@cython.wraparound(False) -cpdef tuple parse_named_injections(dict kwargs): - """Parse named injections.""" - cdef list injections = list() - - cdef object name - cdef object arg - cdef NamedInjection injection - - for name, arg in kwargs.items(): - injection = NamedInjection(name, arg) - injections.append(injection) - - return tuple(injections) diff --git a/src/dependency_injector/providers/singletons.c b/src/dependency_injector/providers/singletons.c deleted file mode 100644 index ee8941f1..00000000 --- a/src/dependency_injector/providers/singletons.c +++ /dev/null @@ -1,9390 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__dependency_injector__providers__singletons -#define __PYX_HAVE_API__dependency_injector__providers__singletons -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/dependency_injector/providers/singletons.pyx", - "src/dependency_injector/providers/injections.pxd", - "src/dependency_injector/providers/callables.pxd", - "src/dependency_injector/providers/factories.pxd", - "src/dependency_injector/providers/base.pxd", -}; - -/*--- Type declarations ---*/ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider; -struct __pyx_obj_19dependency_injector_9providers_4base_Object; -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate; -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency; -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext; -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection; -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection; -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection; -struct __pyx_obj_19dependency_injector_9providers_9callables_Callable; -struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable; -struct __pyx_obj_19dependency_injector_9providers_9factories_Factory; -struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory; -struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton; -struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton; -struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedSingleton; -struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; -struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton; -struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; -struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton; -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy; - -/* "utils.pxd":21 - * - * - * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< - */ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy { - int __pyx_n; - PyObject *memo; -}; - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Provider { - PyObject_HEAD - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtab; - PyObject *__pyx___overridden; - int __pyx___overridden_len; -}; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Object { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; -}; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_Delegate { - struct __pyx_obj_19dependency_injector_9providers_4base_Object __pyx_base; -}; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ -struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyTypeObject *__pyx___instance_of; -}; - - -/* "base.pxd":29 - * - * - * cdef class OverridingContext(object): # <<<<<<<<<<<<<< - * cdef Provider __overridden - * cdef Provider __overriding - */ -struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext { - PyObject_HEAD - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overridden; - struct __pyx_obj_19dependency_injector_9providers_4base_Provider *__pyx___overriding; -}; - - -/* "injections.pxd":9 - * - * - * cdef class Injection(object): # <<<<<<<<<<<<<< - * cdef object __value - * cdef int __is_provider - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_Injection { - PyObject_HEAD - PyObject *__pyx___value; - int __pyx___is_provider; - int __pyx___is_delegated; - int __pyx___call; -}; - - -/* "injections.pxd":16 - * - * - * cdef class PositionalInjection(Injection): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; -}; - - -/* "injections.pxd":20 - * - * - * cdef class NamedInjection(Injection): # <<<<<<<<<<<<<< - * cdef object __name - * - */ -struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection { - struct __pyx_obj_19dependency_injector_9providers_10injections_Injection __pyx_base; - PyObject *__pyx___name; -}; - - -/* "callables.pxd":16 - * - * - * cdef class Callable(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ -struct __pyx_obj_19dependency_injector_9providers_9callables_Callable { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - PyObject *__pyx___provides; - PyObject *__pyx___args; - int __pyx___args_len; - PyObject *__pyx___kwargs; - int __pyx___kwargs_len; -}; - - -/* "callables.pxd":28 - * - * - * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable { - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable __pyx_base; -}; - - -/* "factories.pxd":14 - * - * - * cdef class Factory(Provider): # <<<<<<<<<<<<<< - * cdef Callable __instantiator - * - */ -struct __pyx_obj_19dependency_injector_9providers_9factories_Factory { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx___instantiator; - PyObject *__pyx___attributes; - int __pyx___attributes_len; -}; - - -/* "factories.pxd":23 - * - * - * cdef class DelegatedFactory(Factory): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory { - struct __pyx_obj_19dependency_injector_9providers_9factories_Factory __pyx_base; -}; - - -/* "dependency_injector/providers/singletons.pxd":10 - * - * - * cdef class BaseSingleton(Provider): # <<<<<<<<<<<<<< - * cdef Factory __instantiator - * - */ -struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton { - struct __pyx_obj_19dependency_injector_9providers_4base_Provider __pyx_base; - struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx___instantiator; -}; - - -/* "dependency_injector/providers/singletons.pxd":14 - * - * - * cdef class Singleton(BaseSingleton): # <<<<<<<<<<<<<< - * cdef object __storage - * - */ -struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton { - struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton __pyx_base; - PyObject *__pyx___storage; -}; - - -/* "dependency_injector/providers/singletons.pxd":20 - * - * - * cdef class DelegatedSingleton(Singleton): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedSingleton { - struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton __pyx_base; -}; - - -/* "dependency_injector/providers/singletons.pxd":24 - * - * - * cdef class ThreadSafeSingleton(BaseSingleton): # <<<<<<<<<<<<<< - * cdef object __storage - * cdef object __lock - */ -struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton { - struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton __pyx_base; - PyObject *__pyx___storage; - PyObject *__pyx___lock; -}; - - -/* "dependency_injector/providers/singletons.pxd":31 - * - * - * cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): # <<<<<<<<<<<<<< - * pass - * - */ -struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton { - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton __pyx_base; -}; - - -/* "dependency_injector/providers/singletons.pxd":35 - * - * - * cdef class ThreadLocalSingleton(BaseSingleton): # <<<<<<<<<<<<<< - * cdef object __storage - * - */ -struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton { - struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton __pyx_base; - PyObject *__pyx___storage; -}; - - -/* "dependency_injector/providers/singletons.pxd":41 - * - * - * cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): # <<<<<<<<<<<<<< - * pass - */ -struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton { - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton __pyx_base; -}; - - - -/* "base.pxd":7 - * - * - * cdef class Provider(object): # <<<<<<<<<<<<<< - * cdef tuple __overridden - * cdef int __overridden_len - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider { - PyObject *(*_provide)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); - PyObject *(*_call_last_overriding)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - - -/* "base.pxd":15 - * - * - * cdef class Object(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object *__pyx_vtabptr_19dependency_injector_9providers_4base_Object; - - -/* "base.pxd":21 - * - * - * cdef class Delegate(Object): # <<<<<<<<<<<<<< - * pass - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate *__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate; - - -/* "base.pxd":25 - * - * - * cdef class ExternalDependency(Provider): # <<<<<<<<<<<<<< - * cdef type __instance_of - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency *__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency; - - -/* "callables.pxd":16 - * - * - * cdef class Callable(Provider): # <<<<<<<<<<<<<< - * cdef object __provides - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable *__pyx_vtabptr_19dependency_injector_9providers_9callables_Callable; - - -/* "callables.pxd":28 - * - * - * cdef class DelegatedCallable(Callable): # <<<<<<<<<<<<<< - * pass - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable { - struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable *__pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable; - - -/* "factories.pxd":14 - * - * - * cdef class Factory(Provider): # <<<<<<<<<<<<<< - * cdef Callable __instantiator - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory *__pyx_vtabptr_19dependency_injector_9providers_9factories_Factory; - - -/* "factories.pxd":23 - * - * - * cdef class DelegatedFactory(Factory): # <<<<<<<<<<<<<< - * pass - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_DelegatedFactory { - struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_DelegatedFactory *__pyx_vtabptr_19dependency_injector_9providers_9factories_DelegatedFactory; - - -/* "dependency_injector/providers/singletons.pyx":28 - * - * - * cdef class BaseSingleton(Provider): # <<<<<<<<<<<<<< - * """Base class of singleton providers.""" - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_BaseSingleton { - struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_vtabptr_19dependency_injector_9providers_10singletons_BaseSingleton; - - -/* "dependency_injector/providers/singletons.pyx":202 - * - * - * cdef class Singleton(BaseSingleton): # <<<<<<<<<<<<<< - * """Singleton provider returns same instance on every call. - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_Singleton { - struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_BaseSingleton __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_Singleton *__pyx_vtabptr_19dependency_injector_9providers_10singletons_Singleton; - - -/* "dependency_injector/providers/singletons.pyx":263 - * - * - * cdef class DelegatedSingleton(Singleton): # <<<<<<<<<<<<<< - * """Delegated singleton is injected "as is". - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedSingleton { - struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_Singleton __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedSingleton *__pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedSingleton; - - -/* "dependency_injector/providers/singletons.pyx":284 - * - * - * cdef class ThreadSafeSingleton(BaseSingleton): # <<<<<<<<<<<<<< - * """Thread-safe singleton provider.""" - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadSafeSingleton { - struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_BaseSingleton __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; - - -/* "dependency_injector/providers/singletons.pyx":319 - * - * - * cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): # <<<<<<<<<<<<<< - * """Delegated thread-safe singleton is injected "as is". - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton { - struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadSafeSingleton __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton *__pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton; - - -/* "dependency_injector/providers/singletons.pyx":340 - * - * - * cdef class ThreadLocalSingleton(BaseSingleton): # <<<<<<<<<<<<<< - * """Thread-local singleton provides single objects in scope of thread. - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadLocalSingleton { - struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_BaseSingleton __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; - - -/* "dependency_injector/providers/singletons.pyx":393 - * - * - * cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): # <<<<<<<<<<<<<< - * """Delegated thread-local singleton is injected "as is". - * - */ - -struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton { - struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadLocalSingleton __pyx_base; -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton *__pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* KeywordStringCheck.proto */ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); - -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -/* PyObjectLookupSpecial.proto */ -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 -static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { - PyObject *res; - PyTypeObject *tp = Py_TYPE(obj); -#if PY_MAJOR_VERSION < 3 - if (unlikely(PyInstance_Check(obj))) - return __Pyx_PyObject_GetAttrStr(obj, attr_name); -#endif - res = _PyType_Lookup(tp, attr_name); - if (likely(res)) { - descrgetfunc f = Py_TYPE(res)->tp_descr_get; - if (!f) { - Py_INCREF(res); - } else { - res = f(res, obj, (PyObject *)tp); - } - } else { - PyErr_SetObject(PyExc_AttributeError, attr_name); - } - return res; -} -#else -#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) -#endif - -/* SaveResetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -#else -#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) -#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) -#endif - -/* GetException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* PyObjectSetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) -#endif - -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif - -/* SwapException.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); -#endif - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* PyDictContains.proto */ -static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { - int result = PyDict_Contains(dict, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* CallNextTpDealloc.proto */ -static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc); - -/* CallNextTpTraverse.proto */ -static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse); - -/* CallNextTpClear.proto */ -static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc); - -/* GetVTable.proto */ -static void* __Pyx_GetVtable(PyObject *dict); - -/* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - -/* VoidPtrImport.proto */ -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); - -/* FunctionImport.proto */ -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_9Singleton__provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch); /* proto*/ - -/* Module declarations from 'dependency_injector.providers.base' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Provider = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Object = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_Delegate = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = 0; - -/* Module declarations from 'cython' */ - -/* Module declarations from 'dependency_injector.providers.injections' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_Injection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(PyObject *, PyObject *, int); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(PyObject *, PyObject *, int); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___inject_attributes(PyObject *, PyObject *, int); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.callables' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_Callable = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *, PyObject *, PyObject *); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.factories' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_Factory = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory = 0; -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___factory_call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *, PyObject *, PyObject *); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.utils' */ -static PyObject **__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES = 0; -#define __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES (*__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES) -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_represent_provider)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_19dependency_injector_9providers_5utils_deepcopy)(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args); /*proto*/ - -/* Module declarations from 'dependency_injector.providers.singletons' */ -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10singletons_Singleton = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedSingleton = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadSafeSingleton = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadLocalSingleton = 0; -static PyTypeObject *__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton = 0; -#define __Pyx_MODULE_NAME "dependency_injector.providers.singletons" -int __pyx_module_is_main_dependency_injector__providers__singletons = 0; - -/* Implementation of 'dependency_injector.providers.singletons' */ -static PyObject *__pyx_builtin_super; -static PyObject *__pyx_builtin_id; -static PyObject *__pyx_builtin_NotImplementedError; -static PyObject *__pyx_builtin_AttributeError; -static PyObject *__pyx_builtin_range; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k_cls[] = "cls"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_args[] = "args"; -static const char __pyx_k_exit[] = "__exit__"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_Error[] = "Error"; -static const char __pyx_k_RLock[] = "RLock"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_enter[] = "__enter__"; -static const char __pyx_k_local[] = "local"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_super[] = "super"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_kwargs[] = "kwargs"; -static const char __pyx_k_provide[] = "_provide"; -static const char __pyx_k_add_args[] = "add_args"; -static const char __pyx_k_instance[] = "instance"; -static const char __pyx_k_override[] = "override"; -static const char __pyx_k_provides[] = "provides"; -static const char __pyx_k_set_args[] = "set_args"; -static const char __pyx_k_threading[] = "threading"; -static const char __pyx_k_add_kwargs[] = "add_kwargs"; -static const char __pyx_k_attributes[] = "attributes"; -static const char __pyx_k_clear_args[] = "clear_args"; -static const char __pyx_k_overridden[] = "overridden"; -static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; -static const char __pyx_k_set_kwargs[] = "set_kwargs"; -static const char __pyx_k_GLOBAL_LOCK[] = "GLOBAL_LOCK"; -static const char __pyx_k_IS_DELEGATED[] = "__IS_DELEGATED__"; -static const char __pyx_k_clear_kwargs[] = "clear_kwargs"; -static const char __pyx_k_provided_type[] = "provided_type"; -static const char __pyx_k_AttributeError[] = "AttributeError"; -static const char __pyx_k_add_attributes[] = "add_attributes"; -static const char __pyx_k_set_attributes[] = "set_attributes"; -static const char __pyx_k_clear_attributes[] = "clear_attributes"; -static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; -static const char __pyx_k_dependency_injector_errors[] = "dependency_injector.errors"; -static const char __pyx_k_0_can_provide_only_1_instances[] = "{0} can provide only {1} instances"; -static const char __pyx_k_Dependency_injector_singleton_pr[] = "Dependency injector singleton providers.\n\nPowered by Cython.\n"; -static PyObject *__pyx_kp_s_0_can_provide_only_1_instances; -static PyObject *__pyx_n_s_AttributeError; -static PyObject *__pyx_n_s_Error; -static PyObject *__pyx_n_s_GLOBAL_LOCK; -static PyObject *__pyx_n_s_IS_DELEGATED; -static PyObject *__pyx_n_s_NotImplementedError; -static PyObject *__pyx_n_s_RLock; -static PyObject *__pyx_n_s_add_args; -static PyObject *__pyx_n_s_add_attributes; -static PyObject *__pyx_n_s_add_kwargs; -static PyObject *__pyx_n_s_args; -static PyObject *__pyx_n_s_attributes; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_clear_args; -static PyObject *__pyx_n_s_clear_attributes; -static PyObject *__pyx_n_s_clear_kwargs; -static PyObject *__pyx_n_s_cls; -static PyObject *__pyx_n_s_dependency_injector_errors; -static PyObject *__pyx_n_s_enter; -static PyObject *__pyx_n_s_exit; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_instance; -static PyObject *__pyx_n_s_kwargs; -static PyObject *__pyx_n_s_local; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_overridden; -static PyObject *__pyx_n_s_override; -static PyObject *__pyx_n_s_provide; -static PyObject *__pyx_n_s_provided_type; -static PyObject *__pyx_n_s_provides; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_set_args; -static PyObject *__pyx_n_s_set_attributes; -static PyObject *__pyx_n_s_set_kwargs; -static PyObject *__pyx_n_s_super; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_threading; -static int __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_4args___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_6add_args(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_8set_args(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_10clear_args(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_24reset(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_10singletons_9Singleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_9Singleton_2reset(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_9Singleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static int __pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_BaseSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_Singleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tuple_; - -/* "dependency_injector/providers/singletons.pyx":33 - * provided_type = None - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 33, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 33, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton___init__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/singletons.pyx":45 - * :type kwargs: dict[str, object] - * """ - * if (self.__class__.provided_type and # <<<<<<<<<<<<<< - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - - /* "dependency_injector/providers/singletons.pyx":46 - * """ - * if (self.__class__.provided_type and - * not issubclass(provides, self.__class__.provided_type)): # <<<<<<<<<<<<<< - * raise Error('{0} can provide only {1} instances'.format( - * self.__class__, self.__class__.provided_type)) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = PyObject_IsSubclass(__pyx_v_provides, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = ((!(__pyx_t_4 != 0)) != 0); - __pyx_t_1 = __pyx_t_5; - __pyx_L4_bool_binop_done:; - - /* "dependency_injector/providers/singletons.pyx":45 - * :type kwargs: dict[str, object] - * """ - * if (self.__class__.provided_type and # <<<<<<<<<<<<<< - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - */ - if (__pyx_t_1) { - - /* "dependency_injector/providers/singletons.pyx":47 - * if (self.__class__.provided_type and - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( # <<<<<<<<<<<<<< - * self.__class__, self.__class__.provided_type)) - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_can_provide_only_1_instances, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - - /* "dependency_injector/providers/singletons.pyx":48 - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - * self.__class__, self.__class__.provided_type)) # <<<<<<<<<<<<<< - * - * self.__instantiator = Factory(provides, *args, **kwargs) - */ - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_provided_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = NULL; - __pyx_t_11 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_11 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_10}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_10); - __pyx_t_8 = 0; - __pyx_t_10 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_7) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 47, __pyx_L1_error) - - /* "dependency_injector/providers/singletons.pyx":45 - * :type kwargs: dict[str, object] - * """ - * if (self.__class__.provided_type and # <<<<<<<<<<<<<< - * not issubclass(provides, self.__class__.provided_type)): - * raise Error('{0} can provide only {1} instances'.format( - */ - } - - /* "dependency_injector/providers/singletons.pyx":50 - * self.__class__, self.__class__.provided_type)) - * - * self.__instantiator = Factory(provides, *args, **kwargs) # <<<<<<<<<<<<<< - * - * super(BaseSingleton, self).__init__() - */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_19dependency_injector_9providers_9factories_Factory), __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___instantiator); - __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx___instantiator)); - __pyx_v_self->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":52 - * self.__instantiator = Factory(provides, *args, **kwargs) - * - * super(BaseSingleton, self).__init__() # <<<<<<<<<<<<<< - * - * def __str__(self): - */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_12 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_12) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":33 - * provided_type = None - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":54 - * super(BaseSingleton, self).__init__() - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__(PyObject *__pyx_v_self); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__[] = "Return string representation of provider.\n\n :rtype: str\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__; -#endif -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__str__", 0); - - /* "dependency_injector/providers/singletons.pyx":59 - * :rtype: str - * """ - * return represent_provider(provider=self, # <<<<<<<<<<<<<< - * provides=self.__instantiator.cls) - * - */ - __Pyx_XDECREF(__pyx_r); - - /* "dependency_injector/providers/singletons.pyx":60 - * """ - * return represent_provider(provider=self, - * provides=self.__instantiator.cls) # <<<<<<<<<<<<<< - * - * def __deepcopy__(self, memo): - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_cls); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - - /* "dependency_injector/providers/singletons.pyx":59 - * :rtype: str - * """ - * return represent_provider(provider=self, # <<<<<<<<<<<<<< - * provides=self.__instantiator.cls) - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(((PyObject *)__pyx_v_self), __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":54 - * super(BaseSingleton, self).__init__() - * - * def __str__(self): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":62 - * provides=self.__instantiator.cls) - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_4__deepcopy__[] = "Create and return full copy of provider."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_4__deepcopy__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), ((PyObject *)__pyx_v_memo)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_4__deepcopy__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_memo) { - PyObject *__pyx_v_copied = NULL; - PyObject *__pyx_v_overriding_provider = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - PyObject *__pyx_t_11 = NULL; - __Pyx_RefNannySetupContext("__deepcopy__", 0); - - /* "dependency_injector/providers/singletons.pyx":64 - * def __deepcopy__(self, memo): - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) # <<<<<<<<<<<<<< - * if copied is not None: - * return copied - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_memo, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_copied = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":65 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - __pyx_t_6 = (__pyx_v_copied != Py_None); - __pyx_t_7 = (__pyx_t_6 != 0); - if (__pyx_t_7) { - - /* "dependency_injector/providers/singletons.pyx":66 - * copied = memo.get(id(self)) - * if copied is not None: - * return copied # <<<<<<<<<<<<<< - * - * copied = self.__class__(self.cls, - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":65 - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - * if copied is not None: # <<<<<<<<<<<<<< - * return copied - * - */ - } - - /* "dependency_injector/providers/singletons.pyx":68 - * return copied - * - * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cls); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":69 - * - * copied = self.__class__(self.cls, - * *deepcopy(self.args, memo), # <<<<<<<<<<<<<< - * **deepcopy(self.kwargs, memo)) - * copied.set_attributes(**deepcopy(self.attributes, memo)) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 69, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_2, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":68 - * return copied - * - * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_2 = PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":70 - * copied = self.__class__(self.cls, - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) # <<<<<<<<<<<<<< - * copied.set_attributes(**deepcopy(self.attributes, memo)) - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 70, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_5, 0, &__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(__pyx_t_3 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 70, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_t_3))) { - __pyx_t_2 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - - /* "dependency_injector/providers/singletons.pyx":68 - * return copied - * - * copied = self.__class__(self.cls, # <<<<<<<<<<<<<< - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_copied, __pyx_t_3); - __pyx_t_3 = 0; - - /* "dependency_injector/providers/singletons.pyx":71 - * *deepcopy(self.args, memo), - * **deepcopy(self.kwargs, memo)) - * copied.set_attributes(**deepcopy(self.attributes, memo)) # <<<<<<<<<<<<<< - * - * for overriding_provider in self.overridden: - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_set_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 71, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_t_4, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(__pyx_t_1 == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(0, 71, __pyx_L1_error) - } - if (likely(PyDict_CheckExact(__pyx_t_1))) { - __pyx_t_2 = PyDict_Copy(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = PyObject_CallFunctionObjArgs((PyObject*)&PyDict_Type, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":73 - * copied.set_attributes(**deepcopy(self.attributes, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_overridden); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 73, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_10(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 73, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_overriding_provider, __pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":74 - * - * for overriding_provider in self.overridden: - * copied.override(deepcopy(overriding_provider, memo)) # <<<<<<<<<<<<<< - * - * return copied - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_copied, __pyx_n_s_override); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyDict_CheckExact(__pyx_v_memo))||((__pyx_v_memo) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_memo)->tp_name), 0))) __PYX_ERR(0, 74, __pyx_L1_error) - __pyx_t_8.__pyx_n = 1; - __pyx_t_8.memo = ((PyObject*)__pyx_v_memo); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_overriding_provider, 0, &__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":73 - * copied.set_attributes(**deepcopy(self.attributes, memo)) - * - * for overriding_provider in self.overridden: # <<<<<<<<<<<<<< - * copied.override(deepcopy(overriding_provider, memo)) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":76 - * copied.override(deepcopy(overriding_provider, memo)) - * - * return copied # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_copied); - __pyx_r = __pyx_v_copied; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":62 - * provides=self.__instantiator.cls) - * - * def __deepcopy__(self, memo): # <<<<<<<<<<<<<< - * """Create and return full copy of provider.""" - * copied = memo.get(id(self)) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_copied); - __Pyx_XDECREF(__pyx_v_overriding_provider); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":79 - * - * @property - * def cls(self): # <<<<<<<<<<<<<< - * """Return provided type.""" - * return self.__instantiator.cls - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3cls_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3cls_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_3cls___get__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_3cls___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/singletons.pyx":81 - * def cls(self): - * """Return provided type.""" - * return self.__instantiator.cls # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_cls); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":79 - * - * @property - * def cls(self): # <<<<<<<<<<<<<< - * """Return provided type.""" - * return self.__instantiator.cls - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.cls.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":84 - * - * @property - * def args(self): # <<<<<<<<<<<<<< - * """Return positional argument injections.""" - * return self.__instantiator.args - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_4args_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_4args_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_4args___get__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_4args___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/singletons.pyx":86 - * def args(self): - * """Return positional argument injections.""" - * return self.__instantiator.args # <<<<<<<<<<<<<< - * - * def add_args(self, *args): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":84 - * - * @property - * def args(self): # <<<<<<<<<<<<<< - * """Return positional argument injections.""" - * return self.__instantiator.args - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.args.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":88 - * return self.__instantiator.args - * - * def add_args(self, *args): # <<<<<<<<<<<<<< - * """Add __init__ postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_6add_args[] = "Add __init__ postional argument injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_7add_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_args (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_args", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_6add_args(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_6add_args(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("add_args", 0); - - /* "dependency_injector/providers/singletons.pyx":96 - * :return: Reference ``self`` - * """ - * self.__instantiator.add_args(*args) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":97 - * """ - * self.__instantiator.add_args(*args) - * return self # <<<<<<<<<<<<<< - * - * def set_args(self, *args): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":88 - * return self.__instantiator.args - * - * def add_args(self, *args): # <<<<<<<<<<<<<< - * """Add __init__ postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.add_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":99 - * return self - * - * def set_args(self, *args): # <<<<<<<<<<<<<< - * """Set __init__ postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_8set_args[] = "Set __init__ postional argument injections.\n\n Existing __init__ positional argument injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_9set_args(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_args (wrapper)", 0); - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_args", 0))) return NULL; - __Pyx_INCREF(__pyx_args); - __pyx_v_args = __pyx_args; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_8set_args(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), __pyx_v_args); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_8set_args(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_args) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_args", 0); - - /* "dependency_injector/providers/singletons.pyx":109 - * :return: Reference ``self`` - * """ - * self.__instantiator.set_args(*args) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":110 - * """ - * self.__instantiator.set_args(*args) - * return self # <<<<<<<<<<<<<< - * - * def clear_args(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":99 - * return self - * - * def set_args(self, *args): # <<<<<<<<<<<<<< - * """Set __init__ postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.set_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":112 - * return self - * - * def clear_args(self): # <<<<<<<<<<<<<< - * """Drop __init__ postional argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_10clear_args[] = "Drop __init__ postional argument injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_11clear_args(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_args (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_10clear_args(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_10clear_args(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("clear_args", 0); - - /* "dependency_injector/providers/singletons.pyx":117 - * :return: Reference ``self`` - * """ - * self.__instantiator.clear_args() # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":118 - * """ - * self.__instantiator.clear_args() - * return self # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":112 - * return self - * - * def clear_args(self): # <<<<<<<<<<<<<< - * """Drop __init__ postional argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.clear_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":121 - * - * @property - * def kwargs(self): # <<<<<<<<<<<<<< - * """Return keyword argument injections.""" - * return self.__instantiator.kwargs - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_6kwargs_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_6kwargs_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_6kwargs___get__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_6kwargs___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/singletons.pyx":123 - * def kwargs(self): - * """Return keyword argument injections.""" - * return self.__instantiator.kwargs # <<<<<<<<<<<<<< - * - * def add_kwargs(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":121 - * - * @property - * def kwargs(self): # <<<<<<<<<<<<<< - * """Return keyword argument injections.""" - * return self.__instantiator.kwargs - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.kwargs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":125 - * return self.__instantiator.kwargs - * - * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Add __init__ keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_12add_kwargs[] = "Add __init__ keyword argument injections.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_13add_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_kwargs (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("add_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_kwargs", 1))) return NULL; - if (__pyx_kwds) { - __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - } else { - __pyx_v_kwargs = NULL; - } - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_12add_kwargs(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_12add_kwargs(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("add_kwargs", 0); - - /* "dependency_injector/providers/singletons.pyx":133 - * :return: Reference ``self`` - * """ - * self.__instantiator.add_kwargs(**kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":134 - * """ - * self.__instantiator.add_kwargs(**kwargs) - * return self # <<<<<<<<<<<<<< - * - * def set_kwargs(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":125 - * return self.__instantiator.kwargs - * - * def add_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Add __init__ keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.add_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":136 - * return self - * - * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Set __init__ keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_14set_kwargs[] = "Set __init__ keyword argument injections.\n\n Existing __init__ keyword argument injections are dropped.\n\n :param kwargs: Dictionary of injections.\n :type kwargs: dict\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_15set_kwargs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_kwargs (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("set_kwargs", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_kwargs", 1))) return NULL; - if (__pyx_kwds) { - __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - } else { - __pyx_v_kwargs = NULL; - } - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_14set_kwargs(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_14set_kwargs(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_kwargs", 0); - - /* "dependency_injector/providers/singletons.pyx":146 - * :return: Reference ``self`` - * """ - * self.__instantiator.set_kwargs(**kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":147 - * """ - * self.__instantiator.set_kwargs(**kwargs) - * return self # <<<<<<<<<<<<<< - * - * def clear_kwargs(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":136 - * return self - * - * def set_kwargs(self, **kwargs): # <<<<<<<<<<<<<< - * """Set __init__ keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.set_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":149 - * return self - * - * def clear_kwargs(self): # <<<<<<<<<<<<<< - * """Drop __init__ keyword argument injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_16clear_kwargs[] = "Drop __init__ keyword argument injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_17clear_kwargs(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_kwargs (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_16clear_kwargs(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_16clear_kwargs(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("clear_kwargs", 0); - - /* "dependency_injector/providers/singletons.pyx":154 - * :return: Reference ``self`` - * """ - * self.__instantiator.clear_kwargs() # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":155 - * """ - * self.__instantiator.clear_kwargs() - * return self # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":149 - * return self - * - * def clear_kwargs(self): # <<<<<<<<<<<<<< - * """Drop __init__ keyword argument injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.clear_kwargs", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":158 - * - * @property - * def attributes(self): # <<<<<<<<<<<<<< - * """Return attribute injections.""" - * return self.__instantiator.attributes - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_10attributes_1__get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_10attributes_1__get__(PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_10attributes___get__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_10attributes___get__(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("__get__", 0); - - /* "dependency_injector/providers/singletons.pyx":160 - * def attributes(self): - * """Return attribute injections.""" - * return self.__instantiator.attributes # <<<<<<<<<<<<<< - * - * def add_attributes(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":158 - * - * @property - * def attributes(self): # <<<<<<<<<<<<<< - * """Return attribute injections.""" - * return self.__instantiator.attributes - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.attributes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":162 - * return self.__instantiator.attributes - * - * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Add attribute injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_18add_attributes[] = "Add attribute injections.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_19add_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("add_attributes (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("add_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "add_attributes", 1))) return NULL; - if (__pyx_kwds) { - __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - } else { - __pyx_v_kwargs = NULL; - } - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_18add_attributes(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_18add_attributes(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("add_attributes", 0); - - /* "dependency_injector/providers/singletons.pyx":170 - * :return: Reference ``self`` - * """ - * self.__instantiator.add_attributes(**kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_add_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":171 - * """ - * self.__instantiator.add_attributes(**kwargs) - * return self # <<<<<<<<<<<<<< - * - * def set_attributes(self, **kwargs): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":162 - * return self.__instantiator.attributes - * - * def add_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Add attribute injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.add_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":173 - * return self - * - * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Set attribute injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_20set_attributes[] = "Set attribute injections.\n\n Existing attribute injections are dropped.\n\n :param args: Tuple of injections.\n :type args: tuple\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_21set_attributes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("set_attributes (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("set_attributes", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return NULL;} - if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_attributes", 1))) return NULL; - if (__pyx_kwds) { - __pyx_v_kwargs = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwargs)) return NULL; - __Pyx_GOTREF(__pyx_v_kwargs); - } else { - __pyx_v_kwargs = NULL; - } - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_20set_attributes(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self), __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_20set_attributes(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("set_attributes", 0); - - /* "dependency_injector/providers/singletons.pyx":183 - * :return: Reference ``self`` - * """ - * self.__instantiator.set_attributes(**kwargs) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_set_attributes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":184 - * """ - * self.__instantiator.set_attributes(**kwargs) - * return self # <<<<<<<<<<<<<< - * - * def clear_attributes(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":173 - * return self - * - * def set_attributes(self, **kwargs): # <<<<<<<<<<<<<< - * """Set attribute injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.set_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":186 - * return self - * - * def clear_attributes(self): # <<<<<<<<<<<<<< - * """Drop attribute injections. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_22clear_attributes[] = "Drop attribute injections.\n\n :return: Reference ``self``\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_23clear_attributes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("clear_attributes (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_22clear_attributes(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_22clear_attributes(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("clear_attributes", 0); - - /* "dependency_injector/providers/singletons.pyx":191 - * :return: Reference ``self`` - * """ - * self.__instantiator.clear_attributes() # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx___instantiator), __pyx_n_s_clear_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":192 - * """ - * self.__instantiator.clear_attributes() - * return self # <<<<<<<<<<<<<< - * - * def reset(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __pyx_r = ((PyObject *)__pyx_v_self); - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":186 - * return self - * - * def clear_attributes(self): # <<<<<<<<<<<<<< - * """Drop attribute injections. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.clear_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":194 - * return self - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_25reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_24reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_25reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_24reset(((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_13BaseSingleton_24reset(CYTHON_UNUSED struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("reset", 0); - - /* "dependency_injector/providers/singletons.pyx":199 - * :rtype: None - * """ - * raise NotImplementedError() # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 199, __pyx_L1_error) - - /* "dependency_injector/providers/singletons.pyx":194 - * return self - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.BaseSingleton.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":233 - * """ - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_9Singleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_10singletons_9Singleton___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 233, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 233, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("dependency_injector.providers.singletons.Singleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_9Singleton___init__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_10singletons_9Singleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/singletons.pyx":245 - * :type kwargs: dict[str, object] - * """ - * self.__storage = None # <<<<<<<<<<<<<< - * super(Singleton, self).__init__(provides, *args, **kwargs) - * - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->__pyx___storage); - __Pyx_DECREF(__pyx_v_self->__pyx___storage); - __pyx_v_self->__pyx___storage = Py_None; - - /* "dependency_injector/providers/singletons.pyx":246 - * """ - * self.__storage = None - * super(Singleton, self).__init__(provides, *args, **kwargs) # <<<<<<<<<<<<<< - * - * def reset(self): - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_Singleton)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_Singleton)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_Singleton)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":233 - * """ - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.singletons.Singleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":248 - * super(Singleton, self).__init__(provides, *args, **kwargs) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_9Singleton_2reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_9Singleton_2reset(((struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_9Singleton_2reset(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset", 0); - - /* "dependency_injector/providers/singletons.pyx":253 - * :rtype: None - * """ - * self.__storage = None # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->__pyx___storage); - __Pyx_DECREF(__pyx_v_self->__pyx___storage); - __pyx_v_self->__pyx___storage = Py_None; - - /* "dependency_injector/providers/singletons.pyx":248 - * super(Singleton, self).__init__(provides, *args, **kwargs) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":255 - * self.__storage = None - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return single instance.""" - * if self.__storage is None: - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_9Singleton__provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_5_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/singletons.pyx":257 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return single instance.""" - * if self.__storage is None: # <<<<<<<<<<<<<< - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) - */ - __pyx_t_7 = (__pyx_v_self->__pyx___storage == Py_None); - __pyx_t_8 = (__pyx_t_7 != 0); - if (__pyx_t_8) { - - /* "dependency_injector/providers/singletons.pyx":258 - * """Return single instance.""" - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< - * args, kwargs) - * return self.__storage - */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator); - __Pyx_INCREF(__pyx_t_1); - - /* "dependency_injector/providers/singletons.pyx":259 - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) # <<<<<<<<<<<<<< - * return self.__storage - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_9factories___factory_call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":258 - * """Return single instance.""" - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< - * args, kwargs) - * return self.__storage - */ - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___storage); - __Pyx_DECREF(__pyx_v_self->__pyx___storage); - __pyx_v_self->__pyx___storage = __pyx_t_2; - __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":257 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return single instance.""" - * if self.__storage is None: # <<<<<<<<<<<<<< - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) - */ - } - - /* "dependency_injector/providers/singletons.pyx":260 - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) - * return self.__storage # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___storage); - __pyx_r = __pyx_v_self->__pyx___storage; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":255 - * self.__storage = None - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return single instance.""" - * if self.__storage is None: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.singletons.Singleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_9Singleton_4_provide[] = "Return single instance."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 255, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 255, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 255, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.singletons.Singleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 255, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 255, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_9Singleton_4_provide(((struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_9Singleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10singletons_9Singleton__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.Singleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":287 - * """Thread-safe singleton provider.""" - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 287, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 287, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadSafeSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/singletons.pyx":299 - * :type kwargs: dict[str, object] - * """ - * self.__storage = None # <<<<<<<<<<<<<< - * self.__lock = GLOBAL_LOCK - * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->__pyx___storage); - __Pyx_DECREF(__pyx_v_self->__pyx___storage); - __pyx_v_self->__pyx___storage = Py_None; - - /* "dependency_injector/providers/singletons.pyx":300 - * """ - * self.__storage = None - * self.__lock = GLOBAL_LOCK # <<<<<<<<<<<<<< - * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) - * - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_GLOBAL_LOCK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___lock); - __Pyx_DECREF(__pyx_v_self->__pyx___lock); - __pyx_v_self->__pyx___lock = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":301 - * self.__storage = None - * self.__lock = GLOBAL_LOCK - * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) # <<<<<<<<<<<<<< - * - * def reset(self): - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadSafeSingleton)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadSafeSingleton)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadSafeSingleton)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_provides); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":287 - * """Thread-safe singleton provider.""" - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadSafeSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":303 - * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_2reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_2reset(((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset", 0); - - /* "dependency_injector/providers/singletons.pyx":308 - * :rtype: None - * """ - * self.__storage = None # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(Py_None); - __Pyx_GOTREF(__pyx_v_self->__pyx___storage); - __Pyx_DECREF(__pyx_v_self->__pyx___storage); - __pyx_v_self->__pyx___storage = Py_None; - - /* "dependency_injector/providers/singletons.pyx":303 - * super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":310 - * self.__storage = None - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return single instance.""" - * with self.__lock: - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_5_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/singletons.pyx":312 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return single instance.""" - * with self.__lock: # <<<<<<<<<<<<<< - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, - */ - /*with:*/ { - __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx___lock, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_v_self->__pyx___lock, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L3_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - /*try:*/ { - - /* "dependency_injector/providers/singletons.pyx":313 - * """Return single instance.""" - * with self.__lock: - * if self.__storage is None: # <<<<<<<<<<<<<< - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) - */ - __pyx_t_11 = (__pyx_v_self->__pyx___storage == Py_None); - __pyx_t_12 = (__pyx_t_11 != 0); - if (__pyx_t_12) { - - /* "dependency_injector/providers/singletons.pyx":314 - * with self.__lock: - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< - * args, kwargs) - * return self.__storage - */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator); - __Pyx_INCREF(__pyx_t_1); - - /* "dependency_injector/providers/singletons.pyx":315 - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) # <<<<<<<<<<<<<< - * return self.__storage - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_9factories___factory_call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L7_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":314 - * with self.__lock: - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, # <<<<<<<<<<<<<< - * args, kwargs) - * return self.__storage - */ - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->__pyx___storage); - __Pyx_DECREF(__pyx_v_self->__pyx___storage); - __pyx_v_self->__pyx___storage = __pyx_t_2; - __pyx_t_2 = 0; - - /* "dependency_injector/providers/singletons.pyx":313 - * """Return single instance.""" - * with self.__lock: - * if self.__storage is None: # <<<<<<<<<<<<<< - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) - */ - } - - /* "dependency_injector/providers/singletons.pyx":312 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return single instance.""" - * with self.__lock: # <<<<<<<<<<<<<< - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, - */ - } - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L14_try_end; - __pyx_L7_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - /*except:*/ { - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(0, 312, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 312, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 312, __pyx_L9_except_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_13); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (__pyx_t_12 < 0) __PYX_ERR(0, 312, __pyx_L9_except_error) - __pyx_t_11 = ((!(__pyx_t_12 != 0)) != 0); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_3); - __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; - __PYX_ERR(0, 312, __pyx_L9_except_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_exception_handled; - } - __pyx_L9_except_error:; - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); - goto __pyx_L1_error; - __pyx_L8_exception_handled:; - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); - __pyx_L14_try_end:; - } - } - /*finally:*/ { - /*normal exit:*/{ - if (__pyx_t_7) { - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple_, NULL); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - goto __pyx_L6; - } - __pyx_L6:; - } - goto __pyx_L19; - __pyx_L3_error:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L1_error; - __pyx_L19:; - } - - /* "dependency_injector/providers/singletons.pyx":316 - * self.__storage = __factory_call(self.__instantiator, - * args, kwargs) - * return self.__storage # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___storage); - __pyx_r = __pyx_v_self->__pyx___storage; - goto __pyx_L0; - - /* "dependency_injector/providers/singletons.pyx":310 - * self.__storage = None - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return single instance.""" - * with self.__lock: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_4_provide[] = "Return single instance."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 310, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 310, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 310, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 310, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 310, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_4_provide(((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadSafeSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":358 - * """ - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - -/* Python wrapper */ -static int __pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__[] = "Initializer.\n\n :param provides: Provided type.\n :type provides: type\n\n :param args: Tuple of positional argument injections.\n :type args: tuple[object]\n\n :param kwargs: Dictionary of context keyword argument injections.\n :type kwargs: dict[str, object]\n "; -#if CYTHON_COMPILING_IN_CPYTHON -struct wrapperbase __pyx_wrapperbase_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__; -#endif -static int __pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provides = 0; - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - int __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; - __Pyx_GOTREF(__pyx_v_kwargs); - if (PyTuple_GET_SIZE(__pyx_args) > 1) { - __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); - if (unlikely(!__pyx_v_args)) { - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_RefNannyFinishContext(); - return -1; - } - __Pyx_GOTREF(__pyx_v_args); - } else { - __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); - } - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provides,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - default: - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 358, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - } - __pyx_v_provides = values[0]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 358, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0; - __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadLocalSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return -1; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__(((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *)__pyx_v_self), __pyx_v_provides, __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - __Pyx_XDECREF(__pyx_v_args); - __Pyx_XDECREF(__pyx_v_kwargs); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static int __pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_provides, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - int __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "dependency_injector/providers/singletons.pyx":370 - * :type kwargs: dict[str, object] - * """ - * self.__storage = threading.local() # <<<<<<<<<<<<<< - * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_local); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_v_self->__pyx___storage); - __Pyx_DECREF(__pyx_v_self->__pyx___storage); - __pyx_v_self->__pyx___storage = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":371 - * """ - * self.__storage = threading.local() - * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) # <<<<<<<<<<<<<< - * - * def reset(self): - */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadLocalSingleton)); - __Pyx_GIVEREF(((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadLocalSingleton)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_ThreadLocalSingleton)); - __Pyx_INCREF(((PyObject *)__pyx_v_self)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_provides); - __Pyx_GIVEREF(__pyx_v_provides); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_provides); - __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_v_kwargs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/singletons.pyx":358 - * """ - * - * def __init__(self, provides, *args, **kwargs): # <<<<<<<<<<<<<< - * """Initializer. - * - */ - - /* function exit code */ - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadLocalSingleton.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":373 - * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_2reset[] = "Reset cached instance, if any.\n\n :rtype: None\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_3reset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_2reset(((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_2reset(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("reset", 0); - - /* "dependency_injector/providers/singletons.pyx":378 - * :rtype: None - * """ - * self.__storage.instance = None # <<<<<<<<<<<<<< - * - * cpdef object _provide(self, tuple args, dict kwargs): - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance, Py_None) < 0) __PYX_ERR(0, 378, __pyx_L1_error) - - /* "dependency_injector/providers/singletons.pyx":373 - * super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) - * - * def reset(self): # <<<<<<<<<<<<<< - * """Reset cached instance, if any. - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadLocalSingleton.reset", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/singletons.pyx":380 - * self.__storage.instance = None - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return single instance.""" - * cdef object instance - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton__provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, int __pyx_skip_dispatch) { - PyObject *__pyx_v_instance = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - /* Check if called by wrapper */ - if (unlikely(__pyx_skip_dispatch)) ; - /* Check if overridden in Python */ - else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_provide); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_5_provide)) { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_5 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_args, __pyx_v_kwargs}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_args); - __Pyx_GIVEREF(__pyx_v_args); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_args); - __Pyx_INCREF(__pyx_v_kwargs); - __Pyx_GIVEREF(__pyx_v_kwargs); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_kwargs); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "dependency_injector/providers/singletons.pyx":384 - * cdef object instance - * - * try: # <<<<<<<<<<<<<< - * instance = self.__storage.instance - * except AttributeError: - */ - /*try:*/ { - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - /*try:*/ { - - /* "dependency_injector/providers/singletons.pyx":385 - * - * try: - * instance = self.__storage.instance # <<<<<<<<<<<<<< - * except AttributeError: - * instance = __factory_call(self.__instantiator, args, kwargs) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 385, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_instance = __pyx_t_1; - __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":384 - * cdef object instance - * - * try: # <<<<<<<<<<<<<< - * instance = self.__storage.instance - * except AttributeError: - */ - } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L13_try_end; - __pyx_L6_error:; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/singletons.pyx":386 - * try: - * instance = self.__storage.instance - * except AttributeError: # <<<<<<<<<<<<<< - * instance = __factory_call(self.__instantiator, args, kwargs) - * self.__storage.instance = instance - */ - __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError); - if (__pyx_t_5) { - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 386, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_3); - - /* "dependency_injector/providers/singletons.pyx":387 - * instance = self.__storage.instance - * except AttributeError: - * instance = __factory_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<< - * self.__storage.instance = instance - * finally: - */ - __pyx_t_6 = ((PyObject *)__pyx_v_self->__pyx_base.__pyx___instantiator); - __Pyx_INCREF(__pyx_t_6); - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_9factories___factory_call(((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)__pyx_t_6), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_instance, __pyx_t_4); - __pyx_t_4 = 0; - - /* "dependency_injector/providers/singletons.pyx":388 - * except AttributeError: - * instance = __factory_call(self.__instantiator, args, kwargs) - * self.__storage.instance = instance # <<<<<<<<<<<<<< - * finally: - * return instance - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self->__pyx___storage, __pyx_n_s_instance, __pyx_v_instance) < 0) __PYX_ERR(0, 388, __pyx_L8_except_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L7_exception_handled; - } - goto __pyx_L8_except_error; - __pyx_L8_except_error:; - - /* "dependency_injector/providers/singletons.pyx":384 - * cdef object instance - * - * try: # <<<<<<<<<<<<<< - * instance = self.__storage.instance - * except AttributeError: - */ - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - goto __pyx_L4_error; - __pyx_L7_exception_handled:; - __Pyx_PyThreadState_assign - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); - __pyx_L13_try_end:; - } - } - - /* "dependency_injector/providers/singletons.pyx":390 - * self.__storage.instance = instance - * finally: - * return instance # <<<<<<<<<<<<<< - * - * - */ - /*finally:*/ { - /*normal exit:*/{ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_instance); - __pyx_r = __pyx_v_instance; - goto __pyx_L0; - } - /*exception exit:*/{ - __Pyx_PyThreadState_declare - __pyx_L4_error:; - __pyx_t_9 = 0; __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - __Pyx_PyThreadState_assign - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); - if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_11); - __Pyx_XGOTREF(__pyx_t_12); - { - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_instance)) { __Pyx_RaiseUnboundLocalError("instance"); __PYX_ERR(0, 390, __pyx_L17_error) } - __Pyx_INCREF(__pyx_v_instance); - __pyx_r = __pyx_v_instance; - goto __pyx_L16_return; - } - __pyx_L16_return:; - __Pyx_PyThreadState_assign - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - goto __pyx_L0; - __pyx_L17_error:; - __Pyx_PyThreadState_assign - if (PY_MAJOR_VERSION >= 3) { - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_XGIVEREF(__pyx_t_11); - __Pyx_XGIVEREF(__pyx_t_12); - __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12); - } - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; - goto __pyx_L1_error; - } - } - - /* "dependency_injector/providers/singletons.pyx":380 - * self.__storage.instance = None - * - * cpdef object _provide(self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * """Return single instance.""" - * cdef object instance - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_instance); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_4_provide[] = "Return single instance."; -static PyObject *__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_5_provide(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_args = 0; - PyObject *__pyx_v_kwargs = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_provide (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_kwargs,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, 1); __PYX_ERR(0, 380, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_provide") < 0)) __PYX_ERR(0, 380, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_args = ((PyObject*)values[0]); - __pyx_v_kwargs = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_provide", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 380, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_args), (&PyTuple_Type), 1, "args", 1))) __PYX_ERR(0, 380, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kwargs), (&PyDict_Type), 1, "kwargs", 1))) __PYX_ERR(0, 380, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_4_provide(((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_4_provide(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("_provide", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton__provide(__pyx_v_self, __pyx_v_args, __pyx_v_kwargs, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.singletons.ThreadLocalSingleton._provide", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_name(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get_name", 0); - - /* "injections.pxd":25 - * - * cdef inline object __get_name(NamedInjection self): - * return self.__name # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___name); - __pyx_r = __pyx_v_self->__pyx___name; - goto __pyx_L0; - - /* "injections.pxd":24 - * - * - * cdef inline object __get_name(NamedInjection self): # <<<<<<<<<<<<<< - * return self.__name - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___get_value(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("__get_value", 0); - - /* "injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - __pyx_t_1 = ((__pyx_v_self->__pyx___call == 0) != 0); - if (__pyx_t_1) { - - /* "injections.pxd":30 - * cdef inline object __get_value(Injection self): - * if self.__call == 0: - * return self.__value # <<<<<<<<<<<<<< - * return self.__value() - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_r = __pyx_v_self->__pyx___value; - goto __pyx_L0; - - /* "injections.pxd":29 - * - * cdef inline object __get_value(Injection self): - * if self.__call == 0: # <<<<<<<<<<<<<< - * return self.__value - * return self.__value() - */ - } - - /* "injections.pxd":31 - * if self.__call == 0: - * return self.__value - * return self.__value() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self->__pyx___value); - __pyx_t_3 = __pyx_v_self->__pyx___value; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "injections.pxd":28 - * - * - * cdef inline object __get_value(Injection self): # <<<<<<<<<<<<<< - * if self.__call == 0: - * return self.__value - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(PyObject *__pyx_v_args, PyObject *__pyx_v_inj_args, int __pyx_v_inj_args_len) { - int __pyx_v_index; - PyObject *__pyx_v_positional_args = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *__pyx_v_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__provide_positional_args", 0); - - /* "injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - __pyx_t_1 = ((__pyx_v_inj_args_len == 0) != 0); - if (__pyx_t_1) { - - /* "injections.pxd":44 - * - * if inj_args_len == 0: - * return args # <<<<<<<<<<<<<< - * - * positional_args = list() - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_args); - __pyx_r = __pyx_v_args; - goto __pyx_L0; - - /* "injections.pxd":43 - * cdef PositionalInjection injection - * - * if inj_args_len == 0: # <<<<<<<<<<<<<< - * return args - * - */ - } - - /* "injections.pxd":46 - * return args - * - * positional_args = list() # <<<<<<<<<<<<<< - * for index in range(inj_args_len): - * injection = inj_args[index] - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_positional_args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "injections.pxd":47 - * - * positional_args = list() - * for index in range(inj_args_len): # <<<<<<<<<<<<<< - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - */ - __pyx_t_3 = __pyx_v_inj_args_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":48 - * positional_args = list() - * for index in range(inj_args_len): - * injection = inj_args[index] # <<<<<<<<<<<<<< - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) - */ - if (unlikely(__pyx_v_inj_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 48, __pyx_L1_error) - } - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_v_inj_args, __pyx_v_index); - __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection *)__pyx_t_2)); - __pyx_t_2 = 0; - - /* "injections.pxd":49 - * for index in range(inj_args_len): - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) # <<<<<<<<<<<<<< - * positional_args.extend(args) - * - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_injection)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_positional_args, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "injections.pxd":50 - * injection = inj_args[index] - * positional_args.append(__get_value(injection)) - * positional_args.extend(args) # <<<<<<<<<<<<<< - * - * return tuple(positional_args) - */ - __pyx_t_5 = __Pyx_PyList_Extend(__pyx_v_positional_args, __pyx_v_args); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 50, __pyx_L1_error) - - /* "injections.pxd":52 - * positional_args.extend(args) - * - * return tuple(positional_args) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_AsTuple(__pyx_v_positional_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "injections.pxd":36 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline tuple __provide_positional_args(tuple args, # <<<<<<<<<<<<<< - * tuple inj_args, - * int inj_args_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_positional_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_positional_args); - __Pyx_XDECREF((PyObject *)__pyx_v_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(PyObject *__pyx_v_kwargs, PyObject *__pyx_v_inj_kwargs, int __pyx_v_inj_kwargs_len) { - int __pyx_v_index; - PyObject *__pyx_v_name = 0; - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_kw_injection = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("__provide_keyword_args", 0); - - /* "injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(1, 64, __pyx_L1_error) - } - __pyx_t_1 = PyDict_Size(__pyx_v_kwargs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(1, 64, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_1 == 0) != 0); - if (__pyx_t_2) { - - /* "injections.pxd":65 - * - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":66 - * if len(kwargs) == 0: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 66, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "injections.pxd":67 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * else: - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "injections.pxd":68 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * else: - * for index in range(inj_kwargs_len): - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 68, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 68, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - - /* "injections.pxd":64 - * cdef NamedInjection kw_injection - * - * if len(kwargs) == 0: # <<<<<<<<<<<<<< - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - */ - goto __pyx_L3; - } - - /* "injections.pxd":70 - * kwargs[name] = __get_value(kw_injection) - * else: - * for index in range(inj_kwargs_len): # <<<<<<<<<<<<<< - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - */ - /*else*/ { - __pyx_t_3 = __pyx_v_inj_kwargs_len; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_index = __pyx_t_4; - - /* "injections.pxd":71 - * else: - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] # <<<<<<<<<<<<<< - * name = __get_name(kw_injection) - * if name not in kwargs: - */ - if (unlikely(__pyx_v_inj_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 71, __pyx_L1_error) - } - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_v_inj_kwargs, __pyx_v_index); - __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_kw_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_5)); - __pyx_t_5 = 0; - - /* "injections.pxd":72 - * for index in range(inj_kwargs_len): - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) # <<<<<<<<<<<<<< - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_kw_injection); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_5); - __pyx_t_5 = 0; - - /* "injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 73, __pyx_L1_error) - } - __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_kwargs, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 73, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_2 != 0); - if (__pyx_t_6) { - - /* "injections.pxd":74 - * name = __get_name(kw_injection) - * if name not in kwargs: - * kwargs[name] = __get_value(kw_injection) # <<<<<<<<<<<<<< - * - * return kwargs - */ - __pyx_t_5 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_kw_injection)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__pyx_v_kwargs == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 74, __pyx_L1_error) - } - if (unlikely(PyDict_SetItem(__pyx_v_kwargs, __pyx_v_name, __pyx_t_5) < 0)) __PYX_ERR(1, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "injections.pxd":73 - * kw_injection = inj_kwargs[index] - * name = __get_name(kw_injection) - * if name not in kwargs: # <<<<<<<<<<<<<< - * kwargs[name] = __get_value(kw_injection) - * - */ - } - } - } - __pyx_L3:; - - /* "injections.pxd":76 - * kwargs[name] = __get_value(kw_injection) - * - * return kwargs # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_kwargs); - __pyx_r = __pyx_v_kwargs; - goto __pyx_L0; - - /* "injections.pxd":57 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline dict __provide_keyword_args(dict kwargs, # <<<<<<<<<<<<<< - * tuple inj_kwargs, - * int inj_kwargs_len): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.injections.__provide_keyword_args", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF((PyObject *)__pyx_v_kw_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_10injections___inject_attributes(PyObject *__pyx_v_instance, PyObject *__pyx_v_attributes, int __pyx_v_attributes_len) { - struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *__pyx_v_attr_injection = 0; - int __pyx_v_index; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__inject_attributes", 0); - - /* "injections.pxd":85 - * int attributes_len): - * cdef NamedInjection attr_injection - * for index in range(attributes_len): # <<<<<<<<<<<<<< - * attr_injection = attributes[index] - * setattr(instance, - */ - __pyx_t_1 = __pyx_v_attributes_len; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_index = __pyx_t_2; - - /* "injections.pxd":86 - * cdef NamedInjection attr_injection - * for index in range(attributes_len): - * attr_injection = attributes[index] # <<<<<<<<<<<<<< - * setattr(instance, - * __get_name(attr_injection), - */ - if (unlikely(__pyx_v_attributes == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 86, __pyx_L1_error) - } - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_v_attributes, __pyx_v_index); - __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_attr_injection, ((struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection *)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "injections.pxd":88 - * attr_injection = attributes[index] - * setattr(instance, - * __get_name(attr_injection), # <<<<<<<<<<<<<< - * __get_value(attr_injection)) - * - */ - __pyx_t_3 = __pyx_f_19dependency_injector_9providers_10injections___get_name(__pyx_v_attr_injection); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "injections.pxd":89 - * setattr(instance, - * __get_name(attr_injection), - * __get_value(attr_injection)) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_4 = __pyx_f_19dependency_injector_9providers_10injections___get_value(((struct __pyx_obj_19dependency_injector_9providers_10injections_Injection *)__pyx_v_attr_injection)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "injections.pxd":87 - * for index in range(attributes_len): - * attr_injection = attributes[index] - * setattr(instance, # <<<<<<<<<<<<<< - * __get_name(attr_injection), - * __get_value(attr_injection)) - */ - __pyx_t_5 = PyObject_SetAttr(__pyx_v_instance, __pyx_t_3, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(1, 87, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - - /* "injections.pxd":81 - * @cython.boundscheck(False) - * @cython.wraparound(False) - * cdef inline object __inject_attributes(object instance, # <<<<<<<<<<<<<< - * tuple attributes, - * int attributes_len): - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("dependency_injector.providers.injections.__inject_attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF((PyObject *)__pyx_v_attr_injection); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9callables___callable_call(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_v_positional_args = 0; - PyObject *__pyx_v_keyword_args = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("__callable_call", 0); - - /* "callables.pxd":37 - * - * positional_args = __provide_positional_args(args, - * self.__args, # <<<<<<<<<<<<<< - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, - */ - __pyx_t_1 = __pyx_v_self->__pyx___args; - __Pyx_INCREF(__pyx_t_1); - - /* "callables.pxd":36 - * cdef dict keyword_args - * - * positional_args = __provide_positional_args(args, # <<<<<<<<<<<<<< - * self.__args, - * self.__args_len) - */ - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_10injections___provide_positional_args(__pyx_v_args, ((PyObject*)__pyx_t_1), __pyx_v_self->__pyx___args_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_positional_args = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "callables.pxd":40 - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, - * self.__kwargs, # <<<<<<<<<<<<<< - * self.__kwargs_len) - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___kwargs; - __Pyx_INCREF(__pyx_t_2); - - /* "callables.pxd":39 - * self.__args, - * self.__args_len) - * keyword_args = __provide_keyword_args(kwargs, # <<<<<<<<<<<<<< - * self.__kwargs, - * self.__kwargs_len) - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___provide_keyword_args(__pyx_v_kwargs, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___kwargs_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_keyword_args = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "callables.pxd":43 - * self.__kwargs_len) - * - * return self.__provides(*positional_args, **keyword_args) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - if (unlikely(__pyx_v_positional_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(2, 43, __pyx_L1_error) - } - if (unlikely(__pyx_v_keyword_args == Py_None)) { - PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); - __PYX_ERR(2, 43, __pyx_L1_error) - } - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_self->__pyx___provides, __pyx_v_positional_args, __pyx_v_keyword_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "callables.pxd":32 - * - * - * cdef inline object __callable_call(Callable self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef tuple positional_args - * cdef dict keyword_args - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.callables.__callable_call", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_positional_args); - __Pyx_XDECREF(__pyx_v_keyword_args); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "factories.pxd":27 - * - * - * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef object instance - * - */ - -static CYTHON_INLINE PyObject *__pyx_f_19dependency_injector_9providers_9factories___factory_call(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) { - PyObject *__pyx_v_instance = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - __Pyx_RefNannySetupContext("__factory_call", 0); - - /* "factories.pxd":30 - * cdef object instance - * - * instance = __callable_call(self.__instantiator, args, kwargs) # <<<<<<<<<<<<<< - * - * if self.__attributes_len > 0: - */ - __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx___instantiator); - __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = __pyx_f_19dependency_injector_9providers_9callables___callable_call(((struct __pyx_obj_19dependency_injector_9providers_9callables_Callable *)__pyx_t_1), __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_instance = __pyx_t_2; - __pyx_t_2 = 0; - - /* "factories.pxd":32 - * instance = __callable_call(self.__instantiator, args, kwargs) - * - * if self.__attributes_len > 0: # <<<<<<<<<<<<<< - * __inject_attributes(instance, - * self.__attributes, - */ - __pyx_t_3 = ((__pyx_v_self->__pyx___attributes_len > 0) != 0); - if (__pyx_t_3) { - - /* "factories.pxd":34 - * if self.__attributes_len > 0: - * __inject_attributes(instance, - * self.__attributes, # <<<<<<<<<<<<<< - * self.__attributes_len) - * - */ - __pyx_t_2 = __pyx_v_self->__pyx___attributes; - __Pyx_INCREF(__pyx_t_2); - - /* "factories.pxd":33 - * - * if self.__attributes_len > 0: - * __inject_attributes(instance, # <<<<<<<<<<<<<< - * self.__attributes, - * self.__attributes_len) - */ - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_10injections___inject_attributes(__pyx_v_instance, ((PyObject*)__pyx_t_2), __pyx_v_self->__pyx___attributes_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "factories.pxd":32 - * instance = __callable_call(self.__instantiator, args, kwargs) - * - * if self.__attributes_len > 0: # <<<<<<<<<<<<<< - * __inject_attributes(instance, - * self.__attributes, - */ - } - - /* "factories.pxd":37 - * self.__attributes_len) - * - * return instance # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_instance); - __pyx_r = __pyx_v_instance; - goto __pyx_L0; - - /* "factories.pxd":27 - * - * - * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef object instance - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("dependency_injector.providers.factories.__factory_call", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_instance); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_BaseSingleton __pyx_vtable_19dependency_injector_9providers_10singletons_BaseSingleton; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_BaseSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *p; - PyObject *o = __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_new(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_10singletons_BaseSingleton; - p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)Py_None); Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_BaseSingleton(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___instantiator); - PyObject_GC_Track(o); - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_BaseSingleton); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_10singletons_BaseSingleton(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)o; - e = ((likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) ? ((__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse) ? __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_19dependency_injector_9providers_10singletons_BaseSingleton)); if (e) return e; - if (p->__pyx___instantiator) { - e = (*v)(((PyObject*)p->__pyx___instantiator), a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_10singletons_BaseSingleton(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton *)o; - if (likely(__pyx_ptype_19dependency_injector_9providers_4base_Provider)) { if (__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear) __pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_19dependency_injector_9providers_10singletons_BaseSingleton); - tmp = ((PyObject*)p->__pyx___instantiator); - p->__pyx___instantiator = ((struct __pyx_obj_19dependency_injector_9providers_9factories_Factory *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_cls(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3cls_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_args(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_4args_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_kwargs(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_6kwargs_1__get__(o); -} - -static PyObject *__pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_attributes(PyObject *o, CYTHON_UNUSED void *x) { - return __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_10attributes_1__get__(o); -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_10singletons_BaseSingleton[] = { - {"__deepcopy__", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_5__deepcopy__, METH_O, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_4__deepcopy__}, - {"add_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_7add_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_6add_args}, - {"set_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_9set_args, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_8set_args}, - {"clear_args", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_11clear_args, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_10clear_args}, - {"add_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_13add_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_12add_kwargs}, - {"set_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_15set_kwargs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_14set_kwargs}, - {"clear_kwargs", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_17clear_kwargs, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_16clear_kwargs}, - {"add_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_19add_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_18add_attributes}, - {"set_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_21set_attributes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_20set_attributes}, - {"clear_attributes", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_23clear_attributes, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_22clear_attributes}, - {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_25reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_24reset}, - {0, 0, 0, 0} -}; - -static struct PyGetSetDef __pyx_getsets_19dependency_injector_9providers_10singletons_BaseSingleton[] = { - {(char *)"cls", __pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_cls, 0, (char *)"Return provided type.", 0}, - {(char *)"args", __pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_args, 0, (char *)"Return positional argument injections.", 0}, - {(char *)"kwargs", __pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_kwargs, 0, (char *)"Return keyword argument injections.", 0}, - {(char *)"attributes", __pyx_getprop_19dependency_injector_9providers_10singletons_13BaseSingleton_attributes, 0, (char *)"Return attribute injections.", 0}, - {0, 0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.singletons.BaseSingleton", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10singletons_BaseSingleton), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_BaseSingleton, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Base class of singleton providers.", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10singletons_BaseSingleton, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10singletons_BaseSingleton, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_10singletons_BaseSingleton, /*tp_methods*/ - 0, /*tp_members*/ - __pyx_getsets_19dependency_injector_9providers_10singletons_BaseSingleton, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10singletons_BaseSingleton, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_Singleton __pyx_vtable_19dependency_injector_9providers_10singletons_Singleton; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_Singleton(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10singletons_BaseSingleton(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_10singletons_Singleton; - p->__pyx___storage = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_Singleton(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___storage); - PyObject_GC_Track(o); - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_BaseSingleton(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_10singletons_Singleton(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *)o; - e = __pyx_tp_traverse_19dependency_injector_9providers_10singletons_BaseSingleton(o, v, a); if (e) return e; - if (p->__pyx___storage) { - e = (*v)(p->__pyx___storage, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_10singletons_Singleton(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton *)o; - __pyx_tp_clear_19dependency_injector_9providers_10singletons_BaseSingleton(o); - tmp = ((PyObject*)p->__pyx___storage); - p->__pyx___storage = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_10singletons_Singleton[] = { - {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_3reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10singletons_9Singleton_2reset}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_5_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_9Singleton_4_provide}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10singletons_Singleton = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.singletons.Singleton", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10singletons_Singleton), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_Singleton, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Singleton provider returns same instance on every call.\n\n :py:class:`Singleton` provider creates instance once and returns it on\n every call. :py:class:`Singleton` extends :py:class:`Factory`, so, please\n follow :py:class:`Factory` documentation for getting familiar with\n injections syntax.\n\n Retrieving of provided instance can be performed via calling\n :py:class:`Singleton` object:\n\n .. code-block:: python\n\n singleton = Singleton(SomeClass)\n some_object = singleton()\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10singletons_Singleton, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10singletons_Singleton, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_10singletons_Singleton, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10singletons_Singleton, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedSingleton __pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedSingleton; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedSingleton *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10singletons_Singleton(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedSingleton *)o); - p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedSingleton; - return o; -} - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10singletons_DelegatedSingleton = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.singletons.DelegatedSingleton", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedSingleton), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_Singleton, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Delegated singleton is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10singletons_Singleton, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10singletons_Singleton, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_9Singleton_1__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedSingleton, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadSafeSingleton __pyx_vtable_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10singletons_BaseSingleton(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; - p->__pyx___storage = Py_None; Py_INCREF(Py_None); - p->__pyx___lock = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_ThreadSafeSingleton(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___storage); - Py_CLEAR(p->__pyx___lock); - PyObject_GC_Track(o); - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_BaseSingleton(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_10singletons_ThreadSafeSingleton(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *)o; - e = __pyx_tp_traverse_19dependency_injector_9providers_10singletons_BaseSingleton(o, v, a); if (e) return e; - if (p->__pyx___storage) { - e = (*v)(p->__pyx___storage, a); if (e) return e; - } - if (p->__pyx___lock) { - e = (*v)(p->__pyx___lock, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_10singletons_ThreadSafeSingleton(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton *)o; - __pyx_tp_clear_19dependency_injector_9providers_10singletons_BaseSingleton(o); - tmp = ((PyObject*)p->__pyx___storage); - p->__pyx___storage = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx___lock); - p->__pyx___lock = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_10singletons_ThreadSafeSingleton[] = { - {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_3reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_2reset}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_5_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_4_provide}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.singletons.ThreadSafeSingleton", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadSafeSingleton), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Thread-safe singleton provider.", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton __pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadSafeSingleton(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton *)o); - p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton; - return o; -} - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.singletons.DelegatedThreadSafeSingleton", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Delegated thread-safe singleton is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton_1__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_ThreadLocalSingleton __pyx_vtable_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10singletons_BaseSingleton(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; - p->__pyx___storage = Py_None; Py_INCREF(Py_None); - return o; -} - -static void __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_ThreadLocalSingleton(PyObject *o) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *)o; - #if PY_VERSION_HEX >= 0x030400a1 - if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - #endif - PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx___storage); - PyObject_GC_Track(o); - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_BaseSingleton(o); -} - -static int __pyx_tp_traverse_19dependency_injector_9providers_10singletons_ThreadLocalSingleton(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *)o; - e = __pyx_tp_traverse_19dependency_injector_9providers_10singletons_BaseSingleton(o, v, a); if (e) return e; - if (p->__pyx___storage) { - e = (*v)(p->__pyx___storage, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_19dependency_injector_9providers_10singletons_ThreadLocalSingleton(PyObject *o) { - PyObject* tmp; - struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *p = (struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton *)o; - __pyx_tp_clear_19dependency_injector_9providers_10singletons_BaseSingleton(o); - tmp = ((PyObject*)p->__pyx___storage); - p->__pyx___storage = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_19dependency_injector_9providers_10singletons_ThreadLocalSingleton[] = { - {"reset", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_3reset, METH_NOARGS, __pyx_doc_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_2reset}, - {"_provide", (PyCFunction)__pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_5_provide, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_4_provide}, - {0, 0, 0, 0} -}; - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.singletons.ThreadLocalSingleton", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10singletons_ThreadLocalSingleton), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Thread-local singleton provides single objects in scope of thread.\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; -static struct __pyx_vtabstruct_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton __pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton; - -static PyObject *__pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton *p; - PyObject *o = __pyx_tp_new_19dependency_injector_9providers_10singletons_ThreadLocalSingleton(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton *)o); - p->__pyx_base.__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton; - return o; -} - -static PyTypeObject __pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton = { - PyVarObject_HEAD_INIT(0, 0) - "dependency_injector.providers.singletons.DelegatedThreadLocalSingleton", /*tp_name*/ - sizeof(struct __pyx_obj_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_13BaseSingleton_3__str__, /*tp_str*/ - #else - 0, /*tp_str*/ - #endif - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Delegated thread-local singleton is injected \"as is\".\n\n .. py:attribute:: provided_type\n\n If provided type is defined, provider checks that providing class is\n its subclass.\n\n :type: type | None\n\n .. py:attribute:: cls\n\n Class that provides object.\n Alias for :py:attr:`provides`.\n\n :type: type\n ", /*tp_doc*/ - __pyx_tp_traverse_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_traverse*/ - __pyx_tp_clear_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton_1__init__, /*tp_init*/ - #else - 0, /*tp_init*/ - #endif - 0, /*tp_alloc*/ - __pyx_tp_new_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - 0, /*tp_finalize*/ - #endif -}; - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "singletons", - __pyx_k_Dependency_injector_singleton_pr, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_0_can_provide_only_1_instances, __pyx_k_0_can_provide_only_1_instances, sizeof(__pyx_k_0_can_provide_only_1_instances), 0, 0, 1, 0}, - {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1}, - {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, - {&__pyx_n_s_GLOBAL_LOCK, __pyx_k_GLOBAL_LOCK, sizeof(__pyx_k_GLOBAL_LOCK), 0, 0, 1, 1}, - {&__pyx_n_s_IS_DELEGATED, __pyx_k_IS_DELEGATED, sizeof(__pyx_k_IS_DELEGATED), 0, 0, 1, 1}, - {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, - {&__pyx_n_s_RLock, __pyx_k_RLock, sizeof(__pyx_k_RLock), 0, 0, 1, 1}, - {&__pyx_n_s_add_args, __pyx_k_add_args, sizeof(__pyx_k_add_args), 0, 0, 1, 1}, - {&__pyx_n_s_add_attributes, __pyx_k_add_attributes, sizeof(__pyx_k_add_attributes), 0, 0, 1, 1}, - {&__pyx_n_s_add_kwargs, __pyx_k_add_kwargs, sizeof(__pyx_k_add_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, - {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_clear_args, __pyx_k_clear_args, sizeof(__pyx_k_clear_args), 0, 0, 1, 1}, - {&__pyx_n_s_clear_attributes, __pyx_k_clear_attributes, sizeof(__pyx_k_clear_attributes), 0, 0, 1, 1}, - {&__pyx_n_s_clear_kwargs, __pyx_k_clear_kwargs, sizeof(__pyx_k_clear_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, - {&__pyx_n_s_dependency_injector_errors, __pyx_k_dependency_injector_errors, sizeof(__pyx_k_dependency_injector_errors), 0, 0, 1, 1}, - {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, - {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_instance, __pyx_k_instance, sizeof(__pyx_k_instance), 0, 0, 1, 1}, - {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_local, __pyx_k_local, sizeof(__pyx_k_local), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_overridden, __pyx_k_overridden, sizeof(__pyx_k_overridden), 0, 0, 1, 1}, - {&__pyx_n_s_override, __pyx_k_override, sizeof(__pyx_k_override), 0, 0, 1, 1}, - {&__pyx_n_s_provide, __pyx_k_provide, sizeof(__pyx_k_provide), 0, 0, 1, 1}, - {&__pyx_n_s_provided_type, __pyx_k_provided_type, sizeof(__pyx_k_provided_type), 0, 0, 1, 1}, - {&__pyx_n_s_provides, __pyx_k_provides, sizeof(__pyx_k_provides), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_set_args, __pyx_k_set_args, sizeof(__pyx_k_set_args), 0, 0, 1, 1}, - {&__pyx_n_s_set_attributes, __pyx_k_set_attributes, sizeof(__pyx_k_set_attributes), 0, 0, 1, 1}, - {&__pyx_n_s_set_kwargs, __pyx_k_set_kwargs, sizeof(__pyx_k_set_kwargs), 0, 0, 1, 1}, - {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 52, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 64, __pyx_L1_error) - __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 199, __pyx_L1_error) - __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 386, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(1, 47, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "dependency_injector/providers/singletons.pyx":312 - * cpdef object _provide(self, tuple args, dict kwargs): - * """Return single instance.""" - * with self.__lock: # <<<<<<<<<<<<<< - * if self.__storage is None: - * self.__storage = __factory_call(self.__instantiator, - */ - __pyx_tuple_ = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initsingletons(void); /*proto*/ -PyMODINIT_FUNC initsingletons(void) -#else -PyMODINIT_FUNC PyInit_singletons(void); /*proto*/ -PyMODINIT_FUNC PyInit_singletons(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_singletons(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("singletons", __pyx_methods, __pyx_k_Dependency_injector_singleton_pr, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_dependency_injector__providers__singletons) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "dependency_injector.providers.singletons")) { - if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers.singletons", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Provider = __Pyx_ImportType("dependency_injector.providers.base", "Provider", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Provider), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Provider = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Provider*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Provider->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Provider)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_10singletons_BaseSingleton = &__pyx_vtable_19dependency_injector_9providers_10singletons_BaseSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_BaseSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_4base_Provider; - __pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_4base_Provider; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 28, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton___init__.doc = __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton___init__; - } - } - #endif - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(0, 28, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__.doc = __pyx_doc_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_10singletons_13BaseSingleton_2__str__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_10singletons_BaseSingleton) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "BaseSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton = &__pyx_type_19dependency_injector_9providers_10singletons_BaseSingleton; - __pyx_vtabptr_19dependency_injector_9providers_10singletons_Singleton = &__pyx_vtable_19dependency_injector_9providers_10singletons_Singleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_Singleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_10singletons_BaseSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_Singleton.__pyx_base.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_10singletons_9Singleton__provide; - __pyx_type_19dependency_injector_9providers_10singletons_Singleton.tp_base = __pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10singletons_Singleton) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10singletons_Singleton.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_Singleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 202, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_9Singleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_9Singleton___init__.doc = __pyx_doc_19dependency_injector_9providers_10singletons_9Singleton___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_10singletons_9Singleton___init__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_10singletons_Singleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_10singletons_Singleton) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Singleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_Singleton) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10singletons_Singleton = &__pyx_type_19dependency_injector_9providers_10singletons_Singleton; - __pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedSingleton = &__pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_10singletons_Singleton; - __pyx_type_19dependency_injector_9providers_10singletons_DelegatedSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_10singletons_Singleton; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10singletons_DelegatedSingleton) < 0) __PYX_ERR(0, 263, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10singletons_DelegatedSingleton.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_10singletons_DelegatedSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedSingleton) < 0) __PYX_ERR(0, 263, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "DelegatedSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_DelegatedSingleton) < 0) __PYX_ERR(0, 263, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedSingleton = &__pyx_type_19dependency_injector_9providers_10singletons_DelegatedSingleton; - __pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadSafeSingleton = &__pyx_vtable_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_ThreadSafeSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_10singletons_BaseSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_ThreadSafeSingleton.__pyx_base.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton__provide; - __pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton) < 0) __PYX_ERR(0, 284, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 284, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__.doc = __pyx_doc_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_10singletons_19ThreadSafeSingleton___init__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadSafeSingleton) < 0) __PYX_ERR(0, 284, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "ThreadSafeSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton) < 0) __PYX_ERR(0, 284, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10singletons_ThreadSafeSingleton = &__pyx_type_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; - __pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton = &__pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; - __pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_10singletons_ThreadSafeSingleton; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton) < 0) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton) < 0) __PYX_ERR(0, 319, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "DelegatedThreadSafeSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton) < 0) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton = &__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton; - __pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadLocalSingleton = &__pyx_vtable_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_ThreadLocalSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_10singletons_BaseSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_ThreadLocalSingleton.__pyx_base.__pyx_base._provide = (PyObject *(*)(struct __pyx_obj_19dependency_injector_9providers_4base_Provider *, PyObject *, PyObject *, int __pyx_skip_dispatch))__pyx_f_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton__provide; - __pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton) < 0) __PYX_ERR(0, 340, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton.tp_print = 0; - #if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 340, __pyx_L1_error) - if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; - __pyx_wrapperbase_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__.doc = __pyx_doc_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__; - ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_19dependency_injector_9providers_10singletons_20ThreadLocalSingleton___init__; - } - } - #endif - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadLocalSingleton) < 0) __PYX_ERR(0, 340, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "ThreadLocalSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton) < 0) __PYX_ERR(0, 340, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10singletons_ThreadLocalSingleton = &__pyx_type_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; - __pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton = &__pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton; - __pyx_vtable_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton.__pyx_base = *__pyx_vtabptr_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; - __pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton.tp_base = __pyx_ptype_19dependency_injector_9providers_10singletons_ThreadLocalSingleton; - if (PyType_Ready(&__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton) < 0) __PYX_ERR(0, 393, __pyx_L1_error) - __pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton.tp_dict, __pyx_vtabptr_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton) < 0) __PYX_ERR(0, 393, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "DelegatedThreadLocalSingleton", (PyObject *)&__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton) < 0) __PYX_ERR(0, 393, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton = &__pyx_type_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton; - /*--- Type import code ---*/ - __pyx_ptype_19dependency_injector_9providers_4base_Object = __Pyx_ImportType("dependency_injector.providers.base", "Object", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Object), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Object)) __PYX_ERR(4, 15, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Object = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Object*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Object->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Object)) __PYX_ERR(4, 15, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_Delegate = __Pyx_ImportType("dependency_injector.providers.base", "Delegate", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_Delegate), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(4, 21, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_Delegate = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_Delegate*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_Delegate->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_Delegate)) __PYX_ERR(4, 21, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency = __Pyx_ImportType("dependency_injector.providers.base", "ExternalDependency", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_ExternalDependency), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(4, 25, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency = (struct __pyx_vtabstruct_19dependency_injector_9providers_4base_ExternalDependency*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_4base_ExternalDependency->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_4base_ExternalDependency)) __PYX_ERR(4, 25, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_4base_OverridingContext = __Pyx_ImportType("dependency_injector.providers.base", "OverridingContext", sizeof(struct __pyx_obj_19dependency_injector_9providers_4base_OverridingContext), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_4base_OverridingContext)) __PYX_ERR(4, 29, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_Injection = __Pyx_ImportType("dependency_injector.providers.injections", "Injection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_Injection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_Injection)) __PYX_ERR(1, 9, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection = __Pyx_ImportType("dependency_injector.providers.injections", "PositionalInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_PositionalInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_PositionalInjection)) __PYX_ERR(1, 16, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection = __Pyx_ImportType("dependency_injector.providers.injections", "NamedInjection", sizeof(struct __pyx_obj_19dependency_injector_9providers_10injections_NamedInjection), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_10injections_NamedInjection)) __PYX_ERR(1, 20, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9callables_Callable = __Pyx_ImportType("dependency_injector.providers.callables", "Callable", sizeof(struct __pyx_obj_19dependency_injector_9providers_9callables_Callable), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_9callables_Callable)) __PYX_ERR(2, 16, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9callables_Callable = (struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_Callable*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_9callables_Callable->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_9callables_Callable)) __PYX_ERR(2, 16, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable = __Pyx_ImportType("dependency_injector.providers.callables", "DelegatedCallable", sizeof(struct __pyx_obj_19dependency_injector_9providers_9callables_DelegatedCallable), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable)) __PYX_ERR(2, 28, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable = (struct __pyx_vtabstruct_19dependency_injector_9providers_9callables_DelegatedCallable*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_9callables_DelegatedCallable->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_9callables_DelegatedCallable)) __PYX_ERR(2, 28, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9factories_Factory = __Pyx_ImportType("dependency_injector.providers.factories", "Factory", sizeof(struct __pyx_obj_19dependency_injector_9providers_9factories_Factory), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_9factories_Factory)) __PYX_ERR(3, 14, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9factories_Factory = (struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_Factory*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_9factories_Factory->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_9factories_Factory)) __PYX_ERR(3, 14, __pyx_L1_error) - __pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory = __Pyx_ImportType("dependency_injector.providers.factories", "DelegatedFactory", sizeof(struct __pyx_obj_19dependency_injector_9providers_9factories_DelegatedFactory), 1); if (unlikely(!__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory)) __PYX_ERR(3, 23, __pyx_L1_error) - __pyx_vtabptr_19dependency_injector_9providers_9factories_DelegatedFactory = (struct __pyx_vtabstruct_19dependency_injector_9providers_9factories_DelegatedFactory*)__Pyx_GetVtable(__pyx_ptype_19dependency_injector_9providers_9factories_DelegatedFactory->tp_dict); if (unlikely(!__pyx_vtabptr_19dependency_injector_9providers_9factories_DelegatedFactory)) __PYX_ERR(3, 23, __pyx_L1_error) - /*--- Variable import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportVoidPtr(__pyx_t_1, "CLASS_TYPES", (void **)&__pyx_vp_19dependency_injector_9providers_5utils_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /*--- Function import code ---*/ - __pyx_t_2 = __Pyx_ImportModule("dependency_injector.providers.utils"); if (!__pyx_t_2) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "represent_provider", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_represent_provider, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ImportFunction(__pyx_t_2, "deepcopy", (void (**)(void))&__pyx_f_19dependency_injector_9providers_5utils_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "dependency_injector/providers/singletons.pyx":6 - * """ - * - * import threading # <<<<<<<<<<<<<< - * - * from dependency_injector.errors import Error - */ - __pyx_t_3 = __Pyx_Import(__pyx_n_s_threading, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_3) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/singletons.pyx":8 - * import threading - * - * from dependency_injector.errors import Error # <<<<<<<<<<<<<< - * - * from .base cimport Provider - */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_n_s_Error); - __Pyx_GIVEREF(__pyx_n_s_Error); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Error); - __pyx_t_4 = __Pyx_Import(__pyx_n_s_dependency_injector_errors, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_3) < 0) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "dependency_injector/providers/singletons.pyx":21 - * - * - * GLOBAL_LOCK = threading.RLock() # <<<<<<<<<<<<<< - * """Global reentrant lock. - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_RLock); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (__pyx_t_3) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_GLOBAL_LOCK, __pyx_t_4) < 0) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "dependency_injector/providers/singletons.pyx":31 - * """Base class of singleton providers.""" - * - * provided_type = None # <<<<<<<<<<<<<< - * - * def __init__(self, provides, *args, **kwargs): - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton->tp_dict, __pyx_n_s_provided_type, Py_None) < 0) __PYX_ERR(0, 31, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_10singletons_BaseSingleton); - - /* "dependency_injector/providers/singletons.pyx":281 - * """ - * - * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< - * - * - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedSingleton->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(0, 281, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedSingleton); - - /* "dependency_injector/providers/singletons.pyx":337 - * """ - * - * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< - * - * - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(0, 337, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadSafeSingleton); - - /* "dependency_injector/providers/singletons.pyx":411 - * """ - * - * __IS_DELEGATED__ = True # <<<<<<<<<<<<<< - */ - if (PyDict_SetItem((PyObject *)__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton->tp_dict, __pyx_n_s_IS_DELEGATED, Py_True) < 0) __PYX_ERR(0, 411, __pyx_L1_error) - PyType_Modified(__pyx_ptype_19dependency_injector_9providers_10singletons_DelegatedThreadLocalSingleton); - - /* "dependency_injector/providers/singletons.pyx":1 - * """Dependency injector singleton providers. # <<<<<<<<<<<<<< - * - * Powered by Cython. - */ - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "factories.pxd":27 - * - * - * cdef inline object __factory_call(Factory self, tuple args, dict kwargs): # <<<<<<<<<<<<<< - * cdef object instance - * - */ - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init dependency_injector.providers.singletons", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers.singletons"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* GetModuleGlobalName */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* KeywordStringCheck */ - static CYTHON_INLINE int __Pyx_CheckKeywordStrings( - PyObject *kwdict, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - while (PyDict_Next(kwdict, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if ((!kw_allowed) && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -/* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -#endif - -/* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { -#else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { -#endif - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(&local_type, &local_value, &local_tb); -#endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) -#endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); -#endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { - PyObject *exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - return PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* SwapException */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#else -static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); - PyErr_SetExcInfo(*type, *value, *tb); - *type = tmp_type; - *value = tmp_value; - *tb = tmp_tb; -} -#endif - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* CallNextTpDealloc */ - static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_dealloc != current_tp_dealloc) - type = type->tp_base; - while (type && type->tp_dealloc == current_tp_dealloc) - type = type->tp_base; - if (type) - type->tp_dealloc(obj); -} - -/* CallNextTpTraverse */ - static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_traverse != current_tp_traverse) - type = type->tp_base; - while (type && type->tp_traverse == current_tp_traverse) - type = type->tp_base; - if (type && type->tp_traverse) - return type->tp_traverse(obj, v, a); - return 0; -} - -/* CallNextTpClear */ - static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { - PyTypeObject* type = Py_TYPE(obj); - while (type && type->tp_clear != current_tp_clear) - type = type->tp_base; - while (type && type->tp_clear == current_tp_clear) - type = type->tp_base; - if (type && type->tp_clear) - type->tp_clear(obj); -} - -/* GetVTable */ - static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - -/* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - size_t size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - -/* VoidPtrImport */ - #ifndef __PYX_HAVE_RT_ImportVoidPtr -#define __PYX_HAVE_RT_ImportVoidPtr -static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, name); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C variable %.200s", - PyModule_GetName(module), name); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); - goto bad; - } - *p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), name, sig, desc); - goto bad; - } - *p = PyCObject_AsVoidPtr(cobj);} -#endif - if (!(*p)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* FunctionImport */ - #ifndef __PYX_HAVE_RT_ImportFunction -#define __PYX_HAVE_RT_ImportFunction -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); - if (!d) - goto bad; - cobj = PyDict_GetItemString(d, funcname); - if (!cobj) { - PyErr_Format(PyExc_ImportError, - "%.200s does not export expected C function %.200s", - PyModule_GetName(module), funcname); - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - if (!PyCapsule_IsValid(cobj, sig)) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); - goto bad; - } - tmp.p = PyCapsule_GetPointer(cobj, sig); -#else - {const char *desc, *s1, *s2; - desc = (const char *)PyCObject_GetDesc(cobj); - if (!desc) - goto bad; - s1 = desc; s2 = sig; - while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } - if (*s1 != *s2) { - PyErr_Format(PyExc_TypeError, - "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", - PyModule_GetName(module), funcname, sig, desc); - goto bad; - } - tmp.p = PyCObject_AsVoidPtr(cobj);} -#endif - *f = tmp.fp; - if (!(*f)) - goto bad; - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(d); - return -1; -} -#endif - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers/singletons.pxd b/src/dependency_injector/providers/singletons.pxd deleted file mode 100644 index 0c85d9c1..00000000 --- a/src/dependency_injector/providers/singletons.pxd +++ /dev/null @@ -1,42 +0,0 @@ -"""Dependency injector singleton providers. - -Powered by Cython. -""" - -from .base cimport Provider -from .factories cimport Factory - - -cdef class BaseSingleton(Provider): - cdef Factory __instantiator - - -cdef class Singleton(BaseSingleton): - cdef object __storage - - cpdef object _provide(self, tuple args, dict kwargs) - - -cdef class DelegatedSingleton(Singleton): - pass - - -cdef class ThreadSafeSingleton(BaseSingleton): - cdef object __storage - cdef object __lock - - cpdef object _provide(self, tuple args, dict kwargs) - - -cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): - pass - - -cdef class ThreadLocalSingleton(BaseSingleton): - cdef object __storage - - cpdef object _provide(self, tuple args, dict kwargs) - - -cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): - pass diff --git a/src/dependency_injector/providers/singletons.pyx b/src/dependency_injector/providers/singletons.pyx deleted file mode 100644 index b9f9904b..00000000 --- a/src/dependency_injector/providers/singletons.pyx +++ /dev/null @@ -1,411 +0,0 @@ -"""Dependency injector singleton providers. - -Powered by Cython. -""" - -import threading - -from dependency_injector.errors import Error - -from .base cimport Provider -from .factories cimport ( - Factory, - __factory_call, -) -from .utils cimport ( - represent_provider, - deepcopy, -) - - -GLOBAL_LOCK = threading.RLock() -"""Global reentrant lock. - -:type: :py:class:`threading.RLock` -""" - - -cdef class BaseSingleton(Provider): - """Base class of singleton providers.""" - - provided_type = None - - def __init__(self, provides, *args, **kwargs): - """Initializer. - - :param provides: Provided type. - :type provides: type - - :param args: Tuple of positional argument injections. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword argument injections. - :type kwargs: dict[str, object] - """ - if (self.__class__.provided_type and - not issubclass(provides, self.__class__.provided_type)): - raise Error('{0} can provide only {1} instances'.format( - self.__class__, self.__class__.provided_type)) - - self.__instantiator = Factory(provides, *args, **kwargs) - - super(BaseSingleton, self).__init__() - - def __str__(self): - """Return string representation of provider. - - :rtype: str - """ - return represent_provider(provider=self, - provides=self.__instantiator.cls) - - def __deepcopy__(self, memo): - """Create and return full copy of provider.""" - copied = memo.get(id(self)) - if copied is not None: - return copied - - copied = self.__class__(self.cls, - *deepcopy(self.args, memo), - **deepcopy(self.kwargs, memo)) - copied.set_attributes(**deepcopy(self.attributes, memo)) - - for overriding_provider in self.overridden: - copied.override(deepcopy(overriding_provider, memo)) - - return copied - - @property - def cls(self): - """Return provided type.""" - return self.__instantiator.cls - - @property - def args(self): - """Return positional argument injections.""" - return self.__instantiator.args - - def add_args(self, *args): - """Add __init__ postional argument injections. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__instantiator.add_args(*args) - return self - - def set_args(self, *args): - """Set __init__ postional argument injections. - - Existing __init__ positional argument injections are dropped. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__instantiator.set_args(*args) - return self - - def clear_args(self): - """Drop __init__ postional argument injections. - - :return: Reference ``self`` - """ - self.__instantiator.clear_args() - return self - - @property - def kwargs(self): - """Return keyword argument injections.""" - return self.__instantiator.kwargs - - def add_kwargs(self, **kwargs): - """Add __init__ keyword argument injections. - - :param kwargs: Dictionary of injections. - :type kwargs: dict - - :return: Reference ``self`` - """ - self.__instantiator.add_kwargs(**kwargs) - return self - - def set_kwargs(self, **kwargs): - """Set __init__ keyword argument injections. - - Existing __init__ keyword argument injections are dropped. - - :param kwargs: Dictionary of injections. - :type kwargs: dict - - :return: Reference ``self`` - """ - self.__instantiator.set_kwargs(**kwargs) - return self - - def clear_kwargs(self): - """Drop __init__ keyword argument injections. - - :return: Reference ``self`` - """ - self.__instantiator.clear_kwargs() - return self - - @property - def attributes(self): - """Return attribute injections.""" - return self.__instantiator.attributes - - def add_attributes(self, **kwargs): - """Add attribute injections. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__instantiator.add_attributes(**kwargs) - return self - - def set_attributes(self, **kwargs): - """Set attribute injections. - - Existing attribute injections are dropped. - - :param args: Tuple of injections. - :type args: tuple - - :return: Reference ``self`` - """ - self.__instantiator.set_attributes(**kwargs) - return self - - def clear_attributes(self): - """Drop attribute injections. - - :return: Reference ``self`` - """ - self.__instantiator.clear_attributes() - return self - - def reset(self): - """Reset cached instance, if any. - - :rtype: None - """ - raise NotImplementedError() - - -cdef class Singleton(BaseSingleton): - """Singleton provider returns same instance on every call. - - :py:class:`Singleton` provider creates instance once and returns it on - every call. :py:class:`Singleton` extends :py:class:`Factory`, so, please - follow :py:class:`Factory` documentation for getting familiar with - injections syntax. - - Retrieving of provided instance can be performed via calling - :py:class:`Singleton` object: - - .. code-block:: python - - singleton = Singleton(SomeClass) - some_object = singleton() - - .. py:attribute:: provided_type - - If provided type is defined, provider checks that providing class is - its subclass. - - :type: type | None - - .. py:attribute:: cls - - Class that provides object. - Alias for :py:attr:`provides`. - - :type: type - """ - - def __init__(self, provides, *args, **kwargs): - """Initializer. - - :param provides: Provided type. - :type provides: type - - :param args: Tuple of positional argument injections. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword argument injections. - :type kwargs: dict[str, object] - """ - self.__storage = None - super(Singleton, self).__init__(provides, *args, **kwargs) - - def reset(self): - """Reset cached instance, if any. - - :rtype: None - """ - self.__storage = None - - cpdef object _provide(self, tuple args, dict kwargs): - """Return single instance.""" - if self.__storage is None: - self.__storage = __factory_call(self.__instantiator, - args, kwargs) - return self.__storage - - -cdef class DelegatedSingleton(Singleton): - """Delegated singleton is injected "as is". - - .. py:attribute:: provided_type - - If provided type is defined, provider checks that providing class is - its subclass. - - :type: type | None - - .. py:attribute:: cls - - Class that provides object. - Alias for :py:attr:`provides`. - - :type: type - """ - - __IS_DELEGATED__ = True - - -cdef class ThreadSafeSingleton(BaseSingleton): - """Thread-safe singleton provider.""" - - def __init__(self, provides, *args, **kwargs): - """Initializer. - - :param provides: Provided type. - :type provides: type - - :param args: Tuple of positional argument injections. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword argument injections. - :type kwargs: dict[str, object] - """ - self.__storage = None - self.__lock = GLOBAL_LOCK - super(ThreadSafeSingleton, self).__init__(provides, *args, **kwargs) - - def reset(self): - """Reset cached instance, if any. - - :rtype: None - """ - self.__storage = None - - cpdef object _provide(self, tuple args, dict kwargs): - """Return single instance.""" - with self.__lock: - if self.__storage is None: - self.__storage = __factory_call(self.__instantiator, - args, kwargs) - return self.__storage - - -cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton): - """Delegated thread-safe singleton is injected "as is". - - .. py:attribute:: provided_type - - If provided type is defined, provider checks that providing class is - its subclass. - - :type: type | None - - .. py:attribute:: cls - - Class that provides object. - Alias for :py:attr:`provides`. - - :type: type - """ - - __IS_DELEGATED__ = True - - -cdef class ThreadLocalSingleton(BaseSingleton): - """Thread-local singleton provides single objects in scope of thread. - - .. py:attribute:: provided_type - - If provided type is defined, provider checks that providing class is - its subclass. - - :type: type | None - - .. py:attribute:: cls - - Class that provides object. - Alias for :py:attr:`provides`. - - :type: type - """ - - def __init__(self, provides, *args, **kwargs): - """Initializer. - - :param provides: Provided type. - :type provides: type - - :param args: Tuple of positional argument injections. - :type args: tuple[object] - - :param kwargs: Dictionary of context keyword argument injections. - :type kwargs: dict[str, object] - """ - self.__storage = threading.local() - super(ThreadLocalSingleton, self).__init__(provides, *args, **kwargs) - - def reset(self): - """Reset cached instance, if any. - - :rtype: None - """ - self.__storage.instance = None - - cpdef object _provide(self, tuple args, dict kwargs): - """Return single instance.""" - cdef object instance - - try: - instance = self.__storage.instance - except AttributeError: - instance = __factory_call(self.__instantiator, args, kwargs) - self.__storage.instance = instance - finally: - return instance - - -cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton): - """Delegated thread-local singleton is injected "as is". - - .. py:attribute:: provided_type - - If provided type is defined, provider checks that providing class is - its subclass. - - :type: type | None - - .. py:attribute:: cls - - Class that provides object. - Alias for :py:attr:`provides`. - - :type: type - """ - - __IS_DELEGATED__ = True diff --git a/src/dependency_injector/providers/utils.c b/src/dependency_injector/providers/utils.c deleted file mode 100644 index 8e21ff14..00000000 --- a/src/dependency_injector/providers/utils.c +++ /dev/null @@ -1,5112 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__dependency_injector__providers__utils -#define __PYX_HAVE_API__dependency_injector__providers__utils -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "src/dependency_injector/providers/utils.pyx", -}; - -/*--- Type declarations ---*/ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy; - -/* "dependency_injector/providers/utils.pxd":21 - * - * - * cpdef object deepcopy(object instance, dict memo=*) # <<<<<<<<<<<<<< - */ -struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy { - int __pyx_n; - PyObject *memo; -}; - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* GetAttr.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); - -/* GetAttr3.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* StringJoin.proto */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyString_Join __Pyx_PyBytes_Join -#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) -#else -#define __Pyx_PyString_Join PyUnicode_Join -#define __Pyx_PyBaseString_Join PyUnicode_Join -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION < 3 - #define __Pyx_PyBytes_Join _PyString_Join - #else - #define __Pyx_PyBytes_Join _PyBytes_Join - #endif -#else -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); -#endif - -/* ArgTypeTest.proto */ -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\ - PyObject_RichCompare(op1, op2, Py_EQ) - #endif - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* FetchCommonType.proto */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -/* CythonFunction.proto */ -#define __Pyx_CyFunction_USED 1 -#include -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; - void *defaults; - int defaults_pyobjects; - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; -} __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(void); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* PyObjectSetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) -#endif - -/* VoidPtrExport.proto */ -static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig); - -/* FunctionExport.proto */ -static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'dependency_injector.providers.utils' */ -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 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 PyObject *__pyx_f_19dependency_injector_9providers_5utils_represent_provider(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_5utils_deepcopy(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args); /*proto*/ -#define __Pyx_MODULE_NAME "dependency_injector.providers.utils" -int __pyx_module_is_main_dependency_injector__providers__utils = 0; - -/* Implementation of 'dependency_injector.providers.utils' */ -static PyObject *__pyx_builtin_hex; -static PyObject *__pyx_builtin_id; -static const char __pyx_k_[] = "."; -static const char __pyx_k__2[] = ""; -static const char __pyx_k_id[] = "id"; -static const char __pyx_k_hex[] = "hex"; -static const char __pyx_k_obj[] = "obj"; -static const char __pyx_k_sys[] = "sys"; -static const char __pyx_k_copy[] = "copy"; -static const char __pyx_k_join[] = "join"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_memo[] = "memo"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_Error[] = "Error"; -static const char __pyx_k_class[] = "__class__"; -static const char __pyx_k_types[] = "types"; -static const char __pyx_k_format[] = "format"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_lambda[] = ""; -static const char __pyx_k_module[] = "__module__"; -static const char __pyx_k_address[] = "address"; -static const char __pyx_k_im_func[] = "im_func"; -static const char __pyx_k_im_self[] = "im_self"; -static const char __pyx_k_deepcopy[] = "deepcopy"; -static const char __pyx_k_im_class[] = "im_class"; -static const char __pyx_k_instance[] = "instance"; -static const char __pyx_k_provider[] = "provider"; -static const char __pyx_k_provides[] = "provides"; -static const char __pyx_k_pyx_capi[] = "__pyx_capi__"; -static const char __pyx_k_ClassType[] = "ClassType"; -static const char __pyx_k_threading[] = "threading"; -static const char __pyx_k_MethodType[] = "MethodType"; -static const char __pyx_k_CLASS_TYPES[] = "CLASS_TYPES"; -static const char __pyx_k_IS_PROVIDER[] = "__IS_PROVIDER__"; -static const char __pyx_k_IS_DELEGATED[] = "__IS_DELEGATED__"; -static const char __pyx_k_version_info[] = "version_info"; -static const char __pyx_k_deepcopy_dispatch[] = "_deepcopy_dispatch"; -static const char __pyx_k_dependency_injector_errors[] = "dependency_injector.errors"; -static const char __pyx_k_provider_provides_at_address[] = "<{provider}({provides}) at {address}>"; -static const char __pyx_k_Dependency_injector_provider_uti[] = "Dependency injector provider utils.\n\nPowered by Cython.\n"; -static const char __pyx_k_Expected_provider_instance_got_0[] = "Expected provider instance, got {0}"; -static const char __pyx_k_dependency_injector_providers_ut[] = "dependency_injector.providers.utils"; -static PyObject *__pyx_kp_s_; -static PyObject *__pyx_n_s_CLASS_TYPES; -static PyObject *__pyx_n_s_ClassType; -static PyObject *__pyx_n_s_Error; -static PyObject *__pyx_kp_s_Expected_provider_instance_got_0; -static PyObject *__pyx_n_s_IS_DELEGATED; -static PyObject *__pyx_n_s_IS_PROVIDER; -static PyObject *__pyx_n_s_MethodType; -static PyObject *__pyx_kp_s__2; -static PyObject *__pyx_n_s_address; -static PyObject *__pyx_n_s_class; -static PyObject *__pyx_n_s_copy; -static PyObject *__pyx_n_s_deepcopy; -static PyObject *__pyx_n_s_deepcopy_dispatch; -static PyObject *__pyx_n_s_dependency_injector_errors; -static PyObject *__pyx_n_s_dependency_injector_providers_ut; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_hex; -static PyObject *__pyx_n_s_id; -static PyObject *__pyx_n_s_im_class; -static PyObject *__pyx_n_s_im_func; -static PyObject *__pyx_n_s_im_self; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_instance; -static PyObject *__pyx_n_s_join; -static PyObject *__pyx_n_s_lambda; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_memo; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_obj; -static PyObject *__pyx_n_s_provider; -static PyObject *__pyx_kp_s_provider_provides_at_address; -static PyObject *__pyx_n_s_provides; -static PyObject *__pyx_n_s_pyx_capi; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_threading; -static PyObject *__pyx_n_s_types; -static PyObject *__pyx_n_s_version_info; -static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_5utils_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_2ensure_is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_4is_delegated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_6represent_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provider, PyObject *__pyx_v_provides); /* proto */ -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_8deepcopy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance, PyObject *__pyx_v_memo); /* proto */ -static PyObject *__pyx_int_3; - -/* "dependency_injector/providers/utils.pyx":20 - * - * copy._deepcopy_dispatch[types.MethodType] = \ - * lambda obj, memo: type(obj)(obj.im_func, # <<<<<<<<<<<<<< - * copy.deepcopy(obj.im_self, memo), - * obj.im_class) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_10lambda(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_19dependency_injector_9providers_5utils_10lambda = {"lambda", (PyCFunction)__pyx_pw_19dependency_injector_9providers_5utils_10lambda, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_10lambda(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_obj = 0; - PyObject *__pyx_v_memo = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_memo,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memo)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lambda", 1, 2, 2, 1); __PYX_ERR(0, 20, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda") < 0)) __PYX_ERR(0, 20, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_obj = values[0]; - __pyx_v_memo = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lambda", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 20, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.utils.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_lambda_funcdef_19dependency_injector_9providers_5utils_lambda(__pyx_self, __pyx_v_obj, __pyx_v_memo); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_19dependency_injector_9providers_5utils_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("lambda", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_im_func); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "dependency_injector/providers/utils.pyx":21 - * copy._deepcopy_dispatch[types.MethodType] = \ - * lambda obj, memo: type(obj)(obj.im_func, - * copy.deepcopy(obj.im_self, memo), # <<<<<<<<<<<<<< - * obj.im_class) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_im_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_v_memo}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_v_memo}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4); - __Pyx_INCREF(__pyx_v_memo); - __Pyx_GIVEREF(__pyx_v_memo); - PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_memo); - __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/utils.pyx":22 - * lambda obj, memo: type(obj)(obj.im_func, - * copy.deepcopy(obj.im_self, memo), - * obj.im_class) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_im_class); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_obj))); - __pyx_t_8 = ((PyObject *)Py_TYPE(__pyx_v_obj)); __pyx_t_4 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_5); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/utils.pyx":20 - * - * copy._deepcopy_dispatch[types.MethodType] = \ - * lambda obj, memo: type(obj)(obj.im_func, # <<<<<<<<<<<<<< - * copy.deepcopy(obj.im_self, memo), - * obj.im_class) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("dependency_injector.providers.utils.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/utils.pyx":25 - * - * - * cpdef bint is_provider(object instance): # <<<<<<<<<<<<<< - * """Check if instance is provider instance. - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_1is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ -static int __pyx_f_19dependency_injector_9providers_5utils_is_provider(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("is_provider", 0); - - /* "dependency_injector/providers/utils.pyx":33 - * :rtype: bool - * """ - * return (not isinstance(instance, CLASS_TYPES) and # <<<<<<<<<<<<<< - * getattr(instance, '__IS_PROVIDER__', False) is True) - * - */ - __pyx_t_2 = __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyObject_IsInstance(__pyx_v_instance, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L3_bool_binop_done; - } - - /* "dependency_injector/providers/utils.pyx":34 - * """ - * return (not isinstance(instance, CLASS_TYPES) and - * getattr(instance, '__IS_PROVIDER__', False) is True) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_instance, __pyx_n_s_IS_PROVIDER, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_t_2 == Py_True); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = (__pyx_t_4 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "dependency_injector/providers/utils.pyx":25 - * - * - * cpdef bint is_provider(object instance): # <<<<<<<<<<<<<< - * """Check if instance is provider instance. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("dependency_injector.providers.utils.is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_1is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_5utils_is_provider[] = "Check if instance is provider instance.\n\n :param instance: Instance to be checked.\n :type instance: object\n\n :rtype: bool\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_1is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_provider (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_5utils_is_provider(__pyx_self, ((PyObject *)__pyx_v_instance)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("is_provider", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_19dependency_injector_9providers_5utils_is_provider(__pyx_v_instance, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.utils.is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/utils.pyx":37 - * - * - * cpdef object ensure_is_provider(object instance): # <<<<<<<<<<<<<< - * """Check if instance is provider instance and return it. - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_3ensure_is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_5utils_ensure_is_provider(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("ensure_is_provider", 0); - - /* "dependency_injector/providers/utils.pyx":48 - * :rtype: :py:class:`dependency_injector.providers.Provider` - * """ - * if not is_provider(instance): # <<<<<<<<<<<<<< - * raise Error('Expected provider instance, ' - * 'got {0}'.format(str(instance))) - */ - __pyx_t_1 = ((!(__pyx_f_19dependency_injector_9providers_5utils_is_provider(__pyx_v_instance, 0) != 0)) != 0); - if (__pyx_t_1) { - - /* "dependency_injector/providers/utils.pyx":49 - * """ - * if not is_provider(instance): - * raise Error('Expected provider instance, ' # <<<<<<<<<<<<<< - * 'got {0}'.format(str(instance))) - * return instance - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - - /* "dependency_injector/providers/utils.pyx":50 - * if not is_provider(instance): - * raise Error('Expected provider instance, ' - * 'got {0}'.format(str(instance))) # <<<<<<<<<<<<<< - * return instance - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Expected_provider_instance_got_0, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_instance); - __Pyx_GIVEREF(__pyx_v_instance); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_instance); - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 49, __pyx_L1_error) - - /* "dependency_injector/providers/utils.pyx":48 - * :rtype: :py:class:`dependency_injector.providers.Provider` - * """ - * if not is_provider(instance): # <<<<<<<<<<<<<< - * raise Error('Expected provider instance, ' - * 'got {0}'.format(str(instance))) - */ - } - - /* "dependency_injector/providers/utils.pyx":51 - * raise Error('Expected provider instance, ' - * 'got {0}'.format(str(instance))) - * return instance # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_instance); - __pyx_r = __pyx_v_instance; - goto __pyx_L0; - - /* "dependency_injector/providers/utils.pyx":37 - * - * - * cpdef object ensure_is_provider(object instance): # <<<<<<<<<<<<<< - * """Check if instance is provider instance and return it. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("dependency_injector.providers.utils.ensure_is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_3ensure_is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_5utils_2ensure_is_provider[] = "Check if instance is provider instance and return it.\n\n :param instance: Instance to be checked.\n :type instance: object\n\n :raise: :py:exc:`dependency_injector.errors.Error` if provided instance is\n not provider.\n\n :rtype: :py:class:`dependency_injector.providers.Provider`\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_3ensure_is_provider(PyObject *__pyx_self, PyObject *__pyx_v_instance) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ensure_is_provider (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_5utils_2ensure_is_provider(__pyx_self, ((PyObject *)__pyx_v_instance)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_2ensure_is_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("ensure_is_provider", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_5utils_ensure_is_provider(__pyx_v_instance, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.utils.ensure_is_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/utils.pyx":54 - * - * - * cpdef bint is_delegated(object instance): # <<<<<<<<<<<<<< - * """Check if instance is delegated provider. - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_5is_delegated(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ -static int __pyx_f_19dependency_injector_9providers_5utils_is_delegated(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch) { - int __pyx_r; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("is_delegated", 0); - - /* "dependency_injector/providers/utils.pyx":62 - * :rtype: bool - * """ - * return (not isinstance(instance, CLASS_TYPES) and # <<<<<<<<<<<<<< - * getattr(instance, '__IS_DELEGATED__', False) is True) - * - */ - __pyx_t_2 = __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyObject_IsInstance(__pyx_v_instance, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); - if (__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L3_bool_binop_done; - } - - /* "dependency_injector/providers/utils.pyx":63 - * """ - * return (not isinstance(instance, CLASS_TYPES) and - * getattr(instance, '__IS_DELEGATED__', False) is True) # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_2 = __Pyx_GetAttr3(__pyx_v_instance, __pyx_n_s_IS_DELEGATED, Py_False); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (__pyx_t_2 == Py_True); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = (__pyx_t_4 != 0); - __pyx_t_1 = __pyx_t_3; - __pyx_L3_bool_binop_done:; - __pyx_r = __pyx_t_1; - goto __pyx_L0; - - /* "dependency_injector/providers/utils.pyx":54 - * - * - * cpdef bint is_delegated(object instance): # <<<<<<<<<<<<<< - * """Check if instance is delegated provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("dependency_injector.providers.utils.is_delegated", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); - __pyx_r = 0; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_5is_delegated(PyObject *__pyx_self, PyObject *__pyx_v_instance); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_5utils_4is_delegated[] = "Check if instance is delegated provider.\n\n :param instance: Instance to be checked.\n :type instance: object\n\n :rtype: bool\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_5is_delegated(PyObject *__pyx_self, PyObject *__pyx_v_instance) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_delegated (wrapper)", 0); - __pyx_r = __pyx_pf_19dependency_injector_9providers_5utils_4is_delegated(__pyx_self, ((PyObject *)__pyx_v_instance)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_4is_delegated(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("is_delegated", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_19dependency_injector_9providers_5utils_is_delegated(__pyx_v_instance, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.utils.is_delegated", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/utils.pyx":66 - * - * - * cpdef str represent_provider(object provider, object provides): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_7represent_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_5utils_represent_provider(PyObject *__pyx_v_provider, PyObject *__pyx_v_provides, CYTHON_UNUSED int __pyx_skip_dispatch) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("represent_provider", 0); - - /* "dependency_injector/providers/utils.pyx":78 - * :rtype: str - * """ - * return '<{provider}({provides}) at {address}>'.format( # <<<<<<<<<<<<<< - * provider='.'.join((provider.__class__.__module__, - * provider.__class__.__name__)), - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_provider_provides_at_address, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - - /* "dependency_injector/providers/utils.pyx":79 - * """ - * return '<{provider}({provides}) at {address}>'.format( - * provider='.'.join((provider.__class__.__module__, # <<<<<<<<<<<<<< - * provider.__class__.__name__)), - * provides=repr(provides) if provides is not None else '', - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_module); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/utils.pyx":80 - * return '<{provider}({provides}) at {address}>'.format( - * provider='.'.join((provider.__class__.__module__, - * provider.__class__.__name__)), # <<<<<<<<<<<<<< - * provides=repr(provides) if provides is not None else '', - * address=hex(id(provider))) - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_provider, __pyx_n_s_class); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/utils.pyx":79 - * """ - * return '<{provider}({provides}) at {address}>'.format( - * provider='.'.join((provider.__class__.__module__, # <<<<<<<<<<<<<< - * provider.__class__.__name__)), - * provides=repr(provides) if provides is not None else '', - */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_provider, __pyx_t_5) < 0) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/utils.pyx":81 - * provider='.'.join((provider.__class__.__module__, - * provider.__class__.__name__)), - * provides=repr(provides) if provides is not None else '', # <<<<<<<<<<<<<< - * address=hex(id(provider))) - * - */ - __pyx_t_6 = (__pyx_v_provides != Py_None); - if ((__pyx_t_6 != 0)) { - __pyx_t_3 = PyObject_Repr(__pyx_v_provides); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __pyx_t_3; - __pyx_t_3 = 0; - } else { - __Pyx_INCREF(__pyx_kp_s__2); - __pyx_t_5 = __pyx_kp_s__2; - } - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_provides, __pyx_t_5) < 0) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "dependency_injector/providers/utils.pyx":82 - * provider.__class__.__name__)), - * provides=repr(provides) if provides is not None else '', - * address=hex(id(provider))) # <<<<<<<<<<<<<< - * - * cpdef object deepcopy(object instance, dict memo=None): - */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_provider); - __Pyx_GIVEREF(__pyx_v_provider); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_provider); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_hex, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_address, __pyx_t_3) < 0) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "dependency_injector/providers/utils.pyx":78 - * :rtype: str - * """ - * return '<{provider}({provides}) at {address}>'.format( # <<<<<<<<<<<<<< - * provider='.'.join((provider.__class__.__module__, - * provider.__class__.__name__)), - */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyString_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 78, __pyx_L1_error) - __pyx_r = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/utils.pyx":66 - * - * - * cpdef str represent_provider(object provider, object provides): # <<<<<<<<<<<<<< - * """Return string representation of provider. - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.utils.represent_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_7represent_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_5utils_6represent_provider[] = "Return string representation of provider.\n\n :param provider: Provider object\n :type provider: :py:class:`dependency_injector.providers.Provider`\n\n :param provides: Object that provider provides\n :type provider: object\n\n :return: String representation of provider\n :rtype: str\n "; -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_7represent_provider(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_provider = 0; - PyObject *__pyx_v_provides = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("represent_provider (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_provider,&__pyx_n_s_provides,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provider)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_provides)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("represent_provider", 1, 2, 2, 1); __PYX_ERR(0, 66, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "represent_provider") < 0)) __PYX_ERR(0, 66, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_provider = values[0]; - __pyx_v_provides = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("represent_provider", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 66, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.utils.represent_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_19dependency_injector_9providers_5utils_6represent_provider(__pyx_self, __pyx_v_provider, __pyx_v_provides); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_6represent_provider(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_provider, PyObject *__pyx_v_provides) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("represent_provider", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_5utils_represent_provider(__pyx_v_provider, __pyx_v_provides, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.utils.represent_provider", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "dependency_injector/providers/utils.pyx":84 - * address=hex(id(provider))) - * - * cpdef object deepcopy(object instance, dict memo=None): # <<<<<<<<<<<<<< - * """Return full copy of provider or container with providers.""" - * return copy.deepcopy(instance, memo) - */ - -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_9deepcopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_19dependency_injector_9providers_5utils_deepcopy(PyObject *__pyx_v_instance, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args) { - PyObject *__pyx_v_memo = ((PyObject*)Py_None); - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("deepcopy", 0); - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_memo = __pyx_optional_args->memo; - } - } - - /* "dependency_injector/providers/utils.pyx":86 - * cpdef object deepcopy(object instance, dict memo=None): - * """Return full copy of provider or container with providers.""" - * return copy.deepcopy(instance, memo) # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_deepcopy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_instance, __pyx_v_memo}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_instance, __pyx_v_memo}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_INCREF(__pyx_v_instance); - __Pyx_GIVEREF(__pyx_v_instance); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_instance); - __Pyx_INCREF(__pyx_v_memo); - __Pyx_GIVEREF(__pyx_v_memo); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_memo); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "dependency_injector/providers/utils.pyx":84 - * address=hex(id(provider))) - * - * cpdef object deepcopy(object instance, dict memo=None): # <<<<<<<<<<<<<< - * """Return full copy of provider or container with providers.""" - * return copy.deepcopy(instance, memo) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("dependency_injector.providers.utils.deepcopy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* Python wrapper */ -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_9deepcopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_19dependency_injector_9providers_5utils_8deepcopy[] = "Return full copy of provider or container with providers."; -static PyObject *__pyx_pw_19dependency_injector_9providers_5utils_9deepcopy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_instance = 0; - PyObject *__pyx_v_memo = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("deepcopy (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_instance,&__pyx_n_s_memo,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject*)Py_None); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_instance)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_memo); - if (value) { values[1] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "deepcopy") < 0)) __PYX_ERR(0, 84, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } - } - __pyx_v_instance = values[0]; - __pyx_v_memo = ((PyObject*)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("deepcopy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 84, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("dependency_injector.providers.utils.deepcopy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_memo), (&PyDict_Type), 1, "memo", 1))) __PYX_ERR(0, 84, __pyx_L1_error) - __pyx_r = __pyx_pf_19dependency_injector_9providers_5utils_8deepcopy(__pyx_self, __pyx_v_instance, __pyx_v_memo); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_19dependency_injector_9providers_5utils_8deepcopy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_instance, PyObject *__pyx_v_memo) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy __pyx_t_2; - __Pyx_RefNannySetupContext("deepcopy", 0); - __Pyx_XDECREF(__pyx_r); - __pyx_t_2.__pyx_n = 1; - __pyx_t_2.memo = __pyx_v_memo; - __pyx_t_1 = __pyx_f_19dependency_injector_9providers_5utils_deepcopy(__pyx_v_instance, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("dependency_injector.providers.utils.deepcopy", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {"is_provider", (PyCFunction)__pyx_pw_19dependency_injector_9providers_5utils_1is_provider, METH_O, __pyx_doc_19dependency_injector_9providers_5utils_is_provider}, - {"ensure_is_provider", (PyCFunction)__pyx_pw_19dependency_injector_9providers_5utils_3ensure_is_provider, METH_O, __pyx_doc_19dependency_injector_9providers_5utils_2ensure_is_provider}, - {"is_delegated", (PyCFunction)__pyx_pw_19dependency_injector_9providers_5utils_5is_delegated, METH_O, __pyx_doc_19dependency_injector_9providers_5utils_4is_delegated}, - {"represent_provider", (PyCFunction)__pyx_pw_19dependency_injector_9providers_5utils_7represent_provider, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_5utils_6represent_provider}, - {"deepcopy", (PyCFunction)__pyx_pw_19dependency_injector_9providers_5utils_9deepcopy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_19dependency_injector_9providers_5utils_8deepcopy}, - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "utils", - __pyx_k_Dependency_injector_provider_uti, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_n_s_CLASS_TYPES, __pyx_k_CLASS_TYPES, sizeof(__pyx_k_CLASS_TYPES), 0, 0, 1, 1}, - {&__pyx_n_s_ClassType, __pyx_k_ClassType, sizeof(__pyx_k_ClassType), 0, 0, 1, 1}, - {&__pyx_n_s_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 0, 1, 1}, - {&__pyx_kp_s_Expected_provider_instance_got_0, __pyx_k_Expected_provider_instance_got_0, sizeof(__pyx_k_Expected_provider_instance_got_0), 0, 0, 1, 0}, - {&__pyx_n_s_IS_DELEGATED, __pyx_k_IS_DELEGATED, sizeof(__pyx_k_IS_DELEGATED), 0, 0, 1, 1}, - {&__pyx_n_s_IS_PROVIDER, __pyx_k_IS_PROVIDER, sizeof(__pyx_k_IS_PROVIDER), 0, 0, 1, 1}, - {&__pyx_n_s_MethodType, __pyx_k_MethodType, sizeof(__pyx_k_MethodType), 0, 0, 1, 1}, - {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0}, - {&__pyx_n_s_address, __pyx_k_address, sizeof(__pyx_k_address), 0, 0, 1, 1}, - {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, - {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, - {&__pyx_n_s_deepcopy, __pyx_k_deepcopy, sizeof(__pyx_k_deepcopy), 0, 0, 1, 1}, - {&__pyx_n_s_deepcopy_dispatch, __pyx_k_deepcopy_dispatch, sizeof(__pyx_k_deepcopy_dispatch), 0, 0, 1, 1}, - {&__pyx_n_s_dependency_injector_errors, __pyx_k_dependency_injector_errors, sizeof(__pyx_k_dependency_injector_errors), 0, 0, 1, 1}, - {&__pyx_n_s_dependency_injector_providers_ut, __pyx_k_dependency_injector_providers_ut, sizeof(__pyx_k_dependency_injector_providers_ut), 0, 0, 1, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 0, 0, 1, 1}, - {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, - {&__pyx_n_s_im_class, __pyx_k_im_class, sizeof(__pyx_k_im_class), 0, 0, 1, 1}, - {&__pyx_n_s_im_func, __pyx_k_im_func, sizeof(__pyx_k_im_func), 0, 0, 1, 1}, - {&__pyx_n_s_im_self, __pyx_k_im_self, sizeof(__pyx_k_im_self), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_instance, __pyx_k_instance, sizeof(__pyx_k_instance), 0, 0, 1, 1}, - {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, - {&__pyx_n_s_lambda, __pyx_k_lambda, sizeof(__pyx_k_lambda), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_memo, __pyx_k_memo, sizeof(__pyx_k_memo), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, - {&__pyx_n_s_provider, __pyx_k_provider, sizeof(__pyx_k_provider), 0, 0, 1, 1}, - {&__pyx_kp_s_provider_provides_at_address, __pyx_k_provider_provides_at_address, sizeof(__pyx_k_provider_provides_at_address), 0, 0, 1, 0}, - {&__pyx_n_s_provides, __pyx_k_provides, sizeof(__pyx_k_provides), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1}, - {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1}, - {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_hex = __Pyx_GetBuiltinName(__pyx_n_s_hex); if (!__pyx_builtin_hex) __PYX_ERR(0, 82, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 82, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initutils(void); /*proto*/ -PyMODINIT_FUNC initutils(void) -#else -PyMODINIT_FUNC PyInit_utils(void); /*proto*/ -PyMODINIT_FUNC PyInit_utils(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_utils(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("utils", __pyx_methods, __pyx_k_Dependency_injector_provider_uti, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_dependency_injector__providers__utils) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "dependency_injector.providers.utils")) { - if (unlikely(PyDict_SetItemString(modules, "dependency_injector.providers.utils", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - __pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES = Py_None; Py_INCREF(Py_None); - /*--- Variable export code ---*/ - if (__Pyx_ExportVoidPtr(__pyx_n_s_CLASS_TYPES, (void *)&__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES, "PyObject *") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Function export code ---*/ - if (__Pyx_ExportFunction("is_provider", (void (*)(void))__pyx_f_19dependency_injector_9providers_5utils_is_provider, "int (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("ensure_is_provider", (void (*)(void))__pyx_f_19dependency_injector_9providers_5utils_ensure_is_provider, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("is_delegated", (void (*)(void))__pyx_f_19dependency_injector_9providers_5utils_is_delegated, "int (PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("represent_provider", (void (*)(void))__pyx_f_19dependency_injector_9providers_5utils_represent_provider, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - if (__Pyx_ExportFunction("deepcopy", (void (*)(void))__pyx_f_19dependency_injector_9providers_5utils_deepcopy, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_19dependency_injector_9providers_5utils_deepcopy *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Type init code ---*/ - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "dependency_injector/providers/utils.pyx":6 - * """ - * - * import copy # <<<<<<<<<<<<<< - * import sys - * import types - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_copy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_copy, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/utils.pyx":7 - * - * import copy - * import sys # <<<<<<<<<<<<<< - * import types - * import threading - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/utils.pyx":8 - * import copy - * import sys - * import types # <<<<<<<<<<<<<< - * import threading - * - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_types, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_types, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/utils.pyx":9 - * import sys - * import types - * import threading # <<<<<<<<<<<<<< - * - * from dependency_injector.errors import Error - */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "dependency_injector/providers/utils.pyx":11 - * import threading - * - * from dependency_injector.errors import Error # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_Error); - __Pyx_GIVEREF(__pyx_n_s_Error); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Error); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_dependency_injector_errors, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Error, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "dependency_injector/providers/utils.pyx":14 - * - * - * if sys.version_info[0] == 3: # pragma: no cover # <<<<<<<<<<<<<< - * CLASS_TYPES = (type,) - * else: # pragma: no cover - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_version_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - - /* "dependency_injector/providers/utils.pyx":15 - * - * if sys.version_info[0] == 3: # pragma: no cover - * CLASS_TYPES = (type,) # <<<<<<<<<<<<<< - * else: # pragma: no cover - * CLASS_TYPES = (type, types.ClassType) - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)(&PyType_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyType_Type))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyType_Type))); - __Pyx_XGOTREF(__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES); - __Pyx_DECREF_SET(__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/utils.pyx":14 - * - * - * if sys.version_info[0] == 3: # pragma: no cover # <<<<<<<<<<<<<< - * CLASS_TYPES = (type,) - * else: # pragma: no cover - */ - goto __pyx_L2; - } - - /* "dependency_injector/providers/utils.pyx":17 - * CLASS_TYPES = (type,) - * else: # pragma: no cover - * CLASS_TYPES = (type, types.ClassType) # <<<<<<<<<<<<<< - * - * copy._deepcopy_dispatch[types.MethodType] = \ - */ - /*else*/ { - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_types); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ClassType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)(&PyType_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyType_Type))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyType_Type))); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_XGOTREF(__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES); - __Pyx_DECREF_SET(__pyx_v_19dependency_injector_9providers_5utils_CLASS_TYPES, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - - /* "dependency_injector/providers/utils.pyx":20 - * - * copy._deepcopy_dispatch[types.MethodType] = \ - * lambda obj, memo: type(obj)(obj.im_func, # <<<<<<<<<<<<<< - * copy.deepcopy(obj.im_self, memo), - * obj.im_class) - */ - __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_19dependency_injector_9providers_5utils_10lambda, 0, __pyx_n_s_lambda, NULL, __pyx_n_s_dependency_injector_providers_ut, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - - /* "dependency_injector/providers/utils.pyx":19 - * CLASS_TYPES = (type, types.ClassType) - * - * copy._deepcopy_dispatch[types.MethodType] = \ # <<<<<<<<<<<<<< - * lambda obj, memo: type(obj)(obj.im_func, - * copy.deepcopy(obj.im_self, memo), - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_deepcopy_dispatch); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_MethodType); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_t_5, __pyx_t_1) < 0)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __pyx_L2:; - - /* "dependency_injector/providers/utils.pyx":1 - * """Dependency injector provider utils. # <<<<<<<<<<<<<< - * - * Powered by Cython. - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init dependency_injector.providers.utils", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init dependency_injector.providers.utils"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* GetModuleGlobalName */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { -#if CYTHON_COMPILING_IN_CPYTHON -#if PY_MAJOR_VERSION >= 3 - if (likely(PyUnicode_Check(n))) -#else - if (likely(PyString_Check(n))) -#endif - return __Pyx_PyObject_GetAttrStr(o, n); -#endif - return PyObject_GetAttr(o, n); -} - -/* GetAttr3 */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { - PyObject *r = __Pyx_GetAttr(o, n); - if (unlikely(!r)) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - goto bad; - PyErr_Clear(); - r = d; - Py_INCREF(d); - } - return r; -bad: - return NULL; -} - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* WriteUnraisableException */ - static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* StringJoin */ - #if !CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { - return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); -} -#endif - -/* ArgTypeTest */ - static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); -} -static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (likely(Py_TYPE(obj) == type)) return 1; - #if PY_MAJOR_VERSION == 2 - else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(PyObject_TypeCheck(obj, type))) return 1; - } - __Pyx_RaiseArgumentTypeInvalid(name, obj, type); - return 0; -} - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - -/* ImportFrom */ - static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 - default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); - #else - default: Py_RETURN_FALSE; - #endif - } - } - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - return PyObject_RichCompare(op1, op2, Py_EQ); -} -#endif - -/* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); - if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); - goto bad; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; - } -done: - Py_DECREF(fake_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} - -/* CythonFunction */ - static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp = op->func_doc; - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - PyObject_GC_Track(op); - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return __Pyx_PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0 = PySequence_ITEM(arg, 0); - if (unlikely(!arg0)) return NULL; - result = (*meth)(self, arg0); - Py_DECREF(arg0); - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -}; -static int __pyx_CyFunction_init(void) { - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (__pyx_CyFunctionType == NULL) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (!m->defaults) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* VoidPtrExport */ - static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) { - PyObject *d; - PyObject *cobj = 0; - d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi); - Py_XINCREF(d); - if (!d) { - d = PyDict_New(); - if (!d) - goto bad; - if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0) - goto bad; - } -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0); -#endif - if (!cobj) - goto bad; - if (PyDict_SetItem(d, name, cobj) < 0) - goto bad; - Py_DECREF(cobj); - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(cobj); - Py_XDECREF(d); - return -1; -} - -/* FunctionExport */ - static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { - PyObject *d = 0; - PyObject *cobj = 0; - union { - void (*fp)(void); - void *p; - } tmp; - d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); - if (!d) { - PyErr_Clear(); - d = PyDict_New(); - if (!d) - goto bad; - Py_INCREF(d); - if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) - goto bad; - } - tmp.fp = f; -#if PY_VERSION_HEX >= 0x02070000 - cobj = PyCapsule_New(tmp.p, sig, 0); -#else - cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); -#endif - if (!cobj) - goto bad; - if (PyDict_SetItemString(d, name, cobj) < 0) - goto bad; - Py_DECREF(cobj); - Py_DECREF(d); - return 0; -bad: - Py_XDECREF(cobj); - Py_XDECREF(d); - return -1; -} - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/src/dependency_injector/providers/utils.pxd b/src/dependency_injector/providers/utils.pxd deleted file mode 100644 index 5ff82936..00000000 --- a/src/dependency_injector/providers/utils.pxd +++ /dev/null @@ -1,21 +0,0 @@ -"""Dependency injector provider utils. - -Powered by Cython. -""" - -cdef object CLASS_TYPES - - -cpdef bint is_provider(object instance) - - -cpdef object ensure_is_provider(object instance) - - -cpdef bint is_delegated(object instance) - - -cpdef str represent_provider(object provider, object provides) - - -cpdef object deepcopy(object instance, dict memo=*) diff --git a/src/dependency_injector/providers/utils.pyx b/src/dependency_injector/providers/utils.pyx deleted file mode 100644 index 1940ffc6..00000000 --- a/src/dependency_injector/providers/utils.pyx +++ /dev/null @@ -1,86 +0,0 @@ -"""Dependency injector provider utils. - -Powered by Cython. -""" - -import copy -import sys -import types -import threading - -from dependency_injector.errors import Error - - -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. - - :param instance: Instance to be checked. - :type instance: object - - :rtype: bool - """ - return (not isinstance(instance, CLASS_TYPES) and - getattr(instance, '__IS_PROVIDER__', False) is True) - - -cpdef object ensure_is_provider(object instance): - """Check if instance is provider instance and return it. - - :param instance: Instance to be checked. - :type instance: object - - :raise: :py:exc:`dependency_injector.errors.Error` if provided instance is - not provider. - - :rtype: :py:class:`dependency_injector.providers.Provider` - """ - if not is_provider(instance): - raise Error('Expected provider instance, ' - 'got {0}'.format(str(instance))) - return instance - - -cpdef bint is_delegated(object instance): - """Check if instance is delegated provider. - - :param instance: Instance to be checked. - :type instance: object - - :rtype: bool - """ - return (not isinstance(instance, CLASS_TYPES) and - getattr(instance, '__IS_DELEGATED__', False) is True) - - -cpdef str represent_provider(object provider, object provides): - """Return string representation of provider. - - :param provider: Provider object - :type provider: :py:class:`dependency_injector.providers.Provider` - - :param provides: Object that provider provides - :type provider: object - - :return: String representation of provider - :rtype: str - """ - return '<{provider}({provides}) at {address}>'.format( - provider='.'.join((provider.__class__.__module__, - provider.__class__.__name__)), - provides=repr(provides) if provides is not None else '', - address=hex(id(provider))) - -cpdef object deepcopy(object instance, dict memo=None): - """Return full copy of provider or container with providers.""" - return copy.deepcopy(instance, memo) diff --git a/tests/unit/providers/test_base.py b/tests/unit/providers/test_base.py index e7ca8167..061c9921 100644 --- a/tests/unit/providers/test_base.py +++ b/tests/unit/providers/test_base.py @@ -114,7 +114,7 @@ class ProviderTests(unittest.TestCase): def test_repr(self): self.assertEqual(repr(self.provider), - ''.format(hex(id(self.provider)))) @@ -170,7 +170,7 @@ class ObjectProviderTests(unittest.TestCase): some_object = object() provider = providers.Object(some_object) self.assertEqual(repr(provider), - ''.format( repr(some_object), hex(id(provider)))) @@ -197,7 +197,7 @@ class DelegateTests(unittest.TestCase): def test_repr(self): self.assertEqual(repr(self.delegate), - ''.format( repr(self.delegated), hex(id(self.delegate)))) @@ -259,7 +259,7 @@ class ExternalDependencyTests(unittest.TestCase): def test_repr(self): self.assertEqual(repr(self.provider), - ''.format( repr(list), hex(id(self.provider)))) diff --git a/tests/unit/providers/test_callables.py b/tests/unit/providers/test_callables.py index 717b8397..35481e0f 100644 --- a/tests/unit/providers/test_callables.py +++ b/tests/unit/providers/test_callables.py @@ -170,7 +170,7 @@ class CallableTests(unittest.TestCase): provider = providers.Callable(self.example) self.assertEqual(repr(provider), - ''.format( repr(self.example), hex(id(provider)))) @@ -189,3 +189,12 @@ class DelegatedCallableTests(unittest.TestCase): def test_is_delegated_provider(self): provider = providers.DelegatedCallable(len) self.assertTrue(providers.is_delegated(provider)) + + def test_repr(self): + provider = providers.DelegatedCallable(len) + + self.assertEqual(repr(provider), + ''.format( + repr(len), + hex(id(provider)))) diff --git a/tests/unit/providers/test_configuration.py b/tests/unit/providers/test_configuration.py index 3e116ee0..25f417b2 100644 --- a/tests/unit/providers/test_configuration.py +++ b/tests/unit/providers/test_configuration.py @@ -96,14 +96,14 @@ class ConfigTests(unittest.TestCase): def test_repr(self): self.assertEqual(repr(self.config), - ''.format( repr('config'), hex(id(self.config)))) def test_repr_child(self): self.assertEqual(repr(self.config.a.b.c), - ''.format( repr('config.a.b.c'), hex(id(self.config.a.b.c)))) diff --git a/tests/unit/providers/test_factories.py b/tests/unit/providers/test_factories.py index 42af696b..3d61bcfc 100644 --- a/tests/unit/providers/test_factories.py +++ b/tests/unit/providers/test_factories.py @@ -325,7 +325,7 @@ class FactoryTests(unittest.TestCase): provider = providers.Factory(Example) self.assertEqual(repr(provider), - ''.format( repr(Example), hex(id(provider)))) @@ -344,3 +344,12 @@ class DelegatedFactoryTests(unittest.TestCase): def test_is_delegated_provider(self): self.assertTrue( providers.is_delegated(providers.DelegatedFactory(object))) + + def test_repr(self): + provider = providers.DelegatedFactory(Example) + + self.assertEqual(repr(provider), + ''.format( + repr(Example), + hex(id(provider)))) diff --git a/tests/unit/providers/test_singletons.py b/tests/unit/providers/test_singletons.py index 549e7590..2ff4b61b 100644 --- a/tests/unit/providers/test_singletons.py +++ b/tests/unit/providers/test_singletons.py @@ -344,7 +344,7 @@ class SingletonTests(_BaseSingletonTestCase, unittest.TestCase): provider = self.singleton_cls(Example) self.assertEqual(repr(provider), - ''.format( repr(Example), hex(id(provider)))) @@ -362,7 +362,7 @@ class DelegatedSingletonTests(_BaseSingletonTestCase, unittest.TestCase): provider = self.singleton_cls(Example) self.assertEqual(repr(provider), - ''.format( repr(Example), hex(id(provider)))) @@ -376,7 +376,7 @@ class ThreadLocalSingletonTests(_BaseSingletonTestCase, unittest.TestCase): provider = providers.ThreadLocalSingleton(Example) self.assertEqual(repr(provider), - ''.format( repr(Example), hex(id(provider)))) @@ -395,7 +395,7 @@ class DelegatedThreadLocalSingletonTests(_BaseSingletonTestCase, provider = self.singleton_cls(Example) self.assertEqual(repr(provider), - ''.format( repr(Example), hex(id(provider)))) @@ -409,7 +409,7 @@ class ThreadSafeSingletonTests(_BaseSingletonTestCase, unittest.TestCase): provider = self.singleton_cls(Example) self.assertEqual(repr(provider), - ''.format( repr(Example), hex(id(provider)))) @@ -428,7 +428,7 @@ class DelegatedThreadSafeSingletonTests(_BaseSingletonTestCase, provider = self.singleton_cls(Example) self.assertEqual(repr(provider), - ''.format( repr(Example), hex(id(provider))))