orionis 0.55.0__py3-none-any.whl → 0.57.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- orionis/contracts/bootstrap/i_config_bootstrapper.py +28 -0
- orionis/framework.py +1 -1
- orionis/luminate/bootstrap/config_bootstrapper.py +42 -1
- orionis/luminate/facades/environment/environment_facade.py +2 -2
- {orionis-0.55.0.dist-info → orionis-0.57.0.dist-info}/METADATA +1 -1
- {orionis-0.55.0.dist-info → orionis-0.57.0.dist-info}/RECORD +10 -10
- {orionis-0.55.0.dist-info → orionis-0.57.0.dist-info}/LICENCE +0 -0
- {orionis-0.55.0.dist-info → orionis-0.57.0.dist-info}/WHEEL +0 -0
- {orionis-0.55.0.dist-info → orionis-0.57.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.55.0.dist-info → orionis-0.57.0.dist-info}/top_level.txt +0 -0
@@ -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
@@ -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
|
@@ -26,9 +26,9 @@ def env(key: str, default=None) -> str:
|
|
26
26
|
The value of the environment variable, or the default value if the variable
|
27
27
|
does not exist.
|
28
28
|
"""
|
29
|
-
return
|
29
|
+
return Env().get(key, default)
|
30
30
|
|
31
|
-
class
|
31
|
+
class Env(IEnv):
|
32
32
|
"""
|
33
33
|
A thread-safe singleton class that manages environment variables from a .env file.
|
34
34
|
"""
|
@@ -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=
|
3
|
+
orionis/framework.py,sha256=vsjeBThFCOAyMIZo314Hf8gRrClEnN4Uwbx-vMPKhw4,1386
|
4
4
|
orionis/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
orionis/contracts/bootstrap/i_command_bootstrapper.py,sha256=kdabnjTRXcab0Kelcst8MhuJ_iP0XX8taChMupwzF1M,1901
|
6
|
-
orionis/contracts/bootstrap/i_config_bootstrapper.py,sha256=
|
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
|
@@ -58,7 +58,7 @@ orionis/luminate/app.py,sha256=Rv7DGF5gDAIm8aPfg5xm1ceuye2n1ukor5sF7JU8pf8,629
|
|
58
58
|
orionis/luminate/app_context.py,sha256=XREVkOHU6aP8UB2daA2QbFcOCB8HRmcGXjVbrlW1AHQ,1827
|
59
59
|
orionis/luminate/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
60
60
|
orionis/luminate/bootstrap/command_bootstrapper.py,sha256=fXOvdeyNoB2oN_o1YzhWMbjLa3Nubgwo5QaTNAfm9N4,6297
|
61
|
-
orionis/luminate/bootstrap/config_bootstrapper.py,sha256=
|
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
|
@@ -101,7 +101,7 @@ orionis/luminate/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
101
101
|
orionis/luminate/facades/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
102
102
|
orionis/luminate/facades/config/config_facade.py,sha256=GLQ6JiD2dB7WLyhUZ4SGBSNo7VuwHpX_QrrQcvjoAi8,1429
|
103
103
|
orionis/luminate/facades/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
|
-
orionis/luminate/facades/environment/environment_facade.py,sha256=
|
104
|
+
orionis/luminate/facades/environment/environment_facade.py,sha256=AzaaQaOz8scgSCVi3liyLaBI_nXhZR2deLFhOQ2nmhU,4191
|
105
105
|
orionis/luminate/facades/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
106
106
|
orionis/luminate/facades/files/path_facade.py,sha256=uWU8_-iaMGBWuVxbk_MoTm0FVFq25F_ub-ObvrtceHg,8987
|
107
107
|
orionis/luminate/facades/log/__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.
|
148
|
-
orionis-0.
|
149
|
-
orionis-0.
|
150
|
-
orionis-0.
|
151
|
-
orionis-0.
|
152
|
-
orionis-0.
|
147
|
+
orionis-0.57.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
148
|
+
orionis-0.57.0.dist-info/METADATA,sha256=yLvm_eP4WXlpxMizPT2l7ZM-20NmKHUtYnfXaH7KBX8,2978
|
149
|
+
orionis-0.57.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
150
|
+
orionis-0.57.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
151
|
+
orionis-0.57.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
152
|
+
orionis-0.57.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|