python-injection 0.19.5.post0__py3-none-any.whl → 0.19.6__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 CHANGED
@@ -374,7 +374,7 @@ class Module:
374
374
  *,
375
375
  alias: bool = ...,
376
376
  mode: Mode | ModeStr = ...,
377
- ) -> Self:
377
+ ) -> T:
378
378
  """
379
379
  Function for registering a specific instance to be injected. This is useful for
380
380
  registering global variables. The difference with the singleton decorator is
injection/_core/module.py CHANGED
@@ -480,16 +480,15 @@ class Module(Broker, EventListener):
480
480
  wrapper = contextmanager(wrapped)
481
481
 
482
482
  else:
483
- hint = (wrapped,) # type: ignore[assignment]
484
483
  injectable_class = SimpleScopedInjectable
485
- wrapper = wrapped # type: ignore[assignment]
484
+ hint = wrapper = wrapped # type: ignore[assignment]
486
485
 
487
486
  self.injectable(
488
487
  wrapper,
489
488
  cls=partial(injectable_class, scope_name=scope_name),
490
489
  ignore_type_hint=True,
491
490
  inject=inject,
492
- on=(*hint, on),
491
+ on=(hint, on),
493
492
  mode=mode,
494
493
  )
495
494
  return wrapped
@@ -533,16 +532,21 @@ class Module(Broker, EventListener):
533
532
  *,
534
533
  alias: bool = False,
535
534
  mode: Mode | ModeStr = Mode.get_default(),
536
- ) -> Self:
537
- hints = on if alias else (type(instance), on)
535
+ ) -> T:
536
+ if not alias:
537
+ on = (type(instance), on)
538
+
539
+ elif not on:
540
+ raise ValueError("`on` must be provided when `alias` is `True`.")
541
+
538
542
  self.injectable(
539
543
  lambda: instance,
540
544
  ignore_type_hint=True,
541
545
  inject=False,
542
- on=hints,
546
+ on=on,
543
547
  mode=mode,
544
548
  )
545
- return self
549
+ return instance
546
550
 
547
551
  def reserve_scoped_slot[T](
548
552
  self,
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
  Metadata-Version: 2.4
2
2
  Name: python-injection
3
- Version: 0.19.5.post0
3
+ Version: 0.19.6
4
4
  Summary: Fast and easy dependency injection framework.
5
5
  Project-URL: Repository, https://github.com/100nm/python-injection
6
6
  Author: remimd
@@ -1,6 +1,6 @@
1
1
  injection/__init__.py,sha256=iJm0BbyGZw-Qr5e8d2C3n8-7FiVD-sy4LU_i_n3AgHY,1318
2
- injection/__init__.pyi,sha256=8uWRfGfkVCfWBx4X4XsRyo1l7vKym6-vmcMklPyVMqg,15672
3
- injection/entrypoint.py,sha256=1JtooUCE9nIvHGAps5ypRb9ZEbgLdLwydkGF-kXMXDY,4953
2
+ injection/__init__.pyi,sha256=l4TChZY33TGkkNXRl0hL82XNkPZHH5TvWed146_82TQ,15669
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=Nd7IVFX0Cgw2FDyH0fuOLozXloSaTXcm-pQ-QK6Pf-c,32672
11
+ injection/_core/module.py,sha256=kUOzW7CYf3oGgVBhwJT1-05UI-HLH2N_E4o17Fyw1g4,32721
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
@@ -24,7 +24,7 @@ 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.post0.dist-info/METADATA,sha256=vaFb1wrfK4K1AGaoimYkxPtzCgHJX37dngLeIELmMBw,4307
28
- python_injection-0.19.5.post0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
- python_injection-0.19.5.post0.dist-info/licenses/LICENSE,sha256=oC77BOa9kaaQni5rW-Z-ytz3E5h4EVg248BHg9UFgyg,1063
30
- python_injection-0.19.5.post0.dist-info/RECORD,,
27
+ python_injection-0.19.6.dist-info/METADATA,sha256=y18-vvgfZesQbw4Ni6MrpGgNxzc9WbXHJckwENrWsrQ,4301
28
+ python_injection-0.19.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
+ python_injection-0.19.6.dist-info/licenses/LICENSE,sha256=oC77BOa9kaaQni5rW-Z-ytz3E5h4EVg248BHg9UFgyg,1063
30
+ python_injection-0.19.6.dist-info/RECORD,,