orionis 0.431.0__py3-none-any.whl → 0.434.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 (82) hide show
  1. orionis/app.py +17 -0
  2. orionis/console/commands/version.py +2 -2
  3. orionis/console/core/reactor.py +1 -1
  4. orionis/foundation/config/roots/paths.py +2 -2
  5. orionis/metadata/framework.py +38 -65
  6. orionis/metadata/package.py +280 -54
  7. orionis/support/entities/base.py +18 -37
  8. orionis/support/facades/console.py +3 -9
  9. orionis/support/facades/dumper.py +3 -9
  10. orionis/support/facades/logger.py +3 -9
  11. orionis/support/facades/path_resolver.py +3 -10
  12. orionis/support/facades/progress_bar.py +3 -10
  13. orionis/support/facades/testing.py +4 -10
  14. orionis/support/facades/workers.py +4 -9
  15. orionis/support/formatter/exceptions/contracts/parser.py +10 -7
  16. orionis/support/formatter/exceptions/parser.py +28 -26
  17. orionis/support/formatter/serializer.py +12 -5
  18. orionis/support/patterns/singleton/meta.py +17 -21
  19. orionis/support/standard/contracts/std.py +25 -24
  20. orionis/support/standard/exceptions/value.py +2 -2
  21. orionis/support/standard/std.py +26 -24
  22. orionis/support/wrapper/dot_dict.py +16 -51
  23. orionis/test/cases/asynchronous.py +17 -81
  24. orionis/test/cases/synchronous.py +17 -73
  25. orionis/test/contracts/dumper.py +17 -21
  26. orionis/test/contracts/kernel.py +5 -12
  27. orionis/test/contracts/logs.py +16 -21
  28. orionis/test/contracts/printer.py +70 -8
  29. orionis/test/contracts/render.py +7 -13
  30. orionis/test/contracts/test_result.py +58 -27
  31. orionis/test/contracts/unit_test.py +18 -18
  32. orionis/test/core/unit_test.py +162 -519
  33. orionis/test/entities/result.py +49 -21
  34. orionis/test/enums/status.py +11 -17
  35. orionis/test/exceptions/config.py +4 -8
  36. orionis/test/exceptions/failure.py +2 -18
  37. orionis/test/exceptions/persistence.py +4 -8
  38. orionis/test/exceptions/runtime.py +4 -8
  39. orionis/test/exceptions/value.py +5 -13
  40. orionis/test/kernel.py +14 -42
  41. orionis/test/output/dumper.py +21 -43
  42. orionis/test/output/printer.py +6 -146
  43. orionis/test/records/logs.py +57 -121
  44. orionis/test/validators/base_path.py +8 -6
  45. orionis/test/validators/execution_mode.py +2 -3
  46. orionis/test/validators/fail_fast.py +4 -8
  47. orionis/test/validators/folder_path.py +5 -7
  48. orionis/test/validators/module_name.py +3 -3
  49. orionis/test/validators/name_pattern.py +4 -9
  50. orionis/test/validators/pattern.py +4 -9
  51. orionis/test/validators/persistent.py +4 -14
  52. orionis/test/validators/persistent_driver.py +7 -12
  53. orionis/test/validators/print_result.py +4 -9
  54. orionis/test/validators/tags.py +6 -7
  55. orionis/test/validators/throw_exception.py +7 -14
  56. orionis/test/validators/verbosity.py +15 -5
  57. orionis/test/validators/web_report.py +6 -10
  58. orionis/test/validators/workers.py +9 -4
  59. orionis/test/view/render.py +9 -26
  60. {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/METADATA +1 -1
  61. {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/RECORD +82 -81
  62. tests/metadata/test_metadata_framework.py +64 -90
  63. tests/metadata/test_metadata_package.py +31 -31
  64. tests/support/entities/mock_dataclass.py +16 -10
  65. tests/support/entities/test_base.py +6 -14
  66. tests/support/patterns/singleton/test_patterns_singleton.py +7 -8
  67. tests/support/standard/test_services_std.py +113 -37
  68. tests/support/wrapper/test_services_wrapper_docdict.py +25 -40
  69. tests/testing/cases/test_testing_asynchronous.py +14 -14
  70. tests/testing/cases/test_testing_synchronous.py +12 -14
  71. tests/testing/entities/test_testing_result.py +12 -51
  72. tests/testing/enums/test_testing_status.py +8 -13
  73. tests/testing/output/test_testing_dumper.py +3 -6
  74. tests/testing/output/test_testing_printer.py +5 -5
  75. tests/testing/records/test_testing_records.py +16 -26
  76. tests/testing/test_testing_unit.py +8 -94
  77. tests/testing/validators/test_testing_validators.py +55 -112
  78. tests/testing/view/test_render.py +4 -5
  79. {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/WHEEL +0 -0
  80. {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/licenses/LICENCE +0 -0
  81. {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/top_level.txt +0 -0
  82. {orionis-0.431.0.dist-info → orionis-0.434.0.dist-info}/zip-safe +0 -0
@@ -5,11 +5,10 @@ class BaseEntity:
5
5
 
6
6
  def __post_init__(self):
7
7
  """
8
- Post-initialization hook for dataclass instances.
8
+ Called automatically after the dataclass instance is initialized.
9
9
 
10
- This method is automatically called after the dataclass `__init__` method.
11
- It is intended to be overridden by subclasses to perform additional initialization
12
- or validation logic after all fields have been set.
10
+ This method is intended to be overridden by subclasses to perform additional
11
+ initialization or validation after all fields have been set.
13
12
 
14
13
  Parameters
15
14
  ----------
@@ -18,60 +17,42 @@ class BaseEntity:
18
17
  Returns
19
18
  -------
20
19
  None
21
- This method does not return any value.
22
-
23
- Notes
24
- -----
25
- By default, this method does nothing. Subclasses can override it to implement
26
- custom post-initialization behavior.
27
20
  """
28
-
29
21
  pass
30
22
 
31
23
  def toDict(self) -> dict:
32
24
  """
33
- Converts the current dataclass instance into a dictionary.
34
-
35
- Parameters
36
- ----------
37
- None
25
+ Convert the dataclass instance to a dictionary.
38
26
 
39
27
  Returns
40
28
  -------
41
29
  dict
42
- A dictionary containing all fields of the instance, with field names as keys and their corresponding values.
43
-
44
- Notes
45
- -----
46
- This method uses `dataclasses.asdict` to recursively convert the dataclass instance and any nested dataclasses into dictionaries.
47
- Enum values are preserved as their actual values.
30
+ Dictionary representation of the dataclass instance, including nested dataclasses.
48
31
  """
49
-
50
- # Use asdict to convert the dataclass instance to a dictionary, including nested dataclasses
51
32
  return asdict(self)
52
33
 
53
34
  def getFields(self):
54
35
  """
55
- Retrieves detailed information about each field in the current dataclass instance.
56
-
57
- Parameters
58
- ----------
59
- None
36
+ Get detailed information about each field in the dataclass instance.
60
37
 
61
38
  Returns
62
39
  -------
63
40
  list of dict
64
- Each dictionary in the returned list contains:
65
- - name (str): The name of the field.
66
- - types (list of str): The type(s) of the field, represented as a list of type names.
67
- - default: The default value of the field, resolved from the field definition, default factory, or metadata.
68
- - metadata (dict): The metadata associated with the field.
41
+ A list where each element is a dictionary containing:
42
+ - name : str
43
+ The name of the field.
44
+ - types : list of str
45
+ The type(s) of the field as a list of type names.
46
+ - default : Any
47
+ The default value of the field, resolved from the field definition, default factory, or metadata.
48
+ - metadata : dict
49
+ The metadata associated with the field.
69
50
 
70
51
  Notes
71
52
  -----
72
- - Handles complex field types, including unions and generics, by representing them as lists of type names.
73
- - Resolves default values from direct assignment, default factories, or metadata, and normalizes dataclass and Enum values.
74
- - Metadata defaults are normalized if present and callable or dataclass/Enum types.
53
+ Handles complex field types, including unions and generics, by representing them as lists of type names.
54
+ Resolves default values from direct assignment, default factories, or metadata, and normalizes dataclass and Enum values.
55
+ Metadata defaults are normalized if present and callable or dataclass/Enum types.
75
56
  """
76
57
 
77
58
  # List to hold field information dictionaries
@@ -5,17 +5,11 @@ class Console(Facade):
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls) -> str:
7
7
  """
8
- Returns the service container binding key used to resolve the console component.
9
-
10
- This method provides the unique string identifier that the service container uses
11
- to locate and instantiate the console service. It is typically used internally
12
- by the Facade base class to delegate calls to the underlying implementation.
8
+ Get the service container binding key for the console component.
13
9
 
14
10
  Returns
15
11
  -------
16
12
  str
17
- The string key `"core.orionis.console"` that identifies the console service in the container.
13
+ The binding key used to resolve the console service from the container.
18
14
  """
19
-
20
- # Return the binding key for the console service in the container
21
- return "core.orionis.console"
15
+ return "core.orionis.console"
@@ -5,17 +5,11 @@ class Dumper(Facade):
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls) -> str:
7
7
  """
8
- Returns the binding key used to retrieve the dumper component from the service container.
9
-
10
- This method provides the unique string identifier that the service container uses to resolve
11
- and return the dumper service instance. It is typically used internally by the Facade base class
12
- to access the underlying implementation.
8
+ Returns the service container binding key for the dumper component.
13
9
 
14
10
  Returns
15
11
  -------
16
12
  str
17
- The string "core.orionis.dumper", which is the service container binding key for the dumper component.
13
+ The binding key "core.orionis.dumper" used to resolve the dumper service from the container.
18
14
  """
19
-
20
- # Return the service container binding key for the dumper component
21
- return "core.orionis.dumper"
15
+ return "core.orionis.dumper"
@@ -5,18 +5,12 @@ class Log(Facade):
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls) -> str:
7
7
  """
8
- Returns the binding key used to resolve the logger service from the service container.
9
-
10
- This method provides the unique identifier required by the service container to retrieve
11
- the logger component. It is used internally by the Facade base class to delegate calls
12
- to the appropriate service implementation.
8
+ Returns the binding key for the logger service in the service container.
13
9
 
14
10
  Returns
15
11
  -------
16
12
  str
17
- The binding key for the logger service in the service container, specifically
13
+ The unique identifier used to resolve the logger service, specifically
18
14
  "core.orionis.logger".
19
15
  """
20
-
21
- # Return the service container binding key for the logger component
22
- return "core.orionis.logger"
16
+ return "core.orionis.logger"
@@ -5,18 +5,11 @@ class PathResolver(Facade):
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls):
7
7
  """
8
- Returns the service container binding key used to resolve the path resolver component.
9
-
10
- This method provides the unique string identifier that the service container uses
11
- to locate and retrieve the path resolver service. It is typically used internally
12
- by the facade mechanism to delegate calls to the appropriate underlying implementation.
8
+ Returns the binding key for the path resolver service in the container.
13
9
 
14
10
  Returns
15
11
  -------
16
12
  str
17
- The string key "core.orionis.path_resolver" that identifies the path resolver
18
- service in the container.
13
+ The unique string identifier for the path resolver service, used by the service container.
19
14
  """
20
-
21
- # Return the binding key for the path resolver service in the container
22
- return "core.orionis.path_resolver"
15
+ return "core.orionis.path_resolver"
@@ -5,18 +5,11 @@ class ProgressBar(Facade):
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls):
7
7
  """
8
- Returns the binding key used to retrieve the progress bar service from the service container.
9
-
10
- This method provides the unique string identifier that the service container uses to resolve
11
- the progress bar component. It is typically used internally by the Facade system to access
12
- the underlying implementation.
8
+ Returns the binding key for the progress bar service.
13
9
 
14
10
  Returns
15
11
  -------
16
12
  str
17
- The binding key for the progress bar service in the service container, specifically
18
- "core.orionis.progress_bar".
13
+ The unique identifier used to retrieve the progress bar service from the service container.
19
14
  """
