python-injection 0.19.4__py3-none-any.whl → 0.19.5__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
@@ -145,13 +145,13 @@ class Module:
145
145
  threadsafe: bool | None = ...,
146
146
  ) -> type[T]: ...
147
147
  @overload
148
- def inject[**P, T](
148
+ def inject(
149
149
  self,
150
150
  wrapped: None = ...,
151
151
  /,
152
152
  *,
153
153
  threadsafe: bool | None = ...,
154
- ) -> _Decorator[Callable[P, T]] | _Decorator[type[T]]: ...
154
+ ) -> _Decorator[Callable[..., Any] | type]: ...
155
155
  @overload
156
156
  def injectable[**P, T](
157
157
  self,
@@ -192,20 +192,27 @@ class Module:
192
192
  mode: Mode | ModeStr = ...,
193
193
  ) -> type[T]: ...
194
194
  @overload
195
- def injectable[**P, T](
195
+ def injectable[T](
196
196
  self,
197
197
  wrapped: None = ...,
198
198
  /,
199
199
  *,
200
200
  cls: _InjectableFactory[T] = ...,
201
201
  inject: bool = ...,
202
- on: _TypeInfo[T] = ...,
202
+ on: _TypeInfo[T],
203
203
  mode: Mode | ModeStr = ...,
204
- ) -> (
205
- _Decorator[Callable[P, T]]
206
- | _Decorator[Callable[P, Awaitable[T]]]
207
- | _Decorator[type[T]]
208
- ): ...
204
+ ) -> _Decorator[Callable[..., T] | Callable[..., Awaitable[T]] | type[T]]: ...
205
+ @overload
206
+ def injectable(
207
+ self,
208
+ wrapped: None = ...,
209
+ /,
210
+ *,
211
+ cls: _InjectableFactory[Any] = ...,
212
+ inject: bool = ...,
213
+ on: tuple[()] = ...,
214
+ mode: Mode | ModeStr = ...,
215
+ ) -> _Decorator[Callable[..., Any] | type]: ...
209
216
  @overload
210
217
  def singleton[**P, T](
211
218
  self,
@@ -243,40 +250,57 @@ class Module:
243
250
  mode: Mode | ModeStr = ...,
244
251
  ) -> type[T]: ...
245
252
  @overload
246
- def singleton[**P, T](
253
+ def singleton[T](
247
254
  self,
248
255
  wrapped: None = ...,
249
256
  /,
250
257
  *,
251
258
  inject: bool = ...,
252
- on: _TypeInfo[T] = ...,
259
+ on: _TypeInfo[T],
260
+ mode: Mode | ModeStr = ...,
261
+ ) -> _Decorator[Callable[..., T] | Callable[..., Awaitable[T]] | type[T]]: ...
262
+ @overload
263
+ def singleton(
264
+ self,
265
+ wrapped: None = ...,
266
+ /,
267
+ *,
268
+ inject: bool = ...,
269
+ on: tuple[()] = ...,
253
270
  mode: Mode | ModeStr = ...,
254
- ) -> (
255
- _Decorator[Callable[P, T]]
256
- | _Decorator[Callable[P, Awaitable[T]]]
257
- | _Decorator[type[T]]
258
- ): ...
259
- def scoped[**P, T](
271
+ ) -> _Decorator[Callable[..., Any] | type]: ...
272
+ @overload
273
+ def scoped[T](
260
274
  self,
261
275
  scope_name: str,
262
276
  /,
263
277
  *,
264
278
  inject: bool = ...,
265
- on: _TypeInfo[T] = (),
279
+ on: _TypeInfo[T],
266
280
  mode: Mode | ModeStr = ...,
267
- ) -> (
268
- _Decorator[Callable[P, T]]
269
- | _Decorator[Callable[P, Awaitable[T]]]
270
- | _Decorator[Callable[P, AsyncIterator[T]]]
271
- | _Decorator[Callable[P, Iterator[T]]]
272
- | _Decorator[type[T]]
273
- ):
281
+ ) -> _Decorator[
282
+ Callable[..., T]
283
+ | Callable[..., Awaitable[T]]
284
+ | Callable[..., AsyncIterator[T]]
285
+ | Callable[..., Iterator[T]]
286
+ | type[T]
287
+ ]:
274
288
  """
275
289
  Decorator applicable to a class or function or generator function. It is used
276
290
  to indicate how the scoped instance will be constructed. At injection time, the
277
291
  injected instance is retrieved from the scope.
278
292
  """
