mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-10-31 16:07:51 +03:00 
			
		
		
		
	Make Provider stub generic and remove types module
This commit is contained in:
		
							parent
							
								
									7fc2f458a5
								
							
						
					
					
						commit
						2efefca7c0
					
				|  | @ -27,9 +27,9 @@ class OverridingContext: | |||
|     def __exit__(self, *_: Any) -> None: ... | ||||
| 
 | ||||
| 
 | ||||
| class Provider(_Provider): | ||||
| class Provider(Generic[T]): | ||||
|     def __init__(self) -> None: ... | ||||
|     def __call__(self, *args: Injection, **kwargs: Injection) -> Any: ... | ||||
|     def __call__(self, *args: Injection, **kwargs: Injection) -> T: ... | ||||
|     def __deepcopy__(self, memo: Optional[Dict[str, Any]]) -> Provider: ... | ||||
|     def __str__(self) -> str: ... | ||||
|     def __repr__(self) -> str: ... | ||||
|  |  | |||
|  | @ -1,9 +0,0 @@ | |||
| from typing import TypeVar, Generic, Any | ||||
| 
 | ||||
| 
 | ||||
| Injection = Any | ||||
| T = TypeVar('T') | ||||
| 
 | ||||
| 
 | ||||
| class Provider(Generic[T]): | ||||
|     def __call__(self, *args: Injection, **kwargs: Injection) -> T: ... | ||||
|  | @ -1,6 +1,6 @@ | |||
| from typing import Tuple, Any, Dict | ||||
| 
 | ||||
| from dependency_injector import providers, types | ||||
| from dependency_injector import providers | ||||
| 
 | ||||
| 
 | ||||
| class Animal: | ||||
|  | @ -64,5 +64,5 @@ factory_b_9: providers.Factory = provider9.b | |||
| val9: Any = provider9('a') | ||||
| 
 | ||||
| # Test 10: to check the explicit typing | ||||
| factory10: types.Provider[Animal] = providers.Factory(Cat) | ||||
| factory10: providers.Provider[Animal] = providers.Factory(Cat) | ||||
| animal10: Animal = factory10() | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user