20
-
21
- # Return the service container binding key for the progress bar component
22
- return "core.orionis.progress_bar"
15
+ return "core.orionis.progress_bar"
@@ -5,18 +5,12 @@ class Test(Facade):
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls) -> str:
7
7
  """
8
- Returns the service container binding key for the testing component.
9
-
10
- This method provides the unique string identifier used by the service container
11
- to resolve the testing component. It is typically used internally by the Facade
12
- system to retrieve the correct implementation from the container.
8
+ Returns the binding key for the testing component in the service container.
13
9
 
14
10
  Returns
15
11
  -------
16
12
  str
17
- The string key "core.orionis.testing" that identifies the testing component
18
- in the service container.
13
+ The unique string identifier for the testing component, used by the service
14
+ container to resolve the appropriate implementation.
19
15
  """
20
-
21
- # Return the binding key for the testing component in the service container
22
- return "core.orionis.testing"
16
+ return "core.orionis.testing"
@@ -5,18 +5,13 @@ class Workers(Facade):
5
5
  @classmethod
6
6
  def getFacadeAccessor(cls):
7
7
  """
8
- Returns the service container binding key for the workers component.
9
-
10
- This method provides the unique string identifier used by the service container
11
- to resolve the workers service. It is typically used internally by the Facade
12
- mechanism to access the underlying implementation.
8
+ Returns the binding key for the workers service in the service container.
13
9
 
14
10
  Returns
15
11
  -------
16
12
  str
17
- The string key "core.orionis.workers" that identifies the workers service
18
- in the service container.
13
+ The identifier string for the workers service, used by the service container
14
+ to resolve the corresponding implementation.
19
15
  """
