python-injection 0.10.10__py3-none-any.whl → 0.10.12__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
injection/_core/module.py CHANGED
@@ -514,10 +514,11 @@ class Module(Broker, EventListener):
514
514
  mode: Mode | ModeStr = Mode.get_default(),
515
515
  ):
516
516
  def decorator(wp): # type: ignore[no-untyped-def]
517
- instance = wp()
518
- self.set_constant(
519
- instance,
520
- on=on,
517
+ lazy_instance = Lazy(wp)
518
+ self.injectable(
519
+ lambda: ~lazy_instance,
520
+ inject=False,
521
+ on=(wp, on),
521
522
  mode=mode,
522
523
  )
523
524
  return wp
@@ -1,6 +1,6 @@
1
1
  from collections.abc import Callable
2
2
  from types import GenericAlias
3
- from typing import Any, ClassVar, Self, TypeAliasType
3
+ from typing import Any, ClassVar, TypeAliasType
4
4
 
5
5
  from injection import Module, mod
6
6
  from injection.exceptions import InjectionError
@@ -52,10 +52,8 @@ class InjectionDependency[T]:
52
52
  return hash(self.__key)
53
53
 
54
54
  @property
55
- def __key(
56
- self,
57
- ) -> tuple[type[Self], type[T] | TypeAliasType | GenericAlias, Module]:
58
- return type(self), self.__class, self.__module
55
+ def __key(self) -> tuple[type[T] | TypeAliasType | GenericAlias, Module]:
56
+ return self.__class, self.__module
59
57
 
60
58
  def __ensure(self, instance: T | Any) -> T:
61
59
  if instance is self.__sentinel:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-injection
3
- Version: 0.10.10
3
+ Version: 0.10.12
4
4
  Summary: Fast and easy dependency injection framework.
5
5
  Home-page: https://github.com/100nm/python-injection
6
6
  License: MIT
@@ -8,15 +8,15 @@ injection/_core/common/lazy.py,sha256=kCO1q4S6AdBhsP5RrihBJpgfeR4hxvMqSz1cpCgBdj
8
8
  injection/_core/common/threading.py,sha256=OXm7L3p8c7O7eSkU-RTR7cobqIGMhuo-7gpDXsWKDNQ,214
9
9
  injection/_core/common/type.py,sha256=TQTD-f_rnAHS0VgfkWxNFU8HAWPvkAktNDQ9_23JLHM,1705
10
10
  injection/_core/hook.py,sha256=_TcwhF_DONfcoBz58RxVLeA950Rs8wtZSLGepZwGBRk,3009
11
- injection/_core/module.py,sha256=c3YGhgSsZ8Cu5x-xaXHqJZEi3niSwH7HCVu6tj0IU0k,25243
11
+ injection/_core/module.py,sha256=zvYqUIAV9saTYGBuKbR4tNk2AFrMxyFxNPmvMMmKoe4,25300
12
12
  injection/exceptions.py,sha256=-5Shs7R5rctQXhpMLfcjiMBCzrtFWxC88qETUIHz57s,692
13
13
  injection/integrations/__init__.py,sha256=NYLcstr4ESdLj326LlDub143z6JGM1z1pCOVWhBXK10,304
14
14
  injection/integrations/blacksheep.py,sha256=yO5gLb_l4W3bNPFt-v2qWIL9R8PNon4JmOxQEHdi-5o,923
15
- injection/integrations/fastapi.py,sha256=FUX8u4yq1MNThlqv0g-e9pxh_aG6wEvcw9Yccn9aJL8,1831
15
+ injection/integrations/fastapi.py,sha256=GIxpSOumBQ8r8ihBVAzbp0nd68x8YWh6zSfL7d6QLWs,1786
16
16
  injection/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  injection/testing/__init__.py,sha256=-C38gmZJwDtLDAWJhqiaosOZWQZwwFa1M34tODcrASs,747
18
18
  injection/testing/__init__.pyi,sha256=6ZXbbS-9ppMdkxd03I6yBNurmR3Xw7sM_qiokibkLeY,386
19
19
  injection/utils.py,sha256=gPcxGIdrGz4irbJXGTYPw33jNy8jg56u_c61eb1MBSE,1971
20
- python_injection-0.10.10.dist-info/METADATA,sha256=8zGiqdSQp_K17U5o5PlArBHTT4tkkBpU8e9lQ4qLIx4,3111
21
- python_injection-0.10.10.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
- python_injection-0.10.10.dist-info/RECORD,,
20
+ python_injection-0.10.12.dist-info/METADATA,sha256=Bna8FD7gCC_EOwwaP4TDD_WAC-cy2kBefAdmspEKxg0,3111
21
+ python_injection-0.10.12.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
+ python_injection-0.10.12.dist-info/RECORD,,