python-injection 0.26.0__tar.gz → 0.26.2__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.26.0 → python_injection-0.26.2}/PKG-INFO +2 -2
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/scope.py +22 -6
- {python_injection-0.26.0 → python_injection-0.26.2}/pyproject.toml +2 -2
- {python_injection-0.26.0 → python_injection-0.26.2}/.gitignore +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/LICENSE +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/docs/index.md +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/__init__.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/__init__.pyi +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/__init__.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/asfunction.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/common/__init__.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/common/asynchronous.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/common/event.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/common/invertible.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/common/lazy.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/common/threading.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/common/type.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/descriptors.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/injectables.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/locator.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/module.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/_core/slots.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/entrypoint.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/exceptions.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/ext/__init__.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/ext/fastapi.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/ext/fastapi.pyi +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/loaders.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/py.typed +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/testing/__init__.py +0 -0
- {python_injection-0.26.0 → python_injection-0.26.2}/injection/testing/__init__.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-injection
|
|
3
|
-
Version: 0.26.
|
|
3
|
+
Version: 0.26.2
|
|
4
4
|
Summary: Dead-simple dependency injection framework for Python.
|
|
5
5
|
Project-URL: Documentation, https://python-injection.remimd.dev
|
|
6
6
|
Project-URL: Repository, https://github.com/100nm/python-injection
|
|
@@ -23,7 +23,7 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
24
|
Classifier: Topic :: Software Development :: Testing
|
|
25
25
|
Classifier: Typing :: Typed
|
|
26
|
-
Requires-Python: <3.
|
|
26
|
+
Requires-Python: <3.16,>=3.12
|
|
27
27
|
Requires-Dist: type-analyzer
|
|
28
28
|
Provides-Extra: async
|
|
29
29
|
Requires-Dist: anyio; extra == 'async'
|
|
@@ -212,6 +212,21 @@ def _bind_scope(
|
|
|
212
212
|
stack.close()
|
|
213
213
|
|
|
214
214
|
|
|
215
|
+
class _SealedScopeCache(MutableMapping[Any, Any]):
|
|
216
|
+
__slots__ = ()
|
|
217
|
+
|
|
218
|
+
@staticmethod
|
|
219
|
+
def guard(*args: Any, **kwargs: Any) -> NoReturn:
|
|
220
|
+
raise ScopeError("Can't access cache of an exited scope.")
|
|
221
|
+
|
|
222
|
+
__delitem__ = __getitem__ = __iter__ = __len__ = __setitem__ = guard
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
_sealed_cache = _SealedScopeCache()
|
|
226
|
+
|
|
227
|
+
del _SealedScopeCache
|
|
228
|
+
|
|
229
|
+
|
|
215
230
|
@runtime_checkable
|
|
216
231
|
class Scope(Protocol):
|
|
217
232
|
__slots__ = ()
|
|
@@ -227,14 +242,13 @@ class Scope(Protocol):
|
|
|
227
242
|
raise NotImplementedError
|
|
228
243
|
|
|
229
244
|
|
|
230
|
-
@dataclass(repr=False,
|
|
245
|
+
@dataclass(repr=False, eq=False, slots=True)
|
|
231
246
|
class BaseScope[T](Scope, ABC):
|
|
232
247
|
delegate: T
|
|
233
|
-
cache: MutableMapping[SlotKey[Any], Any] = field(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
)
|
|
248
|
+
cache: MutableMapping[SlotKey[Any], Any] = field(default_factory=dict, init=False)
|
|
249
|
+
|
|
250
|
+
def close(self) -> None:
|
|
251
|
+
self.cache = _sealed_cache
|
|
238
252
|
|
|
239
253
|
|
|
240
254
|
class AsyncScope(BaseScope[AsyncExitStack]):
|
|
@@ -253,6 +267,7 @@ class AsyncScope(BaseScope[AsyncExitStack]):
|
|
|
253
267
|
exc_value: BaseException | None,
|
|
254
268
|
traceback: TracebackType | None,
|
|
255
269
|
) -> Any:
|
|
270
|
+
self.close()
|
|
256
271
|
return await self.delegate.__aexit__(exc_type, exc_value, traceback)
|
|
257
272
|
|
|
258
273
|
async def aenter[T](self, context_manager: AsyncContextManager[T]) -> T:
|
|
@@ -278,6 +293,7 @@ class SyncScope(BaseScope[ExitStack]):
|
|
|
278
293
|
exc_value: BaseException | None,
|
|
279
294
|
traceback: TracebackType | None,
|
|
280
295
|
) -> Any:
|
|
296
|
+
self.close()
|
|
281
297
|
return self.delegate.__exit__(exc_type, exc_value, traceback)
|
|
282
298
|
|
|
283
299
|
async def aenter[T](self, context_manager: AsyncContextManager[T]) -> NoReturn:
|
|
@@ -24,12 +24,12 @@ test = [
|
|
|
24
24
|
|
|
25
25
|
[project]
|
|
26
26
|
name = "python-injection"
|
|
27
|
-
version = "0.26.
|
|
27
|
+
version = "0.26.2"
|
|
28
28
|
description = "Dead-simple dependency injection framework for Python."
|
|
29
29
|
license = "MIT"
|
|
30
30
|
license-files = ["LICENSE"]
|
|
31
31
|
readme = "docs/index.md"
|
|
32
|
-
requires-python = ">=3.12, <3.
|
|
32
|
+
requires-python = ">=3.12, <3.16"
|
|
33
33
|
authors = [{ name = "remimd" }]
|
|
34
34
|
keywords = ["dependencies", "dependency", "inject", "injection"]
|
|
35
35
|
classifiers = [
|
|
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
|
|
File without changes
|
|
File without changes
|