20
16
 
21
- # Return the binding key for the workers service in the container
22
- return "core.orionis.workers"
17
+ return "core.orionis.workers"
@@ -3,36 +3,39 @@ from typing import Any, Dict
3
3
 
4
4
  class IExceptionParser(ABC):
5
5
  """
6
- Abstract base interface for classes that parse exceptions
7
- into a structured dictionary format.
6
+ Interface for parsing exceptions into structured dictionary representations.
7
+
8
+ This abstract base class defines the contract for classes that convert
9
+ exception objects into a standardized dictionary format, which may include
10
+ details such as error type, message, code, stack trace, and cause.
8
11
  """
9
12
 
10
13
  @property
11
14
  @abstractmethod
12
15
  def raw_exception(self) -> Exception:
13
16
  """
14
- Get the original exception object.
17
+ Returns the original exception instance.
15
18
 
16
19
  Returns
17
20
  -------
18
21
  Exception
19
- The raw exception instance.
22
+ The exception object to be parsed.
20
23
  """
21
24
  pass
22
25
 
23
26
  @abstractmethod
24
27
  def toDict(self) -> Dict[str, Any]:
25
28
  """
26
- Serialize the exception into a dictionary.
29
+ Converts the exception into a structured dictionary.
27
30
 
28
31
  Returns
29
32
  -------
30
33
  dict
31
- A structured representation of the exception including details such as:
34
+ A dictionary containing details about the exception, such as:
32
35
  - error_type
33
36
  - error_message
34
37
  - error_code
35
38
  - stack_trace
36
- - cause (if any)
39
+ - cause (if present)
37
40
  """
