python-injection 0.19.5__py3-none-any.whl → 0.19.5.post1__py3-none-any.whl
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.
- injection/__init__.pyi +1 -0
- injection/_core/common/type.py +5 -5
- injection/_core/module.py +6 -5
- injection/entrypoint.py +4 -0
- {python_injection-0.19.5.dist-info → python_injection-0.19.5.post1.dist-info}/METADATA +1 -1
- {python_injection-0.19.5.dist-info → python_injection-0.19.5.post1.dist-info}/RECORD +8 -8
- {python_injection-0.19.5.dist-info → python_injection-0.19.5.post1.dist-info}/WHEEL +0 -0
- {python_injection-0.19.5.dist-info → python_injection-0.19.5.post1.dist-info}/licenses/LICENSE +0 -0
injection/__init__.pyi
CHANGED
injection/_core/common/type.py
CHANGED
@@ -54,10 +54,10 @@ def get_return_hint[T](function: Callable[..., T]) -> InputType[T] | None:
|
|
54
54
|
|
55
55
|
def get_yield_hint[T](
|
56
56
|
function: Callable[..., Iterator[T]] | Callable[..., AsyncIterator[T]],
|
57
|
-
) -> InputType[T] |
|
57
|
+
) -> tuple[InputType[T]] | tuple[()]:
|
58
58
|
return_type = get_return_hint(function)
|
59
59
|
|
60
|
-
if get_origin(return_type)
|
60
|
+
if get_origin(return_type) in {
|
61
61
|
AsyncGenerator,
|
62
62
|
AsyncIterable,
|
63
63
|
AsyncIterator,
|
@@ -65,10 +65,10 @@ def get_yield_hint[T](
|
|
65
65
|
Iterable,
|
66
66
|
Iterator,
|
67
67
|
}:
|
68
|
-
|
68
|
+
for arg in get_args(return_type):
|
69
|
+
return (arg,)
|
69
70
|
|
70
|
-
|
71
|
-
return next(iter(args), None)
|
71
|
+
return ()
|
72
72
|
|
73
73
|
|
74
74
|
def standardize_types(
|
injection/_core/module.py
CHANGED
@@ -337,12 +337,14 @@ class Locator(Broker):
|
|
337
337
|
cls: InputType[T],
|
338
338
|
) -> bool:
|
339
339
|
new_mode, existing_mode = new.mode, existing.mode
|
340
|
-
is_override = new_mode == Mode.OVERRIDE
|
341
340
|
|
342
|
-
if new_mode ==
|
341
|
+
if new_mode == Mode.OVERRIDE:
|
342
|
+
return True
|
343
|
+
|
344
|
+
elif new_mode == existing_mode:
|
343
345
|
raise RuntimeError(f"An injectable already exists for the class `{cls}`.")
|
344
346
|
|
345
|
-
return
|
347
|
+
return new_mode.rank > existing_mode.rank
|
346
348
|
|
347
349
|
@staticmethod
|
348
350
|
def __standardize_inputs[T](
|
@@ -481,13 +483,12 @@ class Module(Broker, EventListener):
|
|
481
483
|
injectable_class = SimpleScopedInjectable
|
482
484
|
hint = wrapper = wrapped # type: ignore[assignment]
|
483
485
|
|
484
|
-
hints = on if hint is None else (hint, on)
|
485
486
|
self.injectable(
|
486
487
|
wrapper,
|
487
488
|
cls=partial(injectable_class, scope_name=scope_name),
|
488
489
|
ignore_type_hint=True,
|
489
490
|
inject=inject,
|
490
|
-
on=
|
491
|
+
on=(hint, on),
|
491
492
|
mode=mode,
|
492
493
|
)
|
493
494
|
return wrapped
|
injection/entrypoint.py
CHANGED
@@ -41,6 +41,10 @@ def autocall[T: Callable[..., Any]](
|
|
41
41
|
return decorator(wrapped) if wrapped else decorator
|
42
42
|
|
43
43
|
|
44
|
+
# SMP = Setup Method Parameters
|
45
|
+
# EPP = EntryPoint Parameters
|
46
|
+
|
47
|
+
|
44
48
|
@overload
|
45
49
|
def entrypointmaker[**SMP, **EPP, T1, T2](
|
46
50
|
wrapped: EntrypointSetupMethod[SMP, EPP, T1, T2],
|
@@ -1,6 +1,6 @@
|
|
1
1
|
injection/__init__.py,sha256=iJm0BbyGZw-Qr5e8d2C3n8-7FiVD-sy4LU_i_n3AgHY,1318
|
2
|
-
injection/__init__.pyi,sha256=
|
3
|
-
injection/entrypoint.py,sha256=
|
2
|
+
injection/__init__.pyi,sha256=8uWRfGfkVCfWBx4X4XsRyo1l7vKym6-vmcMklPyVMqg,15672
|
3
|
+
injection/entrypoint.py,sha256=W76YNPNgvT5UGb2lAqMas4GKPl7xb8GW3rRL34jIWzU,5017
|
4
4
|
injection/exceptions.py,sha256=v57yMujiq6H_zwwn30A8UYEZX9R9k-bY8FnsdaimPM4,1025
|
5
5
|
injection/loaders.py,sha256=gKlJfe9nXCuB8r6j0RF9_2FHC6YplM8GQYsgRqyxYw8,7257
|
6
6
|
injection/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -8,7 +8,7 @@ injection/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
injection/_core/asfunction.py,sha256=fTgAAWsDWUz89kYsoSVDXdqYKIuh6HtUW5MohGp3ov4,1767
|
9
9
|
injection/_core/descriptors.py,sha256=1OX6JnM8Ux14vW1JSW3FzPgKc2VMTKqJUYBGT3Ypafg,800
|
10
10
|
injection/_core/injectables.py,sha256=fxhiGv7qTCbUunhhd6a3ahosFmgznUFsEvqlwxi4gS4,6098
|
11
|
-
injection/_core/module.py,sha256=
|
11
|
+
injection/_core/module.py,sha256=ibWfaNNVjQ4ccu7rabvXeog_EDCsjS-TbFBMuRHXS_k,32616
|
12
12
|
injection/_core/scope.py,sha256=r094k1Vjvwm0hTf7AQGYrxxvqQgb7_CDVUKaHQ8wyeM,8772
|
13
13
|
injection/_core/slots.py,sha256=g9TG6CbqRzCsjg01iPyfRtTTUCJnnJOwcj9mJabH0dc,37
|
14
14
|
injection/_core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -18,13 +18,13 @@ injection/_core/common/invertible.py,sha256=gA_vw5nBjgp_w9MrDK5jMO8lhuOQWON8BbPp
|
|
18
18
|
injection/_core/common/key.py,sha256=ghkZD-Y8Moz6SEPNgMh3xgsZUjDVq-XYAmXaCu5VuCA,80
|
19
19
|
injection/_core/common/lazy.py,sha256=hZvz9LhlYxVkD_D8VBAvQmy7YuVaaw075jq0XM0w9_Y,1193
|
20
20
|
injection/_core/common/threading.py,sha256=kwRXNa9ocndIqeZA9kMHjEa8SBpHFcJARj1bgrWCpxE,225
|
21
|
-
injection/_core/common/type.py,sha256=
|
21
|
+
injection/_core/common/type.py,sha256=U7PtuH-FuMgw75LB7xy-arJRJXojxsJDQbhnTqA4P-o,2567
|
22
22
|
injection/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
23
|
injection/ext/fastapi.py,sha256=fiy3-mZIIwGcql3Y5ekFX8_7hALzqXP5u40qbtNE73o,1441
|
24
24
|
injection/ext/fastapi.pyi,sha256=HLs7mfruIEFRrN_Xf8oCvSa4qwHWfwm6HHU_KMedXkE,185
|
25
25
|
injection/testing/__init__.py,sha256=bJ7WXBXrw4rHc91AFVFnOwFLWOlpvX9Oh2SnRQ_NESo,919
|
26
26
|
injection/testing/__init__.pyi,sha256=raGsGlxwbz3jkzJwA_5oCIE1emWINjT2UuwzbnqRb-0,577
|
27
|
-
python_injection-0.19.5.dist-info/METADATA,sha256=
|
28
|
-
python_injection-0.19.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
29
|
-
python_injection-0.19.5.dist-info/licenses/LICENSE,sha256=oC77BOa9kaaQni5rW-Z-ytz3E5h4EVg248BHg9UFgyg,1063
|
30
|
-
python_injection-0.19.5.dist-info/RECORD,,
|
27
|
+
python_injection-0.19.5.post1.dist-info/METADATA,sha256=fQmu5jF3kcYKuP4_asLoWog9iD4w1snv_udc43D_CTc,4307
|
28
|
+
python_injection-0.19.5.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
29
|
+
python_injection-0.19.5.post1.dist-info/licenses/LICENSE,sha256=oC77BOa9kaaQni5rW-Z-ytz3E5h4EVg248BHg9UFgyg,1063
|
30
|
+
python_injection-0.19.5.post1.dist-info/RECORD,,
|
File without changes
|
{python_injection-0.19.5.dist-info → python_injection-0.19.5.post1.dist-info}/licenses/LICENSE
RENAMED
File without changes
|