orionis 0.331.0__py3-none-any.whl → 0.333.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.
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.331.0"
8
+ VERSION = "0.333.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,8 +1,8 @@
1
1
  import asyncio
2
- from inspect import iscoroutine
3
2
  from typing import Any, Coroutine as TypingCoroutine, TypeVar, Union
4
3
  from orionis.services.asynchrony.contracts.coroutines import ICoroutine
5
4
  from orionis.services.asynchrony.exceptions.coroutine_exception import OrionisCoroutineException
5
+ from orionis.services.introspection.inspection import Inspection
6
6
 
7
7
  T = TypeVar("T")
8
8
 
@@ -36,10 +36,12 @@ class Coroutine(ICoroutine):
36
36
  OrionisCoroutineException
37
37
  If the provided object is not a coroutine.
38
38
  """
39
- if not iscoroutine(func):
39
+ if not Inspection(func).isCoroutine():
40
40
  raise OrionisCoroutineException(
41
41
  f"Expected a coroutine object, but got {type(func).__name__}."
42
42
  )
43
+
44
+ # Store the coroutine function
43
45
  self.__func = func
44
46
 
45
47
  def run(self) -> Union[T, asyncio.Future]:
@@ -57,15 +59,21 @@ class Coroutine(ICoroutine):
57
59
  - If called from within an event loop, it will schedule the coroutine and return a Future.
58
60
  """
59
61
  try:
62
+
60
63
  # Get the current event loop
61
64
  loop = asyncio.get_running_loop()
65
+
62
66
  except RuntimeError:
67
+
63
68
  # No running event loop, run synchronously
64
69
  return asyncio.run(self.__func)
65
70
 
66
71
  if loop.is_running():
72
+
67
73
  # Inside an event loop, schedule as a Future
68
74
  return asyncio.ensure_future(self.__func)
75
+
69
76
  else:
77
+
70
78
  # No running loop, run synchronously
71
79
  return loop.run_until_complete(self.__func)
@@ -45,45 +45,6 @@ class DotEnv(metaclass=Singleton):
45
45
  except OSError as e:
46
46
  raise OSError(f"Failed to create or access the .env file at {self._resolved_path}: {e}")
47
47
 
48
- def get(self, key: str, default: Optional[Any] = None) -> Any:
49
- """
50
- Get the value of an environment variable.
51
-
52
- Parameters
53
- ----------
54
- key : str
55
- Name of the environment variable to retrieve.
56
- default : Any, optional
57
- Value to return if the key is not found. Default is None.
58
-
59
- Returns
60
- -------
61
- Any
62
- Parsed value of the environment variable, or `default` if not found.
63
-
64
- Raises
65
- ------
66
- OrionisEnvironmentValueError
67
- If `key` is not a string.
68
- """
69
- with self._lock:
70
-
71
- # Ensure the key is a string.
72
- if not isinstance(key, str):
73
- raise OrionisEnvironmentValueError(
74
- f"Key must be a string, got {type(key).__name__}."
75
- )
76
-
77
- # Get the value from the .env file or the current environment.
78
- value = dotenv_values(self._resolved_path).get(key)
79
-
80
- # If the value is not found in the .env file, check the current environment variables.
81
- if value is None:
82
- value = os.getenv(key)
83
-
84
- # Parse the value using the internal __parseValue method and return it
85
- return self.__parseValue(value) if value is not None else default
86
-
87
48
  def __parseValue(self, value: Any) -> Any:
88
49
  """
89
50
  Parse and convert the input value to an appropriate Python data type with enhanced features.
@@ -142,6 +103,85 @@ class DotEnv(metaclass=Singleton):
142
103
  except (ValueError, SyntaxError):
143
104
  return value_str
144
105
 
106
+ def __serializeValue(self, value: Any, type_hint: str = None) -> str:
107
+ """
108
+ Parameters
109
+ ----------
110
+ value : Any
111
+ The value to serialize.
112
+ type_hint : str, optional
113
+ An optional type hint to guide serialization.
114
+ Returns
115
+ -------
116
+ str
117
+ The serialized string representation of the value.
118
+ Notes
119
+ -----
120
+ - If `value` is None, returns "null".
121
+ - If `type_hint` is provided, uses `EnvTypes` to serialize.
122
+ - Uses `repr()` for lists, dicts, tuples, and sets.
123
+ - Falls back to `str()` for other types.
124
+ """
125
+
126
+ if value is None:
127
+ return "null"
128
+
129
+ if type_hint:
130
+ return EnvTypes(value).to(type_hint)
131
+
132
+ if isinstance(value, str):
133
+ return value.strip()
134
+
135
+ if isinstance(value, bool):
136
+ return str(value).lower()
137
+
138
+ if isinstance(value, int, float):
139
+ return str(value)
140
+
141
+ if isinstance(value, (list, dict, tuple, set)):
142
+ return repr(value)
143
+
144
+ return str(value)
145
+
146
+ def get(self, key: str, default: Optional[Any] = None) -> Any:
147
+ """
148
+ Get the value of an environment variable.
149
+
150
+ Parameters
151
+ ----------
152
+ key : str
153
+ Name of the environment variable to retrieve.
154
+ default : Any, optional
155
+ Value to return if the key is not found. Default is None.
156
+
157
+ Returns
158
+ -------
159
+ Any
160
+ Parsed value of the environment variable, or `default` if not found.
161
+
162
+ Raises
163
+ ------
164
+ OrionisEnvironmentValueError
165
+ If `key` is not a string.
166
+ """
167
+ with self._lock:
168
+
169
+ # Ensure the key is a string.
170
+ if not isinstance(key, str):
171
+ raise OrionisEnvironmentValueError(
172
+ f"Key must be a string, got {type(key).__name__}."
173
+ )
174
+
175
+ # Get the value from the .env file or the current environment.
176
+ value = dotenv_values(self._resolved_path).get(key)
177
+
178
+ # If the value is not found in the .env file, check the current environment variables.
179
+ if value is None:
180
+ value = os.getenv(key)
181
+
182
+ # Parse the value using the internal __parseValue method and return it
183
+ return self.__parseValue(value) if value is not None else default
184
+
145
185
  def set(self, key: str, value: Union[str, int, float, bool, list, dict, tuple, set], type_hint: str = None) -> bool:
146
186
  """
