orionis 0.304.0__py3-none-any.whl → 0.306.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/services/introspection/modules/{reflection_instance.py → reflection_module.py} +1 -1
  3. orionis/services/introspection/reflection.py +90 -0
  4. orionis/{services → support}/standard/std.py +2 -2
  5. orionis/test/{facade/test_suite.py → test_suite.py} +1 -2
  6. orionis/unittesting.py +1 -1
  7. {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/METADATA +1 -1
  8. {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/RECORD +28 -65
  9. tests/{services → support}/standard/test_services_std.py +3 -3
  10. tests/{services → support}/wrapper/test_services_wrapper_docdict.py +2 -2
  11. orionis/support/abstracts/entities/abstract_class_attributes.py +0 -37
  12. orionis/support/abstracts/reflect_abstract.py +0 -556
  13. orionis/support/helpers/functions.py +0 -285
  14. orionis/support/introspection/container_integrity.py +0 -292
  15. orionis/support/introspection/contracts/__init__.py +0 -0
  16. orionis/support/introspection/contracts/reflection.py +0 -187
  17. orionis/support/introspection/contracts/reflexion_abstract.py +0 -264
  18. orionis/support/introspection/helpers/__init__.py +0 -0
  19. orionis/support/introspection/helpers/functions.py +0 -281
  20. orionis/support/introspection/instances/__init__.py +0 -0
  21. orionis/support/introspection/instances/contracts/__init__.py +0 -0
  22. orionis/support/introspection/instances/contracts/reflection_instance.py +0 -649
  23. orionis/support/introspection/instances/entities/__init__.py +0 -0
  24. orionis/support/introspection/instances/reflection_instance.py +0 -758
  25. orionis/support/introspection/reflect_decorators.py +0 -335
  26. orionis/support/introspection/reflection.py +0 -216
  27. orionis/support/introspection/reflexion_concrete.py +0 -276
  28. orionis/support/introspection/reflexion_concrete_with_abstract.py +0 -185
  29. orionis/support/introspection/reflexion_instance_with_abstract.py +0 -230
  30. orionis/support/introspection/reflexion_module.py +0 -19
  31. orionis/support/introspection/reflexion_module_with_classname.py +0 -22
  32. orionis/support/reflection.py +0 -216
  33. orionis/test/facade/__init__.py +0 -0
  34. orionis/test/facade/contracts/__init__.py +0 -0
  35. orionis/test/facade/contracts/test_suite.py +0 -25
  36. tests/services/standard/__init__.py +0 -0
  37. tests/services/wrapper/__init__.py +0 -0
  38. tests/support/inspection/__init__.py +0 -0
  39. tests/support/inspection/fakes/__init__.py +0 -0
  40. tests/support/inspection/fakes/fake_reflect_abstract.py +0 -276
  41. tests/support/inspection/fakes/fake_reflection_concrete.py +0 -44
  42. tests/support/inspection/fakes/fake_reflection_concrete_with_abstract.py +0 -78
  43. tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py +0 -45
  44. tests/support/inspection/test_reflect_abstract.py +0 -334
  45. tests/support/inspection/test_reflect_instance.py +0 -288
  46. tests/support/inspection/test_reflection_concrete.py +0 -142
  47. tests/support/inspection/test_reflection_concrete_with_abstract.py +0 -87
  48. tests/support/inspection/test_reflection_instance_with_abstract.py +0 -79
  49. /orionis/services/introspection/modules/contracts/{reflection_instance.py → reflection_module.py} +0 -0
  50. /orionis/{services → support}/standard/__init__.py +0 -0
  51. /orionis/{services → support}/standard/contracts/__init__.py +0 -0
  52. /orionis/{services → support}/standard/contracts/std.py +0 -0
  53. /orionis/{services → support}/standard/exceptions/__init__.py +0 -0
  54. /orionis/{services → support}/standard/exceptions/std_value_exception.py +0 -0
  55. /orionis/{services → support}/wrapper/__init__.py +0 -0
  56. /orionis/{services → support}/wrapper/dicts/__init__.py +0 -0
  57. /orionis/{services → support}/wrapper/dicts/dot_dict.py +0 -0
  58. {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/WHEEL +0 -0
  59. {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/licenses/LICENCE +0 -0
  60. {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/top_level.txt +0 -0
  61. {orionis-0.304.0.dist-info → orionis-0.306.0.dist-info}/zip-safe +0 -0
  62. {orionis/support/abstracts → tests/services/inspection/reflection}/__init__.py +0 -0
  63. {orionis/support/abstracts/entities → tests/services/inspection/reflection/mock}/__init__.py +0 -0
  64. /tests/{support/inspection/fakes → services/inspection/reflection/mock}/fake_reflect_instance.py +0 -0
  65. {orionis/support/helpers → tests/support/standard}/__init__.py +0 -0
  66. {orionis/support/introspection → tests/support/wrapper}/__init__.py +0 -0
@@ -1,649 +0,0 @@
1
- from abc import ABC, abstractmethod
2
- import inspect
3
- from typing import Any, Callable, Dict, List, Optional, Tuple, Type
4
- from orionis.support.introspection.dependencies.entities.class_dependencies import ClassDependency
5
- from orionis.support.introspection.dependencies.entities.method_dependencies import MethodDependency
6
- from orionis.support.introspection.instances.entities.class_attributes import ClassAttributes
7
- from orionis.services.introspection.instances.entities.class_parsed import ClassParsed
8
- from orionis.support.introspection.instances.entities.class_property import ClassProperty
9
-
10
- class IReflectionInstance(ABC):
11
- """
12
- A reflection object encapsulating a class instance.
13
-
14
- Parameters
15
- ----------
16
- instance : Any
17
- The instance being reflected upon
18
-
19
- Attributes
20
- ----------
21
- _instance : Any
22
- The encapsulated instance
23
- """
24
-
25
- @abstractmethod
26
- def parse(self) -> ClassParsed:
27
- """
28
- Parse the instance into a structured representation.
29
-
30
- This method extracts and organizes various details about the instance,
31
- including its class name, module, attributes, methods, and properties,
32
- into a `ClassParsed` object.
33
-
34
- Returns
35
- -------
36
- ClassParsed
37
- A structured representation of the instance, containing:
38
- - name: The name of the instance's class.
39
- - module: The module where the class is defined.
40
- - attributes: Categorized attributes (public, private, protected).
41
- - methods: Categorized methods (public, private, protected, static, etc.).
42
- - properties: A dictionary of properties with their details.
43
- """
44
- pass
45
-
46
- @abstractmethod
47
- def getClassName(self) -> str:
48
- """
49
- Get the name of the instance's class.
50
-
51
- Returns
52
- -------
53
- str
54
- The name of the class
55
- """
56
- pass
57
-
58
- @abstractmethod
59
- def getClass(self) -> Type:
60
- """
61
- Get the class of the instance.
62
-
63
- Returns
64
- -------
65
- Type
66
- The class object of the instance
67
- """
68
- pass
69
-
70
- @abstractmethod
71
- def getModuleName(self) -> str:
72
- """
73
- Get the name of the module where the class is defined.
74
-
75
- Returns
76
- -------
77
- str
78
- The module name
79
- """
80
- pass
81
-
82
- @abstractmethod
83
- def getAllAttributes(self) -> ClassAttributes:
84
- """
85
- Get all attributes of the instance.
86
-
87
- Returns
88
- -------
89
- Dict[str, Any]
90
- Dictionary of attribute names and their values
91
- """
92
- pass
93
-
94
- @abstractmethod
95
- def getAttributes(self) -> Dict[str, Any]:
96
- """
97
- Get all attributes of the instance.
98
-
99
- Returns
100
- -------
101
- Dict[str, Any]
102
- Dictionary of attribute names and their values
103
- """
104
- pass
105
-
106
- @abstractmethod
107
- def getPublicAttributes(self) -> Dict[str, Any]:
108
- """
109
- Get all public attributes of the instance.
110
-
111
- Returns
112
- -------
113
- Dict[str, Any]
114
- Dictionary of public attribute names and their values
115
- """
116
- pass
117
-
118
- @abstractmethod
119
- def getPrivateAttributes(self) -> Dict[str, Any]:
120
- """
121
- Get all private attributes of the instance.
122
-
123
- Returns
124
- -------
125
- Dict[str, Any]
126
- Dictionary of private attribute names and their values
127
- """
128
- pass
129
-
130
- @abstractmethod
131
- def getProtectedAttributes(self) -> Dict[str, Any]:
132
- """
133
- Get all Protected attributes of the instance.
134
-
135
- Returns
136
- -------
137
- Dict[str, Any]
138
- Dictionary of Protected attribute names and their values
139
- """
140
- pass
141
-
142
- @abstractmethod
143
- def getAllMethods(self):
144
- """
145
- Retrieves and categorizes all methods of the instance's class into various classifications.
146
- This method inspects the instance's class and its methods, categorizing them into public, private,
147
- protected, static, asynchronous, synchronous, class methods, asynchronous static, synchronous static,
148
- and magic methods.
149
- Returns
150
- -------
151
- ClassMethod
152
- An object containing categorized lists of method names:
153
- - public: List of public instance methods.
154
- - private: List of private instance methods (names without the class prefix).
155
- - protected: List of protected instance methods.
156
- - static: List of static methods.
157
- - asynchronous: List of asynchronous instance methods.
158
- - synchronous: List of synchronous instance methods.
159
- - class_methods: List of class methods.
160
- - asynchronous_static: List of asynchronous static methods.
161
- - synchronous_static: List of synchronous static methods.
162
- - magic: List of magic methods (e.g., `__init__`, `__str__`).
163
- Notes
164
- -----
165
- - Magic methods are identified by their double underscore prefix and suffix (e.g., `__init__`).
166
- - Private methods are identified by a single underscore followed by the class name.
167
- - Protected methods are identified by a single underscore prefix.
168
- - Public methods are identified as methods without any leading underscores.
169
- - Static and class methods are identified using `inspect.getattr_static`.
170
- - Asynchronous methods are identified using `inspect.iscoroutinefunction`.
171
- - Synchronous methods are identified as methods that are not asynchronous, static, or class methods.
172
- """
173
- pass
174
-
175
- @abstractmethod
176
- def getMethods(self) -> List[str]:
177
- """
178
- Get all method names of the instance.
179
-
180
- Returns
181
- -------
182
- List[str]
183
- List of method names
184
- """
185
- pass
186
-
187
- @abstractmethod
188
- def getProtectedMethods(self) -> List[str]:
189
- """
190
- Get all protected method names of the instance.
191
-
192
- Returns
193
- -------
194
- List[str]
195
- List of protected method names, excluding private methods (starting with '_')
196
- """
197
- pass
198
-
199
- @abstractmethod
200
- def getPrivateMethods(self) -> List[str]:
201
- """
202
- Get all private method names of the instance.
203
-
204
- Returns
205
- -------
206
- List[str]
207
- List of private method names, excluding protected methods (starting with '_')
208
- """
209
- pass
210
-
211
- @abstractmethod
212
- def getStaticMethods(self) -> List[str]:
213
- """
214
- Get all static method names of the instance.
215
-
216
- Returns
217
- -------
218
- List[str]
219
- List of static method names.
220
- """
221
- pass
222
-
223
- @abstractmethod
224
- def getAsyncMethods(self) -> List[str]:
225
- """
226
- Get all asynchronous method names of the instance that are not static methods.
227
-
228
- Returns
229
- -------
230
- List[str]
231
- List of asynchronous method names
232
- """
233
- pass
234
-
235
- @abstractmethod
236
- def getSyncMethods(self) -> List[str]:
237
- """
238
- Get all synchronous method names of the instance that are not static methods.
239
-
240
- Returns
241
- -------
242
- List[str]
243
- List of synchronous method names
244
- """
245
- pass
246
-
247
- @abstractmethod
248
- def getClassMethods(self) -> List[str]:
249
- """
250
- Get all class method names of the instance.
251
-
252
- Returns
253
- -------
254
- List[str]
255
- List of class method names.
256
- """
257
- pass
258
-
259
- @abstractmethod
260
- def getAsyncStaticMethods(self) -> List[str]:
261
- """
262
- Get all asynchronous method names of the instance that are not static methods.
263
-
264
- Returns
265
- -------
266
- List[str]
267
- List of asynchronous method names
268
- """
269
- pass
270
-
271
- @abstractmethod
272
- def getSyncStaticMethods(self) -> List[str]:
273
- """
274
- Get all synchronous static method names of the instance.
275
-
276
- Returns
277
- -------
278
- List[str]
279
- List of synchronous static method names
280
- """
281
- pass
282
-
283
- @abstractmethod
284
- def getMagicMethods(self) -> List[str]:
285
- """
286
- Get all magic method names of the instance.
287
-
288
- Returns
289
- -------
290
- List[str]
291
- List of magic method names
292
- """
293
- pass
294
-
295
- @abstractmethod
296
- def getAllProperties(self) -> Dict[str, ClassProperty]:
297
- """
298
- Get all properties of the instance.
299
-
300
- Returns
301
- -------
302
- List[str]
303
- List of property names
304
- """
305
- pass
306
-
307
- @abstractmethod
308
- def getPropertyNames(self) -> List[str]:
309
- """
310
- Get all property names of the instance.
311
-
312
- Returns
313
- -------
314
- List[str]
315
- List of property names
316
- """
317
- pass
318
-
319
- @abstractmethod
320
- def getProperty(self, property_name: str) -> Any:
321
- """
322
- Get the value of a property.
323
-
324
- Parameters
325
- ----------
326
- property_name : str
327
- Name of the property
328
-
329
- Returns
330
- -------
331
- Any
332
- The value of the property
333
-
334
- Raises
335
- ------
336
- AttributeError
337
- If the property doesn't exist or is not a property
338
- """
339
- pass
340
-
341
- @abstractmethod
342
- def getPropertySignature(self, property_name: str) -> inspect.Signature:
343
- """
344
- Get the signature of a property.
345
-
346
- Parameters
347
- ----------
348
- property_name : str
349
- Name of the property
350
-
351
- Returns
352
- -------
353
- inspect.Signature
354
- The property signature
355
-
356
- Raises
357
- ------
358
- AttributeError
359
- If the property doesn't exist or is not a property
360
- """
361
- pass
362
-
363
- @abstractmethod
364
- def getPropertyDoc(self, property_name: str) -> str:
365
- """
366
- Get the docstring of a property.
367
-
368
- Parameters
369
- ----------
370
- property_name : str
371
- Name of the property
372
-
373
- Returns
374
- -------
375
- str
376
- The docstring of the property
377
-
378
- Raises
379
- ------
380
- AttributeError
381
- If the property doesn't exist or is not a property
382
- """
383
- pass
384
-
385
- @abstractmethod
386
- def callMethod(self, method_name: str, *args: Any, **kwargs: Any) -> Any:
387
- """
388
- Call a method on the instance.
389
-
390
- Parameters
391
- ----------
392
- method_name : str
393
- Name of the method to call
394
- *args : Any
395
- Positional arguments for the method
396
- **kwargs : Any
397
- Keyword arguments for the method
398
-
399
- Returns
400
- -------
401
- Any
402
- The result of the method call
403
-
404
- Raises
405
- ------
406
- AttributeError
407
- If the method does not exist on the instance
408
- TypeError
409
- If the method is not callable
410
- """
411
- pass
412
-
413
- @abstractmethod
414
- def getMethodSignature(self, method_name: str) -> inspect.Signature:
415
- """
416
- Get the signature of a method.
417
-
418
- Parameters
419
- ----------
420
- method_name : str
421
- Name of the method
422
-
423
- Returns
424
- -------
425
- inspect.Signature
426
- The method signature
427
- """
428
- pass
429
-
430
- @abstractmethod
431
- def getDocstring(self) -> Optional[str]:
432
- """
433
- Get the docstring of the instance's class.
434
-
435
- Returns
436
- -------
437
- Optional[str]
438
- The class docstring, or None if not available
439
- """
440
- pass
441
-
442
- @abstractmethod
443
- def getBaseClasses(self) -> Tuple[Type, ...]:
444
- """
445
- Get the base classes of the instance's class.
446
-
447
- Returns
448
- -------
449
- Tuple[Type, ...]
450
- Tuple of base classes
451
- """
452
- pass
453
-
454
- @abstractmethod
455
- def isInstanceOf(self, cls: Type) -> bool:
456
- """
457
- Check if the instance is of a specific class.
458
-
459
- Parameters
460
- ----------
461
- cls : Type
462
- The class to check against
463
-
464
- Returns
465
- -------
466
- bool
467
- True if the instance is of the specified class
468
- """
469
- pass
470
-
471
- @abstractmethod
472
- def getSourceCode(self) -> Optional[str]:
473
- """
474
- Get the source code of the instance's class.
475
-
476
- Returns
477
- -------
478
- Optional[str]
479
- The source code if available, None otherwise
480
- """
481
- pass
482
-
483
- @abstractmethod
484
- def getFileLocation(self) -> Optional[str]:
485
- """
486
- Get the file location where the class is defined.
487
-
488
- Returns
489
- -------
490
- Optional[str]
491
- The file path if available, None otherwise
492
- """
493
- pass
494
-
495
- @abstractmethod
496
- def getAnnotations(self) -> Dict[str, Any]:
497
- """
498
- Get type annotations of the class.
499
-
500
- Returns
501
- -------
502
- Dict[str, Any]
503
- Dictionary of attribute names and their type annotations
504
- """
505
- pass
506
-
507
- @abstractmethod
508
- def hasAttribute(self, name: str) -> bool:
509
- """
510
- Check if the instance has a specific attribute.
511
-
512
- Parameters
513
- ----------
514
- name : str
515
- The attribute name to check
516
-
517
- Returns
518
- -------
519
- bool
520
- True if the attribute exists
521
- """
522
- pass
523
-
524
- @abstractmethod
525
- def getAttribute(self, name: str) -> Any:
526
- """
527
- Get an attribute value by name.
528
-
529
- Parameters
530
- ----------
531
- name : str
532
- The attribute name
533
-
534
- Returns
535
- -------
536
- Any
537
- The attribute value
538
-
539
- Raises
540
- ------
541
- AttributeError
542
- If the attribute doesn't exist
543
- """
544
- pass
545
-
546
- @abstractmethod
547
- def setAttribute(self, name: str, value: Any) -> None:
548
- """
549
- Set an attribute value.
550
-
551
- Parameters
552
- ----------
553
- name : str
554
- The attribute name
555
- value : Any
556
- The value to set
557
-
558
- Raises
559
- ------
560
- AttributeError
561
- If the attribute is read-only
562
- """
563
- pass
564
-
565
- @abstractmethod
566
- def removeAttribute(self, name: str) -> None:
567
- """
568
- Remove an attribute from the instance.
569
-
570
- Parameters
571
- ----------
572
- name : str
573
- The attribute name to remove
574
-
575
- Raises
576
- ------
577
- AttributeError
578
- If the attribute doesn't exist or is read-only
579
- """
580
- pass
581
-
582
- @abstractmethod
583
- def setMacro(self, name: str, value: Callable) -> None:
584
- """
585
- Set a callable attribute value.
586
-
587
- Parameters
588
- ----------
589
- name : str
590
- The attribute name
591
- value : Callable
592
- The callable to set
593
-
594
- Raises
595
- ------
596
- AttributeError
597
- If the value is not callable
598
- """
599
- pass
600
-
601
- @abstractmethod
602
- def removeMacro(self, name: str) -> None:
603
- """
604
- Remove a callable attribute from the instance.
605
-
606
- Parameters
607
- ----------
608
- name : str
609
- The attribute name to remove
610
-
611
- Raises
612
- ------
613
- AttributeError
614
- If the attribute doesn't exist or is not callable
615
- """
616
- pass
617
-
618
- @abstractmethod
619
- def getConstructorDependencies(self) -> ClassDependency:
620
- """
621
- Get the resolved and unresolved dependencies from the constructor of the instance's class.
622
-
623
- Returns
624
- -------
625
- ClassDependency
626
- A structured representation of the constructor dependencies, containing:
627
- - resolved: Dictionary of resolved dependencies with their names and values.
628
- - unresolved: List of unresolved dependencies (parameter names without default values or annotations).
629
- """
630
- pass
631
-
632
- @abstractmethod
633
- def getMethodDependencies(self, method_name: str) -> MethodDependency:
634
- """
635
- Get the resolved and unresolved dependencies from a method of the instance's class.
636
-
637
- Parameters
638
- ----------
639
- method_name : str
640
- The name of the method to inspect
641
-
642
- Returns
643
- -------
644
- MethodDependency
645
- A structured representation of the method dependencies, containing:
646
- - resolved: Dictionary of resolved dependencies with their names and values.
647
- - unresolved: List of unresolved dependencies (parameter names without default values or annotations).
648
- """
649
- pass