orionis 0.287.0__py3-none-any.whl → 0.289.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.
Files changed (78) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/metadata/package.py +17 -46
  3. orionis/services/environment/contracts/types.py +70 -0
  4. orionis/services/environment/dot_env.py +11 -13
  5. orionis/services/environment/{type_hint.py → types.py} +64 -45
  6. orionis/services/paths/exceptions/not_found_exceptions.py +15 -12
  7. orionis/services/paths/exceptions/path_value_exceptions.py +13 -10
  8. orionis/services/standard/contracts/std.py +1 -1
  9. orionis/services/standard/exceptions/std_value_exception.py +23 -0
  10. orionis/services/standard/std.py +2 -2
  11. orionis/services/system/contracts/imports.py +27 -7
  12. orionis/services/system/contracts/workers.py +8 -3
  13. orionis/services/system/imports.py +31 -12
  14. orionis/services/system/runtime_imports.py +33 -23
  15. orionis/services/system/workers.py +6 -8
  16. orionis/services/wrapper/dicts/dot_dict.py +82 -41
  17. orionis/unittesting.py +12 -12
  18. {orionis-0.287.0.dist-info → orionis-0.289.0.dist-info}/METADATA +1 -1
  19. {orionis-0.287.0.dist-info → orionis-0.289.0.dist-info}/RECORD +76 -69
  20. tests/foundation/config/app/{test_app.py → test_foundation_config_app.py} +1 -1
  21. tests/foundation/config/auth/{test_auth.py → test_foundation_config_auth.py} +1 -1
  22. tests/foundation/config/cache/{test_cache.py → test_foundation_config_cache.py} +1 -1
  23. tests/foundation/config/cache/{test_cache_file.py → test_foundation_config_cache_file.py} +1 -1
  24. tests/foundation/config/cache/{test_cache_stores.py → test_foundation_config_cache_stores.py} +1 -1
  25. tests/foundation/config/cors/{test_cors.py → test_foundation_config_cors.py} +1 -1
  26. tests/foundation/config/database/{test_database.py → test_foundation_config_database.py} +1 -1
  27. tests/foundation/config/database/{test_database_connections.py → test_foundation_config_database_connections.py} +1 -1
  28. tests/foundation/config/database/{test_database_mysql.py → test_foundation_config_database_mysql.py} +1 -1
  29. tests/foundation/config/database/{test_database_oracle.py → test_foundation_config_database_oracle.py} +1 -1
  30. tests/foundation/config/database/{test_database_pgsql.py → test_foundation_config_database_pgsql.py} +1 -1
  31. tests/foundation/config/database/{test_database_sqlite.py → test_foundation_config_database_sqlite.py} +1 -1
  32. tests/foundation/config/exceptions/{test_exceptions_integrity.py → test_foundation_config_exceptions.py} +1 -1
  33. tests/foundation/config/filesystems/{test_filesystems.py → test_foundation_config_filesystems.py} +1 -1
  34. tests/foundation/config/filesystems/{test_filesystems_aws.py → test_foundation_config_filesystems_aws.py} +1 -1
  35. tests/foundation/config/filesystems/{test_filesystems_disks.py → test_foundation_config_filesystems_disks.py} +1 -1
  36. tests/foundation/config/filesystems/{test_filesystems_local.py → test_foundation_config_filesystems_local.py} +1 -1
  37. tests/foundation/config/filesystems/{test_filesystems_public.py → test_foundation_config_filesystems_public.py} +1 -1
  38. tests/foundation/config/logging/{test_logging.py → test_foundation_config_logging.py} +1 -1
  39. tests/foundation/config/logging/{test_logging_channels.py → test_foundation_config_logging_channels.py} +1 -1
  40. tests/foundation/config/logging/{test_logging_chunked.py → test_foundation_config_logging_chunked.py} +1 -1
  41. tests/foundation/config/logging/{test_logging_daily.py → test_foundation_config_logging_daily.py} +1 -1
  42. tests/foundation/config/logging/{test_logging_hourly.py → test_foundation_config_logging_hourly.py} +1 -1
  43. tests/foundation/config/logging/{test_logging_monthly.py → test_foundation_config_logging_monthly.py} +1 -1
  44. tests/foundation/config/logging/{test_logging_stack.py → test_foundation_config_logging_stack.py} +1 -1
  45. tests/foundation/config/logging/{test_logging_weekly.py → test_foundation_config_logging_weekly.py} +1 -1
  46. tests/foundation/config/mail/{test_mail.py → test_foundation_config_mail.py} +1 -1
  47. tests/foundation/config/mail/{test_mail_file.py → test_foundation_config_mail_file.py} +1 -1
  48. tests/foundation/config/mail/{test_mail_mailers.py → test_foundation_config_mail_mailers.py} +1 -1
  49. tests/foundation/config/mail/{test_mail_smtp.py → test_foundation_config_mail_smtp.py} +1 -1
  50. tests/foundation/config/queue/{test_queue.py → test_foundation_config_queue.py} +1 -1
  51. tests/foundation/config/queue/{test_queue_brokers.py → test_foundation_config_queue_brokers.py} +1 -1
  52. tests/foundation/config/queue/{test_queue_database.py → test_foundation_config_queue_database.py} +1 -1
  53. tests/foundation/config/root/{test_root_paths.py → test_foundation_config_root_paths.py} +1 -1
  54. tests/foundation/config/session/{test_session.py → test_foundation_config_session.py} +1 -1
  55. tests/foundation/config/startup/{test_config_startup.py → test_foundation_config_startup.py} +14 -14
  56. tests/foundation/config/testing/{test_testing.py → test_foundation_config_testing.py} +1 -1
  57. tests/metadata/__init__.py +0 -0
  58. tests/metadata/test_metadata_framework.py +101 -0
  59. tests/metadata/test_metadata_package.py +69 -0
  60. tests/patterns/singleton/{test_singleton.py → test_patterns_singleton.py} +1 -1
  61. tests/services/asynchrony/{test_async_io.py → test_services_asynchrony_coroutine.py} +1 -1
  62. tests/services/environment/test_services_environment.py +93 -0
  63. tests/services/parsers/mocks/mock_custom_error.py +14 -4
  64. tests/services/parsers/{test_exception_parser.py → test_services_parser_exceptions.py} +21 -2
  65. tests/services/path/{test_resolver.py → test_services_resolver.py} +51 -12
  66. tests/services/standard/{test_std.py → test_services_std.py} +45 -22
  67. tests/services/system/__init__.py +0 -0
  68. tests/services/system/test_services_system_imports.py +101 -0
  69. tests/services/system/test_services_system_workers.py +89 -0
  70. tests/services/wrapper/{test_wrapper_doc_dict.py → test_services_wrapper_docdict.py} +28 -16
  71. tests/testing/test_testing_result.py +1 -1
  72. tests/testing/test_testing_unit.py +16 -16
  73. orionis/services/standard/exceptions/path_value_exceptions.py +0 -28
  74. tests/services/environment/test_env.py +0 -154
  75. {orionis-0.287.0.dist-info → orionis-0.289.0.dist-info}/WHEEL +0 -0
  76. {orionis-0.287.0.dist-info → orionis-0.289.0.dist-info}/licenses/LICENCE +0 -0
  77. {orionis-0.287.0.dist-info → orionis-0.289.0.dist-info}/top_level.txt +0 -0
  78. {orionis-0.287.0.dist-info → orionis-0.289.0.dist-info}/zip-safe +0 -0
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.287.0"
8
+ VERSION = "0.289.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -7,38 +7,9 @@ class PypiPackageApi:
7
7
  This class initializes by retrieving package information from the PyPI JSON API for the 'orionis' package.