147
187
  Set an environment variable with the specified key and value.
@@ -195,46 +235,6 @@ class DotEnv(metaclass=Singleton):
195
235
  # Return True to indicate success.
196
236
  return True
197
237
 
198
- def __serializeValue(self, value: Any, type_hint: str = None) -> str:
199
- """
200
- Parameters
201
- ----------
202
- value : Any
203
- The value to serialize.
204
- type_hint : str, optional
205
- An optional type hint to guide serialization.
206
- Returns
207
- -------
208
- str
209
- The serialized string representation of the value.
210
- Notes
211
- -----
212
- - If `value` is None, returns "null".
213
- - If `type_hint` is provided, uses `EnvTypes` to serialize.
214
- - Uses `repr()` for lists, dicts, tuples, and sets.
215
- - Falls back to `str()` for other types.
216
- """
217
-
218
- if value is None:
219
- return "null"
220
-
221
- if type_hint:
222
- return EnvTypes(value).to(type_hint)
223
-
224
- if isinstance(value, str):
225
- return value.strip()
226
-
227
- if isinstance(value, bool):
228
- return str(value).lower()
229
-
230
- if isinstance(value, int, float):
231
- return str(value)
232
-
233
- if isinstance(value, (list, dict, tuple, set)):
234
- return repr(value)
235
-
236
- return str(value)
237
-
238
238
  def unset(self, key: str) -> bool:
239
239
  """
240
240
  Remove the specified environment variable from both the .env file and the current process environment.
@@ -73,6 +73,55 @@ class EnvTypes(IEnvTypes):
73
73
  # If raw is not a string, treat it as a value with no type hint
74
74
  self.__value_raw = raw
75
75
 
76
+ def get(self):
77
+ """
78
+ Returns the value corresponding to the specified type hint.
79
+
80
+ Checks if the provided type hint is valid and then dispatches the call to the appropriate
81
+ method for handling the type.
82
+
83
+ Supported type hints include: 'path:', 'str:', 'int:', 'float:', 'bool:', 'list:', 'dict:', 'tuple:', and 'set:'.
84
+
85
+ Returns
86
+ -------
87
+ Any
88
+ The value converted or processed according to the specified type hint.
89
+
90
+ Raises
91
+ ------
92
+ OrionisEnvironmentValueError
93
+ If the type hint is not one of the supported options.
94
+ """
95
+ if not self.__type_hint in self.OPTIONS:
96
+ raise OrionisEnvironmentValueError(f"Invalid type hint: {self.__type_hint}. Must be one of {self.OPTIONS}.")
97
+
98
+ if self.__type_hint == 'path':
99
+ return self.__parsePath()
100
+
101
+ if self.__type_hint == 'str':
102
+ return self.__parseStr()
103
+
104
+ if self.__type_hint == 'int':
105
+ return self.__parseInt()
106
+
107
+ if self.__type_hint == 'float':
108
+ return self.__parseFloat()
109
+
110
+ if self.__type_hint == 'bool':
111
+ return self.__parseBool()
112
+
113
+ if self.__type_hint == 'list':
114
+ return self.__parseList()
115
+
116
+ if self.__type_hint == 'dict':
117
+ return self.__parseDict()
118
+
119
+ if self.__type_hint == 'tuple':
120
+ return self.__parseTuple()
121
+
122
+ if self.__type_hint == 'set':
123
+ return self.__parseSet()
124
+
76
125
  def to(self, type_hint: str):
77
126
  """
78
127
  Set the type hint for the Type instance.
@@ -527,52 +576,3 @@ class EnvTypes(IEnvTypes):
527
576
  if not isinstance(self.__value_raw, set):
528
577
  raise OrionisEnvironmentValueError(f"Value must be a set to convert to set, got {type(self.__value_raw).__name__} instead.")
