rats-apps 0.1.3.dev15__py3-none-any.whl → 0.1.3.dev16__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.
- rats/apps/__init__.py +2 -1
- rats/apps/_executables.py +23 -1
- {rats_apps-0.1.3.dev15.dist-info → rats_apps-0.1.3.dev16.dist-info}/METADATA +1 -1
- {rats_apps-0.1.3.dev15.dist-info → rats_apps-0.1.3.dev16.dist-info}/RECORD +5 -5
- {rats_apps-0.1.3.dev15.dist-info → rats_apps-0.1.3.dev16.dist-info}/WHEEL +0 -0
rats/apps/__init__.py
CHANGED
@@ -19,7 +19,7 @@ from ._annotations import (
|
|
19
19
|
)
|
20
20
|
from ._composite_container import CompositeContainer
|
21
21
|
from ._container import Container, DuplicateServiceError, ServiceNotFoundError
|
22
|
-
from ._executables import App, Executable
|
22
|
+
from ._executables import App, AppContainer, Executable
|
23
23
|
from ._ids import ConfigId, ServiceId
|
24
24
|
from ._namespaces import ProviderNamespaces
|
25
25
|
from ._plugin_container import PluginContainers
|
@@ -28,6 +28,7 @@ from ._scoping import autoscope
|
|
28
28
|
__all__ = [
|
29
29
|
"AnnotatedContainer",
|
30
30
|
"App",
|
31
|
+
"AppContainer",
|
31
32
|
"CompositeContainer",
|
32
33
|
"ConfigId",
|
33
34
|
"Container",
|
rats/apps/_executables.py
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
from abc import abstractmethod
|
2
|
-
from collections.abc import Callable
|
2
|
+
from collections.abc import Callable, Iterator
|
3
|
+
from functools import cache
|
3
4
|
from typing import Protocol
|
4
5
|
|
6
|
+
from ._container import Container, ServiceId
|
7
|
+
from ._ids import T_ServiceType
|
8
|
+
|
5
9
|
|
6
10
|
class Executable(Protocol):
|
7
11
|
@abstractmethod
|
@@ -17,3 +21,21 @@ class App(Executable):
|
|
17
21
|
|
18
22
|
def execute(self) -> None:
|
19
23
|
self._callback()
|
24
|
+
|
25
|
+
|
26
|
+
class AppContainer(Container):
|
27
|
+
_container: Callable[[Container], Container]
|
28
|
+
|
29
|
+
def __init__(self, container: Callable[[Container], Container]) -> None:
|
30
|
+
self._container = container
|
31
|
+
|
32
|
+
def get_namespaced_group(
|
33
|
+
self,
|
34
|
+
namespace: str,
|
35
|
+
group_id: ServiceId[T_ServiceType],
|
36
|
+
) -> Iterator[T_ServiceType]:
|
37
|
+
yield from self._load_container().get_namespaced_group(namespace, group_id)
|
38
|
+
|
39
|
+
@cache # noqa: B019
|
40
|
+
def _load_container(self) -> Container:
|
41
|
+
return self._container(self)
|
@@ -1,13 +1,13 @@
|
|
1
|
-
rats/apps/__init__.py,sha256=
|
1
|
+
rats/apps/__init__.py,sha256=v_TM5SSmyTxg2H2j3UVzEOKqqeivhCR6scXwTBBO6qs,1204
|
2
2
|
rats/apps/_annotations.py,sha256=GT2VGkLO2Re0oZsVd6oQlm0WdJj5NSirGA0cpPmmiik,6993
|
3
3
|
rats/apps/_composite_container.py,sha256=wSWVQWPin2xxIlEoSgk_D1rlc3N2gpTxQ2y9UFdqXy0,553
|
4
4
|
rats/apps/_container.py,sha256=5uiCyxN6HS2z97XcTOFP-t72cNoB1U1sJMkMcfSfDps,3129
|
5
|
-
rats/apps/_executables.py,sha256=
|
5
|
+
rats/apps/_executables.py,sha256=8ITn__pjTLHo7FEb-3C6ZQrs1mow0gZn6d-24XGBSu8,1079
|
6
6
|
rats/apps/_ids.py,sha256=dxWCPMpMA_vpaTDJEKNByIBJaX97Db203XqWLhaOezo,457
|
7
7
|
rats/apps/_namespaces.py,sha256=THUV_Xj5PtweC23Ob-zsSpk8exC4fT-qRwjpQ6IDm0U,188
|
8
8
|
rats/apps/_plugin_container.py,sha256=W_xQD2btc0N2dEb3c5tXM-ZZ4A4diMpkCjbOZdlXYuI,853
|
9
9
|
rats/apps/_scoping.py,sha256=plSVEq3rJ8JFAu2epVg2NQpuTbpSTA3a0Tha_DwJL_Y,1453
|
10
10
|
rats/apps/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
rats_apps-0.1.3.
|
12
|
-
rats_apps-0.1.3.
|
13
|
-
rats_apps-0.1.3.
|
11
|
+
rats_apps-0.1.3.dev16.dist-info/METADATA,sha256=QJrLvUdljsoB6cFDlokRT9Gv7nWuu2NO7H45-zh2aqc,717
|
12
|
+
rats_apps-0.1.3.dev16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
13
|
+
rats_apps-0.1.3.dev16.dist-info/RECORD,,
|
File without changes
|