orionis 0.316.0__py3-none-any.whl → 0.318.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/container/container.py +407 -53
- orionis/container/entities/binding.py +124 -0
- orionis/metadata/framework.py +1 -1
- orionis/services/introspection/callables/__init__.py +0 -0
- orionis/services/introspection/callables/reflection_callable.py +146 -0
- orionis/services/introspection/dependencies/entities/callable_dependencies.py +55 -0
- orionis/services/introspection/dependencies/reflect_dependencies.py +58 -6
- {orionis-0.316.0.dist-info → orionis-0.318.0.dist-info}/METADATA +1 -1
- {orionis-0.316.0.dist-info → orionis-0.318.0.dist-info}/RECORD +15 -10
- tests/services/inspection/dependencies/test_reflect_dependencies.py +35 -1
- tests/services/inspection/reflection/test_reflection_callable.py +156 -0
- {orionis-0.316.0.dist-info → orionis-0.318.0.dist-info}/WHEEL +0 -0
- {orionis-0.316.0.dist-info → orionis-0.318.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.316.0.dist-info → orionis-0.318.0.dist-info}/top_level.txt +0 -0
- {orionis-0.316.0.dist-info → orionis-0.318.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,124 @@
|
|
1
|
+
from dataclasses import asdict, dataclass, field, fields
|
2
|
+
from orionis.container.enums.lifetimes import Lifetime
|
3
|
+
from orionis.container.exceptions.type_error_exception import OrionisContainerTypeError
|
4
|
+
|
5
|
+
@dataclass(unsafe_hash=True, kw_only=True)
|
6
|
+
class Binding:
|
7
|
+
|
8
|
+
contract: type = field(
|
9
|
+
default=None,
|
10
|
+
metadata={
|
11
|
+
"description": "Contrato de la clase concreta a inyectar.",
|
12
|
+
"default": None
|
13
|
+
}
|
14
|
+
)
|
15
|
+
|
16
|
+
concrete: type = field(
|
17
|
+
default=None,
|
18
|
+
metadata={
|
19
|
+
"description": "Clase concreta que implementa el contrato.",
|
20
|
+
"default": None
|
21
|
+
}
|
22
|
+
)
|
23
|
+
|
24
|
+
instance: object = field(
|
25
|
+
default=None,
|
26
|
+
metadata={
|
27
|
+
"description": "Instancia concreta de la clase, si se proporciona.",
|
28
|
+
"default": None
|
29
|
+
}
|
30
|
+
)
|
31
|
+
|
32
|
+
function: callable = field(
|
33
|
+
default=None,
|
34
|
+
metadata={
|
35
|
+
"description": "Función que se invoca para crear la instancia.",
|
36
|
+
"default": None
|
37
|
+
}
|
38
|
+
)
|
39
|
+
|
40
|
+
lifetime: Lifetime = field(
|
41
|
+
default=Lifetime.TRANSIENT,
|
42
|
+
metadata={
|
43
|
+
"description": "Tiempo de vida de la instancia.",
|
44
|
+
"default": Lifetime.TRANSIENT
|
45
|
+
}
|
46
|
+
)
|
47
|
+
|
48
|
+
enforce_decoupling: bool = field(
|
49
|
+
default=False,
|
50
|
+
metadata={
|
51
|
+
"description": "Indica si se debe forzar el desacoplamiento entre contrato y concreta.",
|
52
|
+
"default": False
|
53
|
+
}
|
54
|
+
)
|
55
|
+
|
56
|
+
alias: str = field(
|
57
|
+
default=None,
|
58
|
+
metadata={
|
59
|
+
"description": "Alias para resolver la dependencia desde el contenedor.",
|
60
|
+
"default": None
|
61
|
+
}
|
62
|
+
)
|
63
|
+
|
64
|
+
def __post_init__(self):
|
65
|
+
"""
|
66
|
+
Performs type validation of instance attributes after initialization.
|
67
|
+
|
68
|
+
Parameters
|
69
|
+
----------
|
70
|
+
None
|
71
|
+
|
72
|
+
Raises
|
73
|
+
------
|
74
|
+
OrionisContainerTypeError
|
75
|
+
If 'lifetime' is not an instance of `Lifetime` (when not None).
|
76
|
+
OrionisContainerTypeError
|
77
|
+
If 'enforce_decoupling' is not of type `bool`.
|
78
|
+
OrionisContainerTypeError
|
79
|
+
If 'alias' is not of type `str` or `None`.
|
80
|
+
"""
|
81
|
+
if self.lifetime is not None and not isinstance(self.lifetime, Lifetime):
|
82
|
+
raise OrionisContainerTypeError(
|
83
|
+
f"The 'lifetime' attribute must be an instance of 'Lifetime', but received type '{type(self.lifetime).__name__}'."
|
84
|
+
)
|
85
|
+
|
86
|
+
if not isinstance(self.enforce_decoupling, bool):
|
87
|
+
raise OrionisContainerTypeError(
|
88
|
+
f"The 'enforce_decoupling' attribute must be of type 'bool', but received type '{type(self.enforce_decoupling).__name__}'."
|
89
|
+
)
|
90
|
+
|
91
|
+
if self.alias is not None and not isinstance(self.alias, str):
|
92
|
+
raise OrionisContainerTypeError(
|
93
|
+
f"The 'alias' attribute must be of type 'str' or 'None', but received type '{type(self.alias).__name__}'."
|
94
|
+
)
|
95
|
+
|
96
|
+
def toDict(self) -> dict:
|
97
|
+
"""
|
98
|
+
Convert the object to a dictionary representation.
|
99
|
+
Returns:
|
100
|
+
dict: A dictionary representation of the Dataclass object.
|
101
|
+
"""
|
102
|
+
return asdict(self)
|
103
|
+
|
104
|
+
def getFields(self):
|
105
|
+
"""
|
106
|
+
Retrieves a list of field information for the current dataclass instance.
|
107
|
+
|
108
|
+
Returns:
|
109
|
+
list: A list of dictionaries, each containing details about a field:
|
110
|
+
- name (str): The name of the field.
|
111
|
+
- type (type): The type of the field.
|
112
|
+
- default: The default value of the field, if specified; otherwise, the value from metadata or None.
|
113
|
+
- metadata (mapping): The metadata associated with the field.
|
114
|
+
"""
|
115
|
+
__fields = []
|
116
|
+
for field in fields(self):
|
117
|
+
__metadata = dict(field.metadata) or {}
|
118
|
+
__fields.append({
|
119
|
+
"name": field.name,
|
120
|
+
"type": field.type.__name__ if hasattr(field.type, '__name__') else str(field.type),
|
121
|
+
"default": field.default if (field.default is not None and '_MISSING_TYPE' not in str(field.default)) else __metadata.get('default', None),
|
122
|
+
"metadata": __metadata
|
123
|
+
})
|
124
|
+
return __fields
|
orionis/metadata/framework.py
CHANGED
File without changes
|
@@ -0,0 +1,146 @@
|
|
1
|
+
import inspect
|
2
|
+
from orionis.services.asynchrony.coroutines import Coroutine
|
3
|
+
from orionis.services.introspection.dependencies.entities.callable_dependencies import CallableDependency
|
4
|
+
from orionis.services.introspection.dependencies.reflect_dependencies import ReflectDependencies
|
5
|
+
from orionis.services.introspection.exceptions.reflection_attribute_error import ReflectionAttributeError
|
6
|
+
from orionis.services.introspection.exceptions.reflection_type_error import ReflectionTypeError
|
7
|
+
|
8
|
+
class ReflectionCallable:
|
9
|
+
|
10
|
+
def __init__(self, fn: callable) -> None:
|
11
|
+
"""
|
12
|
+
Parameters
|
13
|
+
----------
|
14
|
+
fn : callable
|
15
|
+
The function, method, or lambda to be wrapped.
|
16
|
+
Raises
|
17
|
+
------
|
18
|
+
ReflectionTypeError
|
19
|
+
If `fn` is not a function, method, or lambda.
|
20
|
+
Notes
|
21
|
+
-----
|
22
|
+
This constructor initializes the ReflectionCallable with the provided callable object.
|
23
|
+
It ensures that the input is a valid function, method, or lambda, and raises an error otherwise.
|
24
|
+
"""
|
25
|
+
if not (inspect.isfunction(fn) or inspect.ismethod(fn) or (callable(fn) and hasattr(fn, "__code__"))):
|
26
|
+
raise ReflectionTypeError(f"Expected a function, method, or lambda, got {type(fn).__name__}")
|
27
|
+
self.__function = fn
|
28
|
+
|
29
|
+
def getCallable(self) -> callable:
|
30
|
+
"""
|
31
|
+
Retrieve the callable function associated with this instance.
|
32
|
+
Returns
|
33
|
+
-------
|
34
|
+
callable
|
35
|
+
The function object encapsulated by this instance.
|
36
|
+
"""
|
37
|
+
return self.__function
|
38
|
+
|
39
|
+
def getName(self) -> str:
|
40
|
+
"""
|
41
|
+
Returns
|
42
|
+
-------
|
43
|
+
str
|
44
|
+
The name of the function.
|
45
|
+
"""
|
46
|
+
return self.__function.__name__
|
47
|
+
|
48
|
+
def getModuleName(self) -> str:
|
49
|
+
"""
|
50
|
+
Get the name of the module where the underlying function is defined.
|
51
|
+
Returns
|
52
|
+
-------
|
53
|
+
str
|
54
|
+
The name of the module in which the function was originally declared.
|
55
|
+
"""
|
56
|
+
return self.__function.__module__
|
57
|
+
|
58
|
+
def getModuleWithCallableName(self) -> str:
|
59
|
+
"""
|
60
|
+
Get the fully qualified name of the callable, including its module.
|
61
|
+
Returns
|
62
|
+
-------
|
63
|
+
str
|
64
|
+
A string consisting of the module name and the callable name, separated by a dot.
|
65
|
+
"""
|
66
|
+
return f"{self.getModuleName()}.{self.getName()}"
|
67
|
+
|
68
|
+
def getDocstring(self) -> str:
|
69
|
+
"""
|
70
|
+
Retrieve the docstring of the callable function.
|
71
|
+
Returns
|
72
|
+
-------
|
73
|
+
str
|
74
|
+
The docstring associated with the function. Returns an empty string if no docstring is present.
|
75
|
+
"""
|
76
|
+
return self.__function.__doc__ or ""
|
77
|
+
|
78
|
+
def getSourceCode(self) -> str:
|
79
|
+
"""
|
80
|
+
Retrieve the source code of the wrapped callable.
|
81
|
+
Returns
|
82
|
+
-------
|
83
|
+
str
|
84
|
+
The source code of the callable function as a string. If the source code
|
85
|
+
cannot be retrieved, a ReflectionAttributeError is raised.
|
86
|
+
Raises
|
87
|
+
------
|
88
|
+
ReflectionAttributeError
|
89
|
+
If the source code cannot be obtained due to an OSError.
|
90
|
+
"""
|
91
|
+
try:
|
92
|
+
return inspect.getsource(self.__function)
|
93
|
+
except OSError as e:
|
94
|
+
raise ReflectionAttributeError(f"Could not retrieve source code: {e}")
|
95
|
+
|
96
|
+
def getFile(self) -> str:
|
97
|
+
"""
|
98
|
+
Retrieve the filename where the underlying callable function is defined.
|
99
|
+
Returns
|
100
|
+
-------
|
101
|
+
str
|
102
|
+
The absolute path to the source file containing the callable.
|
103
|
+
Raises
|
104
|
+
------
|
105
|
+
TypeError
|
106
|
+
If the underlying object is a built-in function or method, or if its source file cannot be determined.
|
107
|
+
"""
|
108
|
+
return inspect.getfile(self.__function)
|
109
|
+
|
110
|
+
def call(self, *args, **kwargs):
|
111
|
+
"""
|
112
|
+
Call the wrapped function with the provided arguments.
|
113
|
+
If the wrapped function is asynchronous, it will be executed using `asyncio.run`.
|
114
|
+
Parameters
|
115
|
+
----------
|
116
|
+
*args : tuple
|
117
|
+
Positional arguments to pass to the function.
|
118
|
+
**kwargs : dict
|
119
|
+
Keyword arguments to pass to the function.
|
120
|
+
Returns
|
121
|
+
-------
|
122
|
+
Any
|
123
|
+
The result returned by the function call.
|
124
|
+
Raises
|
125
|
+
------
|
126
|
+
Exception
|
127
|
+
Propagates any exception raised by the called function.
|
128
|
+
"""
|
129
|
+
if inspect.iscoroutinefunction(self.__function):
|
130
|
+
return Coroutine(self.__function(*args, **kwargs)).run()
|
131
|
+
return self.__function(*args, **kwargs)
|
132
|
+
|
133
|
+
def getDependencies(self) -> CallableDependency:
|
134
|
+
"""
|
135
|
+
Analyzes the callable associated with this instance and retrieves its dependencies.
|
136
|
+
CallableDependency
|
137
|
+
An object containing information about the callable's dependencies, including:
|
138
|
+
- resolved: dict
|
139
|
+
A dictionary mapping parameter names to their resolved values (e.g., default values or injected dependencies).
|
140
|
+
- unresolved: list of str
|
141
|
+
A list of parameter names that could not be resolved (i.e., parameters without default values or missing annotations).
|
142
|
+
Notes
|
143
|
+
-----
|
144
|
+
This method leverages the `ReflectDependencies` utility to inspect the callable and determine which dependencies are satisfied and which remain unresolved.
|
145
|
+
"""
|
146
|
+
return ReflectDependencies().getCallableDependencies(self.__function)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Any, Dict, List
|
3
|
+
from orionis.services.introspection.dependencies.entities.resolved_dependencies import ResolvedDependency
|
4
|
+
from orionis.services.introspection.exceptions.reflection_type_error import ReflectionTypeError
|
5
|
+
|
6
|
+
@dataclass(frozen=True, kw_only=True)
|
7
|
+
class CallableDependency:
|
8
|
+
"""
|
9
|
+
Represents the dependencies of a callable, separating resolved and unresolved dependencies.
|
10
|
+
|
11
|
+
Parameters
|
12
|
+
----------
|
13
|
+
resolved : Dict[ResolvedDependency, Any]
|
14
|
+
A dictionary mapping resolved dependency descriptors to their corresponding
|
15
|
+
resolved instances or values for the method. All keys must be ResolvedDependency instances.
|
16
|
+
unresolved : List[str]
|
17
|
+
A list of method parameter names or dependency identifiers that could not be resolved.
|
18
|
+
Must contain only non-empty strings.
|
19
|
+
|
20
|
+
Raises
|
21
|
+
------
|
22
|
+
ReflectionTypeError
|
23
|
+
If types don't match the expected:
|
24
|
+
- resolved: Dict[ResolvedDependency, Any]
|
25
|
+
- unresolved: List[str]
|
26
|
+
ValueError
|
27
|
+
If resolved contains None keys or unresolved contains empty strings
|
28
|
+
"""
|
29
|
+
resolved: Dict[ResolvedDependency, Any]
|
30
|
+
unresolved: List[str]
|
31
|
+
|
32
|
+
def __post_init__(self):
|
33
|
+
"""
|
34
|
+
Validates types and values of attributes during initialization.
|
35
|
+
|
36
|
+
Raises
|
37
|
+
------
|
38
|
+
ReflectionTypeError
|
39
|
+
If types don't match the expected:
|
40
|
+
- resolved: Dict[ResolvedDependency, Any]
|
41
|
+
- unresolved: List[str]
|
42
|
+
ValueError
|
43
|
+
If resolved contains None keys or unresolved contains empty strings
|
44
|
+
"""
|
45
|
+
# Validate 'resolved' is a dict with proper key types
|
46
|
+
if not isinstance(self.resolved, dict):
|
47
|
+
raise ReflectionTypeError(
|
48
|
+
f"'resolved' must be a dict, got {type(self.resolved).__name__}"
|
49
|
+
)
|
50
|
+
|
51
|
+
# Validate 'unresolved' is a list of valid parameter names
|
52
|
+
if not isinstance(self.unresolved, list):
|
53
|
+
raise ReflectionTypeError(
|
54
|
+
f"'unresolved' must be a list, got {type(self.unresolved).__name__}"
|
55
|
+
)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import inspect
|
2
2
|
from typing import Any, Dict, List
|
3
3
|
from orionis.services.introspection.contracts.reflect_dependencies import IReflectDependencies
|
4
|
+
from orionis.services.introspection.dependencies.entities.callable_dependencies import CallableDependency
|
4
5
|
from orionis.services.introspection.dependencies.entities.class_dependencies import ClassDependency
|
5
6
|
from orionis.services.introspection.dependencies.entities.method_dependencies import MethodDependency
|
6
7
|
from orionis.services.introspection.dependencies.entities.resolved_dependencies import ResolvedDependency
|
@@ -11,16 +12,16 @@ class ReflectDependencies(IReflectDependencies):
|
|
11
12
|
This class is used to reflect dependencies of a given object.
|
12
13
|
"""
|
13
14
|
|
14
|
-
def __init__(self,
|
15
|
+
def __init__(self, target = None):
|
15
16
|
"""
|
16
17
|
Initializes the ReflectDependencies instance with the given object.
|
17
18
|
|
18
19
|
Parameters
|
19
20
|
----------
|
20
|
-
|
21
|
+
target : Any
|
21
22
|
The object whose dependencies are to be reflected.
|
22
23
|
"""
|
23
|
-
self.
|
24
|
+
self.__target = target
|
24
25
|
|
25
26
|
def __paramSkip(self, param_name: str, param: inspect.Parameter) -> bool:
|
26
27
|
"""
|
@@ -43,7 +44,7 @@ class ReflectDependencies(IReflectDependencies):
|
|
43
44
|
return True
|
44
45
|
|
45
46
|
# Skip 'self' in class methods or instance methods
|
46
|
-
if param_name == 'self' and isinstance(self.
|
47
|
+
if param_name == 'self' and isinstance(self.__target, type):
|
47
48
|
return True
|
48
49
|
|
49
50
|
# Skip special parameters like *args and **kwargs
|
@@ -90,7 +91,7 @@ class ReflectDependencies(IReflectDependencies):
|
|
90
91
|
- resolved: Dictionary of resolved dependencies with their names and values.
|
91
92
|
- unresolved: List of unresolved dependencies (parameter names without default values or annotations).
|
92
93
|
"""
|
93
|
-
signature = self.__inspectSignature(self.
|
94
|
+
signature = self.__inspectSignature(self.__target.__init__)
|
94
95
|
resolved_dependencies: Dict[str, Any] = {}
|
95
96
|
unresolved_dependencies: List[str] = []
|
96
97
|
|
@@ -141,7 +142,7 @@ class ReflectDependencies(IReflectDependencies):
|
|
141
142
|
- resolved: Dictionary of resolved dependencies with their names and values.
|
142
143
|
- unresolved: List of unresolved dependencies (parameter names without default values or annotations).
|
143
144
|
"""
|
144
|
-
signature = self.__inspectSignature(getattr(self.
|
145
|
+
signature = self.__inspectSignature(getattr(self.__target, method_name))
|
145
146
|
resolved_dependencies: Dict[str, Any] = {}
|
146
147
|
unresolved_dependencies: List[str] = []
|
147
148
|
|
@@ -174,4 +175,55 @@ class ReflectDependencies(IReflectDependencies):
|
|
174
175
|
return MethodDependency(
|
175
176
|
resolved=resolved_dependencies,
|
176
177
|
unresolved=unresolved_dependencies
|
178
|
+
)
|
179
|
+
|
180
|
+
def getCallableDependencies(self, fn: callable) -> CallableDependency:
|
181
|
+
"""
|
182
|
+
Get the resolved and unresolved dependencies from a callable function.
|
183
|
+
|
184
|
+
Parameters
|
185
|
+
----------
|
186
|
+
fn : callable
|
187
|
+
The function to inspect.
|
188
|
+
|
189
|
+
Returns
|
190
|
+
-------
|
191
|
+
MethodDependency
|
192
|
+
A structured representation of the callable dependencies, containing:
|
193
|
+
- resolved: Dictionary of resolved dependencies with their names and values.
|
194
|
+
- unresolved: List of unresolved dependencies (parameter names without default values or annotations).
|
195
|
+
"""
|
196
|
+
signature = inspect.signature(fn)
|
197
|
+
resolved_dependencies: Dict[str, Any] = {}
|
198
|
+
unresolved_dependencies: List[str] = []
|
199
|
+
|
200
|
+
for param_name, param in signature.parameters.items():
|
201
|
+
|
202
|
+
# Skip parameters that are not relevant for dependency resolution
|
203
|
+
if self.__paramSkip(param_name, param):
|
204
|
+
continue
|
205
|
+
|
206
|
+
# Add to the list of unresolved dependencies if it has no default value or annotation
|
207
|
+
if param.annotation is param.empty and param.default is param.empty:
|
208
|
+
unresolved_dependencies.append(param_name)
|
209
|
+
continue
|
210
|
+
|
211
|
+
# Parameters with default values
|
212
|
+
if param.default is not param.empty:
|
213
|
+
resolved_dependencies[param_name] = param.default
|
214
|
+
continue
|
215
|
+
|
216
|
+
# If the parameter has an annotation, it is added to the list of resolved dependencies
|
217
|
+
if param.annotation is not param.empty:
|
218
|
+
module_path = param.annotation.__module__
|
219
|
+
resolved_dependencies[param_name] = ResolvedDependency(
|
220
|
+
module_name=module_path,
|
221
|
+
class_name=param.annotation.__name__,
|
222
|
+
type=param.annotation,
|
223
|
+
full_class_path=f"{module_path}.{param.annotation.__name__}"
|
224
|
+
)
|
225
|
+
|
226
|
+
return CallableDependency(
|
227
|
+
resolved=resolved_dependencies,
|
228
|
+
unresolved=unresolved_dependencies
|
177
229
|
)
|
@@ -135,7 +135,8 @@ orionis/console/output/console.py,sha256=TE_Hl720ADd82dbERFSWhkoQRukDQZmETSw4nkw
|
|
135
135
|
orionis/console/output/executor.py,sha256=bdvkzW2-buy0BPpy2r5qUGrRFW2Ay6k-5rSeHb0gQ3o,3352
|
136
136
|
orionis/console/output/progress_bar.py,sha256=vFy582z6VJS46LV6tuyrmr9qvdVeTEtw3hyNcEHezeg,3088
|
137
137
|
orionis/console/output/styles.py,sha256=6a4oQCOBOKMh2ARdeq5GlIskJ3wjiylYmh66tUKKmpQ,4053
|
138
|
-
orionis/container/container.py,sha256=
|
138
|
+
orionis/container/container.py,sha256=TNnevmbvK2e664bl8r1HYk5CHGDsP9J9N_3ZuAHKb6c,30105
|
139
|
+
orionis/container/entities/binding.py,sha256=Qp6Lf4XUDp2NjqXDAC2lzvhOFQWiBDKiGFcKfwb4axw,4342
|
139
140
|
orionis/container/enums/lifetimes.py,sha256=RqQmugMIB1Ev_j_vFLcWorndm-to7xg4stQ7yKFDdDw,190
|
140
141
|
orionis/container/exceptions/container_exception.py,sha256=goTDEwC70xTMD2qppN8KV-xyR0Nps218OD4D1LZ2-3s,470
|
141
142
|
orionis/container/exceptions/type_error_exception.py,sha256=cYuvoXVOgRYj3tZPfK341aUERkf33-buOiI2eXxcrAw,470
|
@@ -231,7 +232,7 @@ orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1i
|
|
231
232
|
orionis/foundation/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
232
233
|
orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
|
233
234
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
234
|
-
orionis/metadata/framework.py,sha256=
|
235
|
+
orionis/metadata/framework.py,sha256=W5PbEW1Zw29V6NsVuzd9ZafK7iR0638kO2Jm0wIwNGw,4960
|
235
236
|
orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
|
236
237
|
orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
237
238
|
orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -257,6 +258,8 @@ orionis/services/introspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
257
258
|
orionis/services/introspection/reflection.py,sha256=6z4VkDICohMIkm9jEd7nmFABwVuU7SBoTFaH3tq4PGk,10897
|
258
259
|
orionis/services/introspection/abstract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
259
260
|
orionis/services/introspection/abstract/reflection_abstract.py,sha256=SPK2X11VvGORxxPOYloaD6hPAvky--obRU4CO1DE4zM,43865
|
261
|
+
orionis/services/introspection/callables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
262
|
+
orionis/services/introspection/callables/reflection_callable.py,sha256=wjztKcqXIT4J-LPXK_Iszv-VzqHoT9MLp0n-GDMtmgA,5633
|
260
263
|
orionis/services/introspection/concretes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
261
264
|
orionis/services/introspection/concretes/reflection_concrete.py,sha256=1GxD-y8LPGL6kI4Y3XbeLcFjR5Y8cOqbVEPCtPnsuYA,50982
|
262
265
|
orionis/services/introspection/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -266,8 +269,9 @@ orionis/services/introspection/contracts/reflection_concrete.py,sha256=9ZQjJpZwv
|
|
266
269
|
orionis/services/introspection/contracts/reflection_instance.py,sha256=D9sH-uOSZ_E7luAfbjI_ML6kfxuO5MtvLk6037iQJ7o,20936
|
267
270
|
orionis/services/introspection/contracts/reflection_module.py,sha256=YLqKg5EhaddUBrytMHX1-uz9mNsRISK1iVyG_iUiVYA,9666
|
268
271
|
orionis/services/introspection/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
269
|
-
orionis/services/introspection/dependencies/reflect_dependencies.py,sha256=
|
272
|
+
orionis/services/introspection/dependencies/reflect_dependencies.py,sha256=OXMfWqacFM7Mo5y0zmPprP4ECHqImChDFsfzTyhqS9A,9414
|
270
273
|
orionis/services/introspection/dependencies/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
274
|
+
orionis/services/introspection/dependencies/entities/callable_dependencies.py,sha256=GJPS1pO8aIhYjtYw7bEoV8WfUCn-ZPGt5mD1WvfoAxg,2198
|
271
275
|
orionis/services/introspection/dependencies/entities/class_dependencies.py,sha256=pALvV_duAvDYmNp7PJYWkpIIQYmqWxuc_RGruEckfPA,2063
|
272
276
|
orionis/services/introspection/dependencies/entities/method_dependencies.py,sha256=FDwroILMPhqPxaxisPVEeKeLUg57GNQ4tQfWjGMh40E,2194
|
273
277
|
orionis/services/introspection/dependencies/entities/resolved_dependencies.py,sha256=0qnEj-3H8iclCc79AduQrqAAdAihv7k39gipo3RT2zc,2216
|
@@ -340,7 +344,7 @@ orionis/test/suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
340
344
|
orionis/test/suite/test_unit.py,sha256=MWgW8dRCRyT1XZ5LsbXQ7-KVPReasoXwzEEL1EWWfE4,52190
|
341
345
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
342
346
|
orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
|
343
|
-
orionis-0.
|
347
|
+
orionis-0.318.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
344
348
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
345
349
|
tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
346
350
|
tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
|
@@ -411,13 +415,14 @@ tests/services/environment/test_services_environment.py,sha256=fdkjwbY-aDEA1FT-9
|
|
411
415
|
tests/services/inspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
412
416
|
tests/services/inspection/test_reflection.py,sha256=ZApQeaDxYLsrfGN6UqEDPbyNzocMV9CURflQ35YMfqk,13678
|
413
417
|
tests/services/inspection/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
414
|
-
tests/services/inspection/dependencies/test_reflect_dependencies.py,sha256=
|
418
|
+
tests/services/inspection/dependencies/test_reflect_dependencies.py,sha256=s_P4ST_dmjzRKmUL4bPFs-oR-Mf5PENGmYk56WiGO9g,7388
|
415
419
|
tests/services/inspection/dependencies/mocks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
416
420
|
tests/services/inspection/dependencies/mocks/mock_user.py,sha256=RxATxe0-Vm4HfX5jKz9Tny42E2fmrdtEN6ZEntbqRL8,912
|
417
421
|
tests/services/inspection/dependencies/mocks/mock_user_controller.py,sha256=P3sOUXVZ55auudwiNtvNCEQuTz0cgAZjvhicLZ4xaz4,1208
|
418
422
|
tests/services/inspection/dependencies/mocks/mock_users_permissions.py,sha256=oENXbS2qmQUudYSmnhB8fgHBqXZdbplplB-Y2nbx4hw,1388
|
419
423
|
tests/services/inspection/reflection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
420
424
|
tests/services/inspection/reflection/test_reflection_abstract.py,sha256=MbGDfCDkfj8wVJcyAlwV6na98JLzbGaYa3QjXR1alL8,27395
|
425
|
+
tests/services/inspection/reflection/test_reflection_callable.py,sha256=ZcZ1_v4Nv22gIleflCRzE0Kfwy5Kjj8XjZ9Z1cKdXt8,6855
|
421
426
|
tests/services/inspection/reflection/test_reflection_concrete.py,sha256=5-iQh1whfpBa47jBWwtg-MIk6ysg92my5J9JdrTBm5E,44622
|
422
427
|
tests/services/inspection/reflection/test_reflection_instance.py,sha256=ZCFTLY_KtLAIq58PuDWak-T1c2PcCKiwTOdI9EDubww,46281
|
423
428
|
tests/services/inspection/reflection/test_reflection_module.py,sha256=Cl-3kWoJMQ2ufOO4VP6M28Tk6kmY4OhVEoW_b0wqw7Y,19849
|
@@ -440,8 +445,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=yeVwl-VcwkWSQYyxZu
|
|
440
445
|
tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
441
446
|
tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
|
442
447
|
tests/testing/test_testing_unit.py,sha256=DjLBtvVn8B1KlVJNNkstBT8_csA1yeaMqnGrbanN_J4,7438
|
443
|
-
orionis-0.
|
444
|
-
orionis-0.
|
445
|
-
orionis-0.
|
446
|
-
orionis-0.
|
447
|
-
orionis-0.
|
448
|
+
orionis-0.318.0.dist-info/METADATA,sha256=_bC7iHlD1eWAOWCuGO8KoLXLlrBz_2nEO7fsbBa2uvI,4772
|
449
|
+
orionis-0.318.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
450
|
+
orionis-0.318.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
451
|
+
orionis-0.318.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
452
|
+
orionis-0.318.0.dist-info/RECORD,,
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import asyncio
|
2
|
+
from orionis.services.introspection.dependencies.entities.callable_dependencies import CallableDependency
|
1
3
|
from orionis.services.introspection.dependencies.reflect_dependencies import (
|
2
4
|
ReflectDependencies,
|
3
5
|
ClassDependency,
|
@@ -91,4 +93,36 @@ class TestReflectDependencies(TestCase):
|
|
91
93
|
self.assertEqual(dep_permissions.module_name, 'builtins')
|
92
94
|
self.assertEqual(dep_permissions.class_name, 'list')
|
93
95
|
self.assertEqual(dep_permissions.full_class_path, 'builtins.list')
|
94
|
-
self.assertEqual(dep_permissions.type, list[str])
|
96
|
+
self.assertEqual(dep_permissions.type, list[str])
|
97
|
+
|
98
|
+
async def testReflectionDependenciesGetCallableDependencies(self):
|
99
|
+
"""
|
100
|
+
Tests the `getCallableDependencies` method of the `ReflectDependencies` class for a callable function.
|
101
|
+
This test verifies:
|
102
|
+
- The returned dependencies are an instance of `MethodDependency`.
|
103
|
+
- There are no unresolved dependencies.
|
104
|
+
- The 'x' and 'y' parameters are correctly resolved as instances of `ResolvedDependency` with the expected
|
105
|
+
module name, class name, full class path, and type (`int`).
|
106
|
+
"""
|
107
|
+
|
108
|
+
async def fake_function(x: int = 3, y: int = 4) -> int:
|
109
|
+
"""Asynchronously adds two integers with a short delay."""
|
110
|
+
await asyncio.sleep(0.1)
|
111
|
+
return x + y
|
112
|
+
|
113
|
+
depend = ReflectDependencies()
|
114
|
+
callable_dependencies = depend.getCallableDependencies(fake_function)
|
115
|
+
|
116
|
+
# Check Instance of MethodDependency
|
117
|
+
self.assertIsInstance(callable_dependencies, CallableDependency)
|
118
|
+
|
119
|
+
# Check unresolved dependencies
|
120
|
+
self.assertEqual(callable_dependencies.unresolved, [])
|
121
|
+
|
122
|
+
# Check Instance of ResolvedDependency for 'x'
|
123
|
+
dep_x:ResolvedDependency = callable_dependencies.resolved.get('x')
|
124
|
+
self.assertEqual(dep_x, 3)
|
125
|
+
|
126
|
+
# Check Instance of ResolvedDependency for 'y'
|
127
|
+
dep_y:ResolvedDependency = callable_dependencies.resolved.get('y')
|
128
|
+
self.assertEqual(dep_y, 4)
|