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,281 +0,0 @@
1
- from typing import Any, Type
2
- import inspect
3
- import importlib
4
-
5
- class HelpersReflection:
6
- """
7
- A collection of helper functions for reflection and inspection.
8
- """
9
-
10
- @staticmethod
11
- def isValidModule(module_name: str) -> bool:
12
- """Check if a module name is valid and can be imported.
13
-
14
- Parameters
15
- ----------
16
- module_name : str
17
- The name of the module to check
18
-
19
- Returns
20
- -------
21
- bool
22
- True if the module is valid and can be imported, False otherwise
23
- """
24
- try:
25
- importlib.import_module(module_name)
26
- return True
27
- except ImportError:
28
- return False
29
-
30
- @staticmethod
31
- def ensureValidModule(module_name: str) -> None:
32
- """Ensure a module name is valid and can be imported.
33
-
34
- Parameters
35
- ----------
36
- module_name : str
37
- The name of the module to check
38
-
39
- Raises
40
- ------
41
- ValueError
42
- If the module cannot be imported or is invalid
43
- """
44
- if not isinstance(module_name, str):
45
- raise TypeError(f"Module name must be a string, got {type(module_name)}")
46
- if not HelpersReflection.isValidModule(module_name):
47
- raise ValueError(f"Invalid or non-importable module: {module_name}")
48
-
49
- @staticmethod
50
- def isInstantiableClass(cls: Type) -> bool:
51
- """Check if a class is concrete and can be instantiated.
52
-
53
- Parameters
54
- ----------
55
- cls : Type
56
- The class to check
57
-
58
- Returns
59
- --
60
- bool
61
- True if the class is concrete and can be instantiated, False otherwise
62
- """
63
- if not isinstance(cls, type):
64
- return False
65
- if HelpersReflection.isAbstractClass(cls):
66
- return False
67
- try:
68
- # Try to create an instance to verify it's truly concrete
69
- cls()
70
- return True
71
- except TypeError:
72
- return False
73
-
74
- @staticmethod
75
- def ensureNotBuiltinType(cls: Type) -> None:
76
- """Ensure a class is not a built-in or primitive type.
77
-
78
- Parameters
79
- ----------
80
- cls : Type
81
- The class to check
82
-
83
- Raises
84
- ------
85
- TypeError
86
- If the input is not a class
87
- ValueError
88
- If the class is a built-in or primitive type
89
- """
90
- if not isinstance(cls, type):
91
- raise TypeError(f"Expected a class, got {type(cls)}")
92
-
93
- builtin_types = {
94
- int, float, str, bool, bytes, type(None), complex,
95
- list, tuple, dict, set, frozenset
96
- }
97
-
98
- if cls in builtin_types:
99
- raise ValueError(f"Class '{cls.__name__}' is a built-in or primitive type and cannot be used.")
100
-
101
- @staticmethod
102
- def ensureInstantiableClass(cls: Type) -> None:
103
- """Ensure a class is concrete and can be instantiated.
104
-
105
- Parameters
106
- ----------
107
- cls : Type
108
- The class to check
109
-
110
- Raises
111
- ------
112
- TypeError
113
- If the input is not a class
114
- ValueError
115
- If the class is abstract or cannot be instantiated
116
- """
117
- if HelpersReflection.ensureNotBuiltinType(cls):
118
- raise TypeError(f"Invalid class: {cls!r}")
119
- if not isinstance(cls, type):
120
- raise TypeError(f"Expected a class, got {type(cls)}")
121
- if HelpersReflection.isAbstractClass(cls):
122
- raise ValueError(f"Class '{cls.__name__}' is abstract")
123
- try:
124
- cls()
125
- except TypeError as e:
126
- raise ValueError(f"Class '{cls.__name__}' cannot be instantiated: {str(e)}")
127
-
128
- @staticmethod
129
- def isValidClassName(module_name: str, class_name: str) -> bool:
130
- """Check if a class exists in a given module.
131
-
132
- Parameters
133
- ----------
134
- module_name : str
135
- The name of the module to check
136
- class_name : str
137
- The name of the class to look for
138
-
139
- Returns
140
- -------
141
- bool
142
- True if the class exists in the module, False otherwise
143
- """
144
- try:
145
- module = importlib.import_module(module_name)
146
- return hasattr(module, class_name) and inspect.isclass(getattr(module, class_name))
147
- except ImportError:
148
- return False
149
-
150
- @staticmethod
151
- def ensureValidClassName(module_name: str, class_name: str) -> None:
152
- """Ensure a class exists in a given module.
153
-
154
- Parameters
155
- ----------
156
- module_name : str
157
- The name of the module to check
158
- class_name : str
159
- The name of the class to look for
160
-
161
- Raises
162
- ------
163
- ValueError
164
- If the class doesn't exist in the module
165
- """
166
- if not HelpersReflection.isValidClassName(module_name, class_name):
167
- raise ValueError(f"Class '{class_name}' not found in module '{module_name}'")
168
-
169
- @staticmethod
170
- def isUserDefinedClassInstance(instance: Any) -> bool:
171
- """Check if an object is an instance of a user-defined class.
172
-
173
- Parameters
174
- ----------
175
- instance : Any
176
- The object to check
177
-
178
- Returns
179
- -------
180
- bool
181
- True if the object is an instance of a user-defined class, False otherwise
182
- """
183
- return isinstance(instance, object) and type(instance).__module__ not in {'builtins', 'abc', '__main__'}
184
-
185
- @staticmethod
186
- def ensureUserDefinedClassInstance(instance: Any) -> None:
187
- """Ensure an object is an instance of a user-defined class.
188
-
189
- Parameters
190
- ----------
191
- instance : Any
192
- The object to check
193
-
194
- Raises
195
- ------
196
- TypeError
197
- If the input is not an object instance
198
- ValueError
199
- If the instance is from builtins, abc, or __main__
200
- """
201
- if not isinstance(instance, object):
202
- raise TypeError(f"Invalid object: {instance!r}")
203
- module = type(instance).__module__
204
- if module in {'builtins', 'abc'}:
205
- raise ValueError(f"'{instance!r}' is not a user-defined class instance, belongs to '{module}'.")
206
- if module == '__main__':
207
- raise ValueError("Instance originates from '__main__', origin indeterminate.")
208
-
209
- @staticmethod
210
- def isAbstractClass(cls: Type) -> bool:
211
- """Check if a class is abstract.
212
-
213
- Parameters
214
- ----------
215
- cls : Type
216
- The class to check
217
-
218
- Returns
219
- -------
220
- bool
221
- True if the class is abstract, False otherwise
222
- """
223
- return isinstance(cls, type) and bool(getattr(cls, '__abstractmethods__', False))
224
-
225
- @staticmethod
226
- def ensureAbstractClass(cls: Type) -> None:
227
- """Ensure a class is abstract.
228
-
229
- Parameters
230
- ----------
231
- cls : Type
232
- The class to check
233
-
234
- Raises
235
- ------
236
- TypeError
237
- If the input is not a class
238
- ValueError
239
- If the class is not abstract
240
- """
241
- if not isinstance(cls, type):
242
- raise TypeError(f"Invalid class: {cls!r}")
243
- if not HelpersReflection.isAbstractClass(cls):
244
- raise ValueError(f"Class '{cls.__name__}' is not abstract.")
245
-
246
- @staticmethod
247
- def isConcreteClass(cls: Type) -> bool:
248
- """Check if a class is concrete.
249
-
250
- Parameters
251
- ----------
252
- cls : Type
253
- The class to check
254
-
255
- Returns
256
- -------
257
- bool
258
- True if the class is concrete, False otherwise
259
- """
260
- return isinstance(cls, type) and not HelpersReflection.isAbstractClass(cls)
261
-
262
- @staticmethod
263
- def ensureConcreteClass(cls: Type) -> None:
264
- """Ensure a class is concrete.
265
-
266
- Parameters
267
- ----------
268
- cls : Type
269
- The class to check
270
-
271
- Raises
272
- ------
273
- TypeError
274
- If the input is not a class
275
- ValueError
276
- If the class is not concrete
277
- """
278
- if not isinstance(cls, type):
279
- raise TypeError(f"Invalid class: {cls!r}")
280
- if not HelpersReflection.isConcreteClass(cls):
281
- raise ValueError(f"Class '{cls.__name__}' is not concrete.")
File without changes