529
578
  return f"{self.__type_hint}:{repr(self.__value_raw)}"
530
-
531
- def get(self):
532
- """
533
- Returns the value corresponding to the specified type hint.
534
-
535
- Checks if the provided type hint is valid and then dispatches the call to the appropriate
536
- method for handling the type.
537
-
538
- Supported type hints include: 'path:', 'str:', 'int:', 'float:', 'bool:', 'list:', 'dict:', 'tuple:', and 'set:'.
539
-
540
- Returns
541
- -------
542
- Any
543
- The value converted or processed according to the specified type hint.
544
-
545
- Raises
546
- ------
547
- OrionisEnvironmentValueError
548
- If the type hint is not one of the supported options.
549
- """
550
- if not self.__type_hint in self.OPTIONS:
551
- raise OrionisEnvironmentValueError(f"Invalid type hint: {self.__type_hint}. Must be one of {self.OPTIONS}.")
552
-
553
- if self.__type_hint == 'path':
554
- return self.__parsePath()
555
-
556
- if self.__type_hint == 'str':
557
- return self.__parseStr()
558
-
559
- if self.__type_hint == 'int':
560
- return self.__parseInt()
561
-
562
- if self.__type_hint == 'float':
563
- return self.__parseFloat()
564
-
565
- if self.__type_hint == 'bool':
566
- return self.__parseBool()
567
-
568
- if self.__type_hint == 'list':
569
- return self.__parseList()
570
-
571
- if self.__type_hint == 'dict':
572
- return self.__parseDict()
573
-
574
- if self.__type_hint == 'tuple':
575
- return self.__parseTuple()
576
-
577
- if self.__type_hint == 'set':
578
- return self.__parseSet()
@@ -0,0 +1,246 @@
1
+ import inspect
2
+ from typing import Any
3
+
4
+ class Inspection:
5
+
6
+ def __init__(self, target: Any):
7
+ """
8
+ Initialize an inspection instance.
9
+
10
+ Parameters
11
+ ----------
12
+ target : Any
13
+ The object to be inspected.
14
+ """
15
+ self.__target = target
16
+
17
+ def isAbstract(self) -> bool:
18
+ """
19
+ Check if the object is an abstract base class.
20
+
21
+ Returns
22
+ -------
23
+ bool
24
+ True if the object is abstract, False otherwise.
25
+ """
26
+ return inspect.isabstract(self.__target)
27
+
28
+ def isAsyncGen(self) -> bool:
29
+ """
30
+ Check if the object is an asynchronous generator.
31
+
32
+ Returns
33
+ -------
34
+ bool
35
+ True if the object is an async generator, False otherwise.
36
+ """
37
+ return inspect.isasyncgen(self.__target)
38
+
39
+ def isAsyncGenFunction(self) -> bool:
40
+ """
41
+ Check if the object is an asynchronous generator function.
42
+
43
+ Returns
44
+ -------
45
+ bool
46
+ True if the object is an async generator function, False otherwise.
47
+ """
48
+ return inspect.isasyncgenfunction(self.__target)
49
+
50
+ def isAwaitable(self) -> bool:
51
+ """
52
+ Check if the object can be awaited.
53
+
54
+ Returns
55
+ -------
56
+ bool
57
+ True if the object is awaitable, False otherwise.
58
+ """
59
+ return inspect.isawaitable(self.__target)
60
+
61
+ def isBuiltin(self) -> bool:
62
+ """
63
+ Check if the object is a built-in function or method.
64
+
65
+ Returns
66
+ -------
67
+ bool
68
+ True if the object is a built-in, False otherwise.
69
+ """
70
+ return inspect.isbuiltin(self.__target)
71
+
72
+ def isClass(self) -> bool:
73
+ """
74
+ Check if the object is a class.
75
+
76
+ Returns
77
+ -------
78
+ bool
79
+ True if the object is a class, False otherwise.
80
+ """
81
+ return inspect.isclass(self.__target)
82
+
83
+ def isCode(self) -> bool:
84
+ """
85
+ Check if the object is a code object.
86
+
87
+ Returns
88
+ -------
89
+ bool
90
+ True if the object is a code object, False otherwise.
91
+ """
92
+ return inspect.iscode(self.__target)
93
+
94
+ def isCoroutine(self) -> bool:
95
+ """
96
+ Check if the object is a coroutine.
97
+
98
+ Returns
99
+ -------
100
+ bool
101
+ True if the object is a coroutine, False otherwise.
102
+ """
103
+ return inspect.iscoroutine(self.__target)
104
+
105
+ def isCoroutineFunction(self) -> bool:
106
+ """
107
+ Check if the object is a coroutine function.
108
+
109
+ Returns
110
+ -------
111
+ bool
112
+ True if the object is a coroutine function, False otherwise.
113
+ """
114
+ return inspect.iscoroutinefunction(self.__target)
115
+
116
+ def isDataDescriptor(self) -> bool:
117
+ """
118
+ Check if the object is a data descriptor.
119
+
120
+ Returns
121
+ -------
122
+ bool
123
+ True if the object is a data descriptor, False otherwise.
124
+ """
125
+ return inspect.isdatadescriptor(self.__target)
126
+
127
+ def isFrame(self) -> bool:
128
+ """
129
+ Check if the object is a frame object.
130
+
131
+ Returns
132
+ -------
133
+ bool
134
+ True if the object is a frame object, False otherwise.
135
+ """
136
+ return inspect.isframe(self.__target)
137
+
138
+ def isFunction(self) -> bool:
139
+ """
140
+ Check if the object is a Python function.
141
+
142
+ Returns
143
+ -------
144
+ bool
145
+ True if the object is a function, False otherwise.
146
+ """
147
+ return inspect.isfunction(self.__target)
148
+
149
+ def isGenerator(self) -> bool:
150
+ """
151
+ Check if the object is a generator.
152
+
153
+ Returns
154
+ -------
155
+ bool
156
+ True if the object is a generator, False otherwise.
157
+ """
158
+ return inspect.isgenerator(self.__target)
159
+
160
+ def isGeneratorFunction(self) -> bool:
161
+ """
162
+ Check if the object is a generator function.
163
+
164
+ Returns
165
+ -------
166
+ bool
167
+ True if the object is a generator function, False otherwise.
168
+ """
169
+ return inspect.isgeneratorfunction(self.__target)
170
+
171
+ def isGetSetDescriptor(self) -> bool:
172
+ """
173
+ Check if the object is a getset descriptor.
174
+
175
+ Returns
176
+ -------
177
+ bool
178
+ True if the object is a getset descriptor, False otherwise.
179
+ """
180
+ return inspect.isgetsetdescriptor(self.__target)
181
+
182
+ def isMemberDescriptor(self) -> bool:
183
+ """
184
+ Check if the object is a member descriptor.
185
+
186
+ Returns
187
+ -------
188
+ bool
189
+ True if the object is a member descriptor, False otherwise.
190
+ """
191
+ return inspect.ismemberdescriptor(self.__target)
192
+
193
+ def isMethod(self) -> bool:
194
+ """
195
+ Check if the object is a method.
196
+
197
+ Returns
198
+ -------
199
+ bool
200
+ True if the object is a method, False otherwise.
201
+ """
202
+ return inspect.ismethod(self.__target)
203
+
204
+ def isMethodDescriptor(self) -> bool:
205
+ """
206
+ Check if the object is a method descriptor.
207
+
208
+ Returns
209
+ -------
210
+ bool
211
+ True if the object is a method descriptor, False otherwise.
212
+ """
213
+ return inspect.ismethoddescriptor(self.__target)
214
+
215
+ def isModule(self) -> bool:
216
+ """
217
+ Check if the object is a module.
218
+
219
+ Returns
220
+ -------
221
+ bool
222
+ True if the object is a module, False otherwise.
223
+ """
224
+ return inspect.ismodule(self.__target)
225
+
226
+ def isRoutine(self) -> bool:
227
+ """
228
+ Check if the object is a user-defined or built-in function or method.
229
+
230
+ Returns
231
+ -------
232
+ bool
233
+ True if the object is a routine, False otherwise.
234
+ """
235
+ return inspect.isroutine(self.__target)
236
+
237
+ def isTraceback(self) -> bool:
238
+ """
239
+ Check if the object is a traceback object.
240
+
241
+ Returns
242
+ -------
243
+ bool
244
+ True if the object is a traceback object, False otherwise.
245
+ """
246
+ return inspect.istraceback(self.__target)
@@ -606,6 +606,34 @@ class ReflectionInstance(IReflectionInstance):
606
606
  # If the method is not callable, raise an error
