orionis 0.579.0__py3-none-any.whl → 0.580.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 (77) hide show
  1. orionis/console/core/reactor.py +5 -5
  2. orionis/console/kernel.py +2 -2
  3. orionis/console/tasks/schedule.py +2 -2
  4. orionis/container/container.py +6 -11
  5. orionis/container/exceptions/__init__.py +4 -4
  6. orionis/foundation/application.py +116 -91
  7. orionis/foundation/config/database/entities/sqlite.py +1 -1
  8. orionis/foundation/config/roots/paths.py +8 -0
  9. orionis/foundation/config/startup.py +1 -1
  10. orionis/foundation/contracts/application.py +4 -4
  11. orionis/foundation/exceptions/__init__.py +6 -4
  12. orionis/foundation/exceptions/application.py +11 -0
  13. orionis/foundation/providers/catch_provider.py +1 -1
  14. orionis/foundation/providers/cli_request_provider.py +1 -1
  15. orionis/foundation/providers/console_provider.py +1 -1
  16. orionis/foundation/providers/directory_provider.py +1 -1
  17. orionis/foundation/providers/dumper_provider.py +1 -1
  18. orionis/foundation/providers/executor_provider.py +1 -1
  19. orionis/foundation/providers/inspirational_provider.py +1 -1
  20. orionis/foundation/providers/logger_provider.py +1 -1
  21. orionis/foundation/providers/performance_counter_provider.py +1 -1
  22. orionis/foundation/providers/progress_bar_provider.py +1 -1
  23. orionis/foundation/providers/reactor_provider.py +1 -2
  24. orionis/foundation/providers/scheduler_provider.py +1 -1
  25. orionis/foundation/providers/testing_provider.py +1 -1
  26. orionis/foundation/providers/workers_provider.py +1 -1
  27. orionis/metadata/framework.py +1 -1
  28. orionis/services/asynchrony/exceptions/__init__.py +1 -1
  29. orionis/services/asynchrony/exceptions/asynchrony.py +11 -0
  30. orionis/services/environment/core/dot_env.py +3 -2
  31. orionis/services/environment/dynamic/caster.py +8 -8
  32. orionis/services/environment/exceptions/__init__.py +11 -3
  33. orionis/services/environment/exceptions/environment.py +125 -0
  34. orionis/services/environment/key/key_generator.py +25 -21
  35. orionis/services/environment/validators/key_name.py +1 -1
  36. orionis/services/environment/validators/types.py +1 -1
  37. orionis/services/file/contracts/directory.py +12 -0
  38. orionis/services/file/directory.py +12 -1
  39. orionis/services/introspection/dataclass/{attributes.py → extractor.py} +2 -2
  40. orionis/services/introspection/exceptions/__init__.py +5 -3
  41. orionis/services/introspection/exceptions/introspection.py +76 -0
  42. orionis/services/log/exceptions/__init__.py +1 -1
  43. orionis/support/facades/application.py +3 -2
  44. orionis/support/facades/console.py +3 -2
  45. orionis/support/facades/directory.py +3 -2
  46. orionis/support/facades/dumper.py +3 -2
  47. orionis/support/facades/executor.py +3 -2
  48. orionis/support/facades/inspire.py +3 -2
  49. orionis/support/facades/logger.py +3 -2
  50. orionis/support/facades/performance_counter.py +3 -2
  51. orionis/support/facades/progress_bar.py +3 -2
  52. orionis/support/facades/reactor.py +3 -2
  53. orionis/support/facades/testing.py +3 -2
  54. orionis/support/facades/workers.py +5 -4
  55. orionis/support/standard/exceptions/__init__.py +1 -1
  56. orionis/support/standard/exceptions/standard.py +23 -0
  57. orionis/test/core/unit_test.py +10 -1
  58. orionis/test/kernel.py +21 -19
  59. orionis/test/output/printer.py +37 -9
  60. {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/METADATA +1 -1
  61. {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/RECORD +66 -72
  62. orionis/foundation/exceptions/integrity.py +0 -19
  63. orionis/foundation/exceptions/runtime.py +0 -19
  64. orionis/foundation/exceptions/type.py +0 -19
  65. orionis/foundation/exceptions/value.py +0 -19
  66. orionis/services/asynchrony/exceptions/exception.py +0 -27
  67. orionis/services/environment/exceptions/exception.py +0 -23
  68. orionis/services/environment/exceptions/value.py +0 -23
  69. orionis/services/introspection/exceptions/attribute.py +0 -20
  70. orionis/services/introspection/exceptions/type.py +0 -19
  71. orionis/services/introspection/exceptions/value.py +0 -19
  72. orionis/support/standard/exceptions/value.py +0 -19
  73. /orionis/container/exceptions/{container_exceptions.py → container.py} +0 -0
  74. /orionis/services/log/exceptions/{runtime.py → log.py} +0 -0
  75. {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/WHEEL +0 -0
  76. {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/licenses/LICENCE +0 -0
  77. {orionis-0.579.0.dist-info → orionis-0.580.0.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,9 @@
1
- from .integrity import OrionisIntegrityException
2
- from .value import OrionisValueError
3
- from .type import OrionisTypeError
4
- from .runtime import OrionisRuntimeError
1
+ from .application import (
2
+ OrionisIntegrityException,
3
+ OrionisValueError,
4
+ OrionisTypeError,
5
+ OrionisRuntimeError
6
+ )
5
7
 
6
8
  __all__ = [
7
9
  "OrionisIntegrityException",
@@ -0,0 +1,11 @@
1
+ class OrionisIntegrityException(Exception):
2
+ pass
3
+
4
+ class OrionisRuntimeError(RuntimeError):
5
+ pass
6
+
7
+ class OrionisTypeError(TypeError):
8
+ pass
9
+
10
+ class OrionisValueError(ValueError):
11
+ pass
@@ -30,7 +30,7 @@ class CathcProvider(ServiceProvider):
30
30
  """
31
31
 
32
32
  # Bind ICatch to Catch as a singleton with a specific alias
33
- self.app.singleton(ICatch, Catch, alias="x-orionis.failure.catch")
33
+ self.app.singleton(ICatch, Catch, alias=f"x-{ICatch.__module__}.{ICatch.__name__}")
34
34
 
35
35
  def boot(self) -> None:
36
36
  """
@@ -25,7 +25,7 @@ class CLRequestProvider(ServiceProvider):
25
25
  """
26
26
  # Register CLIRequest as a transient service bound to ICLIRequest interface
27
27
  # Transient services create a new instance each time they are resolved
28
- self.app.transient(ICLIRequest, CLIRequest, alias="x-orionis.console.request.cli_request")
28
+ self.app.transient(ICLIRequest, CLIRequest, alias=f"x-{ICLIRequest.__module__}.{ICLIRequest.__name__}")
29
29
 
30
30
  def boot(self) -> None:
31
31
  """
@@ -37,7 +37,7 @@ class ConsoleProvider(ServiceProvider):
37
37
  modifying the application's service container.
38
38
  """
39
39
 
40
- self.app.transient(IConsole, Console, alias="x-orionis.console.output.console")
40
+ self.app.transient(IConsole, Console, alias=f"x-{IConsole.__module__}.{IConsole.__name__}")
41
41
 
42
42
  def boot(self) -> None:
43
43
  """
@@ -37,7 +37,7 @@ class DirectoryProvider(ServiceProvider):
37
37
  This method does not return any value.
38
38
  """
39
39
  # Bind IDirectory to Directory as a singleton with a specific alias
40
- self.app.singleton(IDirectory, Directory, alias="x-orionis.services.file.contracts.directory")
40
+ self.app.singleton(IDirectory, Directory, alias=f"x-{IDirectory.__module__}.{IDirectory.__name__}")
41
41
 
42
42
  def boot(self) -> None:
43
43
  """
@@ -54,7 +54,7 @@ class DumperProvider(ServiceProvider):
54
54
  modifying the application container's service registry.
55
55
  """
56
56
 
57
- self.app.transient(IDebug, Debug, alias="x-orionis.console.dumper.dump")
57
+ self.app.transient(IDebug, Debug, alias=f"x-{IDebug.__module__}.{IDebug.__name__}")
58
58
 
59
59
  def boot(self) -> None:
60
60
  """
@@ -54,7 +54,7 @@ class ConsoleExecuteProvider(ServiceProvider):
54
54
  registering the executor service binding in the application container.
55
55
  """
56
56
 
57
- self.app.transient(IExecutor, Executor, alias="x-orionis.console.output.executor")
57
+ self.app.transient(IExecutor, Executor, alias=f"x-{IExecutor.__module__}.{IExecutor.__name__}")
58
58
 
59
59
  def boot(self) -> None:
60
60
  """
@@ -50,7 +50,7 @@ class InspirationalProvider(ServiceProvider):
50
50
  return any value.
51
51
  """
52
52
 
53
- self.app.transient(IInspire, Inspire, alias="x-orionis.services.inspirational.inspire")
53
+ self.app.transient(IInspire, Inspire, alias=f"x-{IInspire.__module__}.{IInspire.__name__}")
54
54
 
55
55
  def boot(self) -> None:
56
56
  """
@@ -54,7 +54,7 @@ class LoggerProvider(ServiceProvider):
54
54
  logger_service = Logger(logging_config)
55
55
 
56
56
  # Register the service instance in the container with interface binding and alias
57
- self.app.instance(ILogger, logger_service, alias="x-orionis.services.log.log_service")
57
+ self.app.instance(ILogger, logger_service, alias=f"x-{ILogger.__module__}.{ILogger.__name__}")
58
58
 
59
59
  def boot(self) -> None:
60
60
  """
@@ -34,7 +34,7 @@ class PerformanceCounterProvider(ServiceProvider):
34
34
 
35
35
  # Register the IPerformanceCounter interface to the PerformanceCounter implementation
36
36
  # with a transient lifetime and assign an alias for alternative resolution.
37
- self.app.transient(IPerformanceCounter, PerformanceCounter, alias="x-orionis.support.performance.counter")
37
+ self.app.transient(IPerformanceCounter, PerformanceCounter, alias=f"x-{IPerformanceCounter.__module__}.{IPerformanceCounter.__name__}")
38
38
 
39
39
  def boot(self) -> None:
40
40
  """
@@ -58,7 +58,7 @@ class ProgressBarProvider(ServiceProvider):
58
58
  as a side effect on the application container.
59
59
  """
60
60
 
61
- self.app.transient(IProgressBar, ProgressBar, alias="x-orionis.console.dynamic.progress_bar")
61
+ self.app.transient(IProgressBar, ProgressBar, alias=f"x-{IProgressBar.__module__}.{IProgressBar.__name__}")
62
62
 
63
63
  def boot(self) -> None:
64
64
  """
@@ -57,8 +57,7 @@ class ReactorProvider(ServiceProvider):
57
57
 
58
58
  # Register the Reactor service with the application container
59
59
  # as a singleton, allowing it to be resolved throughout the application lifecycle
60
- self.app.singleton(IReactor, Reactor, alias="x-orionis.console.core.reactor")
61
-
60
+ self.app.singleton(IReactor, Reactor, alias=f"x-{IReactor.__module__}.{IReactor.__name__}")
62
61
  def boot(self) -> None:
63
62
  """
64
63
  Perform post-registration initialization for the reactor management service.
@@ -33,7 +33,7 @@ class ScheduleProvider(ServiceProvider):
33
33
  This method does not return any value.
34
34
  """
35
35
  # Bind Scheduler as a singleton to the ISchedule interface with an alias
36
- self.app.singleton(ISchedule, Schedule, alias="x-orionis.console.contracts.schedule")
36
+ self.app.singleton(ISchedule, Schedule, alias=f"x-{ISchedule.__module__}.{ISchedule.__name__}")
37
37
 
38
38
  def boot(self) -> None:
39
39
  """
@@ -59,7 +59,7 @@ class TestingProvider(ServiceProvider):
59
59
 
60
60
  # Register the UnitTest service as a singleton in the application container.
61
61
  # The service is bound to the IUnitTest interface and can be resolved using the alias.
62
- self.app.singleton(IUnitTest, UnitTest, alias="x-orionis.test.core.unit_test")
62
+ self.app.singleton(IUnitTest, UnitTest, alias=f"x-{IUnitTest.__module__}.{IUnitTest.__name__}")
63
63
 
64
64
  def boot(self) -> None:
65
65
  """
@@ -57,7 +57,7 @@ class WorkersProvider(ServiceProvider):
57
57
  - Suitable for stateless or short-lived worker operations
58
58
  """
59
59
 
60
- self.app.transient(IWorkers, Workers, alias="x-orionis.services.system.workers")
60
+ self.app.transient(IWorkers, Workers, alias=f"x-{IWorkers.__module__}.{IWorkers.__name__}")
61
61
 
62
62
  def boot(self) -> None:
63
63
  """
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.579.0"
8
+ VERSION = "0.580.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,4 +1,4 @@
1
- from .exception import OrionisCoroutineException
1
+ from .asynchrony import OrionisCoroutineException
2
2
 
3
3
  __all__ = [
4
4
  "OrionisCoroutineException"
@@ -0,0 +1,11 @@
1
+ class OrionisCoroutineException(Exception):
2
+ """
3
+ Exception raised for errors that occur within Orionis coroutines.
4
+
5
+ This exception serves as a base for coroutine-related errors in the Orionis framework,
6
+ allowing for more specific exception handling in asynchronous operations.
7
+
8
+ Attributes:
9
+ message (str): Optional error message describing the exception.
10
+ """
11
+ pass
@@ -5,6 +5,7 @@ from pathlib import Path
5
5
  from typing import Any, Optional, Union
6
6
  from dotenv import dotenv_values, load_dotenv, set_key, unset_key
7
7
  from orionis.services.environment.enums import EnvironmentValueType
8
+ from orionis.services.environment.exceptions.environment import OrionisEnvironmentException, OrionisOperatingSystemError
8
9
  from orionis.services.environment.validators import ValidateKeyName, ValidateTypes
9
10
  from orionis.support.patterns.singleton import Singleton
10
11
  from orionis.services.environment.dynamic.caster import EnvironmentCaster
@@ -59,12 +60,12 @@ class DotEnv(metaclass=Singleton):
59
60
  except OSError as e:
60
61
 
61
62
  # Raise an error if the .env file cannot be created or accessed
62
- raise OSError(f"Failed to create or access the .env file at {self.__resolved_path}: {e}")
63
+ raise OrionisOperatingSystemError(f"Failed to create or access the .env file at {self.__resolved_path}: {e}")
63
64
 
64
65
  except Exception as e:
65
66
 
66
67
  # Raise a general error for any other exceptions during initialization
67
- raise Exception(f"An unexpected error occurred while initializing DotEnv: {e}")
68
+ raise OrionisEnvironmentException(f"An unexpected error occurred while initializing DotEnv: {e}")
68
69
 
69
70
  def set(
70
71
  self,
@@ -658,12 +658,12 @@ class EnvironmentCaster(IEnvironmentCaster):
658
658
 
659
659
  # Ensure the evaluated object is a list
660
660
  if not isinstance(parsed, list):
661
- raise ValueError("Value is not a list")
661
+ raise OrionisEnvironmentValueError("Value is not a list")
662
662
 
663
663
  # Return the parsed list if successful
664
664
  return parsed
665
665
 
666
- except (ValueError, SyntaxError) as e:
666
+ except (OrionisEnvironmentValueError, ValueError, SyntaxError) as e:
667
667
 
668
668
  # Raise a custom exception if conversion fails
669
669
  raise OrionisEnvironmentValueException(f"Cannot convert '{value}' to list: {str(e)}")
@@ -735,12 +735,12 @@ class EnvironmentCaster(IEnvironmentCaster):
735
735
 
736
736
  # Ensure the evaluated object is a dictionary
737
737
  if not isinstance(parsed, dict):
738
- raise ValueError("Value is not a dict")
738
+ raise OrionisEnvironmentValueError("Value is not a dict")
739
739
 
740
740
  # Return the parsed dictionary if successful
741
741
  return parsed
742
742
 
743
- except (ValueError, SyntaxError) as e:
743
+ except (OrionisEnvironmentValueError, ValueError, SyntaxError) as e:
744
744
 
745
745
  # Raise a custom exception if conversion fails
746
746
  raise OrionisEnvironmentValueException(f"Cannot convert '{value}' to dict: {str(e)}")
@@ -806,12 +806,12 @@ class EnvironmentCaster(IEnvironmentCaster):
806
806
 
807
807
  # Ensure the evaluated object is a tuple
808
808
  if not isinstance(parsed, tuple):
809
- raise ValueError("Value is not a tuple")
809
+ raise OrionisEnvironmentValueError("Value is not a tuple")
810
810
 
811
811
  # Return the parsed tuple if successful
812
812
  return parsed
813
813
 
814
- except (ValueError, SyntaxError) as e:
814
+ except (OrionisEnvironmentValueError, ValueError, SyntaxError) as e:
815
815
 
816
816
  # Raise a custom exception if conversion fails
817
817
  raise OrionisEnvironmentValueException(f"Cannot convert '{value}' to tuple: {str(e)}")
@@ -877,12 +877,12 @@ class EnvironmentCaster(IEnvironmentCaster):
877
877
 
878
878
  # Ensure the evaluated object is a set
879
879
  if not isinstance(parsed, set):
880
- raise ValueError("Value is not a set")
880
+ raise OrionisEnvironmentValueError("Value is not a set")
881
881
 
882
882
  # Return the parsed set if successful
883
883
  return parsed
884
884
 
885
- except (ValueError, SyntaxError) as e:
885
+ except (OrionisEnvironmentValueError, ValueError, SyntaxError) as e:
886
886
 
887
887
  # Raise a custom exception if conversion fails
888
888
  raise OrionisEnvironmentValueException(f"Cannot convert '{value}' to set: {str(e)}")
@@ -1,7 +1,15 @@
1
- from .exception import OrionisEnvironmentValueException
2
- from .value import OrionisEnvironmentValueError
1
+ from .environment import (
2
+ OrionisEnvironmentValueException,
3
+ OrionisEnvironmentValueError,
4
+ OrionisEnvironmentTypeException,
5
+ OrionisOperatingSystemError,
6
+ OrionisEnvironmentException
7
+ )
3
8
 
4
9
  __all__ = [
5
10
  "OrionisEnvironmentValueException",
6
- "OrionisEnvironmentValueError"
11
+ "OrionisEnvironmentValueError",
12
+ "OrionisEnvironmentTypeException",
13
+ "OrionisOperatingSystemError",
14
+ "OrionisEnvironmentException"
7
15
  ]
@@ -0,0 +1,125 @@
1
+ class OrionisEnvironmentValueException(Exception):
2
+ """
3
+ Exception raised for invalid or unexpected values in the Orionis environment configuration.
4
+
5
+ This exception is used to indicate that an environment variable or configuration setting
6
+ within the Orionis framework does not conform to the expected value constraints.
7
+
8
+ Parameters
9
+ ----------
10
+ message : str, optional
11
+ Explanation of the error.
12
+
13
+ Returns
14
+ -------
15
+ OrionisEnvironmentValueException
16
+ An instance of this exception is raised when an invalid environment value is encountered.
17
+
18
+ Attributes
19
+ ----------
20
+ message : str
21
+ Optional explanation of the error.
22
+ """
23
+ # No additional implementation; inherits from Exception
24
+ pass
25
+
26
+ class OrionisEnvironmentTypeException(Exception):
27
+ """
28
+ Exception raised for invalid or unsupported environment types in the Orionis framework.
29
+
30
+ This exception signals that an environment type provided to the framework is not recognized
31
+ or is not supported according to the framework's requirements.
32
+
33
+ Parameters
34
+ ----------
35
+ message : str, optional
36
+ Description of the error.
37
+
38
+ Returns
39
+ -------
40
+ OrionisEnvironmentTypeException
41
+ An instance of this exception is raised when an invalid environment type is encountered.
42
+
43
+ Attributes
44
+ ----------
45
+ message : str
46
+ Optional error message describing the exception.
47
+ """
48
+ # No additional implementation; inherits from Exception
49
+ pass
50
+
51
+ class OrionisEnvironmentValueError(Exception):
52
+ """
53
+ Exception raised when a value does not meet the required criteria in the Orionis environment configuration.
54
+
55
+ This exception is typically used to indicate that a provided value violates constraints or
56
+ requirements defined by the environment settings in the Orionis framework.
57
+
58
+ Parameters
59
+ ----------
60
+ message : str, optional
61
+ Explanation of the error.
62
+
63
+ Returns
64
+ -------
65
+ OrionisEnvironmentValueError
66
+ An instance of this exception is raised when a value fails validation.
67
+
68
+ Attributes
69
+ ----------
70
+ message : str
71
+ Optional explanation of the error.
72
+ """
73
+ # No additional implementation; inherits from Exception
74
+ pass
75
+
76
+ class OrionisOperatingSystemError(OSError):
77
+ """
78
+ Exception raised when a value or parameter in the Orionis environment configuration has an incorrect type.
79
+
80
+ This exception is used to signal that a provided value does not match the expected type as required by
81
+ the Orionis framework's environment settings, which may lead to misconfiguration or runtime errors.
82
+
83
+ Parameters
84
+ ----------
85
+ message : str, optional
86
+ Description of the type mismatch error.
87
+
88
+ Returns
89
+ -------
90
+ OrionisOperatingSystemError
91
+ An instance of this exception is raised when a type mismatch is detected in the environment configuration.
92
+
93
+ Attributes
94
+ ----------
95
+ message : str
96
+ Optional error message describing the exception.
97
+ """
98
+ # No additional implementation; inherits from OSError
99
+ pass
100
+
101
+ class OrionisEnvironmentException(Exception):
102
+ """
103
+ General exception for errors related to the Orionis environment configuration.
104
+
105
+ This exception serves as a base class for more specific environment-related exceptions
106
+ within the Orionis framework. It can be used to catch all environment-related errors
107
+ in a single exception handler.
108
+
109
+ Parameters
110
+ ----------
111
+ message : str, optional
112
+ Description of the error.
113
+
114
+ Returns
115
+ -------
116
+ OrionisEnvironmentException
117
+ An instance of this exception is raised for general environment-related errors.
118
+
119
+ Attributes
120
+ ----------
121
+ message : str
122
+ Optional error message describing the exception.
123
+ """
124
+ # No additional implementation; inherits from Exception
125
+ pass
@@ -1,29 +1,25 @@
1
1
  import os
2
2
  import base64
3
+ from orionis.foundation.config.app.enums.ciphers import Cipher
3
4
 
4
5
  class SecureKeyGenerator:
5
- """
6
- Utility class for generating Laravel-compatible APP_KEY values.
7
-
8
- Laravel expects keys in Base64 format, prefixed with 'base64:'.
9
- Supported ciphers: AES-128-CBC, AES-256-CBC, AES-128-GCM, AES-256-GCM.
10
- """
11
6
 
7
+ # Mapping of cipher modes to their respective key sizes in bytes
12
8
  KEY_SIZES = {
13
- "AES-128-CBC": 16,
14
- "AES-256-CBC": 32,
15
- "AES-128-GCM": 16,
16
- "AES-256-GCM": 32,
9
+ Cipher.AES_128_CBC: 16,
10
+ Cipher.AES_256_CBC: 32,
11
+ Cipher.AES_128_GCM: 16,
12
+ Cipher.AES_256_GCM: 32
17
13
  }
18
14
 
19
15
  @staticmethod
20
- def generate(cipher: str = "AES-256-CBC") -> str:
16
+ def generate(cipher: str | Cipher = Cipher.AES_256_CBC) -> str:
21
17
  """
22
18
  Generate a Laravel-compatible APP_KEY.
23
19
 
24
20
  Parameters
25
21
  ----------
26
- cipher : str
22
+ cipher : str | Cipher
27
23
  The cipher algorithm. Options: AES-128-CBC, AES-256-CBC,
28
24
  AES-128-GCM, AES-256-GCM. Default is AES-256-CBC.
29
25
 
@@ -32,16 +28,24 @@ class SecureKeyGenerator:
32
28
  str
33
29
  A string formatted like Laravel's APP_KEY (e.g., base64:xxxx).
34
30
  """
35
- if cipher not in SecureKeyGenerator.KEY_SIZES:
31
+ # Normalize cipher input to Cipher enum if string is provided
32
+ if isinstance(cipher, str):
33
+ try:
34
+ cipher_enum = Cipher(cipher)
35
+ except ValueError:
36
+ raise ValueError(
37
+ f"Cipher '{cipher}' is not supported. "
38
+ f"Options: {', '.join(c.value for c in SecureKeyGenerator.KEY_SIZES.keys())}"
39
+ )
40
+ else:
41
+ cipher_enum = cipher
42
+
43
+ if cipher_enum not in SecureKeyGenerator.KEY_SIZES:
36
44
  raise ValueError(
37
- f"Cipher '{cipher}' no soportado. "
38
- f"Opciones: {', '.join(SecureKeyGenerator.KEY_SIZES.keys())}"
45
+ f"Cipher '{cipher_enum}' is not supported. "
46
+ f"Options: {', '.join(c.value for c in SecureKeyGenerator.KEY_SIZES.keys())}"
39
47
  )
40
48
 
41
- key_length = SecureKeyGenerator.KEY_SIZES[cipher]
42
-
43
- # Generate secure random bytes
49
+ key_length = SecureKeyGenerator.KEY_SIZES[cipher_enum]
44
50
  key = os.urandom(key_length)
45
-
46
- # Encode in Base64 and prepend 'base64:'
47
- return "base64:" + base64.b64encode(key).decode("utf-8")
51
+ return f"base64:{base64.b64encode(key).decode('utf-8')}"
@@ -1,5 +1,5 @@
1
1
  import re
2
- from orionis.services.environment.exceptions.value import OrionisEnvironmentValueError
2
+ from orionis.services.environment.exceptions import OrionisEnvironmentValueError
3
3
 
4
4
  class __ValidateKeyName:
5
5
 
@@ -1,6 +1,6 @@
1
1
  from typing import Union
2
2
  from orionis.services.environment.enums.value_type import EnvironmentValueType
3
- from orionis.services.environment.exceptions.value import OrionisEnvironmentValueError
3
+ from orionis.services.environment.exceptions import OrionisEnvironmentValueError
4
4
 
5
5
  class __ValidateTypes:
6
6
 
@@ -349,4 +349,16 @@ class IDirectory(ABC):
349
349
  Path
350
350
  The path to the storage directory.
351
351
  """
352
+ pass
353
+
354
+ @abstractmethod
355
+ def tests(self) -> Path:
356
+ """
357
+ Get the tests directory path.
358
+
359
+ Returns
360
+ -------
361
+ Path
362
+ The path to the tests directory.
363
+ """
352
364
  pass
@@ -343,4 +343,15 @@ class Directory(IDirectory):
343
343
  Path
344
344
  The path to the storage directory.
345
345
  """
346
- return Path(self.__app.path('storage'))
346
+ return Path(self.__app.path('storage'))
347
+
348
+ def tests(self) -> Path:
349
+ """
350
+ Get the tests directory path.
351
+
352
+ Returns
353
+ -------
354
+ Path
355
+ The path to the tests directory.
356
+ """
357
+ return Path(self.__app.path('tests'))
@@ -1,4 +1,4 @@
1
- class DataclassValues:
1
+ class DataclassInspector:
2
2
 
3
3
  def __call__(self, dataclass_type: type) -> dict:
4
4
  """
@@ -42,4 +42,4 @@ class DataclassValues:
42
42
  raise TypeError("The provided argument is not a valid dataclass type.")
43
43
 
44
44
  # Instantiate the DataclassValues callable
45
- attributes = DataclassValues()
45
+ extractor = DataclassInspector()
@@ -1,6 +1,8 @@
1
- from .value import ReflectionValueError
2
- from .attribute import ReflectionAttributeError
3
- from .type import ReflectionTypeError
1
+ from .introspection import (
2
+ ReflectionAttributeError,
3
+ ReflectionValueError,
4
+ ReflectionTypeError
5
+ )
4
6
 
5
7
  __all__ = [
6
8
  "ReflectionValueError",
@@ -0,0 +1,76 @@
1
+ class ReflectionAttributeError(Exception):
2
+ """
3
+ Exception raised when an attribute cannot be found during reflection or introspection operations.
4
+
5
+ This exception is typically raised when attempting to access an attribute that does not exist
6
+ or is not accessible on the target object during reflection or introspection.
7
+
8
+ Parameters
9
+ ----------
10
+ *args : tuple
11
+ Variable length argument list passed to the base Exception.
12
+ **kwargs : dict
13
+ Arbitrary keyword arguments passed to the base Exception.
14
+
15
+ Returns
16
+ -------
17
+ ReflectionAttributeError
18
+ An instance of the ReflectionAttributeError exception.
19
+
20
+ Notes
21
+ -----
22
+ This exception does not define additional attributes beyond those provided by Exception.
23
+ """
24
+ pass # Custom exception for attribute errors during reflection
25
+
26
+
27
+ class ReflectionTypeError(Exception):
28
+ """
29
+ Exception raised when a type-related error occurs during reflection or introspection operations.
30
+
31
+ This exception signals issues such as invalid type usage, type mismatches, or unsupported types
32
+ encountered while performing reflection-based logic.
33
+
34
+ Parameters
35
+ ----------
36
+ *args : tuple
37
+ Variable length argument list passed to the base Exception.
38
+ **kwargs : dict
39
+ Arbitrary keyword arguments passed to the base Exception.
40
+
41
+ Returns
42
+ -------
43
+ ReflectionTypeError
44
+ An instance of the ReflectionTypeError exception.
45
+
46
+ Notes
47
+ -----
48
+ This exception does not define additional attributes beyond those provided by Exception.
49
+ """
50
+ pass # Custom exception for type errors during reflection
51
+
52
+
53
+ class ReflectionValueError(Exception):
54
+ """
55
+ Exception raised when a reflection operation encounters an invalid or unexpected value.
56
+
57
+ This exception is used within introspection services to indicate that a value obtained or
58
+ manipulated via reflection does not meet the expected criteria or format.
59
+
60
+ Parameters
61
+ ----------
62
+ *args : tuple
63
+ Variable length argument list passed to the base Exception.
64
+ **kwargs : dict
65
+ Arbitrary keyword arguments passed to the base Exception.
66
+
67
+ Returns
68
+ -------
69
+ ReflectionValueError
70
+ An instance of the ReflectionValueError exception.
71
+
72
+ Notes
73
+ -----
74
+ This exception does not define additional attributes beyond those provided by Exception.
75
+ """
76
+ pass # Custom exception for value errors during reflection