8
8
  It exposes various methods to access metadata such as the package name, version, author, description, license,
9
9
  classifiers, required Python version, keywords, and project URLs.
10
- Attributes:
11
- _baseUrl (str): The URL to the PyPI JSON API for the Orionis package.
12
- _info (dict): A dictionary containing the package metadata fetched from PyPI.
13
- Methods:
14
- getAllData():
15
- Fetches and updates the internal information dictionary with the latest data from PyPI.
16
- getName():
17
- Returns the CLI name by appending '-cli' to the package name.
18
- getVersion():
19
- Returns the version string of the framework.
20
- getAuthor():
21
- Returns the author's name.
22
- getAuthorEmail():
23
- Returns the author's email address.
24
- getDescription():
25
- Returns the summary description of the framework.
26
- getUrl():
27
- Returns the homepage URL of the project.
28
- getLongDescription():
29
- getDescriptionContentType():
30
- Returns the content type of the long description.
31
- getLicense():
32
- Returns the license type, defaulting to "MIT" if not specified.
33
- getClassifiers():
34
- Returns a list of PyPI classifiers for the package.
35
- getPythonVersion():
36
- Returns the required Python version specification.
37
- getKeywords():
38
- Returns a list of keywords associated with the package.
39
10
  """
40
11
 
41
- def __init__(self):
12
+ def __init__(self) -> None:
42
13
  """
