orionis 0.299.0__py3-none-any.whl → 0.300.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/metadata/framework.py +1 -1
- orionis/services/introspection/concretes/__init__.py +0 -0
- orionis/services/introspection/concretes/reflection_concrete.py +1444 -0
- orionis/services/introspection/instances/reflection_instance.py +70 -47
- {orionis-0.299.0.dist-info → orionis-0.300.0.dist-info}/METADATA +1 -1
- {orionis-0.299.0.dist-info → orionis-0.300.0.dist-info}/RECORD +11 -9
- tests/support/inspection/fakes/fake_reflect_instance.py +325 -90
- {orionis-0.299.0.dist-info → orionis-0.300.0.dist-info}/WHEEL +0 -0
- {orionis-0.299.0.dist-info → orionis-0.300.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.299.0.dist-info → orionis-0.300.0.dist-info}/top_level.txt +0 -0
- {orionis-0.299.0.dist-info → orionis-0.300.0.dist-info}/zip-safe +0 -0
@@ -1,146 +1,381 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
class BaseFakeClass:
|
4
|
+
"""
|
5
|
+
A base class for creating fake or mock classes in tests.
|
6
|
+
|
7
|
+
This class serves as a simple parent class for test doubles used in inspection-related tests.
|
8
|
+
"""
|
4
9
|
pass
|
5
10
|
|
6
11
|
class FakeClass(BaseFakeClass):
|
7
12
|
"""
|
8
|
-
FakeClass is a test double for inspection and
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
FakeClass is a test double class designed to simulate a variety of attribute and method visibilities for inspection and testing purposes.
|
14
|
+
This class provides:
|
15
|
+
- Public, protected, and private class-level and instance-level attributes.
|
16
|
+
- Public, protected, and private properties.
|
17
|
+
- Synchronous and asynchronous instance methods with varying visibilities.
|
18
|
+
- Synchronous and asynchronous class methods with varying visibilities.
|
19
|
+
- Synchronous and asynchronous static methods with varying visibilities.
|
20
|
+
public_attr (int): A public class and instance attribute set to 42.
|
21
|
+
dynamic_attr: A public attribute initialized to None, can be set dynamically.
|
22
|
+
_protected_attr (str): A protected class and instance attribute set to "protected".
|
23
|
+
__private_attr (str): A private class and instance attribute set to "private".
|
24
|
+
Properties:
|
25
|
+
computed_public_property (str): Returns "public property".
|
26
|
+
_computed_property_protected (str): Returns "protected property".
|
27
|
+
__computed_property_private (str): Returns "private property".
|
17
28
|
Methods:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Private
|
29
|
+
instanceSyncMethod(x: int, y: int) -> int:
|
30
|
+
instanceAsyncMethod(x: int, y: int) -> int:
|
31
|
+
_protectedsyncMethod(x: int, y: int) -> int:
|
32
|
+
Protected synchronous addition method.
|
33
|
+
_protectedAsyncMethod(x: int, y: int) -> int:
|
34
|
+
Protected asynchronous addition method.
|
35
|
+
__privateSyncMethod(x: int, y: int) -> int:
|
36
|
+
Private synchronous addition method.
|
37
|
+
__privateAsyncMethod(x: int, y: int) -> int:
|
38
|
+
Private asynchronous addition method.
|
39
|
+
Class Methods:
|
40
|
+
classSyncMethod(x: int, y: int) -> int:
|
41
|
+
classAsyncMethod(x: int, y: int) -> int:
|
42
|
+
_classMethodProtected(x: int, y: int) -> int:
|
43
|
+
Protected synchronous class addition method.
|
44
|
+
_classAsyncMethodProtected(x: int, y: int) -> int:
|
45
|
+
Protected asynchronous class addition method.
|
46
|
+
__classMethodPrivate(x: int, y: int) -> int:
|
47
|
+
Private synchronous class addition method.
|
48
|
+
__classAsyncMethodPrivate(x: int, y: int) -> int:
|
49
|
+
Private asynchronous class addition method.
|
50
|
+
Static Methods:
|
28
51
|
staticMethod(text: str) -> str:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
52
|
+
Synchronously converts the input text to uppercase.
|
53
|
+
staticAsyncMethod(text: str) -> str:
|
54
|
+
Asynchronously converts the input text to uppercase.
|
55
|
+
_staticMethodProtected(text: str) -> str:
|
56
|
+
Protected synchronous static method to uppercase text.
|
57
|
+
_staticAsyncMethodProtected(text: str) -> str:
|
58
|
+
Protected asynchronous static method to uppercase text.
|
59
|
+
__staticMethodPrivate(text: str) -> str:
|
60
|
+
Private synchronous static method to uppercase text.
|
61
|
+
__staticAsyncMethodPrivate(text: str) -> str:
|
62
|
+
Private asynchronous static method to uppercase text.
|
63
|
+
Note:
|
64
|
+
This class is intended for testing and inspection of attribute and method visibility, including Python's name mangling for private members.
|
42
65
|
"""
|
43
66
|
|
44
|
-
|
67
|
+
# Class-level attribute (Public)
|
68
|
+
public_attr: int = 42
|
69
|
+
dynamic_attr = None
|
45
70
|
|
46
|
-
|
47
|
-
|
48
|
-
self._protected_attr = "protected"
|
49
|
-
self.__private_attr = "private"
|
50
|
-
self.dynamic_attr = None
|
51
|
-
self.__dd__ = "dunder_value"
|
71
|
+
# Class-level attribute (Protected)
|
72
|
+
_protected_attr: str = "protected"
|
52
73
|
|
53
|
-
|
54
|
-
|
55
|
-
|
74
|
+
# Class-level attribute (Private)
|
75
|
+
__private_attr: str = "private"
|
76
|
+
__dd__: str = "dunder_value"
|
56
77
|
|
57
78
|
@property
|
58
|
-
def
|
59
|
-
"""
|
60
|
-
|
79
|
+
def computed_public_property(self) -> str:
|
80
|
+
"""
|
81
|
+
Returns the string "public" as a computed property.
|
82
|
+
|
83
|
+
Returns:
|
84
|
+
str: The string "public".
|
85
|
+
"""
|
86
|
+
return f"public property"
|
61
87
|
|
62
88
|
@property
|
63
89
|
def _computed_property_protected(self) -> str:
|
90
|
+
"""
|
91
|
+
Returns a string indicating that this is a protected computed property.
|
92
|
+
|
93
|
+
Returns:
|
94
|
+
str: The string "protected".
|
95
|
+
"""
|
64
96
|
"""A computed property."""
|
65
|
-
return f"protected"
|
97
|
+
return f"protected property"
|
66
98
|
|
67
99
|
@property
|
68
100
|
def __computed_property_private(self) -> str:
|
69
|
-
"""
|
70
|
-
|
101
|
+
"""
|
102
|
+
Returns the string "private".
|
103
|
+
|
104
|
+
This is a private computed property method, typically used for internal logic or testing purposes.
|
105
|
+
|
106
|
+
Returns:
|
107
|
+
str: The string "private".
|
108
|
+
"""
|
109
|
+
return f"private property"
|
110
|
+
|
111
|
+
def __init__(self) -> None:
|
112
|
+
"""
|
113
|
+
Initializes the instance with various attributes for testing attribute visibility.
|
114
|
+
|
115
|
+
Attributes:
|
116
|
+
public_attr (int): A public attribute set to 42.
|
117
|
+
_protected_attr (str): A protected attribute set to "protected".
|
118
|
+
__private_attr (str): A private attribute set to "private".
|
119
|
+
dynamic_attr: An attribute initialized to None, can be set dynamically.
|
120
|
+
__dd__ (str): A dunder (double underscore) attribute set to "dunder_value".
|
121
|
+
"""
|
122
|
+
|
123
|
+
# Initialize attributes (Publics)
|
124
|
+
self.public_attr = 42
|
125
|
+
self.dynamic_attr = None
|
126
|
+
|
127
|
+
# Initialize attributes (Protected)
|
128
|
+
self._protected_attr = "protected"
|
129
|
+
|
130
|
+
# Initialize attributes (Private)
|
131
|
+
self.__private_attr = "private"
|
132
|
+
self.__dd__ = "dunder_value"
|
133
|
+
|
134
|
+
def instanceSyncMethod(self, x: int, y: int) -> int:
|
135
|
+
"""
|
136
|
+
Synchronously adds two integers and returns the result.
|
137
|
+
|
138
|
+
Args:
|
139
|
+
x (int): The first integer to add.
|
140
|
+
y (int): The second integer to add.
|
141
|
+
|
142
|
+
Returns:
|
143
|
+
int: The sum of x and y.
|
144
|
+
"""
|
145
|
+
return x + y
|
146
|
+
|
147
|
+
async def instanceAsyncMethod(self, x: int, y: int) -> int:
|
148
|
+
"""
|
149
|
+
Asynchronously adds two integers and returns the result.
|
150
|
+
|
151
|
+
Args:
|
152
|
+
x (int): The first integer to add.
|
153
|
+
y (int): The second integer to add.
|
154
|
+
|
155
|
+
Returns:
|
156
|
+
int: The sum of x and y.
|
157
|
+
"""
|
158
|
+
await asyncio.sleep(0.1)
|
159
|
+
return x + y
|
160
|
+
|
161
|
+
def _protectedsyncMethod(self, x: int, y: int) -> int:
|
162
|
+
"""
|
163
|
+
Synchronously adds two integers and returns the result (protected method).
|
164
|
+
|
165
|
+
Args:
|
166
|
+
x (int): The first integer to add.
|
167
|
+
y (int): The second integer to add.
|
168
|
+
|
169
|
+
Returns:
|
170
|
+
int: The sum of x and y.
|
171
|
+
"""
|
172
|
+
return x + y
|
173
|
+
|
174
|
+
async def _protectedAsyncMethod(self, x: int, y: int) -> int:
|
175
|
+
"""
|
176
|
+
Asynchronously adds two integers and returns the result (protected method).
|
177
|
+
|
178
|
+
Args:
|
179
|
+
x (int): The first integer to add.
|
180
|
+
y (int): The second integer to add.
|
181
|
+
|
182
|
+
Returns:
|
183
|
+
int: The sum of x and y.
|
184
|
+
"""
|
185
|
+
await asyncio.sleep(0.1)
|
186
|
+
return x + y
|
187
|
+
|
188
|
+
def __privateSyncMethod(self, x: int, y: int) -> int:
|
189
|
+
"""
|
190
|
+
Synchronously adds two integers and returns the result (private method).
|
191
|
+
|
192
|
+
Args:
|
193
|
+
x (int): The first integer to add.
|
194
|
+
y (int): The second integer to add.
|
195
|
+
|
196
|
+
Returns:
|
197
|
+
int: The sum of x and y.
|
198
|
+
"""
|
199
|
+
return x + y
|
200
|
+
|
201
|
+
async def __privateAsyncMethod(self, x: int, y: int) -> int:
|
202
|
+
"""
|
203
|
+
Asynchronously adds two integers and returns the result (private method).
|
204
|
+
|
205
|
+
Args:
|
206
|
+
x (int): The first integer to add.
|
207
|
+
y (int): The second integer to add.
|
208
|
+
|
209
|
+
Returns:
|
210
|
+
int: The sum of x and y.
|
211
|
+
"""
|
212
|
+
await asyncio.sleep(0.1)
|
213
|
+
return x + y
|
71
214
|
|
72
215
|
@classmethod
|
73
|
-
def
|
74
|
-
"""
|
75
|
-
|
216
|
+
def classSyncMethod(cls, x: int, y: int) -> int:
|
217
|
+
"""
|
218
|
+
Synchronously adds two integers and returns the result (class method).
|
219
|
+
|
220
|
+
Args:
|
221
|
+
x (int): The first integer to add.
|
222
|
+
y (int): The second integer to add.
|
223
|
+
|
224
|
+
Returns:
|
225
|
+
int: The sum of x and y.
|
226
|
+
"""
|
227
|
+
return x + y
|
76
228
|
|
77
229
|
@classmethod
|
78
|
-
async def
|
79
|
-
"""
|
80
|
-
|
230
|
+
async def classAsyncMethod(cls, x: int, y: int) -> int:
|
231
|
+
"""
|
232
|
+
Asynchronously adds two integers and returns the result (class method).
|
233
|
+
|
234
|
+
Args:
|
235
|
+
x (int): The first integer to add.
|
236
|
+
y (int): The second integer to add.
|
237
|
+
|
238
|
+
Returns:
|
239
|
+
int: The sum of x and y.
|
240
|
+
"""
|
241
|
+
await asyncio.sleep(0.1)
|
242
|
+
return x + y
|
81
243
|
|
82
244
|
@classmethod
|
83
|
-
def
|
84
|
-
"""
|
85
|
-
|
245
|
+
def _classMethodProtected(cls, x: int, y: int) -> int:
|
246
|
+
"""
|
247
|
+
Synchronously adds two integers and returns the result (protected class method).
|
248
|
+
|
249
|
+
Args:
|
250
|
+
x (int): The first integer to add.
|
251
|
+
y (int): The second integer to add.
|
252
|
+
|
253
|
+
Returns:
|
254
|
+
int: The sum of x and y.
|
255
|
+
"""
|
256
|
+
return x + y
|
86
257
|
|
87
258
|
@classmethod
|
88
|
-
async def
|
89
|
-
"""
|
90
|
-
|
259
|
+
async def _classAsyncMethodProtected(cls, x: int, y: int) -> int:
|
260
|
+
"""
|
261
|
+
Asynchronously adds two integers and returns the result (protected class method).
|
262
|
+
|
263
|
+
Args:
|
264
|
+
x (int): The first integer to add.
|
265
|
+
y (int): The second integer to add.
|
266
|
+
|
267
|
+
Returns:
|
268
|
+
int: The sum of x and y.
|
269
|
+
"""
|
270
|
+
await asyncio.sleep(0.1)
|
271
|
+
return x + y
|
91
272
|
|
92
273
|
@classmethod
|
93
|
-
def
|
94
|
-
"""
|
95
|
-
|
274
|
+
def __classMethodPrivate(cls, x: int, y: int) -> int:
|
275
|
+
"""
|
276
|
+
Synchronously adds two integers and returns the result (private class method).
|
277
|
+
|
278
|
+
Args:
|
279
|
+
x (int): The first integer to add.
|
280
|
+
y (int): The second integer to add.
|
281
|
+
|
282
|
+
Returns:
|
283
|
+
int: The sum of x and y.
|
284
|
+
"""
|
285
|
+
return x + y
|
96
286
|
|
97
287
|
@classmethod
|
98
|
-
async def
|
99
|
-
"""
|
100
|
-
|
288
|
+
async def __classAsyncMethodPrivate(cls, x: int, y: int) -> int:
|
289
|
+
"""
|
290
|
+
Asynchronously adds two integers and returns the result (private class method).
|
291
|
+
|
292
|
+
Args:
|
293
|
+
x (int): The first integer to add.
|
294
|
+
y (int): The second integer to add.
|
295
|
+
|
296
|
+
Returns:
|
297
|
+
int: The sum of x and y.
|
298
|
+
"""
|
299
|
+
await asyncio.sleep(0.1)
|
300
|
+
return x + y
|
101
301
|
|
102
302
|
@staticmethod
|
103
303
|
def staticMethod(text: str) -> str:
|
104
|
-
"""
|
105
|
-
|
304
|
+
"""
|
305
|
+
Synchronously converts the input text to uppercase (static method).
|
106
306
|
|
107
|
-
|
108
|
-
|
109
|
-
|
307
|
+
Args:
|
308
|
+
text (str): The input string.
|
309
|
+
|
310
|
+
Returns:
|
311
|
+
str: The uppercase version of the input string.
|
312
|
+
"""
|
110
313
|
return text.upper()
|
111
314
|
|
112
315
|
@staticmethod
|
113
316
|
async def staticAsyncMethod(text: str) -> str:
|
114
|
-
"""
|
317
|
+
"""
|
318
|
+
Asynchronously converts the input text to uppercase (static method).
|
319
|
+
|
320
|
+
Args:
|
321
|
+
text (str): The input string.
|
322
|
+
|
323
|
+
Returns:
|
324
|
+
str: The uppercase version of the input string.
|
325
|
+
"""
|
115
326
|
await asyncio.sleep(0.1)
|
116
327
|
return text.upper()
|
117
328
|
|
118
329
|
@staticmethod
|
119
|
-
def
|
120
|
-
"""
|
330
|
+
def _staticMethodProtected(text: str) -> str:
|
331
|
+
"""
|
332
|
+
Synchronously converts the input text to uppercase (protected static method).
|
333
|
+
|
334
|
+
Args:
|
335
|
+
text (str): The input string.
|
336
|
+
|
337
|
+
Returns:
|
338
|
+
str: The uppercase version of the input string.
|
339
|
+
"""
|
121
340
|
return text.upper()
|
122
341
|
|
123
342
|
@staticmethod
|
124
|
-
async def
|
125
|
-
"""
|
343
|
+
async def _staticAsyncMethodProtected(text: str) -> str:
|
344
|
+
"""
|
345
|
+
Asynchronously converts the input text to uppercase (protected static method).
|
346
|
+
|
347
|
+
Args:
|
348
|
+
text (str): The input string.
|
349
|
+
|
350
|
+
Returns:
|
351
|
+
str: The uppercase version of the input string.
|
352
|
+
"""
|
353
|
+
await asyncio.sleep(0.1)
|
126
354
|
return text.upper()
|
127
355
|
|
128
356
|
@staticmethod
|
129
|
-
|
130
|
-
"""
|
131
|
-
|
357
|
+
def __staticMethodPrivate(text: str) -> str:
|
358
|
+
"""
|
359
|
+
Synchronously converts the input text to uppercase (private static method).
|
132
360
|
|
133
|
-
|
134
|
-
|
135
|
-
return "This is private"
|
361
|
+
Args:
|
362
|
+
text (str): The input string.
|
136
363
|
|
137
|
-
|
138
|
-
|
139
|
-
|
364
|
+
Returns:
|
365
|
+
str: The uppercase version of the input string.
|
366
|
+
"""
|
367
|
+
return text.upper()
|
140
368
|
|
141
|
-
|
142
|
-
|
143
|
-
|
369
|
+
@staticmethod
|
370
|
+
async def __staticAsyncMethodPrivate(text: str) -> str:
|
371
|
+
"""
|
372
|
+
Asynchronously converts the input text to uppercase (private static method).
|
144
373
|
|
145
|
-
|
146
|
-
|
374
|
+
Args:
|
375
|
+
text (str): The input string.
|
376
|
+
|
377
|
+
Returns:
|
378
|
+
str: The uppercase version of the input string.
|
379
|
+
"""
|
380
|
+
await asyncio.sleep(0.1)
|
381
|
+
return text.upper()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|