modern-di 0.4.1__py3-none-any.whl → 0.4.3__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.

Potentially problematic release.


This version of modern-di might be problematic. Click here for more details.

modern_di/container.py CHANGED
@@ -38,6 +38,7 @@ class Container(contextlib.AbstractAsyncContextManager["Container"]):
38
38
  self._is_async = None
39
39
  self._provider_states = {}
40
40
  self._overrides = {}
41
+ self.context = {}
41
42
 
42
43
  def _check_entered(self) -> None:
43
44
  if self._is_async is None:
@@ -57,6 +58,10 @@ class Container(contextlib.AbstractAsyncContextManager["Container"]):
57
58
 
58
59
  def find_container(self, scope: enum.IntEnum) -> "typing_extensions.Self":
59
60
  container = self
61
+ if container.scope < scope:
62
+ msg = f"Scope {scope.name} is not initialized"
63
+ raise RuntimeError(msg)
64
+
60
65
  while container.scope > scope and container.parent_container:
61
66
  container = typing.cast("typing_extensions.Self", container.parent_container)
62
67
  return container
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: modern-di
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: Dependency Injection framework with IOC-container and scopes
5
5
  Project-URL: repository, https://github.com/modern-python/modern-di
6
6
  Project-URL: docs, https://modern-di.readthedocs.io
@@ -1,5 +1,5 @@
1
1
  modern_di/__init__.py,sha256=L01VkzSJiV0d0FPrh1DZ-Wy5mUmoG6X-oLz7xYxtehI,194
2
- modern_di/container.py,sha256=xAUiQ10nI_a0NcvedHJ-IFCBzr3HG7TtuJ6mwPiVhmA,3998
2
+ modern_di/container.py,sha256=v96v5qPTGfYaONuMZhO-C4K7rMlCfzLzZdCLuJtviCw,4156
3
3
  modern_di/graph.py,sha256=X60wtG3Mqus_5YZNiZlQuXoHODBp7rYl_IHJs7GzSQM,1356
4
4
  modern_di/provider_state.py,sha256=5Bl_iYEpXjMqoWZJ4op2-axo4Z8nR_vYbLVHL_u5R0c,1206
5
5
  modern_di/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,7 +13,7 @@ modern_di/providers/list.py,sha256=3hx34RfBRmqzh-cT5D6wSTDJPkBGMK_ul4n9gQz-o9M,7
13
13
  modern_di/providers/resource.py,sha256=nKy8_Wfn2cAIvlu_qGjGanmlgrkHQUsZxBNNR6p7OuE,3649
14
14
  modern_di/providers/selector.py,sha256=RQbHD2-Liw-TGqu6UELbfCzXYuqxiO_Mg1tLyF3mKQo,1419
15
15
  modern_di/providers/singleton.py,sha256=7XBNhVzhV5Rh_F7iWZx8is7i7_PuctQ9thKeqIkjnTs,1999
16
- modern_di-0.4.1.dist-info/METADATA,sha256=0yPqoF0wEcJyXcot-4cdWj5SCAEyaGb5J9Np9GTvl5c,2767
17
- modern_di-0.4.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
- modern_di-0.4.1.dist-info/licenses/LICENSE,sha256=aA5_eJwDKqnGvL7PbkPb9x5f-VGIqZ9cvWWkeGqeD90,1070
19
- modern_di-0.4.1.dist-info/RECORD,,
16
+ modern_di-0.4.3.dist-info/METADATA,sha256=s6Q1DeZMxAAuAs8ce9wGcYd4DRbLZCWPGJBpAtQaslk,2767
17
+ modern_di-0.4.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
18
+ modern_di-0.4.3.dist-info/licenses/LICENSE,sha256=aA5_eJwDKqnGvL7PbkPb9x5f-VGIqZ9cvWWkeGqeD90,1070
19
+ modern_di-0.4.3.dist-info/RECORD,,