43
14
  Initializes the class by setting the base URL for the Orionis PyPI package,
44
15
  initializing the information dictionary, and retrieving all package data.
@@ -47,7 +18,7 @@ class PypiPackageApi:
47
18
  self._info = {}
48
19
  self.getAllData()
49
20
 
50
- def getAllData(self):
21
+ def getAllData(self) -> dict:
51
22
  """
52
23
  Fetches all data from the base URL and updates the internal info attribute.
53
24
 
@@ -76,16 +47,16 @@ class PypiPackageApi:
76
47
  f"Invalid response structure from PyPI: {ve}"
77
48
  )
78
49
 
79
- def getName(self):
50
+ def getName(self) -> str:
80
51
  """
81
- Returns the CLI name by appending '-cli' to the value of the 'name' key in the _info dictionary.
52
+ Returns the package name from the value of the 'name' key in the _info dictionary.
82
53
 
83
54
  Returns:
84
- str: The CLI name in the format '<name>-cli'.
55
+ str: The package name.
85
56
  """
86
- return f"{self._info['name']}-cli"
57
+ return self._info['name']
87
58
 
88
- def getVersion(self):
59
+ def getVersion(self) -> str:
89
60
  """
90
61
  Returns the version information of the framework.
91
62
 
@@ -94,7 +65,7 @@ class PypiPackageApi:
94
65
  """
95
66
  return self._info['version']
96
67
 
97
- def getAuthor(self):
68
+ def getAuthor(self) -> str:
98
69
  """
99
70
  Returns the author of the framework.
100
71
 
@@ -103,7 +74,7 @@ class PypiPackageApi:
103
74
  """
104
75
  return self._info['author']
105
76
 
106
- def getAuthorEmail(self):
77
+ def getAuthorEmail(self) -> str:
107
78
  """
108
79
  Retrieve the author's email address from the internal information dictionary.
109
80
 
@@ -112,7 +83,7 @@ class PypiPackageApi:
112
83
  """
113
84
  return self._info['author_email']
114
85
 
115
- def getDescription(self):
86
+ def getDescription(self) -> str:
116
87
  """
117
88
  Returns the summary description from the internal information dictionary.
118
89
 
@@ -121,7 +92,7 @@ class PypiPackageApi:
121
92
  """
122
93
  return self._info['summary']
123
94
 
124
- def getUrl(self):
95
+ def getUrl(self) -> str:
125
96
  """
126
97
  Retrieves the homepage URL from the project's information.
127
98
 
@@ -130,7 +101,7 @@ class PypiPackageApi:
130
101
  """
131
102
  return self._info['project_urls']['Homepage']
132
103
 
133
- def getLongDescription(self):
104
+ def getLongDescription(self) -> str:
134
105
  """
135
106
  Returns the long description of the framework.
136
107
 
@@ -139,7 +110,7 @@ class PypiPackageApi:
139
110
  """
140
111
  return self._info['description']
141
112
 
142
- def getDescriptionContentType(self):
113
+ def getDescriptionContentType(self) -> str:
143
114
  """
144
115
  Returns the content type of the description from the internal information dictionary.
145
116
 
@@ -148,7 +119,7 @@ class PypiPackageApi:
148
119
  """
149
120
  return self._info['description_content_type']
150
121
 
151
- def getLicense(self):
122
+ def getLicense(self) -> str:
152
123
  """
153
124
  Returns the license type specified in the framework information.
154
125
 
@@ -159,7 +130,7 @@ class PypiPackageApi:
159
130
  """
160
131
  return self._info['license'] or "MIT"
161
132
 
162
- def getClassifiers(self):
133
+ def getClassifiers(self) -> list:
163
134
  """
164
135
  Returns the list of classifiers from the internal _info dictionary.
165
136
 
@@ -168,7 +139,7 @@ class PypiPackageApi:
168
139
  """
169
140
  return self._info['classifiers']
170
141
 
171
- def getPythonVersion(self):
142
+ def getPythonVersion(self) -> str:
172
143
  """
173
144
  Retrieves the required Python version for the framework.
174
145
 
