python-injection 0.25.6__tar.gz → 0.25.7__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 (32) hide show
  1. {python_injection-0.25.6 → python_injection-0.25.7}/PKG-INFO +1 -1
  2. {python_injection-0.25.6 → python_injection-0.25.7}/injection/__init__.pyi +7 -0
  3. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/module.py +7 -5
  4. {python_injection-0.25.6 → python_injection-0.25.7}/pyproject.toml +1 -1
  5. {python_injection-0.25.6 → python_injection-0.25.7}/.gitignore +0 -0
  6. {python_injection-0.25.6 → python_injection-0.25.7}/LICENSE +0 -0
  7. {python_injection-0.25.6 → python_injection-0.25.7}/README.md +0 -0
  8. {python_injection-0.25.6 → python_injection-0.25.7}/injection/__init__.py +0 -0
  9. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/__init__.py +0 -0
  10. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/asfunction.py +0 -0
  11. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/__init__.py +0 -0
  12. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/asynchronous.py +0 -0
  13. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/event.py +0 -0
  14. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/invertible.py +0 -0
  15. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/key.py +0 -0
  16. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/lazy.py +0 -0
  17. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/threading.py +0 -0
  18. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/common/type.py +0 -0
  19. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/descriptors.py +0 -0
  20. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/injectables.py +0 -0
  21. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/locator.py +0 -0
  22. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/scope.py +0 -0
  23. {python_injection-0.25.6 → python_injection-0.25.7}/injection/_core/slots.py +0 -0
  24. {python_injection-0.25.6 → python_injection-0.25.7}/injection/entrypoint.py +0 -0
  25. {python_injection-0.25.6 → python_injection-0.25.7}/injection/exceptions.py +0 -0
  26. {python_injection-0.25.6 → python_injection-0.25.7}/injection/ext/__init__.py +0 -0
  27. {python_injection-0.25.6 → python_injection-0.25.7}/injection/ext/fastapi.py +0 -0
  28. {python_injection-0.25.6 → python_injection-0.25.7}/injection/ext/fastapi.pyi +0 -0
  29. {python_injection-0.25.6 → python_injection-0.25.7}/injection/loaders.py +0 -0
  30. {python_injection-0.25.6 → python_injection-0.25.7}/injection/py.typed +0 -0
  31. {python_injection-0.25.6 → python_injection-0.25.7}/injection/testing/__init__.py +0 -0
  32. {python_injection-0.25.6 → python_injection-0.25.7}/injection/testing/__init__.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-injection
3
- Version: 0.25.6
3
+ Version: 0.25.7
4
4
  Summary: Fast and easy dependency injection framework.
5
5
  Project-URL: Repository, https://github.com/100nm/python-injection
6
6
  Author: remimd
@@ -182,6 +182,7 @@ class Module:
182
182
  /,
183
183
  *,
184
184
  cls: _InjectableFactory[Any] = ...,
185
+ ignore_type_hint: bool = ...,
185
186
  inject: bool = ...,
186
187
  on: _TypeInfo[Any] = ...,
187
188
  mode: Mode | ModeStr = ...,
@@ -199,6 +200,7 @@ class Module:
199
200
  /,
200
201
  *,
201
202
  cls: _InjectableFactory[Any] = ...,
203
+ ignore_type_hint: bool = ...,
202
204
  inject: bool = ...,
203
205
  on: _TypeInfo[Any] = ...,
204
206
  mode: Mode | ModeStr = ...,
@@ -209,6 +211,7 @@ class Module:
209
211
  wrapped: T,
210
212
  /,
211
213
  *,
214
+ ignore_type_hint: bool = ...,
212
215
  inject: bool = ...,
213
216
  on: _TypeInfo[Any] = ...,
214
217
  mode: Mode | ModeStr = ...,
@@ -225,6 +228,7 @@ class Module:
225
228
  wrapped: None = ...,
226
229
  /,
227
230
  *,
231
+ ignore_type_hint: bool = ...,
228
232
  inject: bool = ...,
229
233
  on: _TypeInfo[Any] = ...,
