python-injection 0.14.6.post1__py3-none-any.whl → 0.14.6.post2__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.
@@ -6,6 +6,8 @@ from typing import Protocol, runtime_checkable
6
6
 
7
7
  @runtime_checkable
8
8
  class Invertible[T](Protocol):
9
+ __slots__ = ()
10
+
9
11
  @abstractmethod
10
12
  def __invert__(self) -> T:
11
13
  raise NotImplementedError
injection/_core/module.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import threading
3
4
  from abc import ABC, abstractmethod
4
5
  from collections import OrderedDict, deque
5
6
  from collections.abc import (
@@ -27,7 +28,6 @@ from inspect import (
27
28
  )
28
29
  from inspect import signature as inspect_signature
29
30
  from logging import Logger, getLogger
30
- from threading import Lock
31
31
  from types import MethodType
32
32
  from typing import (
33
33
  Any,
@@ -982,7 +982,7 @@ class InjectMetadata[**P, T](Caller[P, T], EventListener):
982
982
 
983
983
  def __init__(self, wrapped: Callable[P, T], /, threadsafe: bool) -> None:
984
984
  self.__dependencies = Dependencies.empty()
985
- self.__lock = Lock() if threadsafe else nullcontext()
985
+ self.__lock = threading.Lock() if threadsafe else nullcontext()
986
986
  self.__owner = None
987
987
  self.__tasks = deque()
988
988
  self.__wrapped = wrapped
injection/_core/scope.py CHANGED
@@ -157,18 +157,18 @@ def get_scope(name, default=...): # type: ignore[no-untyped-def]
157
157
  def _bind_scope(name: str, scope: Scope, shared: bool) -> Iterator[None]:
158
158
  if shared:
159
159
  is_already_defined = bool(get_active_scopes(name))
160
- state = __SHARED_SCOPES[name]
160
+ states = __SHARED_SCOPES
161
161
 
162
162
  else:
163
163
  is_already_defined = bool(get_scope(name, default=None))
164
- state = __CONTEXTUAL_SCOPES[name]
164
+ states = __CONTEXTUAL_SCOPES
165
165
 
166
166
  if is_already_defined:
167
167
  raise ScopeAlreadyDefinedError(
168
168
  f"Scope `{name}` is already defined in the current context."
169
169
  )
170
170
 
171
- with state.bind(scope):
171
+ with states[name].bind(scope):
172
172
  yield
173
173
 
174
174
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-injection
3
- Version: 0.14.6.post1
3
+ Version: 0.14.6.post2
4
4
  Summary: Fast and easy dependency injection framework.
5
5
  Project-URL: Repository, https://github.com/100nm/python-injection
6
6
  Author: remimd
@@ -6,13 +6,13 @@ injection/utils.py,sha256=EuHMrix6gx2YnnUAn2_BPsDkvucGS5-pFhM3596oBK4,2796
6
6
  injection/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  injection/_core/descriptors.py,sha256=7fSHlgAqmgR_Uta8KocBapOt1Xyj2dI7RY9ZdoStTzw,726
8
8
  injection/_core/injectables.py,sha256=idNkQZZ29vd73G_lE-eS5C7zGeVe_ALNkUt8M6YjZrk,5519
9
- injection/_core/module.py,sha256=DLw0pD3HDXfNhzbWM0yeCDKg-Mwg8JAzqZq43tFAXik,31814
10
- injection/_core/scope.py,sha256=fZ6zvuP9RO_9wZvMcM13_elSoztMaYKen1MgTP3s8t4,6555
9
+ injection/_core/module.py,sha256=KrEr66q1lazwz7F7jYscpr-ExX8aOwYHEho1IotXa54,31814
10
+ injection/_core/scope.py,sha256=LGT_Sk0b2FXB_ScXfLhU2BWz_bEE0vdJOV5p-ijCDq4,6552
11
11
  injection/_core/slots.py,sha256=6LoG0XtaRnIGDSG8s-FfUIw_50gL0bl4X3Fo_n-hdak,680
12
12
  injection/_core/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  injection/_core/common/asynchronous.py,sha256=QeS2Lc4gEBFvTA_snOWfme5mTL4BFZWqZ8EzJwOdVos,1816
14
14
  injection/_core/common/event.py,sha256=XjzV8gxtGlGvzZs_ykvoC60qmdpd3RN08Eiqz5QUwes,1236
15
- injection/_core/common/invertible.py,sha256=YZlAdh6bNJgf1-74TRjwJTm8xrlgY95ZhOUGLSJ4XcY,482
15
+ injection/_core/common/invertible.py,sha256=gA_vw5nBjgp_w9MrDK5jMO8lhuOQWON8BbPpKzEuIY0,502
16
16
  injection/_core/common/key.py,sha256=ghkZD-Y8Moz6SEPNgMh3xgsZUjDVq-XYAmXaCu5VuCA,80
17
17
  injection/_core/common/lazy.py,sha256=6xh5h0lmaNvl32V0WoX4VCTsNJ3zUJdWVqpLJ_YeIIU,1363
18
18
  injection/_core/common/type.py,sha256=SCDtmBv9qFvEf5o5tTgCuwMDfuo1fgjSW0bUqA8ACis,2251
@@ -20,6 +20,6 @@ injection/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
20
20
  injection/integrations/fastapi.py,sha256=YHSs85_3m6TUVtOwUcV157b3UZJQIw_aXWAg199a-YE,594
21
21
  injection/testing/__init__.py,sha256=SiImXDd0-DO1a8S5nbUQRtgDX8iaU_nHcp8DdqwtD2M,896
22
22
  injection/testing/__init__.pyi,sha256=iOii0i9F5n7znltGeGQYI2KXC_if9SAogLh1h03yx-0,540
23
- python_injection-0.14.6.post1.dist-info/METADATA,sha256=g-UJxN15zRFae7U8t5Fv2KU-naXLksipOjwefxrmBhs,3205
24
- python_injection-0.14.6.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
- python_injection-0.14.6.post1.dist-info/RECORD,,
23
+ python_injection-0.14.6.post2.dist-info/METADATA,sha256=ST2y_3loRYXo9ugZ7yMrLNCBNMCaUTRdVenvDib8Dxc,3205
24
+ python_injection-0.14.6.post2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ python_injection-0.14.6.post2.dist-info/RECORD,,