orionis 0.450.0__py3-none-any.whl → 0.452.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.
- orionis/console/base/contracts/command.py +0 -2
- orionis/console/core/__init__.py +0 -0
- orionis/console/core/reactor.py +19 -4
- orionis/container/container.py +1581 -69
- orionis/container/contracts/container.py +184 -33
- orionis/foundation/config/database/entities/mysql.py +0 -1
- orionis/metadata/framework.py +1 -1
- orionis/services/inspirational/contracts/__init__.py +0 -0
- orionis/services/introspection/abstract/contracts/reflection.py +5 -6
- orionis/services/introspection/abstract/reflection.py +5 -6
- orionis/services/introspection/callables/contracts/reflection.py +3 -2
- orionis/services/introspection/callables/reflection.py +4 -4
- orionis/services/introspection/concretes/contracts/reflection.py +5 -6
- orionis/services/introspection/concretes/reflection.py +5 -6
- orionis/services/introspection/dependencies/contracts/reflection.py +87 -23
- orionis/services/introspection/dependencies/entities/argument.py +95 -0
- orionis/services/introspection/dependencies/entities/resolve_argument.py +82 -0
- orionis/services/introspection/dependencies/reflection.py +176 -106
- orionis/services/introspection/instances/contracts/reflection.py +5 -6
- orionis/services/introspection/instances/reflection.py +5 -6
- orionis/test/core/unit_test.py +150 -48
- {orionis-0.450.0.dist-info → orionis-0.452.0.dist-info}/METADATA +1 -1
- {orionis-0.450.0.dist-info → orionis-0.452.0.dist-info}/RECORD +35 -38
- tests/container/mocks/mock_auto_resolution.py +192 -0
- tests/services/introspection/dependencies/test_reflect_dependencies.py +135 -58
- tests/services/introspection/reflection/test_reflection_abstract.py +5 -4
- tests/services/introspection/reflection/test_reflection_callable.py +3 -3
- tests/services/introspection/reflection/test_reflection_concrete.py +4 -4
- tests/services/introspection/reflection/test_reflection_instance.py +5 -5
- orionis/console/args/parser.py +0 -40
- orionis/container/contracts/resolver.py +0 -115
- orionis/container/resolver/resolver.py +0 -602
- orionis/services/introspection/dependencies/entities/callable_dependencies.py +0 -54
- orionis/services/introspection/dependencies/entities/class_dependencies.py +0 -61
- orionis/services/introspection/dependencies/entities/known_dependencies.py +0 -67
- orionis/services/introspection/dependencies/entities/method_dependencies.py +0 -61
- tests/container/resolver/test_resolver.py +0 -62
- /orionis/{container/resolver → console/commands}/__init__.py +0 -0
- {tests/container/resolver → orionis/console/contracts}/__init__.py +0 -0
- {orionis-0.450.0.dist-info → orionis-0.452.0.dist-info}/WHEEL +0 -0
- {orionis-0.450.0.dist-info → orionis-0.452.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.450.0.dist-info → orionis-0.452.0.dist-info}/top_level.txt +0 -0
- {orionis-0.450.0.dist-info → orionis-0.452.0.dist-info}/zip-safe +0 -0
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from typing import Any, Dict, List
|
|
3
|
-
from orionis.services.introspection.dependencies.entities.known_dependencies import KnownDependency
|
|
4
|
-
from orionis.services.introspection.exceptions import ReflectionTypeError
|
|
5
|
-
|
|
6
|
-
@dataclass(frozen=True, kw_only=True)
|
|
7
|
-
class ClassDependency:
|
|
8
|
-
"""
|
|
9
|
-
Represents the dependencies of a class, distinguishing between resolved and unresolved dependencies.
|
|
10
|
-
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
resolved : dict of KnownDependency to Any
|
|
14
|
-
Dictionary mapping KnownDependency instances to their resolved values or instances.
|
|
15
|
-
unresolved : list of str
|
|
16
|
-
List of dependency names or identifiers that could not be resolved.
|
|
17
|
-
|
|
18
|
-
Attributes
|
|
19
|
-
----------
|
|
20
|
-
resolved : dict of KnownDependency to Any
|
|
21
|
-
The resolved dependencies for the class.
|
|
22
|
-
unresolved : list of str
|
|
23
|
-
The unresolved dependency names or identifiers.
|
|
24
|
-
|
|
25
|
-
Raises
|
|
26
|
-
------
|
|
27
|
-
ReflectionTypeError
|
|
28
|
-
If 'resolved' is not a dictionary with KnownDependency keys or 'unresolved' is not a list.
|
|
29
|
-
ValueError
|
|
30
|
-
If 'resolved' contains None keys or 'unresolved' contains empty strings.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
# Resolved dependencies mapped to their values
|
|
34
|
-
resolved: Dict[KnownDependency, Any]
|
|
35
|
-
|
|
36
|
-
# Unresolved dependencies as a list of parameter names
|
|
37
|
-
unresolved: List[str]
|
|
38
|
-
|
|
39
|
-
def __post_init__(self):
|
|
40
|
-
"""
|
|
41
|
-
Validates the types of the 'resolved' and 'unresolved' attributes after initialization.
|
|
42
|
-
|
|
43
|
-
Raises
|
|
44
|
-
------
|
|
45
|
-
ReflectionTypeError
|
|
46
|
-
If 'resolved' is not a dict or 'unresolved' is not a list.
|
|
47
|
-
ValueError
|
|
48
|
-
If 'resolved' contains None keys or 'unresolved' contains empty strings.
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
# Validate 'resolved' is a dict with KnownDependency keys
|
|
52
|
-
if not isinstance(self.resolved, dict):
|
|
53
|
-
raise ReflectionTypeError(
|
|
54
|
-
f"'resolved' must be a dict, got {type(self.resolved).__name__}"
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
# Validate 'unresolved' is a list of non-empty strings
|
|
58
|
-
if not isinstance(self.unresolved, list):
|
|
59
|
-
raise ReflectionTypeError(
|
|
60
|
-
f"'unresolved' must be a list, got {type(self.unresolved).__name__}"
|
|
61
|
-
)
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from typing import Type, Any
|
|
3
|
-
from orionis.services.introspection.exceptions import ReflectionTypeError
|
|
4
|
-
|
|
5
|
-
@dataclass(frozen=True, kw_only=True)
|
|
6
|
-
class KnownDependency:
|
|
7
|
-
"""
|
|
8
|
-
Represents a fully resolved dependency with complete type information.
|
|
9
|
-
|
|
10
|
-
Parameters
|
|
11
|
-
----------
|
|
12
|
-
module_name : str
|
|
13
|
-
Name of the module where the dependency is defined. Must be a non-empty string without spaces.
|
|
14
|
-
class_name : str
|
|
15
|
-
Name of the class or type being resolved. Must be a valid Python identifier.
|
|
16
|
-
type : Type
|
|
17
|
-
The actual Python type object of the resolved dependency. Must not be None.
|
|
18
|
-
full_class_path : str
|
|
19
|
-
Full import path to the class (e.g., 'package.module.ClassName'). Must match the 'module_name.class_name' pattern.
|
|
20
|
-
|
|
21
|
-
Raises
|
|
22
|
-
------
|
|
23
|
-
ReflectionTypeError
|
|
24
|
-
If any of the fields have an incorrect type.
|
|
25
|
-
ValueError
|
|
26
|
-
If string fields are empty or do not meet format requirements, or if 'type' is None.
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
# Module name where the dependency is defined
|
|
30
|
-
module_name: str
|
|
31
|
-
|
|
32
|
-
# Class name or type being resolved
|
|
33
|
-
class_name: str
|
|
34
|
-
|
|
35
|
-
# The actual Python type object of the resolved dependency
|
|
36
|
-
type: Type[Any]
|
|
37
|
-
|
|
38
|
-
# Full import path to the class
|
|
39
|
-
full_class_path: str
|
|
40
|
-
|
|
41
|
-
def __post_init__(self):
|
|
42
|
-
"""
|
|
43
|
-
Validates all fields during initialization.
|
|
44
|
-
|
|
45
|
-
Raises
|
|
46
|
-
------
|
|
47
|
-
ReflectionTypeError
|
|
48
|
-
If any field has an incorrect type.
|
|
49
|
-
ValueError
|
|
50
|
-
If string fields are empty or do not meet format requirements, or if 'type' is None.
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
# Validate module_name
|
|
54
|
-
if not isinstance(self.module_name, str):
|
|
55
|
-
raise ReflectionTypeError(f"module_name must be str, got {type(self.module_name).__name__}")
|
|
56
|
-
|
|
57
|
-
# Validate class_name
|
|
58
|
-
if not isinstance(self.class_name, str):
|
|
59
|
-
raise ReflectionTypeError(f"class_name must be str, got {type(self.class_name).__name__}")
|
|
60
|
-
|
|
61
|
-
# Validate type is not None
|
|
62
|
-
if self.type is None:
|
|
63
|
-
raise ValueError("The 'type' field must not be None. Please provide a valid Python type object for the dependency.")
|
|
64
|
-
|
|
65
|
-
# Validate full_class_path
|
|
66
|
-
if not isinstance(self.full_class_path, str):
|
|
67
|
-
raise ReflectionTypeError(f"full_class_path must be str, got {type(self.full_class_path).__name__}")
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from typing import Any, Dict, List
|
|
3
|
-
from orionis.services.introspection.dependencies.entities.known_dependencies import KnownDependency
|
|
4
|
-
from orionis.services.introspection.exceptions import ReflectionTypeError
|
|
5
|
-
|
|
6
|
-
@dataclass(frozen=True, kw_only=True)
|
|
7
|
-
class MethodDependency:
|
|
8
|
-
"""
|
|
9
|
-
Represents the dependencies of a method, distinguishing between resolved and unresolved dependencies.
|
|
10
|
-
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
resolved : dict of KnownDependency to Any
|
|
14
|
-
Dictionary mapping each resolved KnownDependency to its corresponding instance or value.
|
|
15
|
-
unresolved : list of str
|
|
16
|
-
List of parameter names or dependency identifiers that could not be resolved.
|
|
17
|
-
|
|
18
|
-
Raises
|
|
19
|
-
------
|
|
20
|
-
ReflectionTypeError
|
|
21
|
-
If `resolved` is not a dictionary with KnownDependency keys, or if `unresolved` is not a list of strings.
|
|
22
|
-
ValueError
|
|
23
|
-
If `resolved` contains None keys or `unresolved` contains empty strings.
|
|
24
|
-
|
|
25
|
-
Attributes
|
|
26
|
-
----------
|
|
27
|
-
resolved : dict of KnownDependency to Any
|
|
28
|
-
The resolved dependencies for the method.
|
|
29
|
-
unresolved : list of str
|
|
30
|
-
The unresolved dependencies for the method.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
# Resolved dependencies mapped to their values
|
|
34
|
-
resolved: Dict[KnownDependency, Any]
|
|
35
|
-
|
|
36
|
-
# Unresolved dependencies as a list of parameter names
|
|
37
|
-
unresolved: List[str]
|
|
38
|
-
|
|
39
|
-
def __post_init__(self):
|
|
40
|
-
"""
|
|
41
|
-
Validates the types and values of the attributes after initialization.
|
|
42
|
-
|
|
43
|
-
Raises
|
|
44
|
-
------
|
|
45
|
-
ReflectionTypeError
|
|
46
|
-
If `resolved` is not a dictionary or `unresolved` is not a list.
|
|
47
|
-
ValueError
|
|
48
|
-
If `resolved` contains None keys or `unresolved` contains empty strings.
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
# Validate 'resolved' is a dict with proper key types
|
|
52
|
-
if not isinstance(self.resolved, dict):
|
|
53
|
-
raise ReflectionTypeError(
|
|
54
|
-
f"'resolved' must be a dict, got {type(self.resolved).__name__}"
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
# Validate 'unresolved' is a list of valid parameter names
|
|
58
|
-
if not isinstance(self.unresolved, list):
|
|
59
|
-
raise ReflectionTypeError(
|
|
60
|
-
f"'unresolved' must be a list, got {type(self.unresolved).__name__}"
|
|
61
|
-
)
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import inspect
|
|
2
|
-
from orionis.container.contracts.resolver import IResolver
|
|
3
|
-
from orionis.container.resolver.resolver import Resolver
|
|
4
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
|
-
|
|
6
|
-
class TestResolverMethods(AsyncTestCase):
|
|
7
|
-
|
|
8
|
-
async def testMethodsExist(self):
|
|
9
|
-
"""
|
|
10
|
-
Validates the implementation and structure of the `Resolver` class.
|
|
11
|
-
|
|
12
|
-
This test checks that the `Resolver` class:
|
|
13
|
-
- Implements all required methods.
|
|
14
|
-
- Inherits from the `IResolver` interface.
|
|
15
|
-
- Has main public methods (`resolve`, `resolveType`, `resolveSignature`) that are synchronous.
|
|
16
|
-
|
|
17
|
-
Parameters
|
|
18
|
-
----------
|
|
19
|
-
self : TestResolverMethods
|
|
20
|
-
The test case instance.
|
|
21
|
-
|
|
22
|
-
Returns
|
|
23
|
-
-------
|
|
24
|
-
None
|
|
25
|
-
The method does not return any value. Assertions are used to validate the class structure.
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
# List of required method names that must be implemented by Resolver
|
|
29
|
-
required_methods = [
|
|
30
|
-
"__init__",
|
|
31
|
-
"resolve",
|
|
32
|
-
"resolveType",
|
|
33
|
-
"resolveSignature",
|
|
34
|
-
"_Resolver__resolveTransient",
|
|
35
|
-
"_Resolver__resolveSingleton",
|
|
36
|
-
"_Resolver__resolveScoped",
|
|
37
|
-
"_Resolver__instantiateConcreteWithArgs",
|
|
38
|
-
"_Resolver__instantiateCallableWithArgs",
|
|
39
|
-
"_Resolver__instantiateConcreteReflective",
|
|
40
|
-
"_Resolver__instantiateCallableReflective",
|
|
41
|
-
"_Resolver__resolveDependencies",
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
# Check that each required method exists in Resolver
|
|
45
|
-
for method in required_methods:
|
|
46
|
-
self.assertTrue(
|
|
47
|
-
hasattr(Resolver, method),
|
|
48
|
-
f"Resolver must implement the method '{method}'"
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
# Ensure Resolver inherits from IResolver
|
|
52
|
-
self.assertTrue(
|
|
53
|
-
issubclass(Resolver, IResolver),
|
|
54
|
-
"Resolver must inherit from IResolver"
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
# Verify that main public methods are not asynchronous
|
|
58
|
-
for method in ["resolve", "resolveType", "resolveSignature"]:
|
|
59
|
-
self.assertFalse(
|
|
60
|
-
inspect.iscoroutinefunction(getattr(Resolver, method)),
|
|
61
|
-
f"The method '{method}' must not be async"
|
|
62
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|