@@ -177,7 +148,7 @@ class PypiPackageApi:
177
148
  """
178
149
  return self._info['requires_python']
179
150
 
180
- def getKeywords(self):
151
+ def getKeywords(self) -> list:
181
152
  """
182
153
  Retrieve the list of keywords associated with the current object.
183
154
 
@@ -0,0 +1,70 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class IEnvTypes(ABC):
4
+
5
+ @abstractmethod
6
+ def to(self, type_hint: str):
7
+ """
8
+ Set the type hint for the Type instance.
9
+
10
+ Parameters
11
+ ----------
12
+ type_hint : str
13
+ The type hint to set, which must be one of the valid options defined in OPTIONS.
14
+
15
+ Raises
16
+ ------
17
+ OrionisEnvironmentValueError
18
+ If the provided type hint is not one of the valid options.
19
+ """
20
+ pass
21
+
22
+ @abstractmethod
23
+ def hasValidTypeHint(self) -> bool:
24
+ """
25
+ Check if the type hint is valid.
26
+
27
+ Returns
28
+ -------
29
+ bool
30
+ True if the type hint is valid (exists in the OPTIONS set), False otherwise.
31
+ """
32
+ pass
33
+
34
+ @abstractmethod
35
+ def explode(self) -> tuple:
36
+ """
37
+ Returns a tuple containing the type hint and value string.
38
+
39
+ Returns
40
+ -------
41
+ tuple
42
+ A tuple (type_hint, value_str) where:
43
+ type_hint : str or None
44
+ The extracted type hint in lowercase, or None if not provided.
45
+ value_str : str or None
46
+ The extracted value string, or None if not provided.
47
+ """
48
+ pass
49
+
50
+ @abstractmethod
51
+ def get(self):
52
+ """
53
+ Returns the value corresponding to the specified type hint.
54
+
55
+ Checks if the provided type hint is valid and then dispatches the call to the appropriate
56
+ method for handling the type.
57
+
58
+ Supported type hints include: 'path:', 'str:', 'int:', 'float:', 'bool:', 'list:', 'dict:', 'tuple:', and 'set:'.
59
+
60
+ Returns
61
+ -------
62
+ Any
63
+ The value converted or processed according to the specified type hint.
64
+
65
+ Raises
66
+ ------
67
+ OrionisEnvironmentValueError
68
+ If the type hint is not one of the supported options.
69
+ """
70
+ pass
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import ast
3
+ import re
3
4
  import threading
4
5
  from pathlib import Path
5
6
  from typing import Any, Optional, Union
@@ -7,7 +8,7 @@ from dotenv import dotenv_values, load_dotenv, set_key, unset_key
7
8
  from orionis.patterns.singleton.meta_class import Singleton
8
9
  from orionis.services.environment.exceptions.environment_value_exception import OrionisEnvironmentValueException
9
10
  from orionis.services.environment.exceptions.environment_value_error import OrionisEnvironmentValueError
10
- from orionis.services.environment.type_hint import EnvTypes
11
+ from orionis.services.environment.types import EnvTypes
11
12
 
12
13
  class DotEnv(metaclass=Singleton):
13
14
 
@@ -114,7 +115,7 @@ class DotEnv(metaclass=Singleton):
114
115
  return None
115
116
 
116
117
  # Return immediately if already a basic type
117
- if isinstance(value, (bool, int, float, dict, list, tuple)):
118
+ if isinstance(value, (bool, int, float, dict, list, tuple, set)):
118
119
  return value
119
120
 
120
121
  # Convert to string and clean
