mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 18:07:44 +03:00 
			
		
		
		
	* Implement string imports for Factory, Callable, Singletons, and Resource * Refactor the implementation * Add tests * Update tests to pass on Python 2 * Update typing and add typing tests * Update changelog * Update docs
		
			
				
	
	
		
			16 lines
		
	
	
		
			349 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			349 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from typing import Coroutine
 | 
						|
 | 
						|
from dependency_injector import providers
 | 
						|
 | 
						|
 | 
						|
async def _coro() -> None:
 | 
						|
    ...
 | 
						|
 | 
						|
# Test 1: to check the return type
 | 
						|
provider1 = providers.Coroutine(_coro)
 | 
						|
var1: Coroutine = provider1()
 | 
						|
 | 
						|
# Test 2: to check string imports
 | 
						|
provider2: providers.Coroutine[None] = providers.Coroutine("_coro")
 | 
						|
provider2.set_provides("_coro")
 |