607
607
  raise ReflectionAttributeError(f"Method '{name}' is not callable on '{self.getClassName()}'.")
608
608
 
609
+ def getMethodDocstring(self, name: str) -> Optional[str]:
610
+ """
611
+ Get the docstring of a method.
612
+
613
+ Parameters
614
+ ----------
615
+ name : str
616
+ Name of the method
617
+
618
+ Returns
619
+ -------
620
+ Optional[str]
621
+ The method docstring, or None if not available
622
+ """
623
+
624
+ # Handle private method name mangling
625
+ if name.startswith("__") and not name.endswith("__"):
626
+ class_name = self.getClassName()
627
+ name = f"_{class_name}{name}"
628
+
629
+ # Check if the method exists and is callable
630
+ method = getattr(self._instance.__class__, name, None)
631
+ if callable(method):
632
+ return method.__doc__
633
+
634
+ # If the method is not callable, raise an error
635
+ raise ReflectionAttributeError(f"Method '{name}' does not exist on '{self.getClassName()}'.")
636
+
609
637
  def getMethods(self) -> List[str]:
610
638
  """
611
639
  Get all method names of the instance.
@@ -1,7 +1,8 @@
1
- import inspect
2
1
  from typing import Any, Type
3
2
  from orionis.services.introspection.abstract.reflection_abstract import ReflectionAbstract
3
+ from orionis.services.introspection.callables.reflection_callable import ReflectionCallable
4
4
  from orionis.services.introspection.concretes.reflection_concrete import ReflectionConcrete
5
+ from orionis.services.introspection.inspection import Inspection
5
6
  from orionis.services.introspection.instances.reflection_instance import ReflectionInstance
6
7
  from orionis.services.introspection.modules.reflection_module import ReflectionModule
7
8
 
@@ -82,6 +83,23 @@ class Reflection:
82
83
  """