279
293
 
294
+ @overload
295
+ def scoped(
296
+ self,
297
+ scope_name: str,
298
+ /,
299
+ *,
300
+ inject: bool = ...,
301
+ on: tuple[()] = ...,
302
+ mode: Mode | ModeStr = ...,
303
+ ) -> _Decorator[Callable[..., Any] | type]: ...
280
304
  @overload
281
305
  def should_be_injectable[T](self, wrapped: type[T], /) -> type[T]:
282
306
  """
@@ -286,11 +310,11 @@ class Module:
286
310
  """
287
311
 
288
312
  @overload
289
- def should_be_injectable[T](
313
+ def should_be_injectable(
290
314
  self,
291
315
  wrapped: None = ...,
292
316
  /,
293
- ) -> _Decorator[type[T]]: ...
317
+ ) -> _Decorator[type]: ...
294
318
  @overload
295
319
  def constant[**P, T](
296
320
  self,
@@ -325,18 +349,23 @@ class Module:
325
349
  mode: Mode | ModeStr = ...,
326
350
  ) -> type[T]: ...
327
351
  @overload
328
- def constant[**P, T](
352
+ def constant[T](
329
353
  self,
330
354
  wrapped: None = ...,
331
355
  /,
332
356
  *,
333
- on: _TypeInfo[T] = ...,
357
+ on: _TypeInfo[T],
358
+ mode: Mode | ModeStr = ...,
359
+ ) -> _Decorator[Callable[..., T] | Callable[..., Awaitable[T]] | type[T]]: ...
360
+ @overload
361
+ def constant(
362
+ self,
363
+ wrapped: None = ...,
364
+ /,
365
+ *,
366
+ on: tuple[()] = ...,
334
367
  mode: Mode | ModeStr = ...,
335
- ) -> (
336
- _Decorator[Callable[P, T]]
337
- | _Decorator[Callable[P, Awaitable[T]]]
338
- | _Decorator[type[T]]
339
- ): ...
368
+ ) -> _Decorator[Callable[..., Any] | type]: ...
340
369
  def set_constant[T](
341
370
  self,
342
371
  instance: T,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-injection
3
- Version: 0.19.4
3
+ Version: 0.19.5
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,5 +1,5 @@
1
1
  injection/__init__.py,sha256=iJm0BbyGZw-Qr5e8d2C3n8-7FiVD-sy4LU_i_n3AgHY,1318
2
- injection/__init__.pyi,sha256=VCuJkbE1S2XppeTkwiDAbOsVBmlmCpFFXe5ztTUb_-Q,14942
2
+ injection/__init__.pyi,sha256=mWwRp9nS0zW4QOmQUUmyuH2-27acG4iG8vwq-ARzhMs,15671
3
3
  injection/entrypoint.py,sha256=1JtooUCE9nIvHGAps5ypRb9ZEbgLdLwydkGF-kXMXDY,4953
4
4
  injection/exceptions.py,sha256=v57yMujiq6H_zwwn30A8UYEZX9R9k-bY8FnsdaimPM4,1025
5
5
  injection/loaders.py,sha256=gKlJfe9nXCuB8r6j0RF9_2FHC6YplM8GQYsgRqyxYw8,7257
@@ -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.4.dist-info/METADATA,sha256=xtDdgHy2s2fYA8jwKObxTd--xD2gC6yPVkDNKSwgr8c,4301
28
- python_injection-0.19.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
- python_injection-0.19.4.dist-info/licenses/LICENSE,sha256=oC77BOa9kaaQni5rW-Z-ytz3E5h4EVg248BHg9UFgyg,1063
30
- python_injection-0.19.4.dist-info/RECORD,,
27
+ python_injection-0.19.5.dist-info/METADATA,sha256=S648vq2CXn8QOZ4g4sZxODXh9OTAvR8JI6T3PlKPj4U,4301
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,,