@@ -163,6 +164,11 @@ class DotEnv(metaclass=Singleton):
163
164
  """
164
165
  with self._lock:
165
166
 
167
+ # Ensure the key is a string.
168
+ if not isinstance(key, str) or not re.match(r'^[A-Z][A-Z0-9_]*$', key):
169
+ raise OrionisEnvironmentValueError(
170
+ f"The environment variable name '{key}' is not valid. It must be an uppercase string, may contain numbers and underscores, and must always start with a letter. Example of a valid name: 'MY_ENV_VAR'."
171
+ )
166
172
 
167
173
  # Ensure the value is a valid type.
168
174
  if not isinstance(value, (str, int, float, bool, list, dict, tuple, set)):
@@ -170,17 +176,9 @@ class DotEnv(metaclass=Singleton):
170
176
  f"Unsupported value type: {type(value).__name__}. Allowed types are str, int, float, bool, list, dict, tuple, set."
171
177
  )
172
178
 
173
- # Ensure the type is a string.
174
- if not isinstance(type_hint, str):
175
- raise OrionisEnvironmentValueError(
176
- f"Type hint must be a string, got {type(value).__name__}."
177
- )
178
-
179
- # Ensure the key is a string.
180
- if not isinstance(key, str):
181
- raise OrionisEnvironmentValueError(
182
- f"Key must be a string, got {type(key).__name__}."
183
- )
179
+ # Dinamically determine the type hint if not provided.
180
+ if isinstance(value, (int, float, bool, list, dict, tuple, set)) and not type_hint:
181
+ type_hint = type(value).__name__.lower()
184
182
 
185
183
  # Validate the type hint if provided.
186
184
  options = EnvTypes.options()
@@ -1,7 +1,8 @@
1
+ from orionis.services.environment.contracts.types import IEnvTypes
1
2
  from orionis.services.environment.exceptions.environment_value_error import OrionisEnvironmentValueError
2
3
  from orionis.services.environment.exceptions.environment_value_exception import OrionisEnvironmentValueException
3
4
 
4
- class EnvTypes:
5
+ class EnvTypes(IEnvTypes):
5
6
 
6
7
  # Type class to handle different types of environment variables
7
8
  OPTIONS = {
@@ -28,7 +29,7 @@ class EnvTypes:
28
29
  """
29
30
  return EnvTypes.OPTIONS
30
31
 
31
- def __init__(self, raw: str = None):
32
+ def __init__(self, raw):
32
33
  """
33
34
  Parse a raw string input into a type hint and value string.
34
35
 
@@ -46,13 +47,31 @@ class EnvTypes:
46
47
  __value_str : str or None
47
48
  The extracted value string, or None if not provided.
48
49
  """
49
- type_hint, value_str = raw.split(':', 1)
50
- if type_hint.strip().lower() in self.OPTIONS:
51
- self.__type_hint = type_hint.strip().lower()
52
- self.__value_str = value_str.strip() if value_str else None
50
+
51
+ # Default values for type hint and value string
52
+ self.__type_hint = None
53
+ self.__value_raw = None
54
+
55
+ # If raw is a string, parse it to extract type hint and value
56
+ if isinstance(raw, str):
57
+
58
+ # Strip whitespace and check for a colon to separate type hint and value
59
+ self.__value_raw = raw.strip()
60
+
61
+ # If a colon is present, split the string into type hint and value
62
+ if ':' in self.__value_raw:
63
+
64
+ # Split the string at the first colon
65
+ type_hint, value_str = raw.split(':', 1)
66
+
67
+ # If the type hint is valid, set it and the value
68
+ if type_hint.strip().lower() in self.OPTIONS:
69
+ self.__type_hint = type_hint.strip().lower()
70
+ self.__value_raw = value_str.strip() if value_str else None
53
71
  else:
54
- self.__type_hint = None
55
- self.__value_str = raw.strip() if raw else None
72
+
73
+ # If raw is not a string, treat it as a value with no type hint
74
+ self.__value_raw = raw
56
75
 
57
76
  def to(self, type_hint: str):
58
77
  """
@@ -127,7 +146,7 @@ class EnvTypes:
127
146
  value_str : str or None
128
147
  The extracted value string, or None if not provided.
129
148
  """
130
- return self.__type_hint, self.__value_str
149
+ return self.__type_hint, self.__value_raw
131
150
 
132
151
  def __parsePath(self):
133
152
  """
@@ -147,7 +166,7 @@ class EnvTypes:
147
166
  OrionisEnvironmentValueException
148
167
  If the value cannot be processed as a path.
149
168
  """
150
- return self.__value_str.replace('\\', '/').strip()
169
+ return self.__value_raw.replace('\\', '/').strip()
151
170
 
152
171
  def __toPath(self):
153
172
  """
@@ -163,9 +182,9 @@ class EnvTypes:
163
182
  OrionisEnvironmentValueError
164
183
  If the internal value is not a string.
165
184
  """
166
- if not isinstance(self.__value_str, str):
167
- raise OrionisEnvironmentValueError(f"Value must be a string to convert to path, got {type(self.__value_str).__name__} instead.")
168
- value = self.__value_str.replace('\\', '/').strip()
185
+ if not isinstance(self.__value_raw, str):
186
+ raise OrionisEnvironmentValueError(f"Value must be a string to convert to path, got {type(self.__value_raw).__name__} instead.")
187
+ value = self.__value_raw.replace('\\', '/').strip()
169
188
  return f"{self.__type_hint}:{value}"
