orionis 0.237.0__py3-none-any.whl → 0.238.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/introspection/__init__.py +0 -1
- orionis/luminate/support/introspection/dependencies/entities/class_dependencies.py +2 -1
- orionis/luminate/support/introspection/dependencies/entities/method_dependencies.py +2 -1
- {orionis-0.237.0.dist-info → orionis-0.238.0.dist-info}/METADATA +1 -1
- {orionis-0.237.0.dist-info → orionis-0.238.0.dist-info}/RECORD +14 -12
- tests/support/inspection/fakes/fake_reflect_dependencies.py +25 -0
- tests/support/inspection/test_reflect_dependencies.py +67 -0
- tests/support/inspection/{test_reflection_instance.py → test_reflect_instance.py} +6 -5
- {orionis-0.237.0.dist-info → orionis-0.238.0.dist-info}/LICENCE +0 -0
- {orionis-0.237.0.dist-info → orionis-0.238.0.dist-info}/WHEEL +0 -0
- {orionis-0.237.0.dist-info → orionis-0.238.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.237.0.dist-info → orionis-0.238.0.dist-info}/top_level.txt +0 -0
- /tests/support/inspection/fakes/{fake_reflection_instance.py → fake_reflect_instance.py} +0 -0
orionis/framework.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
2
|
from typing import Any, Dict, List
|
3
|
+
from orionis.luminate.support.introspection.dependencies.entities.resolved_dependencies import ResolvedDependency
|
3
4
|
|
4
5
|
@dataclass(frozen=True, kw_only=True)
|
5
6
|
class ClassDependency:
|
6
7
|
"""
|
7
8
|
A class to represent a dependency of a class instance.
|
8
9
|
"""
|
9
|
-
resolved: Dict[
|
10
|
+
resolved: Dict[ResolvedDependency, Any]
|
10
11
|
unresolved: List[str]
|
@@ -1,10 +1,11 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
2
|
from typing import Any, Dict, List
|
3
|
+
from orionis.luminate.support.introspection.dependencies.entities.resolved_dependencies import ResolvedDependency
|
3
4
|
|
4
5
|
@dataclass(frozen=True, kw_only=True)
|
5
6
|
class MethodDependency:
|
6
7
|
"""
|
7
8
|
A class to represent a method dependency of a class instance.
|
8
9
|
"""
|
9
|
-
resolved: Dict[
|
10
|
+
resolved: Dict[ResolvedDependency, Any]
|
10
11
|
unresolved: List[str]
|
@@ -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=XYV_QTxamR0xFfY_RI03mQrvKvRBn423IUDQkDO3D0U,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
|
@@ -166,7 +166,7 @@ orionis/luminate/support/environment/functions.py,sha256=L6gL4z3c89ZU17IWvOXyQ2_
|
|
166
166
|
orionis/luminate/support/environment/helper.py,sha256=G1670w1xkI1pj-rW_inv6D3XmU4oliwnWnrJO5CBm2E,818
|
167
167
|
orionis/luminate/support/environment/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
168
168
|
orionis/luminate/support/environment/contracts/env.py,sha256=buJfzebBOUuq2CnhQCWlnJuzJAEo06-S0_SPR4N_mOY,1647
|
169
|
-
orionis/luminate/support/introspection/__init__.py,sha256=
|
169
|
+
orionis/luminate/support/introspection/__init__.py,sha256=s7ZMEnwkCAKNJtNXID4YbWTKTuab8jhqTmkkcmtlO5s,136
|
170
170
|
orionis/luminate/support/introspection/container_integrity.py,sha256=6d9FsGk-Rm1AXgqBS3Nww49dR7n1ptXTTNyGUuBHgNY,10111
|
171
171
|
orionis/luminate/support/introspection/reflect_abstract.py,sha256=vcPy5r33WeyTzFEXGMmGeI7C23_S4nGS_VXBBODAfng,10851
|
172
172
|
orionis/luminate/support/introspection/reflect_decorators.py,sha256=fnxnkEcRSU8TxDGdjCNlvXMNHEKzW7AwO_aPOVCbs9w,11548
|
@@ -184,8 +184,8 @@ orionis/luminate/support/introspection/dependencies/reflect_dependencies.py,sha2
|
|
184
184
|
orionis/luminate/support/introspection/dependencies/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
185
185
|
orionis/luminate/support/introspection/dependencies/contracts/reflect_dependencies.py,sha256=RnwRP_3uBM0ivE3Y9bgx3chGSmTFhCAcVtKucwEOs0U,1688
|
186
186
|
orionis/luminate/support/introspection/dependencies/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
187
|
-
orionis/luminate/support/introspection/dependencies/entities/class_dependencies.py,sha256=
|
188
|
-
orionis/luminate/support/introspection/dependencies/entities/method_dependencies.py,sha256=
|
187
|
+
orionis/luminate/support/introspection/dependencies/entities/class_dependencies.py,sha256=ZI79TL8D8RsO7_V1SF-mL-IbeRmVWQJa9AGsOIrMmP8,401
|
188
|
+
orionis/luminate/support/introspection/dependencies/entities/method_dependencies.py,sha256=6UauiMVmsLfUbIPRe4jC6CeS4T_77FyMJu0gLUs6I3U,407
|
189
189
|
orionis/luminate/support/introspection/dependencies/entities/resolved_dependencies.py,sha256=u6iM-MIpOHWDF7hG9tjb50mSpPrzcc3adh0yg7AZ30s,298
|
190
190
|
orionis/luminate/support/introspection/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
191
191
|
orionis/luminate/support/introspection/helpers/functions.py,sha256=JC2_t732LqcJn3zoRZwFAqcm6kT6HvsJmupysjH3aiY,8537
|
@@ -246,16 +246,18 @@ tests/support/async_io/test_async_coroutine.py,sha256=rMpjIH3DDjMDIqZkaDGv1q1yGl
|
|
246
246
|
tests/support/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
247
247
|
tests/support/environment/test_env.py,sha256=fcMyvGnDnP2qamhG7yDRN9MyUDjeYN-oSmlno2mc7dQ,2652
|
248
248
|
tests/support/inspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
249
|
+
tests/support/inspection/test_reflect_dependencies.py,sha256=frROd9NDbzwmEpb7TEOpikshFJKbPN5NvJ62ZWUm11E,3686
|
250
|
+
tests/support/inspection/test_reflect_instance.py,sha256=dMSVheTV32y3Faz4kYV803gdN2B4IP944e5wB2RVncs,14065
|
249
251
|
tests/support/inspection/test_reflection_abstract.py,sha256=447L7TCQ5-08QKWuzpIlx0EZ9b9LjEOpR5ZMU5N2Kz0,9340
|
250
252
|
tests/support/inspection/test_reflection_concrete.py,sha256=OXUG4EDW0Xa8c7TWeUuGdwRc3eQ4hoP67ZGbevg8BdU,6778
|
251
253
|
tests/support/inspection/test_reflection_concrete_with_abstract.py,sha256=7QPHwZZOpBaRTlpiXWIQ4DPYQBlnD1-XxNMtjEfMPu4,4673
|
252
|
-
tests/support/inspection/test_reflection_instance.py,sha256=XIPGzQUFXewkcTNVT1vvmDBgx0oqOfJ4dHavOF_Jb-k,14015
|
253
254
|
tests/support/inspection/test_reflection_instance_with_abstract.py,sha256=GmY2W9S84uFCBIRsEjAAVhWbqWR7ZgOPD-AN8sAmhSM,4082
|
254
255
|
tests/support/inspection/fakes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
256
|
+
tests/support/inspection/fakes/fake_reflect_dependencies.py,sha256=TgLnBm31I8CE2qL-BkU_vo2XdBILfF5FvLe9VIr5J_E,797
|
257
|
+
tests/support/inspection/fakes/fake_reflect_instance.py,sha256=P5lSFiGPLLAPOIRmw4VE3YWctxlqmXARRiWMSGLrg3E,1382
|
255
258
|
tests/support/inspection/fakes/fake_reflection_abstract.py,sha256=7qtz44brfFzE4oNYi9kIsvdWP79nP2FnzSz-0bU__pg,5045
|
256
259
|
tests/support/inspection/fakes/fake_reflection_concrete.py,sha256=j6gzsxE3xq5oJ30H_Hm1RsUwEY3jOYBu4sclxtD1ayo,1047
|
257
260
|
tests/support/inspection/fakes/fake_reflection_concrete_with_abstract.py,sha256=ibCjrtNM6BMf5Z5VMvat7E6zOAk5g9z--gj4ykKJWY8,2118
|
258
|
-
tests/support/inspection/fakes/fake_reflection_instance.py,sha256=P5lSFiGPLLAPOIRmw4VE3YWctxlqmXARRiWMSGLrg3E,1382
|
259
261
|
tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=SfL8FuFmr650RlzXTrP4tGMfsPVZLhOxVnBXu_g1POg,1471
|
260
262
|
tests/support/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
261
263
|
tests/support/parsers/test_exception_parser.py,sha256=0z3wanBtrLyGa6T9z2u5juqy8F5ZEHhwa3zOwiQIPGk,2353
|
@@ -267,9 +269,9 @@ tests/support/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
267
269
|
tests/support/patterns/test_singleton.py,sha256=I0Cawq0C5mV5v2I1mLmxJeXw9Vt3B1iq1RgLePsG30I,624
|
268
270
|
tests/support/standard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
269
271
|
tests/support/standard/test_std.py,sha256=g_iU9Pa6W9XDnxwdLB_NAmD60547VAReXe_Vhyrhf4M,2032
|
270
|
-
orionis-0.
|
271
|
-
orionis-0.
|
272
|
-
orionis-0.
|
273
|
-
orionis-0.
|
274
|
-
orionis-0.
|
275
|
-
orionis-0.
|
272
|
+
orionis-0.238.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
273
|
+
orionis-0.238.0.dist-info/METADATA,sha256=E30K5IsKRPLJJ73TdUVMQ17rxAb7asTfPBSb92l2O9o,3003
|
274
|
+
orionis-0.238.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
275
|
+
orionis-0.238.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
|
276
|
+
orionis-0.238.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
277
|
+
orionis-0.238.0.dist-info/RECORD,,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class FakeUser:
|
2
|
+
def __init__(self):
|
3
|
+
self.user_data = None
|
4
|
+
|
5
|
+
def get_user(self, user_id):
|
6
|
+
return self.user_data
|
7
|
+
|
8
|
+
class FakeUserWithPermissions:
|
9
|
+
def __init__(self):
|
10
|
+
self.permissions = set()
|
11
|
+
|
12
|
+
def add_permission(self, permission: str):
|
13
|
+
self.permissions.add(permission)
|
14
|
+
|
15
|
+
def has_permission(self, permission: str) -> bool:
|
16
|
+
return permission in self.permissions
|
17
|
+
|
18
|
+
class UserController:
|
19
|
+
def __init__(self, user_repository: FakeUser):
|
20
|
+
self.user_repository = user_repository
|
21
|
+
|
22
|
+
def create_user_with_permissions(self, user_permissions: FakeUserWithPermissions, permissions: list[str]):
|
23
|
+
for permission in permissions:
|
24
|
+
user_permissions.add_permission(permission)
|
25
|
+
return user_permissions
|
@@ -0,0 +1,67 @@
|
|
1
|
+
from orionis.luminate.support.introspection.dependencies import ReflectDependencies
|
2
|
+
from orionis.luminate.support.introspection.dependencies.entities.class_dependencies import ClassDependency
|
3
|
+
from orionis.luminate.support.introspection.dependencies.entities.method_dependencies import MethodDependency
|
4
|
+
from orionis.luminate.support.introspection.dependencies.entities.resolved_dependencies import ResolvedDependency
|
5
|
+
from orionis.luminate.test import TestCase
|
6
|
+
from tests.support.inspection.fakes.fake_reflect_dependencies import FakeUser, FakeUserWithPermissions, UserController
|
7
|
+
|
8
|
+
class TestReflectDependencies(TestCase):
|
9
|
+
"""
|
10
|
+
Unit tests for the Reflection class.
|
11
|
+
"""
|
12
|
+
|
13
|
+
async def testReflectionDependenciesGetConstructorDependencies(self):
|
14
|
+
"""
|
15
|
+
Test the reflection of dependencies in a class.
|
16
|
+
"""
|
17
|
+
depend = ReflectDependencies(UserController)
|
18
|
+
constructor_dependencies = depend.getConstructorDependencies()
|
19
|
+
|
20
|
+
# Check Instance of ClassDependency
|
21
|
+
self.assertIsInstance(constructor_dependencies, ClassDependency)
|
22
|
+
|
23
|
+
# Check unresolved dependencies
|
24
|
+
self.assertEqual(constructor_dependencies.unresolved, [])
|
25
|
+
|
26
|
+
# Check Instance of ResolvedDependency
|
27
|
+
dep_user_repository:ResolvedDependency = constructor_dependencies.resolved.get('user_repository')
|
28
|
+
self.assertIsInstance(dep_user_repository, ResolvedDependency)
|
29
|
+
|
30
|
+
# Check resolved dependencies
|
31
|
+
self.assertEqual(dep_user_repository.module_name, 'tests.support.inspection.fakes.fake_reflect_dependencies')
|
32
|
+
self.assertEqual(dep_user_repository.class_name, 'FakeUser')
|
33
|
+
self.assertEqual(dep_user_repository.full_class_path, 'tests.support.inspection.fakes.fake_reflect_dependencies.FakeUser')
|
34
|
+
self.assertEqual(dep_user_repository.type, FakeUser)
|
35
|
+
|
36
|
+
async def testReflectionDependenciesGetMethodDependencies(self):
|
37
|
+
"""
|
38
|
+
Test the reflection of dependencies in a class method.
|
39
|
+
"""
|
40
|
+
depend = ReflectDependencies(UserController)
|
41
|
+
method_dependencies = depend.getMethodDependencies('create_user_with_permissions')
|
42
|
+
|
43
|
+
# Check Instance of MethodDependency
|
44
|
+
self.assertIsInstance(method_dependencies, MethodDependency)
|
45
|
+
|
46
|
+
# Check unresolved dependencies
|
47
|
+
self.assertEqual(method_dependencies.unresolved, [])
|
48
|
+
|
49
|
+
# Check Instance of ResolvedDependency for 'user_permissions'
|
50
|
+
dep_user_permissions:ResolvedDependency = method_dependencies.resolved.get('user_permissions')
|
51
|
+
self.assertIsInstance(dep_user_permissions, ResolvedDependency)
|
52
|
+
|
53
|
+
# Check resolved dependencies for 'user_permissions'
|
54
|
+
self.assertEqual(dep_user_permissions.module_name, 'tests.support.inspection.fakes.fake_reflect_dependencies')
|
55
|
+
self.assertEqual(dep_user_permissions.class_name, 'FakeUserWithPermissions')
|
56
|
+
self.assertEqual(dep_user_permissions.full_class_path, 'tests.support.inspection.fakes.fake_reflect_dependencies.FakeUserWithPermissions')
|
57
|
+
self.assertEqual(dep_user_permissions.type, FakeUserWithPermissions)
|
58
|
+
|
59
|
+
# Check Instance of ResolvedDependency for 'permissions'
|
60
|
+
dep_permissions:ResolvedDependency = method_dependencies.resolved.get('permissions')
|
61
|
+
self.assertIsInstance(dep_permissions, ResolvedDependency)
|
62
|
+
|
63
|
+
# Check resolved dependencies for 'permissions'
|
64
|
+
self.assertEqual(dep_permissions.module_name, 'builtins')
|
65
|
+
self.assertEqual(dep_permissions.class_name, 'list')
|
66
|
+
self.assertEqual(dep_permissions.full_class_path, 'builtins.list')
|
67
|
+
self.assertEqual(dep_permissions.type, list[str])
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import asyncio
|
2
|
-
from orionis.luminate.support.introspection import Reflection
|
2
|
+
from orionis.luminate.support.introspection import Reflection
|
3
|
+
from orionis.luminate.support.introspection.reflection import ReflectionInstance
|
3
4
|
from orionis.luminate.test import TestCase
|
4
|
-
from tests.support.inspection.fakes.
|
5
|
+
from tests.support.inspection.fakes.fake_reflect_instance import BaseFakeClass, FakeClass
|
5
6
|
|
6
|
-
class
|
7
|
+
class TestReflectInstance(TestCase):
|
7
8
|
"""
|
8
9
|
Unit tests for the Reflection class.
|
9
10
|
"""
|
@@ -30,7 +31,7 @@ class TestReflectionInstance(TestCase):
|
|
30
31
|
async def testReflectionInstanceGetModuleName(self):
|
31
32
|
"""Verify getModuleName returns the correct module name."""
|
32
33
|
reflex = Reflection.instance(FakeClass())
|
33
|
-
self.assertEqual(reflex.getModuleName(), "tests.support.inspection.fakes.
|
34
|
+
self.assertEqual(reflex.getModuleName(), "tests.support.inspection.fakes.fake_reflect_instance")
|
34
35
|
|
35
36
|
async def testReflectionInstanceGetAllAttributes(self):
|
36
37
|
"""Check that getAllAttributes returns all attributes of the class."""
|
@@ -211,7 +212,7 @@ class TestReflectionInstance(TestCase):
|
|
211
212
|
"""Ensure getFileLocation returns the correct file path."""
|
212
213
|
reflex = Reflection.instance(FakeClass())
|
213
214
|
file_location = reflex.getFileLocation()
|
214
|
-
self.assertIn("
|
215
|
+
self.assertIn("fake_reflect_instance.py", file_location)
|
215
216
|
|
216
217
|
async def testReflectionInstanceGetAnnotations(self):
|
217
218
|
"""Verify getAnnotations returns the correct class annotations."""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|