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 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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rats-apps
3
- Version: 0.1.3.dev15
3
+ Version: 0.1.3.dev16
4
4
  Summary: research analysis tools for building applications
5
5
  Home-page: https://github.com/microsoft/rats/
6
6
  License: MIT
@@ -1,13 +1,13 @@
1
- rats/apps/__init__.py,sha256=mDOsXV95S6ixGdlp4B1HmMujUX5sa3GzkcbNIVEKqls,1170
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=6CoSAH-I9kwqtc_aLnJ3O1M-sTPq7MA5aUorN1ryTag,429
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.dev15.dist-info/METADATA,sha256=w-O8JQfYv4jo2NmzHIpc78ysb-D8JmlBC-PRXA75Z3Q,717
12
- rats_apps-0.1.3.dev15.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
- rats_apps-0.1.3.dev15.dist-info/RECORD,,
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,,