orionis 0.230.0__py3-none-any.whl → 0.232.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/framework.py CHANGED
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.230.0"
8
+ VERSION = "0.232.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,8 @@
1
1
  from typing import Any, Type, Dict, List, Tuple, Callable, Optional
2
2
  import inspect
3
3
 
4
+ from orionis.luminate.support.asynchrony.async_io import AsyncIO
5
+
4
6
  class ReflexionInstance:
5
7
  """A reflection object encapsulating a class instance.
6
8
 
@@ -26,13 +28,6 @@ class ReflexionInstance:
26
28
  -------
27
29
  str
28
30
  The name of the class
29
-
30
- Examples
31
- --------
32
- >>> obj = SomeClass()
33
- >>> reflex = ReflexionInstance(obj)
34
- >>> reflex.getClassName()
35
- 'SomeClass'
36
31
  """
37
32
  return self._instance.__class__.__name__
38
33
 
@@ -43,11 +38,6 @@ class ReflexionInstance:
43
38
  -------
44
39
  Type
45
40
  The class object of the instance
46
-
47
- Examples
48
- --------
49
- >>> reflex.getClass() is SomeClass
50
- True
51
41
  """
52
42
  return self._instance.__class__
53
43
 
@@ -58,11 +48,6 @@ class ReflexionInstance:
58
48
  -------
59
49
  str
60
50
  The module name
61
-
62
- Examples
63
- --------
64
- >>> reflex.getModuleName()
65
- 'some_module'
66
51
  """
67
52
  return self._instance.__class__.__module__
68
53
 
@@ -73,11 +58,6 @@ class ReflexionInstance:
73
58
  -------
74
59
  Dict[str, Any]
75
60
  Dictionary of attribute names and their values
76
-
77
- Examples
78
- --------
79
- >>> reflex.getAttributes()
80
- {'attr1': value1, 'attr2': value2}
81
61
  """
82
62
  return vars(self._instance)
83
63
 
@@ -88,41 +68,165 @@ class ReflexionInstance:
88
68
  -------
89
69
  List[str]
90
70
  List of method names
71
+ """
72
+ class_name = self.getClassName()
73
+ methods = [name for name, _ in inspect.getmembers(
74
+ self._instance,
75
+ predicate=inspect.ismethod
76
+ )]
77
+
78
+ out_methods = []
79
+ for method in methods:
80
+ out_methods.append(method.replace(f"_{class_name}", ""))
81
+
82
+ return out_methods
83
+
84
+ def getProtectedMethods(self) -> List[str]:
85
+ """Get all protected method names of the instance.
91
86
 
92
- Examples
93
- --------
94
- >>> reflex.getMethods()
95
- ['method1', 'method2']
87
+ Returns
88
+ -------
89
+ List[str]
90
+ List of protected method names, excluding private methods (starting with '_')
96
91
  """
