python-injection 0.18.6__tar.gz → 0.18.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.
- {python_injection-0.18.6 → python_injection-0.18.7}/PKG-INFO +1 -1
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/entrypoint.py +3 -1
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/loaders.py +6 -6
- {python_injection-0.18.6 → python_injection-0.18.7}/pyproject.toml +1 -1
- {python_injection-0.18.6 → python_injection-0.18.7}/.gitignore +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/LICENSE +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/README.md +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/__init__.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/__init__.pyi +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/__init__.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/common/__init__.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/common/asynchronous.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/common/event.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/common/invertible.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/common/key.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/common/lazy.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/common/type.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/descriptors.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/injectables.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/module.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/scope.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/_core/slots.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/exceptions.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/ext/__init__.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/ext/fastapi.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/ext/fastapi.pyi +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/py.typed +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/testing/__init__.py +0 -0
- {python_injection-0.18.6 → python_injection-0.18.7}/injection/testing/__init__.pyi +0 -0
@@ -153,7 +153,9 @@ class Entrypoint[**P, T]:
|
|
153
153
|
setup_method = profile_loader.module.make_injected_function(setup_method)
|
154
154
|
|
155
155
|
def decorator(function: Callable[P, T]) -> Callable[P, _T]:
|
156
|
-
profile_loader.
|
156
|
+
if profile_loader.module_subsets:
|
157
|
+
profile_loader.init()
|
158
|
+
|
157
159
|
self = cls(function, profile_loader)
|
158
160
|
return MethodType(setup_method, self)().function
|
159
161
|
|
@@ -141,28 +141,28 @@ class PythonModuleLoader:
|
|
141
141
|
|
142
142
|
@dataclass(repr=False, eq=False, frozen=True, slots=True)
|
143
143
|
class ProfileLoader:
|
144
|
-
|
144
|
+
module_subsets: Mapping[str, Sequence[str]] = field(default=MappingProxyType({}))
|
145
145
|
module: Module = field(default_factory=mod, kw_only=True)
|
146
146
|
__initialized_modules: set[str] = field(default_factory=set, init=False)
|
147
147
|
|
148
148
|
def init(self) -> Self:
|
149
|
-
self.
|
149
|
+
self.__init_subsets_for(self.module)
|
150
150
|
return self
|
151
151
|
|
152
152
|
def load(self, name: str, /) -> LoadedProfile:
|
153
153
|
self.init()
|
154
|
-
target_module = self.
|
154
|
+
target_module = self.__init_subsets_for(mod(name))
|
155
155
|
self.module.use(target_module, priority=Priority.HIGH)
|
156
156
|
return _UserLoadedProfile(self, name)
|
157
157
|
|
158
158
|
def _unload(self, name: str, /) -> None:
|
159
159
|
self.module.unlock().stop_using(mod(name))
|
160
160
|
|
161
|
-
def
|
161
|
+
def __init_subsets_for(self, module: Module) -> Module:
|
162
162
|
if not self.__is_initialized(module):
|
163
163
|
target_modules = tuple(
|
164
|
-
self.
|
165
|
-
for
|
164
|
+
self.__init_subsets_for(mod(name))
|
165
|
+
for name in self.module_subsets.get(module.name, ())
|
166
166
|
)
|
167
167
|
module.unlock().init_modules(*target_modules)
|
168
168
|
self.__mark_initialized(module)
|
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
|