mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 09:57:37 +03:00 
			
		
		
		
	Migrate to Cython3 (#813)
* Fix asyncio tests * Convert class-private attributes to just private * Upgrade to Cython 3 * Regenerate C files * Fix tox coverage report
This commit is contained in:
		
							parent
							
								
									13a7ef609b
								
							
						
					
					
						commit
						595daebd3a
					
				
							
								
								
									
										8
									
								
								.github/workflows/tests-and-linters.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/tests-and-linters.yml
									
									
									
									
										vendored
									
									
								
							| 
						 | 
					@ -40,8 +40,8 @@ jobs:
 | 
				
			||||||
    name: Run tests with coverage
 | 
					    name: Run tests with coverage
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    env:
 | 
					    env:
 | 
				
			||||||
      # Cython's version <3 issue with tracing: "error: no member named 'use_tracing' in 'struct _PyCFrame'"
 | 
					      DEPENDENCY_INJECTOR_DEBUG_MODE: 1
 | 
				
			||||||
      # DEPENDENCY_INJECTOR_DEBUG_MODE: 1
 | 
					      PIP_VERBOSE: 1
 | 
				
			||||||
      COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
 | 
					      COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
 | 
				
			||||||
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
					      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
| 
						 | 
					@ -49,9 +49,9 @@ jobs:
 | 
				
			||||||
      - uses: actions/setup-python@v4
 | 
					      - uses: actions/setup-python@v4
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          python-version: 3.12
 | 
					          python-version: 3.12
 | 
				
			||||||
      - run: pip install tox cython==0.29.37
 | 
					      - run: pip install tox 'cython>=3,<4'
 | 
				
			||||||
      - run: make cythonize
 | 
					      - run: make cythonize
 | 
				
			||||||
      - run: tox
 | 
					      - run: tox -vv
 | 
				
			||||||
        env:
 | 
					        env:
 | 
				
			||||||
          TOXENV: coveralls
 | 
					          TOXENV: coveralls
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| 
						 | 
					@ -2,7 +2,7 @@ VERSION := $(shell python setup.py --version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')
 | 
					CYTHON_SRC := $(shell find src/dependency_injector -name '*.pyx')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CYTHON_DIRECTIVES = -Xlanguage_level=2
 | 
					CYTHON_DIRECTIVES = -Xlanguage_level=3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
 | 
					ifdef DEPENDENCY_INJECTOR_DEBUG_MODE
 | 
				
			||||||
	CYTHON_DIRECTIVES += -Xprofile=True
 | 
						CYTHON_DIRECTIVES += -Xprofile=True
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
cython==0.29.37
 | 
					cython>=3,<4
 | 
				
			||||||
pytest
 | 
					pytest
 | 
				
			||||||
pytest-asyncio
 | 
					pytest-asyncio
 | 
				
			||||||
tox
 | 
					tox
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,3 @@
 | 
				
			||||||
flask==2.1.3
 | 
					flask==2.1.3
 | 
				
			||||||
werkzeug==2.2.2
 | 
					werkzeug==2.2.2
 | 
				
			||||||
aiohttp==3.9.0b1
 | 
					aiohttp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -20,10 +20,10 @@ cdef tuple __COROUTINE_TYPES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Base providers
 | 
					# Base providers
 | 
				
			||||||
cdef class Provider(object):
 | 
					cdef class Provider(object):
 | 
				
			||||||
    cdef tuple __overridden
 | 
					    cdef tuple _overridden
 | 
				
			||||||
    cdef Provider __last_overriding
 | 
					    cdef Provider _last_overriding
 | 
				
			||||||
    cdef tuple __overrides
 | 
					    cdef tuple _overrides
 | 
				
			||||||
    cdef int __async_mode
 | 
					    cdef int _async_mode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef bint is_async_mode_enabled(self)
 | 
					    cpdef bint is_async_mode_enabled(self)
 | 
				
			||||||
    cpdef bint is_async_mode_disabled(self)
 | 
					    cpdef bint is_async_mode_disabled(self)
 | 
				
			||||||
| 
						 | 
					@ -34,32 +34,32 @@ cdef class Provider(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Object(Provider):
 | 
					cdef class Object(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Self(Provider):
 | 
					cdef class Self(Provider):
 | 
				
			||||||
    cdef object __container
 | 
					    cdef object _container
 | 
				
			||||||
    cdef tuple __alt_names
 | 
					    cdef tuple _alt_names
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Delegate(Provider):
 | 
					cdef class Delegate(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Aggregate(Provider):
 | 
					cdef class Aggregate(Provider):
 | 
				
			||||||
    cdef dict __providers
 | 
					    cdef dict _providers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef Provider __get_provider(self, object provider_name)
 | 
					    cdef Provider __get_provider(self, object provider_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Dependency(Provider):
 | 
					cdef class Dependency(Provider):
 | 
				
			||||||
    cdef object __instance_of
 | 
					    cdef object _instance_of
 | 
				
			||||||
    cdef object __default
 | 
					    cdef object _default
 | 
				
			||||||
    cdef object __parent
 | 
					    cdef object _parent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class ExternalDependency(Dependency):
 | 
					cdef class ExternalDependency(Dependency):
 | 
				
			||||||
| 
						 | 
					@ -67,21 +67,21 @@ cdef class ExternalDependency(Dependency):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class DependenciesContainer(Object):
 | 
					cdef class DependenciesContainer(Object):
 | 
				
			||||||
    cdef dict __providers
 | 
					    cdef dict _providers
 | 
				
			||||||
    cdef object __parent
 | 
					    cdef object _parent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _override_providers(self, object container)
 | 
					    cpdef object _override_providers(self, object container)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Callable providers
 | 
					# Callable providers
 | 
				
			||||||
cdef class Callable(Provider):
 | 
					cdef class Callable(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef tuple __args
 | 
					    cdef tuple _args
 | 
				
			||||||
    cdef int __args_len
 | 
					    cdef int _args_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef tuple __kwargs
 | 
					    cdef tuple _kwargs
 | 
				
			||||||
    cdef int __kwargs_len
 | 
					    cdef int _kwargs_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,11 +117,11 @@ cdef class CoroutineDelegate(Delegate):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Configuration providers
 | 
					# Configuration providers
 | 
				
			||||||
cdef class ConfigurationOption(Provider):
 | 
					cdef class ConfigurationOption(Provider):
 | 
				
			||||||
    cdef tuple __name
 | 
					    cdef tuple _name
 | 
				
			||||||
    cdef Configuration __root
 | 
					    cdef Configuration _root
 | 
				
			||||||
    cdef dict __children
 | 
					    cdef dict _children
 | 
				
			||||||
    cdef bint __required
 | 
					    cdef bint _required
 | 
				
			||||||
    cdef object __cache
 | 
					    cdef object _cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class TypedConfigurationOption(Callable):
 | 
					cdef class TypedConfigurationOption(Callable):
 | 
				
			||||||
| 
						 | 
					@ -129,22 +129,22 @@ cdef class TypedConfigurationOption(Callable):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Configuration(Object):
 | 
					cdef class Configuration(Object):
 | 
				
			||||||
    cdef str __name
 | 
					    cdef str _name
 | 
				
			||||||
    cdef bint __strict
 | 
					    cdef bint __strict
 | 
				
			||||||
    cdef dict __children
 | 
					    cdef dict _children
 | 
				
			||||||
    cdef list __ini_files
 | 
					    cdef list _ini_files
 | 
				
			||||||
    cdef list __yaml_files
 | 
					    cdef list _yaml_files
 | 
				
			||||||
    cdef list __json_files
 | 
					    cdef list _json_files
 | 
				
			||||||
    cdef list __pydantic_settings
 | 
					    cdef list _pydantic_settings
 | 
				
			||||||
    cdef object __weakref__
 | 
					    cdef object __weakref__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Factory providers
 | 
					# Factory providers
 | 
				
			||||||
cdef class Factory(Provider):
 | 
					cdef class Factory(Provider):
 | 
				
			||||||
    cdef Callable __instantiator
 | 
					    cdef Callable _instantiator
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef tuple __attributes
 | 
					    cdef tuple _attributes
 | 
				
			||||||
    cdef int __attributes_len
 | 
					    cdef int _attributes_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -167,8 +167,8 @@ cdef class FactoryAggregate(Aggregate):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Singleton providers
 | 
					# Singleton providers
 | 
				
			||||||
cdef class BaseSingleton(Provider):
 | 
					cdef class BaseSingleton(Provider):
 | 
				
			||||||
    cdef Factory __instantiator
 | 
					    cdef Factory _instantiator
 | 
				
			||||||
    cdef object __storage
 | 
					    cdef object _storage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Singleton(BaseSingleton):
 | 
					cdef class Singleton(BaseSingleton):
 | 
				
			||||||
| 
						 | 
					@ -181,7 +181,7 @@ cdef class DelegatedSingleton(Singleton):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class ThreadSafeSingleton(BaseSingleton):
 | 
					cdef class ThreadSafeSingleton(BaseSingleton):
 | 
				
			||||||
    cdef object __storage_lock
 | 
					    cdef object _storage_lock
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -215,87 +215,87 @@ cdef class SingletonDelegate(Delegate):
 | 
				
			||||||
# Miscellaneous providers
 | 
					# Miscellaneous providers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class List(Provider):
 | 
					cdef class List(Provider):
 | 
				
			||||||
    cdef tuple __args
 | 
					    cdef tuple _args
 | 
				
			||||||
    cdef int __args_len
 | 
					    cdef int _args_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Dict(Provider):
 | 
					cdef class Dict(Provider):
 | 
				
			||||||
    cdef tuple __kwargs
 | 
					    cdef tuple _kwargs
 | 
				
			||||||
    cdef int __kwargs_len
 | 
					    cdef int _kwargs_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Resource(Provider):
 | 
					cdef class Resource(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
    cdef bint __initialized
 | 
					    cdef bint _initialized
 | 
				
			||||||
    cdef object __shutdowner
 | 
					    cdef object _shutdowner
 | 
				
			||||||
    cdef object __resource
 | 
					    cdef object _resource
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef tuple __args
 | 
					    cdef tuple _args
 | 
				
			||||||
    cdef int __args_len
 | 
					    cdef int _args_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef tuple __kwargs
 | 
					    cdef tuple _kwargs
 | 
				
			||||||
    cdef int __kwargs_len
 | 
					    cdef int _kwargs_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Container(Provider):
 | 
					cdef class Container(Provider):
 | 
				
			||||||
    cdef object __container_cls
 | 
					    cdef object _container_cls
 | 
				
			||||||
    cdef dict __overriding_providers
 | 
					    cdef dict _overriding_providers
 | 
				
			||||||
    cdef object __container
 | 
					    cdef object _container
 | 
				
			||||||
    cdef object __parent
 | 
					    cdef object _parent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class Selector(Provider):
 | 
					cdef class Selector(Provider):
 | 
				
			||||||
    cdef object __selector
 | 
					    cdef object _selector
 | 
				
			||||||
    cdef dict __providers
 | 
					    cdef dict _providers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Provided instance
 | 
					# Provided instance
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class ProvidedInstance(Provider):
 | 
					cdef class ProvidedInstance(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class AttributeGetter(Provider):
 | 
					cdef class AttributeGetter(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
    cdef object __name
 | 
					    cdef object _name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class ItemGetter(Provider):
 | 
					cdef class ItemGetter(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
    cdef object __name
 | 
					    cdef object _name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class MethodCaller(Provider):
 | 
					cdef class MethodCaller(Provider):
 | 
				
			||||||
    cdef object __provides
 | 
					    cdef object _provides
 | 
				
			||||||
    cdef tuple __args
 | 
					    cdef tuple _args
 | 
				
			||||||
    cdef int __args_len
 | 
					    cdef int _args_len
 | 
				
			||||||
    cdef tuple __kwargs
 | 
					    cdef tuple _kwargs
 | 
				
			||||||
    cdef int __kwargs_len
 | 
					    cdef int _kwargs_len
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpdef object _provide(self, tuple args, dict kwargs)
 | 
					    cpdef object _provide(self, tuple args, dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Injections
 | 
					# Injections
 | 
				
			||||||
cdef class Injection(object):
 | 
					cdef class Injection(object):
 | 
				
			||||||
    cdef object __value
 | 
					    cdef object _value
 | 
				
			||||||
    cdef int __is_provider
 | 
					    cdef int _is_provider
 | 
				
			||||||
    cdef int __is_delegated
 | 
					    cdef int _is_delegated
 | 
				
			||||||
    cdef int __call
 | 
					    cdef int _call
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class PositionalInjection(Injection):
 | 
					cdef class PositionalInjection(Injection):
 | 
				
			||||||
| 
						 | 
					@ -303,7 +303,7 @@ cdef class PositionalInjection(Injection):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class NamedInjection(Injection):
 | 
					cdef class NamedInjection(Injection):
 | 
				
			||||||
    cdef object __name
 | 
					    cdef object _name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cpdef tuple parse_positional_injections(tuple args)
 | 
					cpdef tuple parse_positional_injections(tuple args)
 | 
				
			||||||
| 
						 | 
					@ -314,12 +314,12 @@ cpdef tuple parse_named_injections(dict kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Utils
 | 
					# Utils
 | 
				
			||||||
cdef class OverridingContext(object):
 | 
					cdef class OverridingContext(object):
 | 
				
			||||||
    cdef Provider __overridden
 | 
					    cdef Provider _overridden
 | 
				
			||||||
    cdef Provider __overriding
 | 
					    cdef Provider _overriding
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class BaseSingletonResetContext(object):
 | 
					cdef class BaseSingletonResetContext(object):
 | 
				
			||||||
    cdef object __singleton
 | 
					    cdef object _singleton
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef class SingletonResetContext(BaseSingletonResetContext):
 | 
					cdef class SingletonResetContext(BaseSingletonResetContext):
 | 
				
			||||||
| 
						 | 
					@ -356,19 +356,19 @@ cpdef object deepcopy(object instance, dict memo=*)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Inline helper functions
 | 
					# Inline helper functions
 | 
				
			||||||
cdef inline object __get_name(NamedInjection self):
 | 
					cdef inline object __get_name(NamedInjection self):
 | 
				
			||||||
    return self.__name
 | 
					    return self._name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef inline object __get_value(Injection self):
 | 
					cdef inline object __get_value(Injection self):
 | 
				
			||||||
    if self.__call == 0:
 | 
					    if self._call == 0:
 | 
				
			||||||
        return self.__value
 | 
					        return self._value
 | 
				
			||||||
    return self.__value()
 | 
					    return self._value()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef inline object __get_value_kwargs(Injection self, dict kwargs):
 | 
					cdef inline object __get_value_kwargs(Injection self, dict kwargs):
 | 
				
			||||||
    if self.__call == 0:
 | 
					    if self._call == 0:
 | 
				
			||||||
        return self.__value
 | 
					        return self._value
 | 
				
			||||||
    return self.__value(**kwargs)
 | 
					    return self._value(**kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef inline tuple __separate_prefixed_kwargs(dict kwargs):
 | 
					cdef inline tuple __separate_prefixed_kwargs(dict kwargs):
 | 
				
			||||||
| 
						 | 
					@ -633,14 +633,14 @@ cdef inline object __async_result_callback(object future_result, object future):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cdef inline object __callable_call(Callable self, tuple args, dict kwargs, ):
 | 
					cdef inline object __callable_call(Callable self, tuple args, dict kwargs, ):
 | 
				
			||||||
    return __call(
 | 
					    return __call(
 | 
				
			||||||
        self.__provides,
 | 
					        self._provides,
 | 
				
			||||||
        args,
 | 
					        args,
 | 
				
			||||||
        self.__args,
 | 
					        self._args,
 | 
				
			||||||
        self.__args_len,
 | 
					        self._args_len,
 | 
				
			||||||
        kwargs,
 | 
					        kwargs,
 | 
				
			||||||
        self.__kwargs,
 | 
					        self._kwargs,
 | 
				
			||||||
        self.__kwargs_len,
 | 
					        self._kwargs_len,
 | 
				
			||||||
        self.__async_mode,
 | 
					        self._async_mode,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -648,18 +648,18 @@ cdef inline object __factory_call(Factory self, tuple args, dict kwargs):
 | 
				
			||||||
    cdef object instance
 | 
					    cdef object instance
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    instance = __call(
 | 
					    instance = __call(
 | 
				
			||||||
        self.__instantiator.__provides,
 | 
					        self._instantiator._provides,
 | 
				
			||||||
        args,
 | 
					        args,
 | 
				
			||||||
        self.__instantiator.__args,
 | 
					        self._instantiator._args,
 | 
				
			||||||
        self.__instantiator.__args_len,
 | 
					        self._instantiator._args_len,
 | 
				
			||||||
        kwargs,
 | 
					        kwargs,
 | 
				
			||||||
        self.__instantiator.__kwargs,
 | 
					        self._instantiator._kwargs,
 | 
				
			||||||
        self.__instantiator.__kwargs_len,
 | 
					        self._instantiator._kwargs_len,
 | 
				
			||||||
        self.__async_mode,
 | 
					        self._async_mode,
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if self.__attributes_len > 0:
 | 
					    if self._attributes_len > 0:
 | 
				
			||||||
        attributes = __provide_attributes(self.__attributes, self.__attributes_len)
 | 
					        attributes = __provide_attributes(self._attributes, self._attributes_len)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        is_future_instance = __is_future_or_coroutine(instance)
 | 
					        is_future_instance = __is_future_or_coroutine(instance)
 | 
				
			||||||
        is_future_attributes = __is_future_or_coroutine(attributes)
 | 
					        is_future_attributes = __is_future_or_coroutine(attributes)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -4,6 +4,7 @@ from aiohttp import web, test_utils
 | 
				
			||||||
from dependency_injector import containers, providers
 | 
					from dependency_injector import containers, providers
 | 
				
			||||||
from dependency_injector.ext import aiohttp
 | 
					from dependency_injector.ext import aiohttp
 | 
				
			||||||
from pytest import fixture, mark
 | 
					from pytest import fixture, mark
 | 
				
			||||||
 | 
					from pytest_asyncio import fixture as aio_fixture
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def index_view(_):
 | 
					async def index_view(_):
 | 
				
			||||||
| 
						 | 
					@ -63,7 +64,7 @@ def app():
 | 
				
			||||||
    return app
 | 
					    return app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@fixture
 | 
					@aio_fixture
 | 
				
			||||||
async def client(app):
 | 
					async def client(app):
 | 
				
			||||||
    async with test_utils.TestClient(test_utils.TestServer(app)) as client:
 | 
					    async with test_utils.TestClient(test_utils.TestServer(app)) as client:
 | 
				
			||||||
        yield client
 | 
					        yield client
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
from httpx import AsyncClient
 | 
					from httpx import AsyncClient
 | 
				
			||||||
from pytest import fixture, mark
 | 
					from pytest import fixture, mark
 | 
				
			||||||
 | 
					from pytest_asyncio import fixture as aio_fixture
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
 | 
					# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
| 
						 | 
					@ -16,7 +17,7 @@ sys.path.append(_SAMPLES_DIR)
 | 
				
			||||||
from wiringfastapi import web
 | 
					from wiringfastapi import web
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@fixture
 | 
					@aio_fixture
 | 
				
			||||||
async def async_client():
 | 
					async def async_client():
 | 
				
			||||||
    client = AsyncClient(app=web.app, base_url="http://test")
 | 
					    client = AsyncClient(app=web.app, base_url="http://test")
 | 
				
			||||||
    yield client
 | 
					    yield client
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								tox.ini
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tox.ini
									
									
									
									
									
								
							| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
[tox]
 | 
					[tox]
 | 
				
			||||||
 | 
					parallel_show_output = true
 | 
				
			||||||
envlist=
 | 
					envlist=
 | 
				
			||||||
    coveralls, pylint, flake8, pydocstyle, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, pypy3.9, pypy3.10
 | 
					    coveralls, pylint, flake8, pydocstyle, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, pypy3.9, pypy3.10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,11 +25,11 @@ commands = pytest -c tests/.configs/pytest.ini
 | 
				
			||||||
python_files = test_*_py3*.py
 | 
					python_files = test_*_py3*.py
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[testenv:coveralls]
 | 
					[testenv:coveralls]
 | 
				
			||||||
passenv = GITHUB_*, COVERALLS_*
 | 
					passenv = GITHUB_*, COVERALLS_*, DEPENDENCY_INJECTOR_*
 | 
				
			||||||
basepython=python3.12
 | 
					basepython=python3.12
 | 
				
			||||||
deps=
 | 
					deps=
 | 
				
			||||||
    {[testenv]deps}
 | 
					    {[testenv]deps}
 | 
				
			||||||
    cython<3.0
 | 
					    cython>=3,<4
 | 
				
			||||||
    coverage
 | 
					    coverage
 | 
				
			||||||
    coveralls
 | 
					    coveralls
 | 
				
			||||||
commands=
 | 
					commands=
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user