orionis 0.232.0__py3-none-any.whl → 0.233.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 +1 -1
- orionis/luminate/support/inspection/reflexion_instance.py +55 -2
- {orionis-0.232.0.dist-info → orionis-0.233.0.dist-info}/METADATA +1 -1
- {orionis-0.232.0.dist-info → orionis-0.233.0.dist-info}/RECORD +10 -10
- tests/support/inspection/fakes/fake_reflection_instance.py +2 -1
- tests/support/inspection/test_reflection_instance.py +31 -1
- {orionis-0.232.0.dist-info → orionis-0.233.0.dist-info}/LICENCE +0 -0
- {orionis-0.232.0.dist-info → orionis-0.233.0.dist-info}/WHEEL +0 -0
- {orionis-0.232.0.dist-info → orionis-0.233.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.232.0.dist-info → orionis-0.233.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
@@ -59,7 +59,59 @@ class ReflexionInstance:
|
|
59
59
|
Dict[str, Any]
|
60
60
|
Dictionary of attribute names and their values
|
61
61
|
"""
|
62
|
-
|
62
|
+
attributes : dict = vars(self._instance)
|
63
|
+
class_name : str = self.getClassName()
|
64
|
+
out_attributes = {}
|
65
|
+
for attr, value in attributes.items():
|
66
|
+
out_attributes[str(attr).replace(f"_{class_name}", "")] = value
|
67
|
+
return out_attributes
|
68
|
+
|
69
|
+
def getPublicAttributes(self) -> Dict[str, Any]:
|
70
|
+
"""Get all public attributes of the instance.
|
71
|
+
|
72
|
+
Returns
|
73
|
+
-------
|
74
|
+
Dict[str, Any]
|
75
|
+
Dictionary of public attribute names and their values
|
76
|
+
"""
|
77
|
+
attributes : dict = vars(self._instance)
|
78
|
+
out_attributes = {}
|
79
|
+
for attr, value in attributes.items():
|
80
|
+
if not str(attr).startswith("_"):
|
81
|
+
out_attributes[attr] = value
|
82
|
+
return out_attributes
|
83
|
+
|
84
|
+
def getPrivateAttributes(self) -> Dict[str, Any]:
|
85
|
+
"""Get all private attributes of the instance.
|
86
|
+
|
87
|
+
Returns
|
88
|
+
-------
|
89
|
+
Dict[str, Any]
|
90
|
+
Dictionary of private attribute names and their values
|
91
|
+
"""
|
92
|
+
attributes : dict = vars(self._instance)
|
93
|
+
class_name : str = self.getClassName()
|
94
|
+
out_attributes = {}
|
95
|
+
for attr, value in attributes.items():
|
96
|
+
if str(attr).startswith(f"_{class_name}"):
|
97
|
+
out_attributes[str(attr).replace(f"_{class_name}", "")] = value
|
98
|
+
return out_attributes
|
99
|
+
|
100
|
+
def getProtectedAttributes(self) -> Dict[str, Any]:
|
101
|
+
"""Get all Protected attributes of the instance.
|
102
|
+
|
103
|
+
Returns
|
104
|
+
-------
|
105
|
+
Dict[str, Any]
|
106
|
+
Dictionary of Protected attribute names and their values
|
107
|
+
"""
|
108
|
+
attributes : dict = vars(self._instance)
|
109
|
+
class_name : str = self.getClassName()
|
110
|
+
out_attributes = {}
|
111
|
+
for attr, value in attributes.items():
|
112
|
+
if str(attr).startswith("_") and not str(attr).startswith("__") and not str(attr).startswith(f"_{class_name}"):
|
113
|
+
out_attributes[attr] = value
|
114
|
+
return out_attributes
|
63
115
|
|
64
116
|
def getMethods(self) -> List[str]:
|
65
117
|
"""Get all method names of the instance.
|
@@ -452,7 +504,8 @@ class ReflexionInstance:
|
|
452
504
|
AttributeError
|
453
505
|
If the attribute doesn't exist
|
454
506
|
"""
|
455
|
-
|
507
|
+
attrs = self.getAttributes()
|
508
|
+
return attrs.get(name, getattr(self._instance, name, None))
|
456
509
|
|
457
510
|
def setAttribute(self, name: str, value: Any) -> None:
|
458
511
|
"""Set an attribute value.
|
@@ -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=
|
3
|
+
orionis/framework.py,sha256=zMVqUWppG3gKA3WkFIStp5LPdnRnvB_1vZjloIBbWv8,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=
|
176
|
+
orionis/luminate/support/inspection/reflexion_instance.py,sha256=GFtJMehIZq58jVJ8SOofQuwgk4IgWGV-g2PPGkKb24o,17598
|
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
|
@@ -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=
|
234
|
+
tests/support/inspection/test_reflection_instance.py,sha256=fapzzH2Qyacsy-S1I2Uq9k3B6fZ3Qbb3IJxvx451zoU,12668
|
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=
|
240
|
+
tests/support/inspection/fakes/fake_reflection_instance.py,sha256=P5lSFiGPLLAPOIRmw4VE3YWctxlqmXARRiWMSGLrg3E,1382
|
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.
|
253
|
-
orionis-0.
|
254
|
-
orionis-0.
|
255
|
-
orionis-0.
|
256
|
-
orionis-0.
|
257
|
-
orionis-0.
|
252
|
+
orionis-0.233.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
253
|
+
orionis-0.233.0.dist-info/METADATA,sha256=gp1CXdBLUnA91O29GEY1b6JD8w-kUcrK4y6nQdfTZHw,3003
|
254
|
+
orionis-0.233.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
255
|
+
orionis-0.233.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
|
256
|
+
orionis-0.233.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
257
|
+
orionis-0.233.0.dist-info/RECORD,,
|
@@ -10,7 +10,8 @@ class FakeClass(BaseFakeClass):
|
|
10
10
|
|
11
11
|
def __init__(self) -> None:
|
12
12
|
self.public_attr = 42
|
13
|
-
self.
|
13
|
+
self._protected_attr = "protected"
|
14
|
+
self.__private_attr = "private"
|
14
15
|
self.dynamic_attr = None
|
15
16
|
|
16
17
|
def instanceMethod(self, x: int, y: int) -> int:
|
@@ -38,9 +38,28 @@ class TestReflectionInstance(TestCase):
|
|
38
38
|
reflex = Reflection.instance(FakeClass())
|
39
39
|
attributes = reflex.getAttributes()
|
40
40
|
self.assertTrue("public_attr" in attributes)
|
41
|
-
self.assertTrue("
|
41
|
+
self.assertTrue("__private_attr" in attributes)
|
42
42
|
self.assertTrue("dynamic_attr" in attributes)
|
43
43
|
|
44
|
+
async def testReflectionInstanceGetPublicAttributes(self):
|
45
|
+
"""Ensure getPublicAttributes returns all public attributes."""
|
46
|
+
reflex = Reflection.instance(FakeClass())
|
47
|
+
attributes = reflex.getPublicAttributes()
|
48
|
+
self.assertTrue("public_attr" in attributes)
|
49
|
+
self.assertTrue("dynamic_attr" in attributes)
|
50
|
+
|
51
|
+
async def testReflectionInstanceGetProtectedAttributes(self):
|
52
|
+
"""Check that getProtectedAttributes returns all protected attributes."""
|
53
|
+
reflex = Reflection.instance(FakeClass())
|
54
|
+
attributes = reflex.getProtectedAttributes()
|
55
|
+
self.assertTrue("_protected_attr" in attributes)
|
56
|
+
|
57
|
+
async def testReflectionInstanceGetPrivateAttributes(self):
|
58
|
+
"""Ensure getPrivateAttributes returns all private attributes."""
|
59
|
+
reflex = Reflection.instance(FakeClass())
|
60
|
+
attributes = reflex.getPrivateAttributes()
|
61
|
+
self.assertTrue("__private_attr" in attributes)
|
62
|
+
|
44
63
|
async def testReflectionInstanceGetMethods(self):
|
45
64
|
"""Ensure getMethods returns all methods of the class."""
|
46
65
|
reflex = Reflection.instance(FakeClass())
|
@@ -182,6 +201,8 @@ class TestReflectionInstance(TestCase):
|
|
182
201
|
reflex = Reflection.instance(FakeClass())
|
183
202
|
attr_value = reflex.getAttribute("public_attr")
|
184
203
|
self.assertEqual(attr_value, 42)
|
204
|
+
attr_value = reflex.getAttribute("__private_attr")
|
205
|
+
self.assertEqual(attr_value, "private")
|
185
206
|
|
186
207
|
async def testReflectionInstanceSetAttribute(self):
|
187
208
|
"""Check that setAttribute correctly sets a new attribute."""
|
@@ -189,6 +210,9 @@ class TestReflectionInstance(TestCase):
|
|
189
210
|
reflex.setAttribute("new_attr", 'Orionis')
|
190
211
|
attr_value = reflex.getAttribute("new_attr")
|
191
212
|
self.assertEqual(attr_value, 'Orionis')
|
213
|
+
reflex.setAttribute("__new_private_attr", 'Hidden')
|
214
|
+
attr_value = reflex.getAttribute("__new_private_attr")
|
215
|
+
self.assertEqual(attr_value, 'Hidden')
|
192
216
|
|
193
217
|
async def testReflectionInstanceRemoveAttribute(self):
|
194
218
|
"""Ensure removeAttribute correctly removes an attribute."""
|
@@ -204,6 +228,8 @@ class TestReflectionInstance(TestCase):
|
|
204
228
|
return cls.instanceMethod(10, 12) + num
|
205
229
|
def syncMacro(cls: FakeClass, num):
|
206
230
|
return cls.instanceMethod(10, 12) + num
|
231
|
+
def __privateMacro(cls: FakeClass, num):
|
232
|
+
return cls.instanceMethod(10, 12) + num
|
207
233
|
|
208
234
|
reflex = Reflection.instance(FakeClass())
|
209
235
|
|
@@ -215,6 +241,10 @@ class TestReflectionInstance(TestCase):
|
|
215
241
|
result = reflex.callMethod("syncMacro", reflex._instance, 3)
|
216
242
|
self.assertEqual(result, 25)
|
217
243
|
|
244
|
+
reflex.setMacro("__privateMacro", __privateMacro)
|
245
|
+
result = reflex.callMethod("__privateMacro", reflex._instance, 3)
|
246
|
+
self.assertEqual(result, 25)
|
247
|
+
|
218
248
|
async def testReflectionInstanceRemoveMacro(self):
|
219
249
|
"""Ensure removeMacro correctly removes a macro."""
|
220
250
|
async def asyncMacro(cls: FakeClass, num):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|