orionis 0.325.0__py3-none-any.whl → 0.326.0__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.
@@ -0,0 +1,19 @@
1
+ class OrionisContainerAttributeError(AttributeError):
2
+
3
+ def __init__(self, msg: str):
4
+ """
5
+ Parameters
6
+ ----------
7
+ msg : str
8
+ Descriptive error message explaining the cause of the exception.
9
+ """
10
+ super().__init__(msg)
11
+
12
+ def __str__(self) -> str:
13
+ """
14
+ Returns
15
+ -------
16
+ str
17
+ Formatted string describing the exception.
18
+ """
19
+ return str(self.args[0])
@@ -1,25 +1,34 @@
1
1
  from typing import Any
2
2
  from orionis.container.container import Container
3
+ from orionis.container.exceptions.attribute_error import OrionisContainerAttributeError
4
+ from orionis.container.exceptions.container_exception import OrionisContainerException
3
5
 
4
6
  class FacadeMeta(type):
5
7
 
6
8
  def __getattr__(cls, name: str) -> Any:
7
9
  """
8
10
  When an undefined attribute is accessed, this method resolves the service and delegates the call.
9
- It's like having a genie in a bottle, but for services.
10
11
 
11
- Args:
12
- name: The name of the attribute to access
12
+ Parameters
13
+ ----------
14
+ name : str
15
+ The name of the attribute to access
13
16
 
14
- Returns:
17
+ Returns
18
+ -------
19
+ Any
15
20
  The requested attribute from the underlying service
21
+
22
+ Raises
23
+ ------
24
+ OrionisContainerAttributeError
25
+ If the resolved service does not have the requested attribute
16
26
  """
17
27
  service = cls.resolve()
18
28
  if not hasattr(service, name):
19
- raise AttributeError(f"'{cls.__name__}' facade's service has no attribute '{name}'")
29
+ raise OrionisContainerAttributeError(f"'{cls.__name__}' facade's service has no attribute '{name}'")
20
30
  return getattr(service, name)
21
31
 
22
-
23
32
  class Facade(metaclass=FacadeMeta):
24
33
 
25
34
  # Container instance to resolve services
@@ -53,13 +62,15 @@ class Facade(metaclass=FacadeMeta):
53
62
  Positional arguments to pass to the service constructor.
54
63
  **kwargs
55
64
  Keyword arguments to pass to the service constructor.
65
+
56
66
  Returns
57
67
  -------
58
68
  Any
59
69
  The resolved service instance.
70
+
60
71
  Raises
61
72
  ------
62
- RuntimeError
73
+ OrionisContainerException
63
74
  If the service is not bound in the container.
64
75
  Notes
65
76
  -----
@@ -70,9 +81,10 @@ class Facade(metaclass=FacadeMeta):
70
81
 
71
82
  # Check if the service is bound in the container
72
83
  if not cls._container.bound(service_name):
73
- raise RuntimeError(
74
- f"The service '{service_name}' is not bound in the container. "
75
- "Did you forget to register it?"
84
+ raise OrionisContainerException(
85
+ f"Service '{service_name}' not bound in the container. "
86
+ f"Please ensure '{service_name}' is registered in the container before using the {cls.__name__} facade. "
87
+ "You can register services in a service provider using the 'register' method."
76
88
  )
77
89
 
78
90
  # Resolve the service instance from the container
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.325.0"
8
+ VERSION = "0.326.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.325.0
3
+ Version: 0.326.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -137,11 +137,12 @@ orionis/container/context/scope.py,sha256=CWFiLLTAC_IdmeFKWX-jrphdxB0_TMEVBlz6lQ
137
137
  orionis/container/contracts/container.py,sha256=hOO3w2yqVhp2nPTeS1uJEYgXSTbM3xwezDCOSNMC_a0,7603
138
138
  orionis/container/entities/binding.py,sha256=Qp6Lf4XUDp2NjqXDAC2lzvhOFQWiBDKiGFcKfwb4axw,4342
139
139
  orionis/container/enums/lifetimes.py,sha256=RqQmugMIB1Ev_j_vFLcWorndm-to7xg4stQ7yKFDdDw,190
140
+ orionis/container/exceptions/attribute_error.py,sha256=ysYKvXfunH-bywK_e02inY94s8aZ3vUZA6jATbDcQmk,480
140
141
  orionis/container/exceptions/container_exception.py,sha256=goTDEwC70xTMD2qppN8KV-xyR0Nps218OD4D1LZ2-3s,470
141
142
  orionis/container/exceptions/type_error_exception.py,sha256=cYuvoXVOgRYj3tZPfK341aUERkf33-buOiI2eXxcrAw,470
142
143
  orionis/container/exceptions/value_exception.py,sha256=hjY0YEusoL3DurME1ornxvIv1wyGaf6tBggLFlGHblo,472
143
144
  orionis/container/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
- orionis/container/facades/facade.py,sha256=jY0Np_-fdUofq9cRLTZCYHuE-_Zj-hAhvsg8mhWCaM8,2771
145
+ orionis/container/facades/facade.py,sha256=vu71_uqXnSpCFyeswPgKIhTPmIBLEK3bsy5sk4vTOEk,3306
145
146
  orionis/container/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
147
  orionis/container/validators/implements.py,sha256=iSoDxxTalQKhyKjvsojFlkROhBFvAjvJxRvPJlmGrSg,2843
147
148
  orionis/container/validators/is_abstract_class.py,sha256=Q-Lqyrrps6oj2XWI0KFRp-hDZf4_sgbZlEbfBXj5XT4,1169
@@ -243,7 +244,7 @@ orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1i
243
244
  orionis/foundation/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
244
245
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
245
246
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
246
- orionis/metadata/framework.py,sha256=IhPmn8wBfMaPIOA6TEFEcnsrQ6JRJkYY7ET01P4bSBU,4960
247
+ orionis/metadata/framework.py,sha256=svbGGD2xkWp-acBSsN0mAnDdJP_467sDrJurMdbEcTw,4960
247
248
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
248
249
  orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
249
250
  orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -355,7 +356,7 @@ orionis/test/suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
355
356
  orionis/test/suite/test_unit.py,sha256=MWgW8dRCRyT1XZ5LsbXQ7-KVPReasoXwzEEL1EWWfE4,52190
356
357
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
357
358
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
358
- orionis-0.325.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
359
+ orionis-0.326.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
359
360
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
360
361
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
361
362
  tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
@@ -456,8 +457,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=yeVwl-VcwkWSQYyxZu
456
457
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
457
458
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
458
459
  tests/testing/test_testing_unit.py,sha256=DjLBtvVn8B1KlVJNNkstBT8_csA1yeaMqnGrbanN_J4,7438
459
- orionis-0.325.0.dist-info/METADATA,sha256=I_YFjyuy8QRXf_lRW03geTqwLoN1QgHe-LXTm2_qk3Q,4772
460
- orionis-0.325.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
461
- orionis-0.325.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
462
- orionis-0.325.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
463
- orionis-0.325.0.dist-info/RECORD,,
460
+ orionis-0.326.0.dist-info/METADATA,sha256=9cULji4Q0k6ra8WQx__ktSXu2OXXFZHm8RZ-rKpG9LY,4772
461
+ orionis-0.326.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
462
+ orionis-0.326.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
463
+ orionis-0.326.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
464
+ orionis-0.326.0.dist-info/RECORD,,