orionis 0.300.0__py3-none-any.whl → 0.302.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.
@@ -0,0 +1,893 @@
1
+ from abc import ABC, abstractmethod
2
+ import inspect
3
+ from typing import List, Type
4
+ from orionis.services.introspection.dependencies.entities.class_dependencies import ClassDependency
5
+ from orionis.services.introspection.dependencies.entities.method_dependencies import MethodDependency
6
+
7
+ class IReflectionAbstract(ABC):
8
+
9
+ @abstractmethod
10
+ def getClass(self) -> Type:
11
+ """
12
+ Returns the class type that this reflection concrete is based on.
13
+
14
+ Returns
15
+ -------
16
+ Type
17
+ The class type provided during initialization.
18
+ """
19
+ pass
20
+
21
+ @abstractmethod
22
+ def getClassName(self) -> str:
23
+ """
24
+ Returns the name of the class type.
25
+
26
+ Returns
27
+ -------
28
+ str
29
+ The name of the class type.
30
+ """
31
+ pass
32
+
33
+ @abstractmethod
34
+ def getModuleName(self) -> str:
35
+ """
36
+ Returns the name of the module where the class is defined.
37
+
38
+ Returns
39
+ -------
40
+ str
41
+ The name of the module.
42
+ """
43
+ pass
44
+
45
+ @abstractmethod
46
+ def getModuleWithClassName(self) -> str:
47
+ """
48
+ Returns the module name concatenated with the class name.
49
+
50
+ Returns
51
+ -------
52
+ str
53
+ The module name followed by the class name.
54
+ """
55
+ pass
56
+
57
+ @abstractmethod
58
+ def getDocstring(self) -> str:
59
+ """
60
+ Returns the docstring of the class.
61
+
62
+ Returns
63
+ -------
64
+ str or None
65
+ The docstring of the class, or None if not defined.
66
+ """
67
+ pass
68
+
69
+ @abstractmethod
70
+ def getBaseClasses(self) -> list:
71
+ """
72
+ Returns a list of base classes of the reflected class.
73
+
74
+ Returns
75
+ -------
76
+ list
77
+ A list of base classes.
78
+ """
79
+ pass
80
+
81
+ @abstractmethod
82
+ def getSourceCode(self) -> str:
83
+ """
84
+ Returns the source code of the class.
85
+
86
+ Returns
87
+ -------
88
+ str
89
+ The source code of the class.
90
+
91
+ Raises
92
+ ------
93
+ ReflectionValueError
94
+ If the source code cannot be retrieved.
95
+ """
96
+ pass
97
+
98
+ @abstractmethod
99
+ def getFile(self) -> str:
100
+ """
101
+ Returns the file path where the class is defined.
102
+
103
+ Returns
104
+ -------
105
+ str
106
+ The file path of the class definition.
107
+
108
+ Raises
109
+ ------
110
+ ReflectionValueError
111
+ If the file path cannot be retrieved.
112
+ """
113
+ pass
114
+
115
+ @abstractmethod
116
+ def getAnnotations(self) -> dict:
117
+ """
118
+ Returns the type annotations of the class.
119
+
120
+ Returns
121
+ -------
122
+ dict
123
+ A dictionary of type annotations.
124
+ """
125
+ pass
126
+
127
+ @abstractmethod
128
+ def hasAttribute(self, attribute: str) -> bool:
129
+ """
130
+ Checks if the class has a specific attribute.
131
+
132
+ Parameters
133
+ ----------
134
+ attribute : str
135
+ The name of the attribute to check.
136
+
137
+ Returns
138
+ -------
139
+ bool
140
+ True if the class has the specified attribute, False otherwise.
141
+ """
142
+ pass
143
+
144
+ @abstractmethod
145
+ def getAttribute(self, attribute: str):
146
+ """
147
+ Returns the value of a specific class attribute.
148
+
149
+ Parameters
150
+ ----------
151
+ attribute : str
152
+ The name of the attribute to retrieve.
153
+
154
+ Returns
155
+ -------
156
+ Any
157
+ The value of the specified class attribute.
158
+
159
+ Raises
160
+ ------
161
+ ReflectionValueError
162
+ If the attribute does not exist or is not accessible.
163
+ """
164
+ pass
165
+
166
+ @abstractmethod
167
+ def setAttribute(self, name: str, value) -> bool:
168
+ """
169
+ Set an attribute value.
170
+
171
+ Parameters
172
+ ----------
173
+ name : str
174
+ The attribute name
175
+ value : Any
176
+ The value to set
177
+
178
+ Raises
179
+ ------
180
+ ReflectionValueError
181
+ If the attribute is read-only or invalid
182
+ """
183
+ pass
184
+
185
+ @abstractmethod
186
+ def removeAttribute(self, name: str) -> bool:
187
+ """
188
+ Remove an attribute from the class.
189
+
190
+ Parameters
191
+ ----------
192
+ name : str
193
+ The name of the attribute to remove.
194
+
195
+ Raises
196
+ ------
197
+ ReflectionValueError
198
+ If the attribute does not exist or cannot be removed.
199
+ """
200
+ pass
201
+
202
+ @abstractmethod
203
+ def getAttributes(self) -> dict:
204
+ """
205
+ Returns a dictionary of all class attributes (not instance attributes).
206
+
207
+ Parameters
208
+ ----------
209
+ None
210
+
211
+ Returns
212
+ -------
213
+ dict
214
+ A dictionary where keys are the names of class attributes and values are their corresponding values.
215
+ Only attributes that are not callable, not static/class methods, not properties, and do not start with
216
+ underscores (including dunder, protected, or private) are included.
217
+ """
218
+ pass
219
+
220
+ @abstractmethod
221
+ def getPublicAttributes(self) -> dict:
222
+ """
223
+ Returns a dictionary of public class attributes (not instance attributes).
224
+
225
+ Parameters
226
+ ----------
227
+ None
228
+
229
+ Returns
230
+ -------
231
+ dict
232
+ A dictionary where keys are the names of public class attributes and values are their corresponding values.
233
+ Only attributes that are not callable, not static/class methods, not properties, and do not start with
234
+ underscores (including dunder, protected, or private) are included.
235
+ """
236
+ pass
237
+
238
+ @abstractmethod
239
+ def getProtectedAttributes(self) -> dict:
240
+ """
241
+ Returns a dictionary of protected class attributes (not instance attributes).
242
+
243
+ Parameters
244
+ ----------
245
+ None
246
+
247
+ Returns
248
+ -------
249
+ dict
250
+ A dictionary where keys are the names of protected class attributes and values are their corresponding values.
251
+ Only attributes that are not callable, not static/class methods, not properties, and start with a single underscore
252
+ (indicating protected visibility) are included.
253
+ """
254
+ pass
255
+
256
+ @abstractmethod
257
+ def getPrivateAttributes(self) -> dict:
258
+ """
259
+ Returns a dictionary of private class attributes (not instance attributes).
260
+
261
+ Parameters
262
+ ----------
263
+ None
264
+
265
+ Returns
266
+ -------
267
+ dict
268
+ A dictionary where keys are the names of private class attributes and values are their corresponding values.
269
+ Only attributes that are not callable, not static/class methods, not properties, and start with double underscores
270
+ (indicating private visibility) are included.
271
+ """
272
+ pass
273
+
274
+ @abstractmethod
275
+ def getDunderAttributes(self) -> dict:
276
+ """
277
+ Returns a dictionary of dunder (double underscore) class attributes (not instance attributes).
278
+
279
+ Parameters
280
+ ----------
281
+ None
282
+
283
+ Returns
284
+ -------
285
+ dict
286
+ A dictionary where keys are the names of dunder class attributes and values are their corresponding values.
287
+ Only attributes that are not callable, not static/class methods, not properties, and start with double underscores
288
+ (indicating dunder visibility) are included.
289
+ """
290
+ pass
291
+
292
+ @abstractmethod
293
+ def getMagicAttributes(self) -> dict:
294
+ """
295
+ Returns a dictionary of magic (dunder) class attributes (not instance attributes).
296
+
297
+ Parameters
298
+ ----------
299
+ None
300
+
301
+ Returns
302
+ -------
303
+ dict
304
+ A dictionary where keys are the names of magic class attributes and values are their corresponding values.
305
+ Only attributes that are not callable, not static/class methods, not properties, and start with double underscores
306
+ (indicating magic visibility) are included.
307
+ """
308
+ pass
309
+
310
+ @abstractmethod
311
+ def hasMethod(self, name: str) -> bool:
312
+ """
313
+ Check if the instance has a specific method.
314
+
315
+ Parameters
316
+ ----------
317
+ name : str
318
+ The method name to check
319
+
320
+ Returns
321
+ -------
322
+ bool
323
+ True if the method exists, False otherwise
324
+ """
325
+ pass
326
+
327
+ @abstractmethod
328
+ def removeMethod(self, name: str) -> bool:
329
+ """
330
+ Remove a method from the class.
331
+
332
+ Parameters
333
+ ----------
334
+ name : str
335
+ The method name to remove
336
+
337
+ Raises
338
+ ------
339
+ ReflectionValueError
340
+ If the method does not exist or cannot be removed.
341
+ """
342
+ pass
343
+
344
+ @abstractmethod
345
+ def getMethodSignature(self, name: str) -> inspect.Signature:
346
+ """
347
+ Get the signature of a method.
348
+
349
+ Parameters
350
+ ----------
351
+ name : str
352
+ The method name to get the signature for
353
+
354
+ Returns
355
+ -------
356
+ str
357
+ The signature of the method
358
+
359
+ Raises
360
+ ------
361
+ ReflectionValueError
362
+ If the method does not exist or is not callable.
363
+ """
364
+ pass
365
+
366
+ @abstractmethod
367
+ def getMethods(self) -> List[str]:
368
+ """
369
+ Get all method names of the instance.
370
+
371
+ Returns
372
+ -------
373
+ List[str]
374
+ List of method names
375
+ """
376
+ pass
377
+
378
+ @abstractmethod
379
+ def getPublicMethods(self) -> list:
380
+ """
381
+ Returns a list of public class methods (not instance methods).
382
+
383
+ Parameters
384
+ ----------
385
+ None
386
+
387
+ Returns
388
+ -------
389
+ dict
390
+ A list where each element is the name of a public class method.
391
+ """
392
+ pass
393
+
394
+ @abstractmethod
395
+ def getPublicSyncMethods(self) -> list:
396
+ """
397
+ Get all public synchronous method names of the class.
398
+
399
+ Returns
400
+ -------
401
+ list
402
+ List of public synchronous method names
403
+ """
404
+ pass
405
+
406
+ @abstractmethod
407
+ def getPublicAsyncMethods(self) -> list:
408
+ """
409
+ Get all public asynchronous method names of the class.
410
+
411
+ Returns
412
+ -------
413
+ list
414
+ List of public asynchronous method names
415
+ """
416
+ pass
417
+
418
+ @abstractmethod
419
+ def getProtectedMethods(self) -> list:
420
+ """
421
+ Returns a list of protected class methods (not instance methods).
422
+
423
+ Parameters
424
+ ----------
425
+ None
426
+
427
+ Returns
428
+ -------
429
+ dict
430
+ A list where each element is the name of a protected class method.
431
+ """
432
+ pass
433
+
434
+ @abstractmethod
435
+ def getProtectedSyncMethods(self) -> list:
436
+ """
437
+ Get all protected synchronous method names of the class.
438
+
439
+ Returns
440
+ -------
441
+ list
442
+ List of protected synchronous method names
443
+ """
444
+ pass
445
+
446
+ @abstractmethod
447
+ def getProtectedAsyncMethods(self) -> list:
448
+ """
449
+ Get all protected asynchronous method names of the class.
450
+
451
+ Returns
452
+ -------
453
+ list
454
+ List of protected asynchronous method names
455
+ """
456
+ pass
457
+
458
+ @abstractmethod
459
+ def getPrivateMethods(self) -> list:
460
+ """
461
+ Returns a list of private class methods (not instance methods).
462
+
463
+ Parameters
464
+ ----------
465
+ None
466
+
467
+ Returns
468
+ -------
469
+ list
470
+ A list where each element is the name of a private class method.
471
+ """
472
+ pass
473
+
474
+ @abstractmethod
475
+ def getPrivateSyncMethods(self) -> list:
476
+ """
477
+ Get all private synchronous method names of the class.
478
+
479
+ Returns
480
+ -------
481
+ list
482
+ List of private synchronous method names
483
+ """
484
+ pass
485
+
486
+ @abstractmethod
487
+ def getPrivateAsyncMethods(self) -> list:
488
+ """
489
+ Get all private asynchronous method names of the class.
490
+
491
+ Returns
492
+ -------
493
+ list
494
+ List of private asynchronous method names
495
+ """
496
+ pass
497
+
498
+ @abstractmethod
499
+ def getPublicClassMethods(self) -> list:
500
+ """
501
+ Returns a list of public class methods (not instance methods).
502
+
503
+ Parameters
504
+ ----------
505
+ None
506
+
507
+ Returns
508
+ -------
509
+ list
510
+ A list where each element is the name of a public class method.
511
+ """
512
+ pass
513
+
514
+ @abstractmethod
515
+ def getPublicClassSyncMethods(self) -> list:
516
+ """
517
+ Get all public synchronous class method names of the class.
518
+
519
+ Returns
520
+ -------
521
+ list
522
+ List of public synchronous class method names
523
+ """
524
+ pass
525
+
526
+ @abstractmethod
527
+ def getPublicClassAsyncMethods(self) -> list:
528
+ """
529
+ Get all public asynchronous class method names of the class.
530
+
531
+ Returns
532
+ -------
533
+ list
534
+ List of public asynchronous class method names
535
+ """
536
+ pass
537
+
538
+ @abstractmethod
539
+ def getProtectedClassMethods(self) -> list:
540
+ """
541
+ Returns a list of protected class methods (not instance methods).
542
+
543
+ Parameters
544
+ ----------
545
+ None
546
+
547
+ Returns
548
+ -------
549
+ list
550
+ A list where each element is the name of a protected class method.
551
+ """
552
+ pass
553
+
554
+ @abstractmethod
555
+ def getProtectedClassSyncMethods(self) -> list:
556
+ """
557
+ Get all protected synchronous class method names of the class.
558
+
559
+ Returns
560
+ -------
561
+ list
562
+ List of protected synchronous class method names
563
+ """
564
+ pass
565
+
566
+ @abstractmethod
567
+ def getProtectedClassAsyncMethods(self) -> list:
568
+ """
569
+ Get all protected asynchronous class method names of the class.
570
+
571
+ Returns
572
+ -------
573
+ list
574
+ List of protected asynchronous class method names
575
+ """
576
+ pass
577
+
578
+ @abstractmethod
579
+ def getPrivateClassMethods(self) -> list:
580
+ """
581
+ Returns a list of private class methods (not instance methods).
582
+
583
+ Parameters
584
+ ----------
585
+ None
586
+
587
+ Returns
588
+ -------
589
+ list
590
+ A list where each element is the name of a private class method.
591
+ """
592
+ pass
593
+
594
+ @abstractmethod
595
+ def getPrivateClassSyncMethods(self) -> list:
596
+ """
597
+ Get all private synchronous class method names of the class.
598
+
599
+ Returns
600
+ -------
601
+ list
602
+ List of private synchronous class method names
603
+ """
604
+ pass
605
+
606
+ @abstractmethod
607
+ def getPrivateClassAsyncMethods(self) -> list:
608
+ """
609
+ Get all private asynchronous class method names of the class.
610
+
611
+ Returns
612
+ -------
613
+ list
614
+ List of private asynchronous class method names
615
+ """
616
+ pass
617
+
618
+ @abstractmethod
619
+ def getPublicStaticMethods(self) -> list:
620
+ """
621
+ Returns a list of public static methods of the class.
622
+
623
+ Parameters
624
+ ----------
625
+ None
626
+
627
+ Returns
628
+ -------
629
+ list
630
+ A list where each element is the name of a public static method.
631
+ """
632
+ pass
633
+
634
+ @abstractmethod
635
+ def getPublicStaticSyncMethods(self) -> list:
636
+ """
637
+ Get all public synchronous static method names of the class.
638
+
639
+ Returns
640
+ -------
641
+ list
642
+ List of public synchronous static method names
643
+ """
644
+ pass
645
+
646
+ @abstractmethod
647
+ def getPublicStaticAsyncMethods(self) -> list:
648
+ """
649
+ Get all public asynchronous static method names of the class.
650
+
651
+ Returns
652
+ -------
653
+ list
654
+ List of public asynchronous static method names
655
+ """
656
+ pass
657
+
658
+ @abstractmethod
659
+ def getProtectedStaticMethods(self) -> list:
660
+ """
661
+ Returns a list of protected static methods of the class.
662
+
663
+ Parameters
664
+ ----------
665
+ None
666
+
667
+ Returns
668
+ -------
669
+ list
670
+ A list where each element is the name of a protected static method.
671
+ """
672
+ pass
673
+
674
+ @abstractmethod
675
+ def getProtectedStaticSyncMethods(self) -> list:
676
+ """
677
+ Get all protected synchronous static method names of the class.
678
+
679
+ Returns
680
+ -------
681
+ list
682
+ List of protected synchronous static method names
683
+ """
684
+ pass
685
+
686
+ @abstractmethod
687
+ def getProtectedStaticAsyncMethods(self) -> list:
688
+ """
689
+ Get all protected asynchronous static method names of the class.
690
+
691
+ Returns
692
+ -------
693
+ list
694
+ List of protected asynchronous static method names
695
+ """
696
+ pass
697
+
698
+ @abstractmethod
699
+ def getPrivateStaticMethods(self) -> list:
700
+ """
701
+ Returns a list of private static methods of the class.
702
+
703
+ Parameters
704
+ ----------
705
+ None
706
+
707
+ Returns
708
+ -------
709
+ list
710
+ A list where each element is the name of a private static method.
711
+ """
712
+ pass
713
+
714
+ @abstractmethod
715
+ def getPrivateStaticSyncMethods(self) -> list:
716
+ """
717
+ Get all private synchronous static method names of the class.
718
+
719
+ Returns
720
+ -------
721
+ list
722
+ List of private synchronous static method names
723
+ """
724
+ pass
725
+
726
+ @abstractmethod
727
+ def getPrivateStaticAsyncMethods(self) -> list:
728
+ """
729
+ Get all private asynchronous static method names of the class.
730
+
731
+ Returns
732
+ -------
733
+ list
734
+ List of private asynchronous static method names
735
+ """
736
+ pass
737
+
738
+ @abstractmethod
739
+ def getDunderMethods(self) -> list:
740
+ """
741
+ Returns a list of dunder (double underscore) methods of the class.
742
+
743
+ Parameters
744
+ ----------
745
+ None
746
+
747
+ Returns
748
+ -------
749
+ list
750
+ A list where each element is the name of a dunder method.
751
+ """
752
+ pass
753
+
754
+ @abstractmethod
755
+ def getMagicMethods(self) -> list:
756
+ """
757
+ Returns a list of magic (dunder) methods of the class.
758
+
759
+ Parameters
760
+ ----------
761
+ None
762
+
763
+ Returns
764
+ -------
765
+ list
766
+ A list where each element is the name of a magic method.
767
+ """
768
+ pass
769
+
770
+ @abstractmethod
771
+ def getProperties(self) -> List:
772
+ """
773
+ Get all properties of the instance.
774
+
775
+ Returns
776
+ -------
777
+ List[str]
778
+ List of property names
779
+ """
780
+ pass
781
+
782
+ @abstractmethod
783
+ def getPublicProperties(self) -> List:
784
+ """
785
+ Get all public properties of the instance.
786
+
787
+ Returns
788
+ -------
789
+ List:
790
+ List of public property names and their values
791
+ """
792
+ pass
793
+
794
+ @abstractmethod
795
+ def getProtectedProperties(self) -> List:
796
+ """
797
+ Get all protected properties of the instance.
798
+
799
+ Returns
800
+ -------
801
+ List
802
+ List of protected property names and their values
803
+ """
804
+ pass
805
+
806
+ @abstractmethod
807
+ def getPrivateProperties(self) -> List:
808
+ """
809
+ Get all private properties of the instance.
810
+
811
+ Returns
812
+ -------
813
+ List
814
+ List of private property names and their values
815
+ """
816
+ pass
817
+
818
+ @abstractmethod
819
+ def getPropertySignature(self, name: str) -> inspect.Signature:
820
+ """
821
+ Get the signature of a property.
822
+
823
+ Parameters
824
+ ----------
825
+ name : str
826
+ The property name to get the signature for
827
+
828
+ Returns
829
+ -------
830
+ inspect.Signature
831
+ The signature of the property
832
+
833
+ Raises
834
+ ------
835
+ ReflectionValueError
836
+ If the property does not exist or is not accessible.
837
+ """
838
+ pass
839
+
840
+ @abstractmethod
841
+ def getPropiertyDocstring(self, name: str) -> str:
842
+ """
843
+ Get the docstring of a property.
844
+
845
+ Parameters
846
+ ----------
847
+ name : str
848
+ The property name to get the docstring for
849
+
850
+ Returns
851
+ -------
852
+ str
853
+ The docstring of the property
854
+
855
+ Raises
856
+ ------
857
+ ReflectionValueError
858
+ If the property does not exist or is not accessible.
859
+ """
860
+ pass
861
+
862
+ @abstractmethod
863
+ def getConstructorDependencies(self) -> ClassDependency:
864
+ """
865
+ Get the resolved and unresolved dependencies from the constructor of the instance's class.
866
+
867
+ Returns
868
+ -------
869
+ ClassDependency
870
+ A structured representation of the constructor dependencies, containing:
871
+ - resolved: Dictionary of resolved dependencies with their names and values.
872
+ - unresolved: List of unresolved dependencies (parameter names without default values or annotations).
873
+ """
874
+ pass
875
+
876
+ @abstractmethod
877
+ def getMethodDependencies(self, method_name: str) -> MethodDependency:
878
+ """
879
+ Get the resolved and unresolved dependencies from a method of the instance's class.
880
+
881
+ Parameters
882
+ ----------
883
+ method_name : str
884
+ The name of the method to inspect
885
+
886
+ Returns
887
+ -------
888
+ MethodDependency
889
+ A structured representation of the method dependencies, containing:
890
+ - resolved: Dictionary of resolved dependencies with their names and values.
891
+ - unresolved: List of unresolved dependencies (parameter names without default values or annotations).
892
+ """
893
+ pass