orionis 0.56.0__py3-none-any.whl → 0.58.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,4 +56,26 @@ class ICommandsBootstrapper(ABC):
56
56
  ValueError
57
57
  If the class does not have required attributes or methods.
58
58
  """
59
+ pass
60
+
61
+ @abstractmethod
62
+ def get(self, signature: str = None) -> Dict[str, Any]:
63
+ """
64
+ Retrieves a registered command by its signature.
65
+
66
+ Parameters
67
+ ----------
68
+ signature : str
69
+ The command signature to retrieve.
70
+
71
+ Returns
72
+ -------
73
+ Dict[str, Any]
74
+ A dictionary containing the command class, arguments, description, and signature.
75
+
76
+ Raises
77
+ ------
78
+ KeyError
79
+ If the command signature is not found.
80
+ """
59
81
  pass
@@ -109,4 +109,32 @@ class IConfigBootstrapper(ABC):
109
109
  ValueError
110
110
  If the section is already registered.
111
111
  """
112
+ pass
113
+
114
+ @abstractmethod
115
+ def get(self, key: str = None, default: Any = None) -> Any:
116
+ """
117
+ Retrieves configuration data.
118
+
119
+ If a key is provided, it retrieves the value associated with the key using dot notation.
120
+ If no key is provided, it returns the entire configuration dictionary.
121
+
122
+ Parameters
123
+ ----------
124
+ key : str, optional
125
+ The key to retrieve the value for, using dot notation (default is None).
126
+ default : Any, optional
127
+ The default value to return if the key is not found (default is None).
128
+
129
+ Returns
130
+ -------
131
+ Any
132
+ The configuration value associated with the key, or the entire configuration dictionary
133
+ if no key is provided. If the key is not found, returns the default value.
134
+
135
+ Raises
136
+ ------
137
+ KeyError
138
+ If the key is not found and no default value is provided.
139
+ """
112
140
  pass
orionis/framework.py CHANGED
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.56.0"
8
+ VERSION = "0.58.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
orionis/luminate/app.py CHANGED
@@ -1,18 +1,28 @@
1
1
  from orionis.luminate.container.container import Container
2
2
  from orionis.luminate.bootstrap.config_bootstrapper import ConfigBootstrapper
3
+ from orionis.luminate.bootstrap.command_bootstrapper import CommandsBootstrapper
3
4
  from orionis.luminate.patterns.singleton import SingletonMeta
4
5
 
5
6
  class Application(metaclass=SingletonMeta):
6
7
 
7
8
  def __init__(self):
9
+
10
+ self._config = {}
11
+ self._commands = {}
12
+
8
13
  self.container = Container()
9
14
  self.container.instance(self.container)
10
15
  self._bootstraping()
11
16
 
12
17
  def _bootstraping(self):
13
- config_bootstrapper = self.container.singleton(ConfigBootstrapper)
14
- config = self.container.make(config_bootstrapper)
15
- print(config)
18
+ config_bootstrapper_key = self.container.singleton(ConfigBootstrapper)
19
+ config_bootstrapper: ConfigBootstrapper = self.container.make(config_bootstrapper_key)
20
+ self._config = config_bootstrapper.get()
21
+
22
+ commands_bootstrapper_key = self.container.singleton(CommandsBootstrapper)
23
+ commands_bootstrapper: CommandsBootstrapper = self.container.make(commands_bootstrapper_key)
24
+ self._commands = commands_bootstrapper.get()
25
+ print(self._commands)
16
26
 
17
27
  def isBooted(self):
18
28
  return True
@@ -147,4 +147,27 @@ class CommandsBootstrapper(ICommandsBootstrapper):
147
147
  'arguments': arguments,
148
148
  'description': description,
149
149
  'signature': signature