170
189
 
171
190
  def __parseStr(self):
@@ -177,7 +196,7 @@ class EnvTypes:
177
196
  str
178
197
  The value string if the type hint is 'str:', otherwise raises an error.
179
198
  """
180
- return self.__value_str.strip()
199
+ return self.__value_raw.strip()
181
200
 
182
201
  def __toStr(self):
183
202
  """
@@ -193,9 +212,9 @@ class EnvTypes:
193
212
  OrionisEnvironmentValueError
194
213
  If the internal value is not a string.
195
214
  """
196
- if not isinstance(self.__value_str, str):
197
- raise OrionisEnvironmentValueError(f"Value must be a string to convert to str, got {type(self.__value_str).__name__} instead.")
198
- return f"{self.__type_hint}:{self.__value_str}"
215
+ if not isinstance(self.__value_raw, str):
216
+ raise OrionisEnvironmentValueError(f"Value must be a string to convert to str, got {type(self.__value_raw).__name__} instead.")
217
+ return f"{self.__type_hint}:{self.__value_raw}"
199
218
 
200
219
  def __parseInt(self):
201
220
  """
@@ -215,7 +234,7 @@ class EnvTypes:
215
234
  OrionisEnvironmentValueException
216
235
  If the value cannot be converted to an integer.
217
236
  """
218
- value = self.__value_str.strip()
237
+ value = self.__value_raw.strip()
219
238
  try:
220
239
  return int(value)
221
240
  except ValueError as e:
@@ -235,9 +254,9 @@ class EnvTypes:
235
254
  OrionisEnvironmentValueError
236
255
  If the internal value is not a string or cannot be converted to an integer.
237
256
  """
238
- if not isinstance(self.__value_str, int):
239
- raise OrionisEnvironmentValueError(f"Value must be an integer to convert to int, got {type(self.__value_str).__name__} instead.")
240
- return f"{self.__type_hint}:{str(self.__value_str)}"
257
+ if not isinstance(self.__value_raw, int):
258
+ raise OrionisEnvironmentValueError(f"Value must be an integer to convert to int, got {type(self.__value_raw).__name__} instead.")
259
+ return f"{self.__type_hint}:{str(self.__value_raw)}"
241
260
 
242
261
  def __parseFloat(self):
243
262
  """
@@ -257,7 +276,7 @@ class EnvTypes:
257
276
  OrionisEnvironmentValueException
258
277
  If the value cannot be converted to a float.
259
278
  """
260
- value = self.__value_str.strip()
279
+ value = self.__value_raw.strip()
261
280
  try:
262
281
  return float(value)
263
282
  except ValueError as e:
@@ -277,9 +296,9 @@ class EnvTypes:
277
296
  OrionisEnvironmentValueError
278
297
  If the internal value is not a string or cannot be converted to a float.
279
298
  """
280
- if not isinstance(self.__value_str, float):
281
- raise OrionisEnvironmentValueError(f"Value must be a float to convert to float, got {type(self.__value_str).__name__} instead.")
282
- return f"{self.__type_hint}:{str(self.__value_str)}"
299
+ if not isinstance(self.__value_raw, float):
300
+ raise OrionisEnvironmentValueError(f"Value must be a float to convert to float, got {type(self.__value_raw).__name__} instead.")
301
+ return f"{self.__type_hint}:{str(self.__value_raw)}"
283
302
 
284
303
  def __parseBool(self):
285
304
  """
@@ -299,7 +318,7 @@ class EnvTypes:
299
318
  OrionisEnvironmentValueException
300
319
  If the value cannot be converted to a boolean.
301
320
  """
302
- value = self.__value_str.strip().lower()
321
+ value = self.__value_raw.strip().lower()
303
322
  if value in {'true', '1', 'yes', 'on'}:
304
323
  return True
305
324
  elif value in {'false', '0', 'no', 'off'}:
@@ -321,9 +340,9 @@ class EnvTypes:
321
340
  OrionisEnvironmentValueError
322
341
  If the internal value is not a boolean.
323
342
  """