38
41
  pass
@@ -4,24 +4,21 @@ from orionis.support.formatter.exceptions.contracts.parser import IExceptionPars
4
4
 
5
5
  class ExceptionParser(IExceptionParser):
6
6
  """
7
- A utility class to parse an exception and convert it into a structured dictionary.
7
+ Parses an exception and converts it into a structured dictionary representation.
8
+
9
+ Parameters
10
+ ----------
11
+ exception : Exception
12
+ The exception instance to be parsed.
8
13
  """
9
14
 
10
15
  def __init__(self, exception: Exception) -> None:
11
- """
12
- Initialize the ExceptionParser with the given exception.
13
-
14
- Parameters
15
- ----------
16
- exception : Exception
17
- The exception to be parsed.
18
- """
19
16
  self.__exception = exception
20
17
 
21
18
  @property
22
19
  def raw_exception(self) -> Exception:
23
20
  """
24
- Get the original exception object.
21
+ Returns the original exception object.
25
22
 
26
23
  Returns
27
24
  -------
@@ -32,21 +29,21 @@ class ExceptionParser(IExceptionParser):
32
29
 
33
30
  def toDict(self) -> Dict[str, Any]:
34
31
  """
35
- Serialize the exception into a dictionary format.
32
+ Serializes the exception into a dictionary containing detailed error information.
36
33
 