150
- }
150
+ }
151
+
152
+ def get(self, signature: str = None) -> Dict[str, Any]:
153
+ """
154
+ Retrieves a registered command by its signature.
155
+
156
+ Parameters
157
+ ----------
158
+ signature : str
159
+ The command signature to retrieve.
160
+
161
+ Returns
162
+ -------
163
+ Dict[str, Any]
164
+ A dictionary containing the command class, arguments, description, and signature.
165
+
166
+ Raises
167
+ ------
168
+ KeyError
169
+ If the command signature is not found.
170
+ """
171
+ if signature is None:
172
+ return self._commands
173
+ return self._commands[signature]
@@ -165,4 +165,45 @@ class ConfigBootstrapper(IConfigBootstrapper):
165
165
  """
166
166
  if section in self._config:
167
167
  raise ValueError(f"Configuration section '{section}' is already registered.")
168
- self._config[section] = data
168
+ self._config[section] = data
169
+
170
+ def get(self, key: str = None, default: Any = None) -> Any:
171
+ """
172
+ Retrieves configuration data.
173
+
174
+ If a key is provided, it retrieves the value associated with the key using dot notation.
175
+ If no key is provided, it returns the entire configuration dictionary.
176
+
177
+ Parameters
178
+ ----------
179
+ key : str, optional
180
+ The key to retrieve the value for, using dot notation (default is None).
181
+ default : Any, optional
182
+ The default value to return if the key is not found (default is None).
183
+
184
+ Returns
185
+ -------
186
+ Any
187
+ The configuration value associated with the key, or the entire configuration dictionary
188
+ if no key is provided. If the key is not found, returns the default value.
189
+
190
+ Raises
191
+ ------
192
+ KeyError
193
+ If the key is not found and no default value is provided.
194
+ """
195
+ if key is None:
196
+ return self._config
197
+
198
+ keys = key.split('.')
199
+ value = self._config
200
+
201
+ try:
202
+ for k in keys:
203
+ value = value[k]
204
+ except KeyError:
205
+ if default is not None:
206
+ return default
207
+ raise KeyError(f"Key '{key}' not found in configuration.")
208
+
209
+ return value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.56.0
3
+ Version: 0.58.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
@@ -1,9 +1,9 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/cli_manager.py,sha256=0bM-hABXJSoPGuvEgnqeaj9qcLP8VjTQ3z9Mb0TSEUI,1381
3
- orionis/framework.py,sha256=8hBzbeYv75ZZ3G8XYRcJI_n2XpjCzctK6sd9FiYhdX8,1386
3
+ orionis/framework.py,sha256=1SuX-fO2e1rTuvmdCIVjhOfzwh24mffYAfBHOkZA2AQ,1386
4
4
  orionis/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- orionis/contracts/bootstrap/i_command_bootstrapper.py,sha256=kdabnjTRXcab0Kelcst8MhuJ_iP0XX8taChMupwzF1M,1901
6
- orionis/contracts/bootstrap/i_config_bootstrapper.py,sha256=x38bXXX49ASm5yZ0O6vwssmtiLMsF-fkxFcq-Cqf5GM,3480
5
+ orionis/contracts/bootstrap/i_command_bootstrapper.py,sha256=cfpYWSlNhOY1q_C9o0H7F381OoM0Oh0qaeqP-c85nzk,2457
6
+ orionis/contracts/bootstrap/i_config_bootstrapper.py,sha256=d2TXT74H2fCBbzWgrt9-ZG11S_H_YPQOEcJoIOrsgb0,4462
7
7
  orionis/contracts/bootstrap/i_environment_bootstrapper.py,sha256=MEeZmh0XWvzvWHFB5ZOp5SKY89F1IHsIXJvdjmEncJU,1076
8
8
  orionis/contracts/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  orionis/contracts/config/i_config.py,sha256=rbeojO2gm8XhSXIPY8EnUt4e0wO633OKF9Nx_tN5y60,785
@@ -54,11 +54,11 @@ orionis/installer/installer_manager.py,sha256=Hb6T0bmSl39T30maY-nUWkrLhG77JdrKe4
54
54
  orionis/installer/installer_output.py,sha256=LeKxzuXpnHOKbKpUtx3tMGkCi2bGcPV1VNnfBxwfxUU,7161
55
55
  orionis/installer/installer_setup.py,sha256=c2HtVklSa-2_-YVonc7fwtoK-RTDqBS2Ybvbekgfqtc,6970
56
56
  orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
- orionis/luminate/app.py,sha256=Rv7DGF5gDAIm8aPfg5xm1ceuye2n1ukor5sF7JU8pf8,629
57
+ orionis/luminate/app.py,sha256=UoP-uDYX2mgeLMVtJHW4xcu9O47mST14Pcfxdghod5Y,1112
58
58
  orionis/luminate/app_context.py,sha256=XREVkOHU6aP8UB2daA2QbFcOCB8HRmcGXjVbrlW1AHQ,1827
59
59
  orionis/luminate/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- orionis/luminate/bootstrap/command_bootstrapper.py,sha256=fXOvdeyNoB2oN_o1YzhWMbjLa3Nubgwo5QaTNAfm9N4,6297
61
- orionis/luminate/bootstrap/config_bootstrapper.py,sha256=Ep300UwgJvatv4TUfPy6KeqrYKjCr13eFTbKtMBsHZs,6137
60
+ orionis/luminate/bootstrap/command_bootstrapper.py,sha256=G0qckn4QSi3SRZJCjDApiDhltofb8qp9GOVf0ky0Hew,6926
61
+ orionis/luminate/bootstrap/config_bootstrapper.py,sha256=Gw83UtPAOggwzqmz062JfJcpIfmZvmIQyZJfgVFiIcQ,7474
62
62
  orionis/luminate/bootstrap/environment_bootstrapper.py,sha256=kBTpc5j01_O5hwTLpKxwx2kOwwjOgJlrqoxlYflmHlE,2758
63
63
  orionis/luminate/bootstrap/exception_bootstrapper.py,sha256=wDKfEW295c7-bavr7YUHK2CLYcTSZgjT9ZRSBne6GOE,1356
64
64
  orionis/luminate/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -144,9 +144,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
144
144
  tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
145
  tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
146
146
  tests/tools/test_reflection.py,sha256=bhLQ7VGVod4B8sv-rW9AjnOumvaBVsoxieA3sdoM2yM,5244
147
- orionis-0.56.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
148
- orionis-0.56.0.dist-info/METADATA,sha256=lEuikqLbJZ2w43uTNwbHO_PG3QB1wwtb7UBPwfKtdyM,2978
149
- orionis-0.56.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
150
- orionis-0.56.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
151
- orionis-0.56.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
152
- orionis-0.56.0.dist-info/RECORD,,
147
+ orionis-0.58.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
148
+ orionis-0.58.0.dist-info/METADATA,sha256=7RmQw3DFcxR9FHvtNUUvqbCbdyld3v5HqOOWe5-BdzY,2978
149
+ orionis-0.58.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
150
+ orionis-0.58.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
151
+ orionis-0.58.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
152
+ orionis-0.58.0.dist-info/RECORD,,