python-injection 0.18.11__tar.gz → 0.18.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_injection-0.18.11 → python_injection-0.18.12}/PKG-INFO +1 -1
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/__init__.pyi +7 -5
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/descriptors.py +4 -1
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/ext/fastapi.py +1 -1
- {python_injection-0.18.11 → python_injection-0.18.12}/pyproject.toml +1 -1
- {python_injection-0.18.11 → python_injection-0.18.12}/.gitignore +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/LICENSE +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/README.md +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/__init__.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/__init__.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/__init__.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/asynchronous.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/event.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/invertible.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/key.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/lazy.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/threading.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/type.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/injectables.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/module.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/scope.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/slots.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/entrypoint.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/exceptions.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/ext/__init__.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/ext/fastapi.pyi +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/loaders.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/py.typed +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/testing/__init__.py +0 -0
- {python_injection-0.18.11 → python_injection-0.18.12}/injection/testing/__init__.pyi +0 -0
@@ -78,7 +78,9 @@ class LazyInstance[T]:
|
|
78
78
|
cls: _InputType[T],
|
79
79
|
/,
|
80
80
|
default: T = ...,
|
81
|
+
*,
|
81
82
|
module: Module = ...,
|
83
|
+
threadsafe: bool = ...,
|
82
84
|
) -> None: ...
|
83
85
|
@overload
|
84
86
|
def __get__(self, instance: object, owner: type | None = ...) -> T: ...
|
@@ -178,9 +180,9 @@ class Module:
|
|
178
180
|
mode: Mode | ModeStr = ...,
|
179
181
|
) -> Any:
|
180
182
|
"""
|
181
|
-
Decorator applicable to a class
|
182
|
-
|
183
|
-
|
183
|
+
Decorator applicable to a class. It is used to indicate how the constant is
|
184
|
+
constructed. At injection time, the injected instance will always be the same.
|
185
|
+
Unlike `@singleton`, dependencies will not be resolved.
|
184
186
|
"""
|
185
187
|
|
186
188
|
def set_constant[T](
|
@@ -292,8 +294,8 @@ class Module:
|
|
292
294
|
) -> _Invertible[T | Default]:
|
293
295
|
"""
|
294
296
|
Function used to retrieve an instance associated with the type passed in
|
295
|
-
parameter or `NotImplemented`. Return
|
296
|
-
contained in an invertible object, simply use a wavy line (~).
|
297
|
+
parameter or `NotImplemented`. Return an `Invertible` object. To access the
|
298
|
+
instance contained in an invertible object, simply use a wavy line (~).
|
297
299
|
|
298
300
|
Example: instance = ~lazy_instance
|
299
301
|
"""
|
@@ -15,9 +15,12 @@ class LazyInstance[T]:
|
|
15
15
|
cls: InputType[T],
|
16
16
|
/,
|
17
17
|
default: T = NotImplemented,
|
18
|
+
*,
|
18
19
|
module: Module | None = None,
|
20
|
+
threadsafe: bool = False,
|
19
21
|
) -> None:
|
20
|
-
|
22
|
+
module = module or mod()
|
23
|
+
self.__value = module.get_lazy_instance(cls, default, threadsafe=threadsafe)
|
21
24
|
|
22
25
|
def __get__(
|
23
26
|
self,
|
@@ -12,7 +12,7 @@ __all__ = ("Inject", "InjectThreadSafe")
|
|
12
12
|
@dataclass(eq=False, frozen=True, slots=True)
|
13
13
|
class FastAPIInject:
|
14
14
|
module: Module = field(default_factory=mod)
|
15
|
-
threadsafe: bool = field(default=False)
|
15
|
+
threadsafe: bool = field(default=False, kw_only=True)
|
16
16
|
|
17
17
|
def __call__[T](
|
18
18
|
self,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{python_injection-0.18.11 → python_injection-0.18.12}/injection/_core/common/asynchronous.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|