37
34
  Returns
38
35
  -------
39
36
  dict
40
- A dictionary containing:
41
- - 'error_type': The type of exception.
42
- - 'error_message': The complete traceback string.
43
- - 'error_code': Custom error code, if available.
44
- - 'stack_trace': A list of frames in the stack trace, each with:
45
- - 'filename': File where the error occurred.
46
- - 'lineno': Line number.
47
- - 'name': Function or method name.
48
- - 'line': The source line of code.
49
- - 'cause': A nested dictionary representing the original cause (if any).
37
+ Dictionary with the following keys:
38
+ - 'error_type': str, the type of the exception.
39
+ - 'error_message': str, the formatted traceback string.
40
+ - 'error_code': Any, custom error code if present on the exception.
41
+ - 'stack_trace': list of dict, each dict contains frame details:
42
+ - 'filename': str, file where the error occurred.
43
+ - 'lineno': int, line number in the file.
44
+ - 'name': str, function or method name.
45
+ - 'line': str or None, source line of code.
46
+ - 'cause': dict or None, nested dictionary for the original cause if present.
50
47
  """
51
48
  tb = traceback.TracebackException.from_exception(self.__exception, capture_locals=False)
52
49
 
@@ -60,17 +57,21 @@ class ExceptionParser(IExceptionParser):
60
57
 
61
58
  def __parse_stack(self, stack: traceback.StackSummary) -> List[Dict[str, Union[str, int, None]]]:
62
59
  """
63
- Helper method to parse the stack trace.
60
+ Parses the stack trace summary into a list of frame dictionaries.
64
61
 
65
62
  Parameters
66
63
  ----------
67
64
  stack : traceback.StackSummary
68
- The summary of the stack.
65
+ The summary of the stack trace.
69
66
 
70
67
  Returns
71
68
  -------
72
69
  list of dict
73
- A list of dictionaries with detailed frame information.
70
+ Each dictionary contains:
71
+ - 'filename': str, file where the frame is located.
72
+ - 'lineno': int, line number in the file.
73
+ - 'name': str, function or method name.
74
+ - 'line': str or None, source line of code.
74
75
  """
75
76
  return [
76
77
  {
@@ -84,7 +85,7 @@ class ExceptionParser(IExceptionParser):
84
85
 
85
86
  def __parse_cause(self, cause: Optional[BaseException]) -> Optional[Dict[str, Any]]:
86
87
  """
87
- Recursively parse the cause of an exception, if available.
88
+ Recursively parses the cause of an exception, if present.
88
89
 
89
90
  Parameters
90
91
  ----------
@@ -94,7 +95,8 @@ class ExceptionParser(IExceptionParser):
94
95
  Returns
95
96
  -------
96
97
  dict or None
97
- A dictionary with the cause information or None if no cause exists.
98
+ Dictionary with the cause's error type, message, and stack trace,
99
+ or None if no cause exists.
98
100
  """
99
101
  if not isinstance(cause, BaseException):
100
102
  return None
@@ -5,11 +5,18 @@ class Parser:
5
5
  @staticmethod
6
6
  def exception(exception: Exception) -> ExceptionParser:
7
7
  """
8
- Creates and returns an ExceptionParser instance for the given exception.
9
- Args:
10
- exception (Exception): The exception to be parsed.
11
- Returns:
12
- ExceptionParser: An instance of ExceptionParser initialized with the provided exception.
8
+ Create and return an ExceptionParser instance for the given exception.
9
+
10
+ Parameters
11
+ ----------
12
+ exception : Exception
13
+ The exception object to be parsed.
14
+
15
+ Returns
16
+ -------
17
+ ExceptionParser
18
+ An ExceptionParser instance initialized with the provided exception.
13
19
  """
14
20
 
21
+ # Instantiate and return an ExceptionParser for the given exception
15
22
  return ExceptionParser(exception)
@@ -6,25 +6,21 @@ T = TypeVar('T')
6
6
 
7
7
  class Singleton(type):
8
8
  """
9
- Thread-safe and async-safe singleton metaclass.
9
+ Metaclass for implementing thread-safe and async-safe singleton pattern.
10
10
 