83
84
  return ReflectionModule(module)
84
85
 
86
+ @staticmethod
87
+ def callable(fn: callable) -> 'ReflectionCallable':
88
+ """
89
+ Create a ReflectionCallable instance for the given callable function.
90
+
91
+ Parameters
92
+ ----------
93
+ fn : callable
94
+ The function or method to wrap in a ReflectionCallable.
95
+
96
+ Returns
97
+ -------
98
+ ReflectionCallable
99
+ A reflection object that encapsulates the provided callable.
100
+ """
101
+ return ReflectionCallable(fn)
102
+
85
103
  @staticmethod
86
104
  def isAbstract(obj: Any) -> bool:
87
105
  """
@@ -97,7 +115,7 @@ class Reflection:
97
115
  bool
98
116
  True if the object is abstract, False otherwise.
99
117
  """
100
- return inspect.isabstract(obj)
118
+ return Inspection(obj).isAbstract()
101
119
 
102
120
  @staticmethod
103
121
  def isAsyncGen(obj: Any) -> bool:
@@ -114,7 +132,7 @@ class Reflection:
114
132
  bool
115
133
  True if the object is an async generator, False otherwise.
116
134
  """
117
- return inspect.isasyncgen(obj)
135
+ return Inspection(obj).isAsyncGen()
118
136
 
119
137
  @staticmethod
120
138
  def isAsyncGenFunction(obj: Any) -> bool:
@@ -131,7 +149,7 @@ class Reflection:
131
149
  bool
132
150
  True if the object is an async generator function, False otherwise.
133
151
  """
134
- return inspect.isasyncgenfunction(obj)
152
+ return Inspection(obj).isAsyncGenFunction()
135
153
 
136
154
  @staticmethod
137
155
  def isAwaitable(obj: Any) -> bool:
@@ -148,7 +166,7 @@ class Reflection:
148
166
  bool
149
167
  True if the object is awaitable, False otherwise.
150
168
  """
151
- return inspect.isawaitable(obj)
169
+ return Inspection(obj).isAwaitable()
152
170
 
153
171
  @staticmethod
154
172
  def isBuiltin(obj: Any) -> bool:
@@ -165,7 +183,7 @@ class Reflection:
165
183
  bool
166
184
  True if the object is a built-in, False otherwise.
167
185
  """
168
- return inspect.isbuiltin(obj)
186
+ return Inspection(obj).isBuiltin()
169
187
 
170
188
  @staticmethod
171
189
  def isClass(obj: Any) -> bool:
@@ -182,7 +200,7 @@ class Reflection:
182
200
  bool
183
201
  True if the object is a class, False otherwise.
184
202
  """
185
- return inspect.isclass(obj)
203
+ return Inspection(obj).isClass()
186
204
 
187
205
  @staticmethod
188
206
  def isCode(obj: Any) -> bool:
@@ -199,7 +217,7 @@ class Reflection:
199
217
  bool
200
218
  True if the object is a code object, False otherwise.
201
219
  """
202
- return inspect.iscode(obj)
220
+ return Inspection(obj).isCode()
203
221
 
204
222
  @staticmethod
205
223
  def isCoroutine(obj: Any) -> bool:
@@ -216,7 +234,7 @@ class Reflection:
216
234
  bool
217
235
  True if the object is a coroutine, False otherwise.
218
236
  """
219
- return inspect.iscoroutine(obj)
237
+ return Inspection(obj).isCoroutine()
220
238
 
221
239
  @staticmethod
222
240
  def isCoroutineFunction(obj: Any) -> bool:
@@ -233,7 +251,7 @@ class Reflection:
233
251
  bool
234
252
  True if the object is a coroutine function, False otherwise.
235
253
  """
236
- return inspect.iscoroutinefunction(obj)
254
+ return Inspection(obj).isCoroutineFunction()
237
255
 
238
256
  @staticmethod
239
257
  def isDataDescriptor(obj: Any) -> bool:
@@ -250,7 +268,7 @@ class Reflection:
250
268
  bool
251
269
  True if the object is a data descriptor, False otherwise.
252
270
  """
253
- return inspect.isdatadescriptor(obj)
271
+ return Inspection(obj).isDataDescriptor()
254
272
 
255
273
  @staticmethod
256
274
  def isFrame(obj: Any) -> bool:
@@ -267,7 +285,7 @@ class Reflection:
267
285
  bool
268
286
  True if the object is a frame object, False otherwise.
269
287
  """
270
- return inspect.isframe(obj)
288
+ return Inspection(obj).isFrame()
271
289
 
272
290
  @staticmethod
273
291
  def isFunction(obj: Any) -> bool:
