python-injection 0.19.5__tar.gz → 0.19.5.post1__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.
Files changed (31) hide show
  1. {python_injection-0.19.5 → python_injection-0.19.5.post1}/PKG-INFO +1 -1
  2. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/__init__.pyi +1 -0
  3. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/type.py +5 -5
  4. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/module.py +6 -5
  5. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/entrypoint.py +4 -0
  6. {python_injection-0.19.5 → python_injection-0.19.5.post1}/pyproject.toml +1 -1
  7. {python_injection-0.19.5 → python_injection-0.19.5.post1}/.gitignore +0 -0
  8. {python_injection-0.19.5 → python_injection-0.19.5.post1}/LICENSE +0 -0
  9. {python_injection-0.19.5 → python_injection-0.19.5.post1}/README.md +0 -0
  10. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/__init__.py +0 -0
  11. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/__init__.py +0 -0
  12. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/asfunction.py +0 -0
  13. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/__init__.py +0 -0
  14. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/asynchronous.py +0 -0
  15. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/event.py +0 -0
  16. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/invertible.py +0 -0
  17. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/key.py +0 -0
  18. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/lazy.py +0 -0
  19. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/common/threading.py +0 -0
  20. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/descriptors.py +0 -0
  21. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/injectables.py +0 -0
  22. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/scope.py +0 -0
  23. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/_core/slots.py +0 -0
  24. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/exceptions.py +0 -0
  25. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/ext/__init__.py +0 -0
  26. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/ext/fastapi.py +0 -0
  27. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/ext/fastapi.pyi +0 -0
  28. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/loaders.py +0 -0
  29. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/py.typed +0 -0
  30. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/testing/__init__.py +0 -0
  31. {python_injection-0.19.5 → python_injection-0.19.5.post1}/injection/testing/__init__.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-injection
3
- Version: 0.19.5
3
+ Version: 0.19.5.post1
4
4
  Summary: Fast and easy dependency injection framework.
5
5
  Project-URL: Repository, https://github.com/100nm/python-injection
6
6
  Author: remimd
@@ -136,6 +136,7 @@ class Module:
136
136
 
137
137
  With `threadsafe=True`, the injection logic is wrapped in a `threading.RLock`.
138
138
  """
139
+
139
140
  @overload
140
141
  def inject[T](
141
142
  self,
@@ -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] | None:
57
+ ) -> tuple[InputType[T]] | tuple[()]:
58
58
  return_type = get_return_hint(function)
59
59
 
60
- if get_origin(return_type) not in {
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
- return None
68
+ for arg in get_args(return_type):
69
+ return (arg,)
69
70
 
70
- args = get_args(return_type)
71
- return next(iter(args), None)
71
+ return ()
72
72
 
73
73
 
74
74
  def standardize_types(
@@ -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 == existing_mode and not is_override:
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 is_override or new_mode.rank > existing_mode.rank
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=hints,
491
+ on=(hint, on),
491
492
  mode=mode,
492
493
  )
493
494
  return wrapped
@@ -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],
@@ -30,7 +30,7 @@ test = [
30
30
 
31
31
  [project]
32
32
  name = "python-injection"
33
- version = "0.19.5"
33
+ version = "0.19.5.post1"
34
34
  description = "Fast and easy dependency injection framework."
35
35
  license = "MIT"
36
36
  license-files = ["LICENSE"]