11
- Ensures that only one instance of a class exists, regardless of whether the code is running in a synchronous or asynchronous context. This metaclass provides both a synchronous (`__call__`) and asynchronous (`__acall__`) method for instance creation, using appropriate locking mechanisms to prevent race conditions in multi-threaded or async environments.
11
+ This metaclass ensures that only one instance of a class exists, regardless of
12
+ whether the code is running in a synchronous or asynchronous context. It provides
13
+ both synchronous and asynchronous mechanisms for instance creation, using appropriate
14
+ locking to prevent race conditions in multi-threaded or async environments.
12
15
 
13
16
  Attributes
14
17
  ----------
15
18
  _instances : Dict[Type[T], T]
16
- Stores singleton instances for each class using this metaclass.
19
+ Dictionary storing singleton instances for each class using this metaclass.
17
20
  _lock : threading.Lock
18
21
  Thread lock for synchronizing instance creation in synchronous contexts.
19
22
  _async_lock : asyncio.Lock
20
23
  Async lock for synchronizing instance creation in asynchronous contexts.
21
-
22
- Methods
23
- -------
24
- __call__(cls, *args, **kwargs)
25
- Synchronously creates or retrieves the singleton instance.
26
- __acall__(cls, *args, **kwargs)
27
- Asynchronously creates or retrieves the singleton instance.
28
24
  """
29
25
 
30
26
  _instances: Dict[Type[T], T] = {}
@@ -33,12 +29,12 @@ class Singleton(type):
33
29
 
34
30
  def __call__(cls: Type[T], *args: Any, **kwargs: Any) -> T:
35
31
  """
36
- Synchronously creates or retrieves a singleton instance of the class.
32
+ Synchronously create or retrieve the singleton instance.
37
33
 
38
- This method ensures that only one instance of the class is created, even in multi-threaded environments.
39
- If the instance does not exist, it acquires a thread lock to prevent race conditions, creates the instance,
40
- and stores it in the class-level `_instances` dictionary. If the instance already exists, it simply returns
41
- the existing instance.
34
+ Ensures that only one instance of the class is created in a thread-safe manner.
35
+ If the instance does not exist, acquires a thread lock to prevent race conditions,
36
+ creates the instance, and stores it in the class-level `_instances` dictionary.
37
+ If the instance already exists, returns the existing instance.
42
38
 
43
39
  Parameters
44
40
  ----------
@@ -70,12 +66,12 @@ class Singleton(type):
70
66
 
71
67
  async def __acall__(cls: Type[T], *args: Any, **kwargs: Any) -> T:
72
68
  """
73
- Asynchronously creates or retrieves a singleton instance of the class.
69
+ Asynchronously create or retrieve the singleton instance.
74
70
 
75
- This method ensures that only one instance of the class is created, even in asynchronous contexts.
76
- If the instance does not exist, it acquires an asynchronous lock to prevent race conditions,
77
- creates the instance, and stores it in the class-level `_instances` dictionary. If the instance
78
- already exists, it simply returns the existing instance.
71
+ Ensures that only one instance of the class is created in an async-safe manner.
72
+ If the instance does not exist, acquires an asynchronous lock to prevent race
73
+ conditions, creates the instance, and stores it in the class-level `_instances`
74
+ dictionary. If the instance already exists, returns the existing instance.
79
75
 
80
76
  Parameters
81
77
  ----------
@@ -103,4 +99,4 @@ class Singleton(type):
103
99
  cls._instances[cls] = super().__call__(*args, **kwargs)
104
100
 
105
101
  # Return the singleton instance
106
- return cls._instances[cls]
102
+ return cls._instances[cls]
@@ -3,86 +3,87 @@ from typing import Any, Dict
3
3
 
4
4
  class IStdClass(ABC):
5
5
  """
6
- Interface for a dynamic class that allows setting arbitrary attributes,
6
+ Abstract base class for a dynamic object that allows arbitrary attribute assignment,
7
7
  similar to PHP's stdClass.
8
8
 
9
- Implementations should provide dynamic attribute access and management.
9
+ Implementations must support dynamic attribute management and provide methods for
10
+ representation, comparison, serialization, and attribute manipulation.
10
11
  """
11
12
 
12
13
  @abstractmethod
13
14
  def __init__(self, **kwargs: Any) -> None:
14
15
  """