@@ -284,7 +302,7 @@ class Reflection:
284
302
  bool
285
303
  True if the object is a function, False otherwise.
286
304
  """
287
- return inspect.isfunction(obj)
305
+ return Inspection(obj).isFunction()
288
306
 
289
307
  @staticmethod
290
308
  def isGenerator(obj: Any) -> bool:
@@ -301,7 +319,7 @@ class Reflection:
301
319
  bool
302
320
  True if the object is a generator, False otherwise.
303
321
  """
304
- return inspect.isgenerator(obj)
322
+ return Inspection(obj).isGenerator()
305
323
 
306
324
  @staticmethod
307
325
  def isGeneratorFunction(obj: Any) -> bool:
@@ -318,7 +336,7 @@ class Reflection:
318
336
  bool
319
337
  True if the object is a generator function, False otherwise.
320
338
  """
321
- return inspect.isgeneratorfunction(obj)
339
+ return Inspection(obj).isGeneratorFunction()
322
340
 
323
341
  @staticmethod
324
342
  def isGetSetDescriptor(obj: Any) -> bool:
@@ -335,7 +353,7 @@ class Reflection:
335
353
  bool
336
354
  True if the object is a getset descriptor, False otherwise.
337
355
  """
338
- return inspect.isgetsetdescriptor(obj)
356
+ return Inspection(obj).isGetSetDescriptor()
339
357
 
340
358
  @staticmethod
341
359
  def isMemberDescriptor(obj: Any) -> bool:
@@ -352,7 +370,7 @@ class Reflection:
352
370
  bool
353
371
  True if the object is a member descriptor, False otherwise.
354
372
  """
355
- return inspect.ismemberdescriptor(obj)
373
+ return Inspection(obj).isMemberDescriptor()
356
374
 
357
375
  @staticmethod
358
376
  def isMethod(obj: Any) -> bool:
@@ -369,7 +387,7 @@ class Reflection:
369
387
  bool
370
388
  True if the object is a method, False otherwise.
371
389
  """
372
- return inspect.ismethod(obj)
390
+ return Inspection(obj).isMethod()
373
391
 
374
392
  @staticmethod
375
393
  def isMethodDescriptor(obj: Any) -> bool:
@@ -386,7 +404,7 @@ class Reflection:
386
404
  bool
387
405
  True if the object is a method descriptor, False otherwise.
388
406
  """
389
- return inspect.ismethoddescriptor(obj)
407
+ return Inspection(obj).isMethodDescriptor()
390
408
 
391
409
  @staticmethod
392
410
  def isModule(obj: Any) -> bool:
@@ -403,7 +421,7 @@ class Reflection:
403
421
  bool
404
422
  True if the object is a module, False otherwise.
405
423
  """
406
- return inspect.ismodule(obj)
424
+ return Inspection(obj).isModule()
407
425
 
408
426
  @staticmethod
409
427
  def isRoutine(obj: Any) -> bool:
@@ -420,7 +438,7 @@ class Reflection:
420
438
  bool
421
439
  True if the object is a routine, False otherwise.
422
440
  """
423
- return inspect.isroutine(obj)
441
+ return Inspection(obj).isRoutine()
424
442
 
425
443
  @staticmethod
426
444
  def isTraceback(obj: Any) -> bool:
@@ -437,4 +455,4 @@ class Reflection:
437
455
  bool
438
456
  True if the object is a traceback object, False otherwise.
439
457
  """
440
- return inspect.istraceback(obj)
458
+ return Inspection(obj).isTraceback()
@@ -1,4 +1,3 @@
1
- import inspect
2
1
  import io
3
2
  import json
4
3
  import os
@@ -11,6 +10,7 @@ from contextlib import redirect_stdout, redirect_stderr
11
10
  from datetime import datetime
12
11
  from pathlib import Path
13
12
  from typing import Any, Dict, List, Optional, Tuple
13
+ from orionis.services.introspection.instances.reflection_instance import ReflectionInstance
14
14
  from orionis.services.system.workers import Workers
15
15
  from orionis.test.entities.test_result import TestResult
16
16
  from orionis.test.enums.test_mode import ExecutionMode
@@ -828,10 +828,10 @@ class UnitTest(IUnitTest):
828
828
  status=TestStatus.PASSED,
829
829
  execution_time=elapsed,
830
830
  class_name=test.__class__.__name__,
831
- method=getattr(test, "_testMethodName", None),
832
- module=getattr(test, "__module__", None),
833
- file_path=inspect.getfile(test.__class__),
834
- doc_string=getattr(getattr(test, test._testMethodName, None), "__doc__", None),
831
+ method=ReflectionInstance(test).getAttribute("_testMethodName"),
832
+ module=ReflectionInstance(test).getModuleName(),
833
+ file_path=ReflectionInstance(test).getFile(),
834
+ doc_string=ReflectionInstance(test).getMethodDocstring(test._testMethodName),
835
835
  )
836
836
  )
837
837
 
@@ -849,10 +849,10 @@ class UnitTest(IUnitTest):
849
849
  error_message=str(err[1]),
