mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 09:57:37 +03:00 
			
		
		
		
	Add .initializer attribute to Resource provider
This commit is contained in:
		
							parent
							
								
									7a2c61e9f8
								
							
						
					
					
						commit
						385437e2d4
					
				| 
						 | 
					@ -12,6 +12,7 @@ Development version
 | 
				
			||||||
- Add ``.provides`` attribute to ``Singleton`` and its subclasses.
 | 
					- Add ``.provides`` attribute to ``Singleton`` and its subclasses.
 | 
				
			||||||
  It's a consistency change to make ``Singleton`` match ``Callable``
 | 
					  It's a consistency change to make ``Singleton`` match ``Callable``
 | 
				
			||||||
  and ``Factory`` interfaces.
 | 
					  and ``Factory`` interfaces.
 | 
				
			||||||
 | 
					- Add ``.initializer`` attribute to ``Resource`` provider.
 | 
				
			||||||
- Update string representation of ``Resource`` provider.
 | 
					- Update string representation of ``Resource`` provider.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
4.13.2
 | 
					4.13.2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -319,6 +319,8 @@ class Resource(Provider[T]):
 | 
				
			||||||
    @overload
 | 
					    @overload
 | 
				
			||||||
    def __init__(self, initializer: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
 | 
					    def __init__(self, initializer: _Callable[..., T], *args: Injection, **kwargs: Injection) -> None: ...
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
 | 
					    def initializer(self) -> _Callable[..., Any]: ...
 | 
				
			||||||
 | 
					    @property
 | 
				
			||||||
    def args(self) -> Tuple[Injection]: ...
 | 
					    def args(self) -> Tuple[Injection]: ...
 | 
				
			||||||
    def add_args(self, *args: Injection) -> Resource[T]: ...
 | 
					    def add_args(self, *args: Injection) -> Resource[T]: ...
 | 
				
			||||||
    def set_args(self, *args: Injection) -> Resource[T]: ...
 | 
					    def set_args(self, *args: Injection) -> Resource[T]: ...
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2999,6 +2999,11 @@ cdef class Resource(Provider):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        return represent_provider(provider=self, provides=self.__initializer)
 | 
					        return represent_provider(provider=self, provides=self.__initializer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @property
 | 
				
			||||||
 | 
					    def initializer(self):
 | 
				
			||||||
 | 
					        """Return initializer."""
 | 
				
			||||||
 | 
					        return self.__initializer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def args(self):
 | 
					    def args(self):
 | 
				
			||||||
        """Return positional argument injections."""
 | 
					        """Return positional argument injections."""
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user