15
- Initializes the object with optional attributes.
16
+ Initialize the object with optional attributes.
16
17
 
17
18
  Parameters
18
19
  ----------
19
- kwargs : Any
20
- Key-value pairs to set as initial attributes.
20
+ **kwargs : Any
21
+ Arbitrary keyword arguments to set as initial attributes.
21
22
  """
22
23
  pass
23
24
 
24
25
  @abstractmethod
25
26
  def __repr__(self) -> str:
26
27
  """
27
- Returns an unambiguous string representation of the object.
28
+ Return an unambiguous string representation of the object.
28
29
 
29
30
  Returns
30
31
  -------
31
32
  str
32
- A string that could be used to recreate the object.
33
+ String representation suitable for debugging and object recreation.
33
34
  """
34
35
  pass
35
36
 
36
37
  @abstractmethod
37
38
  def __str__(self) -> str:
38
39
  """
39
- Returns a readable string representation of the object.
40
+ Return a readable string representation of the object.
40
41
 
41
42
  Returns
42
43
  -------
43
44
  str
44
- A user-friendly string showing the object's attributes.
45
+ Human-readable string displaying the object's attributes.
45
46
  """
46
47
  pass
47
48
 
48
49
  @abstractmethod
49
50
  def __eq__(self, other: Any) -> bool:
50
51
  """
51
- Compares two objects for equality based on their attributes.
52
+ Compare this object with another for equality based on attributes.
52
53
 
53
54
  Parameters
54
55
  ----------
55
56
  other : Any
56
- The object to compare with.
57
+ Object to compare against.
57
58
 
58
59
  Returns
59
60
  -------
60
61
  bool
61
- True if both objects have the same attributes and values.
62
+ True if both objects have identical attributes and values, False otherwise.
62
63
  """
63
64
  pass
64
65
 
65
66
  @abstractmethod
66
67
  def toDict(self) -> Dict[str, Any]:
67
68
  """
68
- Converts the object's attributes to a dictionary.
69
+ Convert the object's attributes to a dictionary.
69
70
 
70
71
  Returns
71
72
  -------
72
- Dict[str, Any]
73
- A dictionary representation of the object's attributes.
73
+ dict of str to Any
74
+ Dictionary containing the object's attribute names and values.
74
75
  """
75
76
  pass
76
77
 
77
78
  @abstractmethod
78
79
  def update(self, **kwargs: Any) -> None:
79
80
  """
80
- Updates the object's attributes dynamically.
81
+ Update the object's attributes with the provided key-value pairs.
81
82
 
82
83
  Parameters
83
84
  ----------
84
- kwargs : Any
85
- Key-value pairs to update attributes.
85
+ **kwargs : Any
86
+ Arbitrary keyword arguments to update or add as attributes.
86
87
 
87
88
  Raises
88
89
  ------
@@ -94,7 +95,7 @@ class IStdClass(ABC):
94
95
  @abstractmethod
95
96
  def remove(self, *attributes: str) -> None:
96
97
  """
97
- Removes one or more attributes from the object.
98
+ Remove one or more attributes from the object.
98
99
 
99
100
  Parameters
100
101
  ----------
@@ -104,7 +105,7 @@ class IStdClass(ABC):
104
105
  Raises
105
106
  ------
106
107
  AttributeError
107
- If any of the attributes doesn't exist.
108
+ If any specified attribute does not exist.
108
109
  """
109
110
  pass
110
111
 
@@ -112,16 +113,16 @@ class IStdClass(ABC):
112
113
  @abstractmethod
113
114
  def fromDict(cls, dictionary: Dict[str, Any]) -> 'IStdClass':
114
115
  """
115
- Creates an instance from a dictionary.
116
+ Create an instance from a dictionary of attributes.
116
117
 
117
118
  Parameters
118
119
  ----------
119
- dictionary : Dict[str, Any]
120
- Dictionary to create the object from.
120
+ dictionary : dict of str to Any
121
+ Dictionary containing attribute names and values.
121
122
 
122
123
  Returns
123
124
  -------
124
125
  IStdClass
125
- A new instance with the dictionary's key-value pairs as attributes.
126
+ New instance with attributes set from the dictionary.
126
127
  """
127
128
  pass