850
850
  traceback=clean_tb,
851
851
  class_name=test.__class__.__name__,
852
- method=getattr(test, "_testMethodName", None),
853
- module=getattr(test, "__module__", None),
854
- file_path=inspect.getfile(test.__class__),
855
- doc_string=getattr(getattr(test, test._testMethodName, None), "__doc__", None),
852
+ method=ReflectionInstance(test).getAttribute("_testMethodName"),
853
+ module=ReflectionInstance(test).getModuleName(),
854
+ file_path=ReflectionInstance(test).getFile(),
855
+ doc_string=ReflectionInstance(test).getMethodDocstring(test._testMethodName),
856
856
  )
857
857
  )
858
858
 
@@ -870,10 +870,10 @@ class UnitTest(IUnitTest):
870
870
  error_message=str(err[1]),
871
871
  traceback=clean_tb,
872
872
  class_name=test.__class__.__name__,
873
- method=getattr(test, "_testMethodName", None),
874
- module=getattr(test, "__module__", None),
875
- file_path=inspect.getfile(test.__class__),
876
- doc_string=getattr(getattr(test, test._testMethodName, None), "__doc__", None),
873
+ method=ReflectionInstance(test).getAttribute("_testMethodName"),
874
+ module=ReflectionInstance(test).getModuleName(),
875
+ file_path=ReflectionInstance(test).getFile(),
876
+ doc_string=ReflectionInstance(test).getMethodDocstring(test._testMethodName),
877
877
  )
878
878
  )
879
879
 
@@ -888,10 +888,10 @@ class UnitTest(IUnitTest):
888
888
  execution_time=elapsed,
889
889
  error_message=reason,
890
890
  class_name=test.__class__.__name__,
891
- method=getattr(test, "_testMethodName", None),
892
- module=getattr(test, "__module__", None),
893
- file_path=inspect.getfile(test.__class__),
894
- doc_string=getattr(getattr(test, test._testMethodName, None), "__doc__", None),
891
+ method=ReflectionInstance(test).getAttribute("_testMethodName"),
892
+ module=ReflectionInstance(test).getModuleName(),
893
+ file_path=ReflectionInstance(test).getFile(),
894
+ doc_string=ReflectionInstance(test).getMethodDocstring(test._testMethodName)
895
895
  )
896
896
  )
897
897
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.331.0
3
+ Version: 0.333.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -217,22 +217,22 @@ orionis/foundation/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
217
217
  orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
218
218
  orionis/foundation/exceptions/value_error.py,sha256=hQhXybXEnaa59ba7JxG65jceHt3mnql9MyekF-TChpM,465
219
219
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
220
- orionis/metadata/framework.py,sha256=xyHnBHp7isvGf3jdwdrxIS1mecl7PdPJzRrnTIesL7M,4960
220
+ orionis/metadata/framework.py,sha256=T9uPprE6PgkT3Ul3aGrYoNE0ZluzDjd9OECon0Vo2JE,4960
221
221
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
222
222
  orionis/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
223
223
  orionis/patterns/singleton/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
224
224
  orionis/patterns/singleton/meta_class.py,sha256=YN5mSSQeIX_Gh_TK5HD-ms6IYBTRsRcuzoUtpX-9kYY,2134
225
225
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
226
226
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
- orionis/services/asynchrony/coroutines.py,sha256=i-r6P_-kA-7TTUhfXBS2XStbvaF7_9kpuB15ScScwYg,2294
227
+ orionis/services/asynchrony/coroutines.py,sha256=uAw84xDhaqgmhwTL8ttoj1bFR5ACXJIdcuk80HXQtcM,2394
228
228
  orionis/services/asynchrony/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
229
  orionis/services/asynchrony/contracts/coroutines.py,sha256=Wuwp2k4HXAX-tQ3waVIT8AmzX_HeIbjliRchKIqy2k0,688
230
230
  orionis/services/asynchrony/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
231
231
  orionis/services/asynchrony/exceptions/coroutine_exception.py,sha256=eopQpl-2chut-iN1drBy-53EDKava1icwtcWUF4S1Cc,472
232
232
  orionis/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
233
- orionis/services/environment/dot_env.py,sha256=ztl3juEiYmOIVIa2CLy6tNGWOtmIK5UuTlA25oP1iWI,10256
233
+ orionis/services/environment/dot_env.py,sha256=Giq_HZ7nww_1H_peQkX8LLYZgTVTreIDe4ozbvCBZlg,10256
234
234
  orionis/services/environment/env.py,sha256=jbELcOGNvTslgs96j3PNisEy6967SifV3rourHnnxR4,2799
235
- orionis/services/environment/types.py,sha256=LVDe4hzt2sMaCElcQu5Z3aMAPzFf-JngQ7p4aRtdijQ,18438
235
+ orionis/services/environment/types.py,sha256=3lw1luvdligW54YPbPTHo36AZQjoQY1HHSgielbPGqA,18440
236
236
  orionis/services/environment/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
237
237
  orionis/services/environment/contracts/env.py,sha256=7lezGxABAG63pEEvzAmHXgr9izBI6TCp05Trx_SRvc4,2054
