orionis 0.322.0__py3-none-any.whl → 0.324.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.
File without changes
@@ -0,0 +1,60 @@
1
+ from typing import Any
2
+ from orionis.container.container import Container
3
+
4
+ class FacadeMeta(type):
5
+
6
+ def __getattr__(cls, name: str) -> Any:
7
+ """
8
+ 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
+ Args:
12
+ name: The name of the attribute to access
13
+
14
+ Returns:
15
+ The requested attribute from the underlying service
16
+ """
17
+ service = cls.resolve()
18
+ if not hasattr(service, name):
19
+ raise AttributeError(f"'{cls.__name__}' facade's service has no attribute '{name}'")
20
+ return getattr(service, name)
21
+
22
+
23
+ class Facade(metaclass=FacadeMeta):
24
+
25
+ _container = Container()
26
+
27
+ @classmethod
28
+ def getFacadeAccessor(cls) -> str:
29
+ """
30
+ This method must be overridden by subclasses to return the name of the service to be resolved.
31
+ If not, it throws a tantrum (NotImplementedError).
32
+
33
+ Returns:
34
+ The service name to be resolved from the container
35
+ """
36
+ raise NotImplementedError(f"Class {cls.__name__} must define the getFacadeAccessor method")
37
+
38
+ @classmethod
39
+ def resolve(cls) -> Any:
40
+ """
41
+ Resolves the service from the Container with caching for improved performance.
42
+ It's like calling the butler to fetch something from the pantry.
43
+
44
+ Returns:
45
+ The resolved service instance
46
+ """
47
+
48
+ # Get the service name from the facade accessor
49
+ service_name = cls.getFacadeAccessor()
50
+
51
+ # Check if the service is bound in the container
52
+ if not cls._container.bound(service_name):
53
+ raise RuntimeError(
54
+ f"The service '{service_name}' is not bound in the container. "
55
+ "Did you forget to register it?"
56
+ )
57
+
58
+ # Resolve the service instance from the container
59
+ service_instance = cls._container.make(service_name)
60
+ return service_instance
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.322.0"
8
+ VERSION = "0.324.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.322.0
3
+ Version: 0.324.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
@@ -140,6 +140,8 @@ orionis/container/enums/lifetimes.py,sha256=RqQmugMIB1Ev_j_vFLcWorndm-to7xg4stQ7
140
140
  orionis/container/exceptions/container_exception.py,sha256=goTDEwC70xTMD2qppN8KV-xyR0Nps218OD4D1LZ2-3s,470
141
141
  orionis/container/exceptions/type_error_exception.py,sha256=cYuvoXVOgRYj3tZPfK341aUERkf33-buOiI2eXxcrAw,470
142
142
  orionis/container/exceptions/value_exception.py,sha256=hjY0YEusoL3DurME1ornxvIv1wyGaf6tBggLFlGHblo,472
143
+ orionis/container/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
+ orionis/container/facades/facade.py,sha256=8YMuZp9Mc--OfGzcyDbSke8Xi5V1kpRglHvMWftr1DQ,2075
143
145
  orionis/container/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
146
  orionis/container/validators/implements.py,sha256=iSoDxxTalQKhyKjvsojFlkROhBFvAjvJxRvPJlmGrSg,2843
145
147
  orionis/container/validators/is_abstract_class.py,sha256=Q-Lqyrrps6oj2XWI0KFRp-hDZf4_sgbZlEbfBXj5XT4,1169
@@ -241,7 +243,7 @@ orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1i
241
243
  orionis/foundation/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
242
244
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
243
245
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
244
- orionis/metadata/framework.py,sha256=-G5Ox-3m6R7JXyXZxf3c-6gmJ37J674tYlWjc8-Ar6k,4960
246
+ orionis/metadata/framework.py,sha256=Tn2CA1aDnOjAWmbHE6LPW2Tppul-5HWA9jaGGOqOPP0,4960
245
247
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
246
248
  orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
247
249
  orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -353,7 +355,7 @@ orionis/test/suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
353
355
  orionis/test/suite/test_unit.py,sha256=MWgW8dRCRyT1XZ5LsbXQ7-KVPReasoXwzEEL1EWWfE4,52190
354
356
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
355
357
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
356
- orionis-0.322.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
358
+ orionis-0.324.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
357
359
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
358
360
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
361
  tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
@@ -454,8 +456,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=yeVwl-VcwkWSQYyxZu
454
456
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
455
457
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
456
458
  tests/testing/test_testing_unit.py,sha256=DjLBtvVn8B1KlVJNNkstBT8_csA1yeaMqnGrbanN_J4,7438
457
- orionis-0.322.0.dist-info/METADATA,sha256=AU8sCGe16NBNt6PHdMNm_gcUrv3R8mwDPArdt-WH0qU,4772
458
- orionis-0.322.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
459
- orionis-0.322.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
460
- orionis-0.322.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
461
- orionis-0.322.0.dist-info/RECORD,,
459
+ orionis-0.324.0.dist-info/METADATA,sha256=IfgMF40zGtLB70soj7RfPxfOlijb56XbhLfGbl2HHI8,4772
460
+ orionis-0.324.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
461
+ orionis-0.324.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
462
+ orionis-0.324.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
463
+ orionis-0.324.0.dist-info/RECORD,,