orionis 0.41.0__py3-none-any.whl → 0.42.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- orionis/framework.py +1 -1
- orionis/luminate/facades/config.py +1 -1
- orionis/luminate/orionis.py +45 -78
- {orionis-0.41.0.dist-info → orionis-0.42.0.dist-info}/METADATA +1 -1
- {orionis-0.41.0.dist-info → orionis-0.42.0.dist-info}/RECORD +9 -9
- {orionis-0.41.0.dist-info → orionis-0.42.0.dist-info}/LICENCE +0 -0
- {orionis-0.41.0.dist-info → orionis-0.42.0.dist-info}/WHEEL +0 -0
- {orionis-0.41.0.dist-info → orionis-0.42.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.41.0.dist-info → orionis-0.42.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
orionis/luminate/orionis.py
CHANGED
@@ -7,52 +7,35 @@ from orionis.luminate.patterns.singleton import SingletonMeta
|
|
7
7
|
|
8
8
|
class Orionis(metaclass=SingletonMeta):
|
9
9
|
"""
|
10
|
-
|
11
|
-
|
12
|
-
This class manages the lifecycle of an Orionis application instance.
|
13
|
-
It starts the application when entering the context and ensures that the
|
14
|
-
application is properly finished when exiting, capturing any exceptions that occur.
|
15
|
-
|
16
|
-
Attributes
|
17
|
-
----------
|
18
|
-
is_started : bool
|
19
|
-
Flag indicating whether the application has been successfully started.
|
20
|
-
app : App
|
21
|
-
Instance of the Orionis application.
|
22
|
-
error_info : tuple or None
|
23
|
-
Tuple containing the exception instance and its formatted traceback if an error occurs;
|
24
|
-
otherwise, None.
|
10
|
+
Manages the Orionis application lifecycle, ensuring proper initialization
|
11
|
+
and cleanup while handling exceptions.
|
25
12
|
"""
|
26
13
|
|
27
14
|
def __init__(self):
|
28
|
-
"""
|
29
|
-
|
30
|
-
|
31
|
-
Sets up the application instance and initializes state variables.
|
32
|
-
"""
|
33
|
-
self.container = Container()
|
15
|
+
"""Initialize Orionis with a container and setup state tracking."""
|
16
|
+
self.container = None
|
34
17
|
self.is_started = False
|
35
18
|
self.error_info = None
|
36
19
|
|
37
20
|
def __enter__(self):
|
38
21
|
"""
|
39
|
-
|
40
|
-
|
41
|
-
Attempts to start the Orionis application. If successful, sets the active flag
|
42
|
-
and returns the context instance. If an exception is raised during startup,
|
43
|
-
captures the exception and its traceback before re-raising it.
|
22
|
+
Starts the Orionis application and registers required dependencies.
|
44
23
|
|
45
24
|
Returns
|
46
25
|
-------
|
47
|
-
|
48
|
-
The
|
26
|
+
Orionis
|
27
|
+
The initialized Orionis instance.
|
49
28
|
|
50
29
|
Raises
|
51
30
|
------
|
52
31
|
Exception
|
53
|
-
|
32
|
+
If an error occurs during startup.
|
54
33
|
"""
|
55
34
|
try:
|
35
|
+
if self.is_started:
|
36
|
+
return self
|
37
|
+
|
38
|
+
self.container = Container()
|
56
39
|
|
57
40
|
self.container.singleton(CacheConfig)
|
58
41
|
self.container.singleton(Register)
|
@@ -62,81 +45,65 @@ class Orionis(metaclass=SingletonMeta):
|
|
62
45
|
self.container.make(Bootstrapper)
|
63
46
|
|
64
47
|
self.is_started = True
|
65
|
-
OrionisContext().is_started = True
|
66
|
-
|
67
48
|
return self
|
68
49
|
|
69
50
|
except Exception as e:
|
70
|
-
|
71
51
|
self.error_info = (e, traceback.format_exc())
|
72
52
|
raise
|
73
53
|
|
74
54
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
75
55
|
"""
|
76
|
-
|
77
|
-
|
78
|
-
Calls the application's finish method to perform cleanup regardless of whether
|
79
|
-
an exception occurred. If an exception occurred, captures its information and
|
80
|
-
returns False to indicate that the exception should not be suppressed.
|
81
|
-
|
82
|
-
Parameters
|
83
|
-
----------
|
84
|
-
exc_type : type
|
85
|
-
The type of the exception raised (if any).
|
86
|
-
exc_val : Exception
|
87
|
-
The exception instance raised (if any).
|
88
|
-
exc_tb : traceback
|
89
|
-
The traceback associated with the exception (if any).
|
56
|
+
Cleans up resources and ensures proper shutdown.
|
90
57
|
|
91
58
|
Returns
|
92
59
|
-------
|
93
60
|
bool
|
94
|
-
|
61
|
+
False to propagate exceptions.
|
95
62
|
"""
|
96
|
-
|
97
|
-
|
98
|
-
finally:
|
99
|
-
self.is_started = False
|
63
|
+
self.container = None
|
64
|
+
self.is_started = False
|
100
65
|
|
101
66
|
if exc_type:
|
102
67
|
self.error_info = (exc_val, traceback.format_exc())
|
103
68
|
return False
|
104
69
|
|
105
70
|
def isStarted(self):
|
106
|
-
"""
|
107
|
-
Check if the application is currently active.
|
108
|
-
|
109
|
-
Returns
|
110
|
-
-------
|
111
|
-
bool
|
112
|
-
True if the application has been started and is active, False otherwise.
|
113
|
-
"""
|
71
|
+
"""Check if Orionis is currently active."""
|
114
72
|
return self.is_started
|
115
73
|
|
116
74
|
def getError(self):
|
117
|
-
"""
|
118
|
-
Retrieve the stored error information.
|
119
|
-
|
120
|
-
Returns
|
121
|
-
-------
|
122
|
-
tuple or None
|
123
|
-
A tuple containing the exception and its formatted traceback if an error occurred;
|
124
|
-
otherwise, None.
|
125
|
-
"""
|
75
|
+
"""Retrieve stored error information."""
|
126
76
|
return self.error_info
|
127
77
|
|
128
|
-
class OrionisContext(metaclass=SingletonMeta):
|
129
78
|
|
130
|
-
|
131
|
-
|
79
|
+
class OrionisContext:
|
80
|
+
"""
|
81
|
+
Ensures that Orionis is running within a valid context before allowing access
|
82
|
+
to the dependency container.
|
83
|
+
"""
|
132
84
|
|
133
85
|
def __enter__(self):
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
86
|
+
"""
|
87
|
+
Validates that Orionis is active and provides access to its container.
|
88
|
+
|
89
|
+
Returns
|
90
|
+
-------
|
91
|
+
Container
|
92
|
+
The Orionis container instance.
|
93
|
+
|
94
|
+
Raises
|
95
|
+
------
|
96
|
+
RuntimeError
|
97
|
+
If Orionis is not running.
|
98
|
+
"""
|
99
|
+
orionis = Orionis()
|
100
|
+
if not orionis.isStarted():
|
101
|
+
raise RuntimeError(
|
102
|
+
"Error: Not running within a valid Orionis Framework context. "
|
103
|
+
"Ensure that the Orionis application is correctly initialized."
|
104
|
+
)
|
105
|
+
return orionis
|
140
106
|
|
141
107
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
142
|
-
|
108
|
+
"""Ensures exceptions propagate naturally."""
|
109
|
+
return False
|
@@ -1,8 +1,8 @@
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
orionis/cli_manager.py,sha256=9wNVJxB0HyqUbNesUvkwlsqTyUbZwK6R46iVLE5WVBQ,1715
|
3
|
-
orionis/framework.py,sha256=
|
3
|
+
orionis/framework.py,sha256=TlT7nkQG2E_adhasSB1bze9IufktITLC1x24P5H2Ubo,1386
|
4
4
|
orionis/luminate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
orionis/luminate/orionis.py,sha256=
|
5
|
+
orionis/luminate/orionis.py,sha256=HojY14tDsDZ38CeyOaQFMDsXz3hiTCbq8zscVsUmYls,3150
|
6
6
|
orionis/luminate/bootstrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
orionis/luminate/bootstrap/cli_exception.py,sha256=wDKfEW295c7-bavr7YUHK2CLYcTSZgjT9ZRSBne6GOE,1356
|
8
8
|
orionis/luminate/bootstrap/commands/bootstrapper.py,sha256=TuXuQUzeaiDL8sJyZNdqnFl2h2MfxcnSU045IeIKVQE,4016
|
@@ -108,7 +108,7 @@ orionis/luminate/contracts/tools/exception_to_dict_interface.py,sha256=rCuhx2tmU
|
|
108
108
|
orionis/luminate/contracts/tools/reflection_interface.py,sha256=k9y7So3Z-_QFBBaCl-4t50ZRixt1pcxPtpwlo1NrSGk,8140
|
109
109
|
orionis/luminate/contracts/tools/std_interface.py,sha256=VtOlmz7c1llBRVzKnEBA4aJE5m0Y0w7pFJ_1TgG1-G0,1408
|
110
110
|
orionis/luminate/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
111
|
-
orionis/luminate/facades/config.py,sha256=
|
111
|
+
orionis/luminate/facades/config.py,sha256=5x-m8XNz_IEGNtnLqQ0rkRkVR2NCs_vPocbDOxZygow,324
|
112
112
|
orionis/luminate/facades/environment.py,sha256=HFnePQKzbBuJxKuL2bv3-6Fwm2xXeJdqDIpGTeY2HUM,2225
|
113
113
|
orionis/luminate/facades/log.py,sha256=yHht-ok-eseVmwZgsAiHuFOS3MRLJ-YJrbG7VmHguMU,1643
|
114
114
|
orionis/luminate/facades/paths.py,sha256=qXU9KvgNw54IsNc82_S66o198CA9bMZqO8wuCMW1Rnk,7300
|
@@ -147,9 +147,9 @@ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
147
147
|
tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
148
148
|
tests/tools/class_example.py,sha256=dIPD997Y15n6WmKhWoOFSwEldRm9MdOHTZZ49eF1p3c,1056
|
149
149
|
tests/tools/test_reflection.py,sha256=dNN5p_xAosyEf0ddAElmmmTfhcTtBd4zBNl7qzgnsc0,5242
|
150
|
-
orionis-0.
|
151
|
-
orionis-0.
|
152
|
-
orionis-0.
|
153
|
-
orionis-0.
|
154
|
-
orionis-0.
|
155
|
-
orionis-0.
|
150
|
+
orionis-0.42.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
151
|
+
orionis-0.42.0.dist-info/METADATA,sha256=4pDDzZVrM92tNXgB5Uv7WfdTmpyoBOW6iUCyv7fKsT0,2978
|
152
|
+
orionis-0.42.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
153
|
+
orionis-0.42.0.dist-info/entry_points.txt,sha256=eef1_CVewfokKjrGBynXa06KabSJYo7LlDKKIKvs1cM,53
|
154
|
+
orionis-0.42.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
155
|
+
orionis-0.42.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|