230
234
  mode: Mode | ModeStr = ...,
@@ -234,6 +238,7 @@ class Module:
234
238
  scope_name: str,
235
239
  /,
236
240
  *,
241
+ ignore_type_hint: bool = ...,
237
242
  inject: bool = ...,
238
243
  on: _TypeInfo[Any] = ...,
239
244
  mode: Mode | ModeStr = ...,
@@ -264,6 +269,7 @@ class Module:
264
269
  wrapped: T,
265
270
  /,
266
271
  *,
272
+ ignore_type_hint: bool = ...,
267
273
  on: _TypeInfo[Any] = ...,
268
274
  mode: Mode | ModeStr = ...,
269
275
  ) -> T:
@@ -279,6 +285,7 @@ class Module:
279
285
  wrapped: None = ...,
280
286
  /,
281
287
  *,
288
+ ignore_type_hint: bool = ...,
282
289
  on: _TypeInfo[Any] = ...,
283
290
  mode: Mode | ModeStr = ...,
284
291
  ) -> _Decorator: ...
@@ -8,6 +8,7 @@ from collections.abc import (
8
8
  AsyncIterator,
9
9
  Awaitable,
10
10
  Callable,
11
+ Collection,
11
12
  Container,
12
13
  Generator,
13
14
  Iterable,
@@ -180,7 +181,7 @@ type GeneratorRecipe[**P, T] = (
180
181
  @dataclass(repr=False, eq=False, frozen=True, slots=True)
181
182
  class _ScopedContext[**P, T]:
182
183
  cls: type[ScopedInjectable[Any, T]]
183
- hints: TypeInfo[T]
184
+ hints: Collection[TypeInfo[T]]
184
185
  wrapper: Recipe[P, T] | ContextManagerRecipe[P, T]
185
186
 
186
187
 
@@ -266,6 +267,7 @@ class Module(EventListener, InjectionProvider): # type: ignore[misc]
266
267
  scope_name: str,
267
268
  /,
268
269
  *,
270
+ ignore_type_hint: bool = False,
269
271
  inject: bool = True,
270
272
  on: TypeInfo[T] = (),
271
273
  mode: Mode | ModeStr = Mode.get_default(),
@@ -276,21 +278,21 @@ class Module(EventListener, InjectionProvider): # type: ignore[misc]
276
278
  if isasyncgenfunction(wrapped):
277
279
  ctx = _ScopedContext(
278
280
  cls=AsyncCMScopedInjectable,
279
- hints=get_yield_hints(wrapped),
281
+ hints=() if ignore_type_hint else get_yield_hints(wrapped),
280
282
  wrapper=asynccontextmanager(wrapped),
281
283
  )
282
284
 
283
285
  elif isgeneratorfunction(wrapped):
284
286
  ctx = _ScopedContext(
285
287
  cls=CMScopedInjectable,
286
- hints=get_yield_hints(wrapped),
288
+ hints=() if ignore_type_hint else get_yield_hints(wrapped),
287
289
  wrapper=contextmanager(wrapped),
288
290
  )
289
291
 
290
292
  else:
291
293
  ctx = _ScopedContext(
292
294
  cls=SimpleScopedInjectable,
293
- hints=(wrapped,),
295
+ hints=() if ignore_type_hint else (wrapped,),
294
296
  wrapper=wrapped,
295
297
  )
296
298
 
@@ -299,7 +301,7 @@ class Module(EventListener, InjectionProvider): # type: ignore[misc]
299
301
  cls=ctx.cls.bind_scope_name(scope_name),
300
302
  ignore_type_hint=True,
301
303
  inject=inject,
302
- on=(ctx.hints, on),
304
+ on=(*ctx.hints, on),
303
305
  mode=mode,
304
306
  )
305
307
  return wrapped
@@ -31,7 +31,7 @@ test = [
31
31
 
32
32
  [project]
33
33
  name = "python-injection"
34
- version = "0.25.6"
34
+ version = "0.25.7"
35
35
  description = "Fast and easy dependency injection framework."
36
36
  license = "MIT"
37
37
  license-files = ["LICENSE"]