238
238
  orionis/services/environment/contracts/types.py,sha256=n0USxUblz0Ofbo1ef0hnGHGkuGjSiWk-SBWVPXv33mE,1994
@@ -240,7 +240,8 @@ orionis/services/environment/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
240
240
  orionis/services/environment/exceptions/environment_value_error.py,sha256=Pe1qNHRrM9T0AzESN284CzA3GQYxzokfXPMOVqOTlyQ,475
241
241
  orionis/services/environment/exceptions/environment_value_exception.py,sha256=NnxWmgoSca7LXi7GLDa95HSBPKotFfy8u729d1OAmCc,479
242
242
  orionis/services/introspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
243
- orionis/services/introspection/reflection.py,sha256=6z4VkDICohMIkm9jEd7nmFABwVuU7SBoTFaH3tq4PGk,10897
243
+ orionis/services/introspection/inspection.py,sha256=jxHaC5Q7aydCJ66WPugplB7cfHVOgyTP9zMubqyLjUo,6349
244
+ orionis/services/introspection/reflection.py,sha256=_3Zns_hRFoz7pG8C3YoZWJ5P7ikzwjJi0J09WLAJIXk,11639
244
245
  orionis/services/introspection/abstract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
245
246
  orionis/services/introspection/abstract/reflection_abstract.py,sha256=SPK2X11VvGORxxPOYloaD6hPAvky--obRU4CO1DE4zM,43865
246
247
  orionis/services/introspection/callables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -265,7 +266,7 @@ orionis/services/introspection/exceptions/reflection_attribute_error.py,sha256=_
265
266
  orionis/services/introspection/exceptions/reflection_type_error.py,sha256=73DB8JoTbxd7LNMnZKXf4jJ8OzLyC0HPXgDo5pffkYY,466
266
267
  orionis/services/introspection/exceptions/reflection_value_error.py,sha256=ywO_cwawEmB22uP3i4ofsZytO9QTbvy7axm9NzEfHr4,467
267
268
  orionis/services/introspection/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
268
- orionis/services/introspection/instances/reflection_instance.py,sha256=DrPrzdm7FbnUj6h6970hJOyFfit-OpWskZ4FnxJMz6k,54053
269
+ orionis/services/introspection/instances/reflection_instance.py,sha256=xQQ4fNW24_OUQMPmhyJNCy-EyhzWSDH1umz7_yvQzjA,54945
269
270
  orionis/services/introspection/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
270
271
  orionis/services/introspection/modules/reflection_module.py,sha256=1QB_853_ct5ehDNSxNQaaJDCeY9eXciXJwRYkNHgYd4,15632
271
272
  orionis/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -328,10 +329,10 @@ orionis/test/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
328
329
  orionis/test/output/dumper.py,sha256=q1_S5AYMce01ukPkEJ73gQT7gyLBK5XA1NyOeVINQMI,4280
329
330
  orionis/test/output/printer.py,sha256=I7hkZ5z1VQkt1TowWyxfARb1ODYLSpHDX3fzrxMPBzg,16959
330
331
  orionis/test/suite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
331
- orionis/test/suite/test_unit.py,sha256=MWgW8dRCRyT1XZ5LsbXQ7-KVPReasoXwzEEL1EWWfE4,52190
332
+ orionis/test/suite/test_unit.py,sha256=wUn2WBv3HoO3Fv2sYD-mpUcA8E9g7nZVpSWHUzicjRM,52370
332
333
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
333
334
  orionis/test/view/render.py,sha256=jXZkbITBknbUwm_mD8bcTiwLDvsFkrO9qrf0ZgPwqxc,4903
334
- orionis-0.331.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
335
+ orionis-0.333.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
335
336
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
336
337
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
338
  tests/example/test_example.py,sha256=kvWgiW3ADEZf718dGsMPtDh_rmOSx1ypEInKm7_6ZPQ,601
@@ -432,8 +433,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=yeVwl-VcwkWSQYyxZu
432
433
  tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
433
434
  tests/testing/test_testing_result.py,sha256=MrGK3ZimedL0b5Ydu69Dg8Iul017AzLTm7VPxpXlpfU,4315
434
435
  tests/testing/test_testing_unit.py,sha256=DjLBtvVn8B1KlVJNNkstBT8_csA1yeaMqnGrbanN_J4,7438
435
- orionis-0.331.0.dist-info/METADATA,sha256=VI8annoXwnRCTc0VP9072w4kDC4TwwhdXFPk0UhnnKM,4772
436
- orionis-0.331.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
437
- orionis-0.331.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
438
- orionis-0.331.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
439
- orionis-0.331.0.dist-info/RECORD,,
436
+ orionis-0.333.0.dist-info/METADATA,sha256=EudUS7MOzhRsXl5BF2IFx7wJBSlKRtkk9YOA8br67Ac,4772
437
+ orionis-0.333.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
438
+ orionis-0.333.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
439
+ orionis-0.333.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
440
+ orionis-0.333.0.dist-info/RECORD,,