324
- if not isinstance(self.__value_str, bool):
325
- raise OrionisEnvironmentValueError(f"Value must be a boolean to convert to bool, got {type(self.__value_str).__name__} instead.")
326
- return f"{self.__type_hint}:{str(self.__value_str).lower()}"
343
+ if not isinstance(self.__value_raw, bool):
344
+ raise OrionisEnvironmentValueError(f"Value must be a boolean to convert to bool, got {type(self.__value_raw).__name__} instead.")
345
+ return f"{self.__type_hint}:{str(self.__value_raw).lower()}"
327
346
 
328
347
  def __parseList(self):
329
348
  """
@@ -341,7 +360,7 @@ class EnvTypes:
341
360
  """
342
361
  import ast
343
362
 
344
- value = self.__value_str.strip()
363
+ value = self.__value_raw.strip()
345
364
  try:
346
365
  parsed = ast.literal_eval(value)
347
366
  if not isinstance(parsed, list):
@@ -364,9 +383,9 @@ class EnvTypes:
364
383
  OrionisEnvironmentValueError
365
384
  If the internal value is not a list.
366
385
  """
367
- if not isinstance(self.__value_str, list):
368
- raise OrionisEnvironmentValueError(f"Value must be a list to convert to list, got {type(self.__value_str).__name__} instead.")
369
- return f"{self.__type_hint}:{repr(self.__value_str)}"
386
+ if not isinstance(self.__value_raw, list):
387
+ raise OrionisEnvironmentValueError(f"Value must be a list to convert to list, got {type(self.__value_raw).__name__} instead.")
388
+ return f"{self.__type_hint}:{repr(self.__value_raw)}"
370
389
 
371
390
  def __parseDict(self):
372
391
  """
@@ -388,7 +407,7 @@ class EnvTypes:
388
407
  """
389
408
  import ast
390
409
 
391
- value = self.__value_str.strip()
410
+ value = self.__value_raw.strip()
392
411
  try:
393
412
  parsed = ast.literal_eval(value)
394
413
  if not isinstance(parsed, dict):
@@ -411,9 +430,9 @@ class EnvTypes:
411
430
  OrionisEnvironmentValueError
412
431
  If the internal value is not a dict.
413
432
  """
414
- if not isinstance(self.__value_str, dict):
415
- raise OrionisEnvironmentValueError(f"Value must be a dict to convert to dict, got {type(self.__value_str).__name__} instead.")
416
- return f"{self.__type_hint}:{repr(self.__value_str)}"
433
+ if not isinstance(self.__value_raw, dict):
434
+ raise OrionisEnvironmentValueError(f"Value must be a dict to convert to dict, got {type(self.__value_raw).__name__} instead.")
435
+ return f"{self.__type_hint}:{repr(self.__value_raw)}"
417
436
 
418
437
  def __parseTuple(self):
419
438
  """
@@ -435,7 +454,7 @@ class EnvTypes:
435
454
  """
436
455
  import ast
437
456
 
438
- value = self.__value_str.strip()
457
+ value = self.__value_raw.strip()
439
458
  try:
440
459
  parsed = ast.literal_eval(value)
441
460
  if not isinstance(parsed, tuple):
@@ -458,9 +477,9 @@ class EnvTypes:
458
477
  OrionisEnvironmentValueError
459
478
  If the internal value is not a tuple.
460
479
  """
461
- if not isinstance(self.__value_str, tuple):
462
- raise OrionisEnvironmentValueError(f"Value must be a tuple to convert to tuple, got {type(self.__value_str).__name__} instead.")
463
- return f"{self.__type_hint}:{repr(self.__value_str)}"
480
+ if not isinstance(self.__value_raw, tuple):
481
+ raise OrionisEnvironmentValueError(f"Value must be a tuple to convert to tuple, got {type(self.__value_raw).__name__} instead.")
482
+ return f"{self.__type_hint}:{repr(self.__value_raw)}"
464
483
 
465
484
  def __parseSet(self):
466
485
  """
@@ -482,7 +501,7 @@ class EnvTypes:
482
501
  """
483
502
  import ast
484
503
 
485
- value = self.__value_str.strip()
504
+ value = self.__value_raw.strip()
486
505
  try:
487
506
  parsed = ast.literal_eval(value)
488
507
  if not isinstance(parsed, set):
@@ -505,9 +524,9 @@ class EnvTypes:
505
524
  OrionisEnvironmentValueError
506
525
  If the internal value is not a set.
507
526
  """
