python-injection 0.18.1__tar.gz → 0.18.3__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.
- {python_injection-0.18.1 → python_injection-0.18.3}/PKG-INFO +1 -1
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/module.py +17 -12
- {python_injection-0.18.1 → python_injection-0.18.3}/pyproject.toml +1 -1
- {python_injection-0.18.1 → python_injection-0.18.3}/.gitignore +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/LICENSE +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/README.md +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/__init__.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/__init__.pyi +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/__init__.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/common/__init__.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/common/asynchronous.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/common/event.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/common/invertible.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/common/key.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/common/lazy.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/common/type.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/descriptors.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/injectables.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/scope.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/_core/slots.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/entrypoint.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/exceptions.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/ext/__init__.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/ext/fastapi.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/ext/fastapi.pyi +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/loaders.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/py.typed +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/testing/__init__.py +0 -0
- {python_injection-0.18.1 → python_injection-0.18.3}/injection/testing/__init__.pyi +0 -0
@@ -156,6 +156,12 @@ class ModulePriorityUpdated(ModuleEvent):
|
|
156
156
|
)
|
157
157
|
|
158
158
|
|
159
|
+
@dataclass(frozen=True, slots=True)
|
160
|
+
class UnlockCalled(Event):
|
161
|
+
def __str__(self) -> str:
|
162
|
+
return "An `unlock` method has been called."
|
163
|
+
|
164
|
+
|
159
165
|
"""
|
160
166
|
Broker
|
161
167
|
"""
|
@@ -802,17 +808,16 @@ class Module(Broker, EventListener):
|
|
802
808
|
return self
|
803
809
|
|
804
810
|
def unlock(self) -> Self:
|
805
|
-
|
806
|
-
|
811
|
+
event = UnlockCalled()
|
812
|
+
|
813
|
+
with self.dispatch(event, lock_bypass=True):
|
814
|
+
for broker in self.__brokers:
|
815
|
+
broker.unlock()
|
807
816
|
|
808
817
|
return self
|
809
818
|
|
810
819
|
def load_profile(self, *names: str) -> ContextManager[Self]:
|
811
|
-
modules =
|
812
|
-
|
813
|
-
for module in modules:
|
814
|
-
module.unlock()
|
815
|
-
|
820
|
+
modules = (self.from_name(name) for name in names)
|
816
821
|
self.unlock().init_modules(*modules)
|
817
822
|
|
818
823
|
@contextmanager
|
@@ -838,20 +843,20 @@ class Module(Broker, EventListener):
|
|
838
843
|
self.__channel.remove_listener(listener)
|
839
844
|
return self
|
840
845
|
|
841
|
-
def on_event(self, event: Event, /) -> ContextManager[None]
|
846
|
+
def on_event(self, event: Event, /) -> ContextManager[None]:
|
842
847
|
self_event = ModuleEventProxy(self, event)
|
843
848
|
return self.dispatch(self_event)
|
844
849
|
|
845
850
|
@contextmanager
|
846
|
-
def dispatch(self, event: Event) -> Iterator[None]:
|
847
|
-
|
851
|
+
def dispatch(self, event: Event, *, lock_bypass: bool = False) -> Iterator[None]:
|
852
|
+
if not lock_bypass:
|
853
|
+
self.__check_locking()
|
848
854
|
|
849
855
|
with self.__channel.dispatch(event):
|
850
856
|
try:
|
851
857
|
yield
|
852
858
|
finally:
|
853
|
-
|
854
|
-
self.__debug(message)
|
859
|
+
self.__debug(event)
|
855
860
|
|
856
861
|
def __debug(self, message: object) -> None:
|
857
862
|
for logger in self.__loggers:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|