97
- return [name for name, _ in inspect.getmembers(
92
+ class_name = self.getClassName()
93
+ methods = [name for name, _ in inspect.getmembers(
98
94
  self._instance,
99
95
  predicate=inspect.ismethod
100
96
  )]
101
97
 
98
+ out_methods = []
99
+ for method in methods:
100
+ if method.startswith("_") and not method.startswith("__") and not method.startswith(f"_{class_name}"):
101
+ out_methods.append(method)
102
+
103
+ return out_methods
104
+
105
+ def getPrivateMethods(self) -> List[str]:
106
+ """Get all private method names of the instance.
107
+
108
+ Returns
109
+ -------
110
+ List[str]
111
+ List of private method names, excluding protected methods (starting with '_')
112
+ """
113
+ class_name = self.getClassName()
114
+ methods = [name for name, _ in inspect.getmembers(
115
+ self._instance,
116
+ predicate=inspect.ismethod
117
+ )]
118
+
119
+ out_methods = []
120
+ for method in methods:
121
+ if method.startswith(f"_{class_name}"):
122
+ out_methods.append(method.replace(f"_{class_name}", ""))
123
+
124
+ return out_methods
125
+
126
+ def getAsyncMethods(self) -> List[str]:
127
+ """
128
+ Get all asynchronous method names of the instance that are not static methods.
129
+
130
+ Returns
131
+ -------
132
+ List[str]
133
+ List of asynchronous method names
134
+ """
135
+ obj = self._instance
136
+ cls = obj if inspect.isclass(obj) else obj.__class__
137
+ class_name = self.getClassName()
138
+ methods = [
139
+ name for name, func in inspect.getmembers(obj, inspect.iscoroutinefunction)
140
+ if not isinstance(inspect.getattr_static(cls, name, None), staticmethod)
141
+ ]
142
+
143
+ out_methods = []
144
+ for method in methods:
145
+ out_methods.append(method.replace(f"_{class_name}", ""))
146
+
147
+ return out_methods
148
+
149
+ def getSyncMethods(self) -> List[str]:
150
+ """
151
+ Get all synchronous method names of the instance that are not static methods.
152
+
153
+ Returns
154
+ -------
155
+ List[str]
156
+ List of synchronous method names
157
+ """
158
+ obj = self._instance
159
+ cls = obj if inspect.isclass(obj) else obj.__class__
160
+ class_name = self.getClassName()
161
+ methods = [
162
+ name for name, func in inspect.getmembers(obj, predicate=inspect.ismethod)
163
+ if not inspect.iscoroutinefunction(func) and
164
+ not isinstance(inspect.getattr_static(cls, name, None), staticmethod)
165
+ ]
166
+
167
+ out_methods = []
168
+ for method in methods:
169
+ out_methods.append(method.replace(f"_{class_name}", ""))
170
+
171
+ return out_methods
172
+
173
+ def getClassMethods(self) -> List[str]:
174
+ """Get all class method names of the instance.
175
+
176
+ Returns
177
+ -------
178
+ List[str]
179
+ List of class method names.
180
+ """
181
+ return [
182
+ name for name in dir(self._instance.__class__)
183
+ if isinstance(inspect.getattr_static(self._instance.__class__, name), classmethod)
184
+ ]
185
+
102
186
  def getStaticMethods(self) -> List[str]:
103
187
  """Get all static method names of the instance.
104
188
 
105
189
  Returns
106
190
  -------
107
191
  List[str]
108
- List of static method names, excluding private methods (starting with '_')
109
-
110
- Examples
111
- --------
112
- >>> class MyClass:
113
- ... @staticmethod
114
- ... def static_method(): pass
115
- ... @staticmethod
116
- ... def _private_static(): pass
117
- ...
118
- >>> reflex = ReflexionInstance(MyClass())
119
- >>> reflex.getStaticMethods()
120
- ['static_method']
192
+ List of static method names.
121
193
  """
122
194
  return [
123
195
  name for name in dir(self._instance.__class__)
124
- if not name.startswith('_') and
125
- isinstance(inspect.getattr_static(self._instance.__class__, name), staticmethod)
196
+ if isinstance(inspect.getattr_static(self._instance.__class__, name), staticmethod)
197
+ ]
198
+
199
+ def getAsyncStaticMethods(self) -> List[str]:
200
+ """
201
+ Get all asynchronous method names of the instance that are not static methods.
202
+
203
+ Returns
204
+ -------
205
+ List[str]
206
+ List of asynchronous method names
207
+ """
208
+ obj = self._instance
209
+ cls = obj if inspect.isclass(obj) else obj.__class__
210
+ return [
211
+ name for name, func in inspect.getmembers(obj, inspect.iscoroutinefunction)
212
+ if isinstance(inspect.getattr_static(cls, name, None), staticmethod)
213
+ ]
214
+
215
+ def getSyncStaticMethods(self) -> List[str]:
216
+ """
217
+ Get all synchronous static method names of the instance.
218
+
219
+ Returns
220
+ -------
221
+ List[str]
222
+ List of synchronous static method names
223
+ """
224
+ obj = self._instance
225
+ cls = obj if inspect.isclass(obj) else obj.__class__
226
+ return [
227
+ name for name, func in inspect.getmembers(cls, inspect.isfunction)
228
+ if not inspect.iscoroutinefunction(func) and
229
+ isinstance(inspect.getattr_static(cls, name, None), staticmethod)
126
230
  ]
127
231
 
128
232
  def getPropertyNames(self) -> List[str]:
@@ -132,103 +236,117 @@ class ReflexionInstance:
132
236
  -------
133
237
  List[str]
134
238
  List of property names
135
-
136
- Examples
137
- --------
138
- >>> reflex.getPropertyNames()
139
- ['prop1', 'prop2']
140
239
  """
141
240
  return [name for name, _ in inspect.getmembers(
142
241
  self._instance.__class__,
143
242
  lambda x: isinstance(x, property)
144
243
  )]
145
244
 
146
- def callMethod(self, methodName: str, *args: Any, **kwargs: Any) -> Any:
147
- """Call a method on the instance.
245
+ def getProperty(self, propertyName: str) -> Any:
246
+ """Get the value of a property.
148
247
 
149
248
  Parameters
150
249
  ----------
151
- methodName : str
152
- Name of the method to call
153
- *args : Any
154
- Positional arguments for the method
155
- **kwargs : Any
156
- Keyword arguments for the method
250
+ propertyName : str
251
+ Name of the property
157
252
 
158
253
  Returns
159
254
  -------
160
255
  Any
161
- The return value of the method
256
+ The value of the property
162
257
 
163
258
  Raises
164
259
  ------
165
260
  AttributeError
166
- If the method doesn't exist
167
-
168
- Examples
169
- --------
170
- >>> reflex.callMethod('calculate', 2, 3)
171
- 5
261
+ If the property doesn't exist or is not a property
172
262
  """
173
- method = getattr(self._instance, methodName)
174
- return method(*args, **kwargs)
263
+ attr = getattr(self._instance.__class__, propertyName, None)
264
+ if isinstance(attr, property) and attr.fget is not None:
265
+ return getattr(self._instance, propertyName)
266
+ raise AttributeError(f"{propertyName} is not a property or doesn't have a getter.")
175
267
 
176
- def getMethodSignature(self, methodName: str) -> inspect.Signature:
177
- """Get the signature of a method.
268
+ def getPropertySignature(self, propertyName: str) -> inspect.Signature:
269
+ """Get the signature of a property.
178
270
 
179
271
  Parameters
180
272
  ----------
181
- methodName : str
182
- Name of the method
273
+ propertyName : str
274
+ Name of the property
183
275
 
184
276
  Returns
185
277
  -------
186
278
  inspect.Signature
187
- The method signature
279
+ The property signature
188
280
 
189
281
  Raises
190
282
  ------
191
283
  AttributeError
192
- If the method doesn't exist
193
-
194
- Examples
195
- --------
196
- >>> sig = reflex.getMethodSignature('calculate')
197
- >>> str(sig)
198
- '(x, y)'
284
+ If the property doesn't exist or is not a property
199
285
  """
200
- method = getattr(self._instance, methodName)
201
- if callable(method):
202
- return inspect.signature(method)
286
+ attr = getattr(self._instance.__class__, propertyName, None)
287
+ if isinstance(attr, property) and attr.fget is not None:
288
+ return inspect.signature(attr.fget)
289
+ raise AttributeError(f"{propertyName} is not a property or doesn't have a getter.")
203
290
 
204
- def getPropertySignature(self, propertyName: str) -> inspect.Signature:
205
- """Get the signature of a property getter.
291
+ def callMethod(self, methodName: str, *args: Any, **kwargs: Any) -> Any:
292
+ """Call a method on the instance.
206
293
 
207
294
  Parameters
208
295
  ----------
209
- propertyName : str
210
- Name of the property
296
+ methodName : str
297
+ Name of the method to call
298
+ *args : Any
299
+ Positional arguments for the method
300
+ **kwargs : Any
301
+ Keyword arguments for the method
211
302
 
212
303
  Returns
213
304
  -------
214
- inspect.Signature
215
- The property's getter method signature
305
+ Any
306
+ The result of the method call
216
307
 
217
308
  Raises
218
309
  ------
219
310
  AttributeError
220
- If the property doesn't exist or is not a property
311
+ If the method does not exist on the instance
312
+ TypeError
313
+ If the method is not callable
314
+ """
315
+
316
+ if methodName in self.getPrivateMethods():
317
+ methodName = f"_{self.getClassName()}{methodName}"
318
+
319
+ method = getattr(self._instance, methodName, None)
320
+
321
+ if method is None:
322
+ raise AttributeError(f"'{self.getClassName()}' object has no method '{methodName}'.")
323
+ if not callable(method):
324
+ raise TypeError(f"'{methodName}' is not callable on '{self.getClassName()}'.")
325
+
326
+ if inspect.iscoroutinefunction(method):
327
+ return AsyncIO.run(method(*args, **kwargs))
328
+
329
+ return method(*args, **kwargs)
221
330
 
222
- Examples
223
- --------
224
- >>> sig = reflex.getPropertySignature('config')
225
- >>> str(sig)
226
- '(self)'
331
+ def getMethodSignature(self, methodName: str) -> inspect.Signature:
332
+ """Get the signature of a method.
333
+
334
+ Parameters
335
+ ----------
336
+ methodName : str
337
+ Name of the method
338
+
339
+ Returns
340
+ -------
341
+ inspect.Signature
342
+ The method signature
227
343
  """
228
- attr = getattr(type(self._instance), propertyName, None)
229
- if isinstance(attr, property) and attr.fget is not None:
230
- return inspect.signature(attr.fget)
231
- raise AttributeError(f"{propertyName} is not a property or doesn't have a getter.")
344
+ if methodName in self.getPrivateMethods():
345
+ methodName = f"_{self.getClassName()}{methodName}"
346
+
347
+ method = getattr(self._instance, methodName)
348
+ if callable(method):
349
+ return inspect.signature(method)
232
350
 
233
351
  def getDocstring(self) -> Optional[str]:
234
352
  """Get the docstring of the instance's class.
@@ -237,11 +355,6 @@ class ReflexionInstance:
237
355
  -------
238
356
  Optional[str]
239
357
  The class docstring, or None if not available
240
-
241
- Examples
242
- --------
243
- >>> reflex.getDocstring()
244
- 'This class does something important.'
245
358
  """
246
359
  return self._instance.__class__.__doc__
247
360
 
@@ -252,11 +365,6 @@ class ReflexionInstance:
252
365
  -------
253
366
  Tuple[Type, ...]
254
367
  Tuple of base classes
255
-
256
- Examples
257
- --------
258
- >>> reflex.getBaseClasses()
259
- (<class 'object'>,)
260
368
  """
261
369
  return self._instance.__class__.__bases__
262
370
 
@@ -272,11 +380,6 @@ class ReflexionInstance:
272
380
  -------
273
381
  bool
274
382
  True if the instance is of the specified class
275
-
276
- Examples
277
- --------
278
- >>> reflex.isInstanceOf(SomeClass)
279
- True
280
383
  """
281
384
  return isinstance(self._instance, cls)
282
385
 
@@ -287,13 +390,6 @@ class ReflexionInstance:
287
390
  -------
288
391
  Optional[str]
289
392
  The source code if available, None otherwise
290
-
291
- Examples
292
- --------
293
- >>> print(reflex.getSourceCode())
294
- class SomeClass:
295
- def __init__(self):
296
- ...
297
393
  """
298
394
  try:
299
395
  return inspect.getsource(self._instance.__class__)
@@ -307,11 +403,6 @@ class ReflexionInstance:
307
403
  -------
308
404
  Optional[str]
309
405
  The file path if available, None otherwise
310
-
311
- Examples
312
- --------
313
- >>> reflex.getFileLocation()
314
- '/path/to/module.py'
315
406
  """
316
407
  try:
317
408
  return inspect.getfile(self._instance.__class__)
@@ -325,11 +416,6 @@ class ReflexionInstance:
325
416
  -------
326
417
  Dict[str, Any]
327
418
  Dictionary of attribute names and their type annotations
328
-
329
- Examples
330
- --------
331
- >>> reflex.getAnnotations()
332
- {'name': str, 'value': int}
333
419
  """
334
420
  return self._instance.__class__.__annotations__
335
421
 
@@ -345,11 +431,6 @@ class ReflexionInstance:
345
431
  -------
346
432
  bool
347
433
  True if the attribute exists
348
-
349
- Examples
350
- --------
351
- >>> reflex.hasAttribute('important_attr')
352
- True
353
434
  """
354
435
  return hasattr(self._instance, name)
355
436
 
@@ -370,11 +451,6 @@ class ReflexionInstance:
370
451
  ------
371
452
  AttributeError
372
453
  If the attribute doesn't exist
373
-
374
- Examples
375
- --------
376
- >>> reflex.getAttribute('count')
377
- 42
378
454
  """
379
455
  return getattr(self._instance, name)
380
456
 
@@ -392,29 +468,60 @@ class ReflexionInstance:
392
468
  ------
393
469
  AttributeError
394
470
  If the attribute is read-only
471
+ """
472
+ if callable(value):
473
+ raise AttributeError(f"Cannot set attribute '{name}' to a callable.")
474
+ setattr(self._instance, name, value)
395
475
 
396
- Examples
397
- --------
398
- >>> reflex.setAttribute('count', 100)
476
+ def removeAttribute(self, name: str) -> None:
477
+ """Remove an attribute from the instance.
478
+
479
+ Parameters
480
+ ----------
481
+ name : str
482
+ The attribute name to remove
483
+
484
+ Raises
485
+ ------
486
+ AttributeError
487
+ If the attribute doesn't exist or is read-only
399
488
  """
489
+ if not hasattr(self._instance, name):
490
+ raise AttributeError(f"'{self.getClassName()}' object has no attribute '{name}'.")
491
+ delattr(self._instance, name)
492
+
493
+ def setMacro(self, name: str, value: Callable) -> None:
494
+ """Set a callable attribute value.
495
+
496
+ Parameters
497
+ ----------
498
+ name : str
499
+ The attribute name
500
+ value : Callable
501
+ The callable to set
502
+
503
+ Raises
504
+ ------
505
+ AttributeError
506
+ If the value is not callable
507
+ """
508
+ if not callable(value):
509
+ raise AttributeError(f"The value for '{name}' must be a callable.")
400
510
  setattr(self._instance, name, value)
401
511
 
402
- def getCallableMembers(self) -> Dict[str, Callable]:
403
- """Get all callable members (methods) of the instance.
512
+ def removeMacro(self, name: str) -> None:
513
+ """Remove a callable attribute from the instance.
404
514
 
405
- Returns
406
- -------
407
- Dict[str, Callable]
408
- Dictionary of method names and their callable objects
409
-
410
- Examples
411
- --------
412
- >>> reflex.getCallableMembers()
413
- {'calculate': <bound method SomeClass.calculate>, ...}
414
- """
415
- return {
416
- name: member for name, member in inspect.getmembers(
417
- self._instance,
418
- callable
419
- ) if not name.startswith('__')
420
- }
515
+ Parameters
516
+ ----------
517
+ name : str
518
+ The attribute name to remove
519
+
520
+ Raises
521
+ ------
522
+ AttributeError
523
+ If the attribute doesn't exist or is not callable
524
+ """
525
+ if not hasattr(self._instance, name) or not callable(getattr(self._instance, name)):
526
+ raise AttributeError(f"'{self.getClassName()}' object has no callable macro '{name}'.")
527
+ delattr(self._instance, name)
@@ -17,7 +17,7 @@ class IUnitTest:
17
17
  Timestamp when the test execution started.
18
18
  """
19
19
 
20
- def addFolder(
20
+ def discoverTestsInFolder(
21
21
  self,
22
22
  folder_path: str,
23
23
  base_path: str = "tests",
@@ -75,7 +75,7 @@ class TestSuite(ITestSuite):
75
75
 
76
76
  # Add discovered folders to the test suite
77
77
  for folder in discovered_folders:
78
- tests.addFolder(
78
+ tests.discoverTestsInFolder(
79
79
  base_path=base_path,
80
80
  folder_path=folder,
81
81
  pattern=pattern
@@ -42,7 +42,7 @@ class UnitTest(IUnitTest):
42
42
  self.test_results: List[TestResult] = []
43
43
  self.start_time: float = 0.0
44
44
 
45
- def addFolder(
45
+ def discoverTestsInFolder(
46
46
  self,
47
47
  folder_path: str,
48
48
  base_path: str = "tests",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orionis
3
- Version: 0.230.0
3
+ Version: 0.232.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
@@ -1,6 +1,6 @@
1
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  orionis/console.py,sha256=4gYWxf0fWYgJ4RKwARvnTPh06FL3GJ6SAZ7R2NzOICw,1342
3
- orionis/framework.py,sha256=bi6Li6kcFmefOar93w0po4ec5BGmPG60Ll_AaFeT00c,1458
3
+ orionis/framework.py,sha256=qijmmceXtP9OKeexD1p98DWoR1fkOIOLwMd6suDV0pM,1458
4
4
  orionis/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  orionis/installer/manager.py,sha256=Li4TVziRXWfum02xNG4JHwbnLk-u8xzHjdqKz-D894k,2755
6
6
  orionis/installer/output.py,sha256=7O9qa2xtXMB_4ZvVi-Klneom9YazwygAd_4uYAoxhbU,8548
@@ -173,7 +173,7 @@ orionis/luminate/support/inspection/reflection.py,sha256=xUILK5eEkTqXiAaOWVjEn_u
173
173
  orionis/luminate/support/inspection/reflexion_abstract.py,sha256=nImlP07TpsT0azgIafGVZfSv1THrBoJOlNSSr9vDKiE,10848
174
174
  orionis/luminate/support/inspection/reflexion_concrete.py,sha256=1ISuy2L6Oser-EhmpuGALmbauh7Z-X8Rx1YYgt5CabQ,7543
175
175
  orionis/luminate/support/inspection/reflexion_concrete_with_abstract.py,sha256=z1cAscuG6a1E4ZJmwkp9HVQ0yhTAeFYKfnnyR_M-RFI,7480
176
- orionis/luminate/support/inspection/reflexion_instance.py,sha256=LNAgw4sZvHT7UMiObHTGk7xgqpIeKYHAQRgRpuPfEas,10842
176
+ orionis/luminate/support/inspection/reflexion_instance.py,sha256=hf0c0PZkBcMXWvn4-Q2cPnTpVlQYUI-na9YgvHLpSzM,15554
177
177
  orionis/luminate/support/inspection/reflexion_instance_with_abstract.py,sha256=PI_VSH8baxjPgheOYc9tQAlLq9mjxGm5zCOr-bLVksg,9406
178
178
  orionis/luminate/support/inspection/reflexion_module.py,sha256=OgBXpqNJHkmq-gX4rqFStv-WVNe9R38RsgUgfHpak8k,405
179
179
  orionis/luminate/support/inspection/reflexion_module_with_classname.py,sha256=YZHZI0XUZkSWnq9wrGxrIXtI64nY9yVSZoMe7PZXq8Y,620
@@ -200,12 +200,12 @@ orionis/luminate/test/test_exception.py,sha256=21PILTXnMuL5-wT3HGKjIklt8VeIYDcQD
200
200
  orionis/luminate/test/test_result.py,sha256=Px2_M70r_y7BntRITk_h0IPTbSTW5XhDyklMKHm3JJI,999
201
201
  orionis/luminate/test/test_status.py,sha256=vNKRmp1lud_ZGTayf3A8wO_0vEYdFABy_oMw-RcEc1c,673
202
202
  orionis/luminate/test/test_std_out.py,sha256=rPwXCf3qvMzkZHRCu03KvLCfD4K7cPOB02BZNpXtaiU,2851
203
- orionis/luminate/test/test_suite.py,sha256=752VbEJHCSe0ztDrBmJlU8FpUg96W4MHnQbHPKpOGqc,3270
204
- orionis/luminate/test/test_unit.py,sha256=ZTsGlFJ-vwc77sfb7kLDs_sAwJL4L1YP8R9nFUWlgZY,12146
203
+ orionis/luminate/test/test_suite.py,sha256=olhQfsX1Q_koPetFxZ8gPSz_rk-El37X8H-sI_RXaBg,3282
204
+ orionis/luminate/test/test_unit.py,sha256=YZfNNQy8jN5FRwa0qlNE3LW88nAxPvzGkh5Jbam6oaQ,12158
205
205
  orionis/luminate/test/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
206
206
  orionis/luminate/test/contracts/test_std_out.py,sha256=ryvMotj-rpVKOsyGqW0B0IEHuF8DdQj1Rn0K8xiyBOE,489
207
207
  orionis/luminate/test/contracts/test_suite.py,sha256=TOIys-Z1HllUJe-qMY9mOfZGiZPXlKRuAZtJ-B2iDz8,1375
208
- orionis/luminate/test/contracts/test_unit.py,sha256=3euExuq7QgkJljnENxDyZW-okrw9S0apLnhf93o0Vqg,2612
208
+ orionis/luminate/test/contracts/test_unit.py,sha256=CD4FHslmWt1yPbfBhZBsG1QPzGmwKQPkL5cFvJgeilo,2624
209
209
  orionis/static/ascii/icon.ascii,sha256=IgrlVjcYxcCrr0cJuJkOnEz0aEdAQBTyLzO5ainKsWc,398
210
210
  orionis/static/ascii/info.ascii,sha256=HF_o2eXaiw5iqcOhHfnPByn5GJ_O2eBwSK3IpTfYOwY,457
211
211
  orionis/static/bg/galaxy.jpg,sha256=_FuPghOe9LBrIWv1eKZ9fiZR72sEz5obvXGDnD7MzTc,172244
@@ -231,13 +231,13 @@ tests/support/inspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
231
231
  tests/support/inspection/test_reflection_abstract.py,sha256=6w8vm8H_fR4Z-KYjQGm8bq-HcetlpQl0EsDmDy3WzQ8,9311
232
232
  tests/support/inspection/test_reflection_concrete.py,sha256=3BWSU7MkFEv2UgAVAwhiaMrzEwAyDBBJCa6edOENKSU,6782
233
233
  tests/support/inspection/test_reflection_concrete_with_abstract.py,sha256=85cV9loDvtLG7sUxD6n_Ja0KV3x8FYakE2Z0W2Iruu8,4680
234
- tests/support/inspection/test_reflection_instance.py,sha256=8XKkEhboESLG2UaJ-STJ8STe7mUO4YDkKy01kiiGvkI,7197
234
+ tests/support/inspection/test_reflection_instance.py,sha256=JuTHhhsrO2yJQrSl1ITJ3NjAGg2mJbMSIyY4BvVcZbg,11141
235
235
  tests/support/inspection/test_reflection_instance_with_abstract.py,sha256=l6tidHJUJpWhol-E5GfQEpMZ5gIVZFsegwVtMk8tYhs,4089
236
236
  tests/support/inspection/fakes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
237
237
  tests/support/inspection/fakes/fake_reflection_abstract.py,sha256=7qtz44brfFzE4oNYi9kIsvdWP79nP2FnzSz-0bU__pg,5045
238
238
  tests/support/inspection/fakes/fake_reflection_concrete.py,sha256=j6gzsxE3xq5oJ30H_Hm1RsUwEY3jOYBu4sclxtD1ayo,1047
239
239
  tests/support/inspection/fakes/fake_reflection_concrete_with_abstract.py,sha256=ibCjrtNM6BMf5Z5VMvat7E6zOAk5g9z--gj4ykKJWY8,2118
240
- tests/support/inspection/fakes/fake_reflection_instance.py,sha256=G16rZdJWC3L8SGEQkmwktvw4n7IAusIIx9Tm-ZFLcg4,1419
240
+ tests/support/inspection/fakes/fake_reflection_instance.py,sha256=NYfUF86nheHG_jVGmpwq3D22DyBZEmkJ-n08YkF5LqY,1336
241
241
  tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=SfL8FuFmr650RlzXTrP4tGMfsPVZLhOxVnBXu_g1POg,1471
242
242
  tests/support/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
243
243
  tests/support/parsers/test_exception_parser.py,sha256=s-ZRbxyr9bs5uis2SM0IN-vCc-AJhWqRnEMIVgeEFXE,2363
@@ -249,9 +249,9 @@ tests/support/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
249
249
  tests/support/patterns/test_singleton.py,sha256=U5uwpgGcP7-fIazsnFLwg30mmc24S62udhVIHuL-scY,634
250
250
  tests/support/standard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
251
251
  tests/support/standard/test_std.py,sha256=bJ5LV_OKEEZa_Bk3PTk9Kapk6qECLzcKf0hfR_x2QqM,2042
252
- orionis-0.230.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
253
- orionis-0.230.0.dist-info/METADATA,sha256=jQC8g9qbVXlE1cvFGv96tT8o_55xjFZz12DNC2nXcSI,3003
254
- orionis-0.230.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
255
- orionis-0.230.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
256
- orionis-0.230.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
257
- orionis-0.230.0.dist-info/RECORD,,
252
+ orionis-0.232.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
253
+ orionis-0.232.0.dist-info/METADATA,sha256=mcQWVf2OW3OHHuaU6yahxyd633xMoscMfKrUzOWGAUw,3003
254
+ orionis-0.232.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
255
+ orionis-0.232.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
256
+ orionis-0.232.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
257
+ orionis-0.232.0.dist-info/RECORD,,
@@ -1,16 +1,10 @@
1
+ import asyncio
2
+
1
3
  class BaseFakeClass:
2
4
  pass
3
5
 
4
6
  class FakeClass(BaseFakeClass):
5
- """This is a test class for ReflexionInstance.
6
-
7
- Attributes
8
- ----------
9
- public_attr : int
10
- An example public attribute
11
- _private_attr : str
12
- An example "private" attribute
13
- """
7
+ """This is a test class for ReflexionInstance."""
14
8
 
15
9
  class_attr: str = "class_value"
16
10
 
@@ -19,21 +13,8 @@ class FakeClass(BaseFakeClass):
19
13
  self._private_attr = "secret"
20
14
  self.dynamic_attr = None
21
15
 
22
- def instance_method(self, x: int, y: int) -> int:
23
- """Adds two numbers.
24
-
25
- Parameters
26
- ----------
27
- x : int
28
- First number
29
- y : int
30
- Second number
31
-
32
- Returns
33
- -------
34
- int
35
- The sum of x and y
36
- """
16
+ def instanceMethod(self, x: int, y: int) -> int:
17
+ """Adds two numbers."""
37
18
  return x + y
38
19
 
39
20
  @property
@@ -42,19 +23,29 @@ class FakeClass(BaseFakeClass):
42
23
  return f"Value: {self.public_attr}"
43
24
 
44
25
  @classmethod
45
- def class_method(cls) -> str:
26
+ def classMethod(cls) -> str:
46
27
  """A class method."""
47
28
  return f"Class attr: {cls.class_attr}"
48
29
 
49
30
  @staticmethod
50
- def static_method(text: str) -> str:
31
+ def staticMethod(text: str) -> str:
51
32
  """A static method."""
52
33
  return text.upper()
53
34
 
54
- def __private_method(self) -> str:
35
+ @staticmethod
36
+ async def staticAsyncMethod(text: str) -> str:
37
+ """An asynchronous static method."""
38
+ await asyncio.sleep(0.1)
39
+ return text.upper()
40
+
41
+ def __privateMethod(self) -> str:
55
42
  """A 'private' method."""
56
43
  return "This is private"
57
44
 
58
- def _protected_method(self) -> str:
45
+ def _protectedMethod(self) -> str:
59
46
  """A 'protected' method."""
60
- return "This is protected"
47
+ return "This is protected"
48
+
49
+ async def asyncMethod(self) -> str:
50
+ """An async method."""
51
+ return "This is async"
@@ -45,14 +45,63 @@ class TestReflectionInstance(TestCase):
45
45
  """Ensure getMethods returns all methods of the class."""
46
46
  reflex = Reflection.instance(FakeClass())
47
47
  methods = reflex.getMethods()
48
- self.assertTrue("instance_method" in methods)
49
- self.assertTrue("class_method" in methods)
48
+ self.assertTrue("__privateMethod" in methods)
49
+ self.assertTrue("_protectedMethod" in methods)
50
+ self.assertTrue("asyncMethod" in methods)
51
+ self.assertTrue("classMethod" in methods)
52
+ self.assertTrue("instanceMethod" in methods)
53
+
54
+ async def testReflectionInstanceGetProtectedMethods(self):
55
+ """Check that getProtectedMethods returns all protected methods."""
56
+ reflex = Reflection.instance(FakeClass())
57
+ methods = reflex.getProtectedMethods()
58
+ self.assertTrue("_protectedMethod" in methods)
59
+
60
+ async def testReflectionInstanceGetPrivateMethods(self):
61
+ """Ensure getPrivateMethods returns all private methods."""
62
+ reflex = Reflection.instance(FakeClass())
63
+ methods = reflex.getPrivateMethods()
64
+ self.assertTrue("__privateMethod" in methods)
65
+
66
+ async def testReflectionInstanceGetAsyncMethods(self):
67
+ """Check that getAsyncMethods returns all async methods of the class."""
68
+ reflex = Reflection.instance(FakeClass())
69
+ methods = reflex.getAsyncMethods()
70
+ self.assertTrue("asyncMethod" in methods)
71
+
72
+ async def testReflectionInstanceGetSyncMethods(self):
73
+ """Check that getASyncMethods returns all async methods of the class."""
74
+ reflex = Reflection.instance(FakeClass())
75
+ methods = reflex.getSyncMethods()
76
+ self.assertTrue("__privateMethod" in methods)
77
+ self.assertTrue("_protectedMethod" in methods)
78
+ self.assertTrue("classMethod" in methods)
79
+ self.assertTrue("instanceMethod" in methods)
80
+
81
+ async def testReflectionInstanceGetClassMethods(self):
82
+ """Verify getClassMethods returns all class methods of the class."""
83
+ reflex = Reflection.instance(FakeClass())
84
+ methods = reflex.getClassMethods()
85
+ self.assertTrue("classMethod" in methods)
50
86
 
51
87
  async def testReflectionInstanceGetStaticMethods(self):
52
88
  """Verify getStaticMethods returns all static methods of the class."""
53
89
  reflex = Reflection.instance(FakeClass())
54
90
  methods = reflex.getStaticMethods()
55
- self.assertTrue("static_method" in methods)
91
+ self.assertTrue("staticAsyncMethod" in methods)
92
+ self.assertTrue("staticMethod" in methods)
93
+
94
+ async def testReflectionInstanceGetAsyncStaticMethods(self):
95
+ """Ensure getSyncMethods returns all sync methods of the class."""
96
+ reflex = Reflection.instance(FakeClass())
97
+ methods = reflex.getAsyncStaticMethods()
98
+ self.assertTrue("staticAsyncMethod" in methods)
99
+
100
+ async def testReflectionInstanceGetSyncStaticMethods(self):
101
+ """Check that getSyncMethods returns all sync methods of the class."""
102
+ reflex = Reflection.instance(FakeClass())
103
+ methods = reflex.getSyncStaticMethods()
104
+ self.assertTrue("staticMethod" in methods)
56
105
 
57
106
  async def testReflectionInstanceGetPropertyNames(self):
58
107
  """Check that getPropertyNames returns all property names."""
@@ -60,17 +109,31 @@ class TestReflectionInstance(TestCase):
60
109
  properties = reflex.getPropertyNames()
61
110
  self.assertTrue("computed_property" in properties)
62
111
 
112
+ async def testReflectionInstanceGetProperty(self):
113
+ """Ensure getProperty retrieves the correct property value."""
114
+ reflex = Reflection.instance(FakeClass())
115
+ property_value = reflex.getProperty("computed_property")
116
+ self.assertEqual(property_value, "Value: 42")
117
+
63
118
  async def testReflectionInstanceCallMethod(self):
64
119
  """Ensure callMethod correctly invokes a method with arguments."""
65
120
  reflex = Reflection.instance(FakeClass())
66
- result = reflex.callMethod("instance_method", 1, 2)
121
+
122
+ # Execute Sync Method
123
+ result = reflex.callMethod("instanceMethod", 1, 2)
67
124
  self.assertEqual(result, 3)
68
125
 
126
+ # Execute Async Method
127
+ result = await reflex.callMethod("asyncMethod")
128
+ self.assertEqual(result, "This is async")
129
+
69
130
  async def testReflectionInstanceGetMethodSignature(self):
70
131
  """Verify getMethodSignature returns the correct method signature."""
71
132
  reflex = Reflection.instance(FakeClass())
72
- signature = reflex.getMethodSignature("instance_method")
133
+ signature = reflex.getMethodSignature("instanceMethod")
73
134
  self.assertEqual(str(signature), "(x: int, y: int) -> int")
135
+ signature = reflex.getMethodSignature("__privateMethod")
136
+ self.assertEqual(str(signature), "() -> str")
74
137
 
75
138
  async def testReflectionInstanceGetDocstring(self):
76
139
  """Check that getDocstring returns the correct class docstring."""
@@ -87,7 +150,8 @@ class TestReflectionInstance(TestCase):
87
150
  async def testReflectionInstanceIsInstanceOf(self):
88
151
  """Verify isInstanceOf checks inheritance correctly."""
89
152
  reflex = Reflection.instance(FakeClass())
90
- self.assertTrue(reflex.isInstanceOf(BaseFakeClass))
153
+ result = reflex.isInstanceOf(BaseFakeClass)
154
+ self.assertTrue(result)
91
155
 
92
156
  async def testReflectionInstanceGetSourceCode(self):
93
157
  """Check that getSourceCode returns the class source code."""
@@ -119,29 +183,50 @@ class TestReflectionInstance(TestCase):
119
183
  attr_value = reflex.getAttribute("public_attr")
120
184
  self.assertEqual(attr_value, 42)
121
185
 
122
- async def testReflectionInstanceGetCallableMembers(self):
123
- """Verify getCallableMembers returns all callable members."""
124
- reflex = Reflection.instance(FakeClass())
125
- callable_members = reflex.getCallableMembers()
126
- self.assertIn("instance_method", callable_members)
127
- self.assertIn("class_method", callable_members)
128
- self.assertIn("static_method", callable_members)
129
-
130
186
  async def testReflectionInstanceSetAttribute(self):
131
187
  """Check that setAttribute correctly sets a new attribute."""
132
- async def myMacro(cls: FakeClass, num):
133
- """Simulate an async function with an async sleep."""
188
+ reflex = Reflection.instance(FakeClass())
189
+ reflex.setAttribute("new_attr", 'Orionis')
190
+ attr_value = reflex.getAttribute("new_attr")
191
+ self.assertEqual(attr_value, 'Orionis')
192
+
193
+ async def testReflectionInstanceRemoveAttribute(self):
194
+ """Ensure removeAttribute correctly removes an attribute."""
195
+ reflex = Reflection.instance(FakeClass())
196
+ reflex.setAttribute("temp_attr", 'Temporary')
197
+ reflex.removeAttribute("temp_attr")
198
+ self.assertFalse(reflex.hasAttribute("temp_attr"))
199
+
200
+ async def testReflectionInstanceSetMacro(self):
201
+ """Check that setMacro correctly."""
202
+ async def asyncMacro(cls: FakeClass, num):
134
203
  await asyncio.sleep(0.1)
135
- return cls.instance_method(10, 12) + num
204
+ return cls.instanceMethod(10, 12) + num
205
+ def syncMacro(cls: FakeClass, num):
206
+ return cls.instanceMethod(10, 12) + num
136
207
 
137
208
  reflex = Reflection.instance(FakeClass())
138
- reflex.setAttribute("myMacro", myMacro)
139
209
 
140
- self.assertTrue(reflex.hasAttribute("myMacro"))
210
+ reflex.setMacro("asyncMacro", asyncMacro)
211
+ result = await reflex.callMethod("asyncMacro", reflex._instance, 3)
212
+ self.assertEqual(result, 25)
141
213
 
142
- result = await reflex.callMethod("myMacro", reflex._instance, 3)
214
+ reflex.setMacro("syncMacro", syncMacro)
215
+ result = reflex.callMethod("syncMacro", reflex._instance, 3)
143
216
  self.assertEqual(result, 25)
144
217
 
218
+ async def testReflectionInstanceRemoveMacro(self):
219
+ """Ensure removeMacro correctly removes a macro."""
220
+ async def asyncMacro(cls: FakeClass, num):
221
+ await asyncio.sleep(0.1)
222
+ return cls.instanceMethod(10, 12) + num
223
+
224
+ reflex = Reflection.instance(FakeClass())
225
+ reflex.setMacro("asyncMacro", asyncMacro)
226
+ reflex.removeMacro("asyncMacro")
227
+ with self.assertRaises(Exception):
228
+ await reflex.callMethod("asyncMacro", reflex._instance, 3)
229
+
145
230
  def testReflectionInstanceGetPropertySignature(self):
146
231
  """Ensure getPropertySignature returns the correct property signature."""
147
232
  signature = Reflection.instance(FakeClass()).getPropertySignature('computed_property')