508
- if not isinstance(self.__value_str, set):
509
- raise OrionisEnvironmentValueError(f"Value must be a set to convert to set, got {type(self.__value_str).__name__} instead.")
510
- return f"{self.__type_hint}:{repr(self.__value_str)}"
527
+ if not isinstance(self.__value_raw, set):
528
+ raise OrionisEnvironmentValueError(f"Value must be a set to convert to set, got {type(self.__value_raw).__name__} instead.")
529
+ return f"{self.__type_hint}:{repr(self.__value_raw)}"
511
530
 
512
531
  def get(self):
513
532
  """
@@ -1,28 +1,31 @@
1
1
  class OrionisFileNotFoundException(Exception):
2
2
  """
3
- Exception raised when a file is not found in the Orionis framework.
3
+ Exception raised when a specified file is not found.
4
4
 
5
- Args:
6
- msg (str): A detailed message describing the missing file.
7
-
8
- Example:
9
- raise OrionisFileNotFoundException("File 'config.yaml' not found.")
5
+ Parameters
6
+ ----------
7
+ msg : str
8
+ The error message describing the exception.
10
9
  """
11
10
 
12
11
  def __init__(self, msg: str):
13
12
  """
14
- Initializes the exception with a custom error message.
13
+ Initialize the exception with a custom error message.
15
14
 
16
- Args:
17
- msg (str): The error message describing the exception.
15
+ Parameters
16
+ ----------
17
+ msg : str
18
+ The error message describing the exception.
18
19
  """
19
20
  super().__init__(msg)
20
21
 
21
22
  def __str__(self) -> str:
22
23
  """
23
- Return a string representation of the exception, including the class name and the first argument.
24
+ Return a string representation of the exception.
24
25
 
25
- Returns:
26
- str: A formatted string with the exception class name and the first argument.
26
+ Returns
27
+ -------
28
+ str
29
+ A formatted string with the exception class name and the first argument.
27
30
  """
28
31
  return f"{self.__class__.__name__}: {self.args[0]}"
@@ -2,19 +2,20 @@ class OrionisPathValueException(Exception):
2
2
  """
3
3
  Exception raised when a file is not found in the Orionis framework.
4
4
 
5
- Args:
6
- msg (str): A detailed message describing the missing file.
7
-
8
- Example:
9
- raise OrionisFileNotFoundException("File 'config.yaml' not found.")
5
+ Parameters
6
+ ----------
7
+ msg : str
8
+ A detailed message describing the missing file.
10
9
  """
11
10
 
12
11
  def __init__(self, msg: str):
13
12
  """
14
- Initializes the exception with a custom error message.
13
+ Initialize the exception with a custom error message.
15
14
 
16
- Args:
17
- msg (str): The error message describing the exception.
15
+ Parameters
16
+ ----------
17
+ msg : str
18
+ The error message describing the exception.
18
19
  """
19
20
  super().__init__(msg)
20
21
 
@@ -22,7 +23,9 @@ class OrionisPathValueException(Exception):
22
23
  """
23
24
  Return a string representation of the exception, including the class name and the first argument.
24
25
 
25
- Returns:
26
- str: A formatted string with the exception class name and the first argument.
26
+ Returns
27
+ -------
28
+ str
29
+ A formatted string with the exception class name and the first argument.
27
30
  """
28
31
  return f"{self.__class__.__name__}: {self.args[0]}"
@@ -110,7 +110,7 @@ class IStdClass(ABC):
110
110
 
111
111
  @classmethod
112
112
  @abstractmethod
113
- def from_dict(cls, dictionary: Dict[str, Any]) -> 'IStdClass':
113
+ def fromDict(cls, dictionary: Dict[str, Any]) -> 'IStdClass':
114
114
  """
115
115
  Creates an instance from a dictionary.
116
116
 
@@ -0,0 +1,23 @@
1
+ class OrionisStdValueException(Exception):
2
+
3
+ def __init__(self, msg: str):
4
+ """
5
+ Initialize the exception with a custom error message.
6
+
7
+ Parameters
8
+ ----------
9
+ msg : str
10
+ The error message describing the exception.
11
+ """
12
+ super().__init__(msg)
13
+
14
+ def __str__(self) -> str:
15
+ """
16
+ Return a string representation of the exception, including the class name and the first argument.
17
+
18
+ Returns
19
+ -------
20
+ str
21
+ A formatted string with the exception class name and the first argument.
22
+ """
23
+ return f"{self.__class__.__name__}: {self.args[0]}"