orionis 0.139.0__py3-none-any.whl → 0.152.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/application.py +159 -309
- orionis/luminate/console/base/command.py +6 -3
- orionis/luminate/console/command_filter.py +1 -1
- orionis/luminate/console/commands/cache_clear.py +4 -3
- orionis/luminate/console/commands/schedule_work.py +1 -1
- orionis/luminate/console/kernel.py +1 -2
- orionis/luminate/console/output/console.py +1 -1
- orionis/luminate/console/output/executor.py +1 -1
- orionis/luminate/console/output/progress_bar.py +1 -1
- orionis/luminate/console/parser.py +1 -1
- orionis/luminate/container/container.py +361 -272
- orionis/luminate/container/container_integrity.py +235 -0
- orionis/luminate/container/lifetimes.py +13 -0
- orionis/luminate/container/resolve.py +74 -0
- orionis/luminate/contracts/application.py +41 -0
- orionis/luminate/contracts/console/{i_parser.py → parser.py} +0 -1
- orionis/luminate/contracts/container/container.py +346 -0
- orionis/luminate/contracts/container/container_integrity.py +168 -0
- orionis/luminate/contracts/foundation/providers/{i_service_providers_bootstrapper.py → service_providers_bootstrapper.py} +4 -3
- orionis/luminate/facades/commands/commands_facade.py +1 -1
- orionis/luminate/facades/commands/scheduler_facade.py +1 -1
- orionis/luminate/facades/config/config_facade.py +1 -1
- orionis/luminate/facades/environment/environment_facade.py +1 -26
- orionis/luminate/facades/files/path_facade.py +1 -1
- orionis/luminate/facades/log/log_facade.py +1 -1
- orionis/luminate/facades/tests/tests_facade.py +1 -1
- orionis/luminate/foundation/config/config_bootstrapper.py +1 -1
- orionis/luminate/foundation/console/command_bootstrapper.py +1 -1
- orionis/luminate/foundation/environment/environment_bootstrapper.py +1 -1
- orionis/luminate/foundation/exceptions/exception_providers.py +54 -0
- orionis/luminate/foundation/providers/service_providers_bootstrapper.py +53 -45
- orionis/luminate/providers/commands/reactor_commands_service_provider.py +4 -3
- orionis/luminate/providers/commands/scheduler_provider.py +2 -10
- orionis/luminate/providers/config/config_service_provider.py +2 -10
- orionis/luminate/providers/environment/environment__service_provider.py +3 -4
- orionis/luminate/providers/files/paths_provider.py +3 -4
- orionis/luminate/providers/log/log_service_provider.py +3 -2
- orionis/luminate/providers/service_provider.py +2 -6
- orionis/luminate/services/commands/reactor_commands_service.py +6 -16
- orionis/luminate/services/commands/scheduler_service.py +1 -2
- orionis/luminate/services/config/config_service.py +4 -5
- orionis/luminate/services/environment/environment_service.py +25 -2
- orionis/luminate/services/files/path_resolver_service.py +1 -2
- orionis/luminate/services/log/log_service.py +1 -2
- orionis/luminate/support/exception_to_dict.py +1 -1
- orionis/luminate/support/reflection.py +1 -1
- orionis/luminate/support/std.py +1 -1
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/METADATA +1 -1
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/RECORD +82 -78
- orionis/luminate/container/types.py +0 -51
- orionis/luminate/contracts/container/i_container.py +0 -239
- orionis/luminate/contracts/container/i_types.py +0 -16
- /orionis/luminate/contracts/console/base/{i_command.py → command.py} +0 -0
- /orionis/luminate/contracts/console/{i_command_filter.py → command_filter.py} +0 -0
- /orionis/luminate/contracts/console/{i_kernel.py → kernel.py} +0 -0
- /orionis/luminate/contracts/console/output/{i_console.py → console.py} +0 -0
- /orionis/luminate/contracts/console/output/{i_executor.py → executor.py} +0 -0
- /orionis/luminate/contracts/console/output/{i_progress_bar.py → progress_bar.py} +0 -0
- /orionis/luminate/contracts/console/{i_task_manager.py → task_manager.py} +0 -0
- /orionis/luminate/contracts/facades/commands/{i_commands_facade.py → commands_facade.py} +0 -0
- /orionis/luminate/contracts/facades/commands/{i_scheduler_facade.py → scheduler_facade.py} +0 -0
- /orionis/luminate/contracts/facades/config/{i_config_facade.py → config_facade.py} +0 -0
- /orionis/luminate/contracts/facades/environment/{i_environment_facade.py → environment_facade.py} +0 -0
- /orionis/luminate/contracts/facades/files/{i_path_facade.py → path_facade.py} +0 -0
- /orionis/luminate/contracts/facades/log/{i_log_facade.py → log_facade.py} +0 -0
- /orionis/luminate/contracts/facades/tests/{i_tests_facade.py → tests_facade.py} +0 -0
- /orionis/luminate/contracts/foundation/{i_bootstraper.py → bootstraper.py} +0 -0
- /orionis/luminate/contracts/foundation/config/{i_config_bootstrapper.py → config_bootstrapper.py} +0 -0
- /orionis/luminate/contracts/foundation/console/{i_command_bootstrapper.py → command_bootstrapper.py} +0 -0
- /orionis/luminate/contracts/foundation/environment/{i_environment_bootstrapper.py → environment_bootstrapper.py} +0 -0
- /orionis/luminate/contracts/providers/{i_service_provider.py → service_provider.py} +0 -0
- /orionis/luminate/contracts/services/commands/{i_reactor_commands_service.py → reactor_commands_service.py} +0 -0
- /orionis/luminate/contracts/services/commands/{i_schedule_service.py → schedule_service.py} +0 -0
- /orionis/luminate/contracts/services/config/{i_config_service.py → config_service.py} +0 -0
- /orionis/luminate/contracts/services/environment/{i_environment_service.py → environment_service.py} +0 -0
- /orionis/luminate/contracts/services/files/{i_path_resolver_service.py → path_resolver_service.py} +0 -0
- /orionis/luminate/contracts/services/log/{i_log_service.py → log_service.py} +0 -0
- /orionis/luminate/contracts/support/{i_exception_to_dict.py → exception_to_dict.py} +0 -0
- /orionis/luminate/contracts/support/{i_reflection.py → reflection.py} +0 -0
- /orionis/luminate/contracts/support/{i_std.py → std.py} +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/LICENCE +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/WHEEL +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.139.0.dist-info → orionis-0.152.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,346 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IContainer(ABC):
|
4
|
+
|
5
|
+
@abstractmethod
|
6
|
+
def bind(self, abstract, concrete, lifetime):
|
7
|
+
"""
|
8
|
+
Binds an abstract type to a concrete implementation with a specified lifetime.
|
9
|
+
|
10
|
+
Parameters
|
11
|
+
----------
|
12
|
+
abstract : Callable[..., Any]
|
13
|
+
The abstract base type or alias to be bound.
|
14
|
+
concrete : Callable[..., Any]
|
15
|
+
The concrete implementation to associate with the abstract type.
|
16
|
+
lifetime : str
|
17
|
+
The lifecycle of the binding. Must be one of 'transient', 'scoped', or 'singleton'.
|
18
|
+
|
19
|
+
Raises
|
20
|
+
------
|
21
|
+
OrionisContainerValueError
|
22
|
+
If an invalid lifetime is provided or the concrete implementation is None.
|
23
|
+
|
24
|
+
Examples
|
25
|
+
--------
|
26
|
+
>>> container.bind(MyService, MyServiceImplementation, "singleton")
|
27
|
+
"""
|
28
|
+
pass
|
29
|
+
|
30
|
+
@abstractmethod
|
31
|
+
def transient(self, abstract, concrete):
|
32
|
+
"""
|
33
|
+
Registers a service with a transient lifetime.
|
34
|
+
|
35
|
+
Parameters
|
36
|
+
----------
|
37
|
+
abstract : Callable[..., Any]
|
38
|
+
The abstract base type or alias to be bound.
|
39
|
+
concrete : Callable[..., Any]
|
40
|
+
The concrete implementation to associate with the abstract type.
|
41
|
+
|
42
|
+
Examples
|
43
|
+
--------
|
44
|
+
>>> container.transient(MyService, MyServiceImplementation)
|
45
|
+
"""
|
46
|
+
pass
|
47
|
+
|
48
|
+
@abstractmethod
|
49
|
+
def scoped(self, abstract, concrete):
|
50
|
+
"""
|
51
|
+
Registers a service with a scoped lifetime.
|
52
|
+
|
53
|
+
Parameters
|
54
|
+
----------
|
55
|
+
abstract : Callable[..., Any]
|
56
|
+
The abstract base type or alias to be bound.
|
57
|
+
concrete : Callable[..., Any]
|
58
|
+
The concrete implementation to associate with the abstract type.
|
59
|
+
|
60
|
+
Examples
|
61
|
+
--------
|
62
|
+
>>> container.scoped(MyService, MyServiceImplementation)
|
63
|
+
"""
|
64
|
+
pass
|
65
|
+
|
66
|
+
@abstractmethod
|
67
|
+
def singleton(self, abstract, concrete):
|
68
|
+
"""
|
69
|
+
Registers a service with a singleton lifetime.
|
70
|
+
|
71
|
+
Parameters
|
72
|
+
----------
|
73
|
+
abstract : Callable[..., Any]
|
74
|
+
The abstract base type or alias to be bound.
|
75
|
+
concrete : Callable[..., Any]
|
76
|
+
The concrete implementation to associate with the abstract type.
|
77
|
+
|
78
|
+
Examples
|
79
|
+
--------
|
80
|
+
>>> container.singleton(MyService, MyServiceImplementation)
|
81
|
+
"""
|
82
|
+
pass
|
83
|
+
|
84
|
+
@abstractmethod
|
85
|
+
def instance(self, abstract, instance):
|
86
|
+
"""
|
87
|
+
Registers an already instantiated object in the container.
|
88
|
+
|
89
|
+
Parameters
|
90
|
+
----------
|
91
|
+
abstract : Callable[..., Any]
|
92
|
+
The abstract base type or alias to be bound.
|
93
|
+
instance : Any
|
94
|
+
The instance to be stored.
|
95
|
+
|
96
|
+
Raises
|
97
|
+
------
|
98
|
+
OrionisContainerValueError
|
99
|
+
If the instance is None.
|
100
|
+
|
101
|
+
Examples
|
102
|
+
--------
|
103
|
+
>>> container.instance(MyService, my_service_instance)
|
104
|
+
"""
|
105
|
+
pass
|
106
|
+
|
107
|
+
@abstractmethod
|
108
|
+
def bound(self, abstract_or_alias):
|
109
|
+
"""
|
110
|
+
Checks if a service or alias is bound in the container.
|
111
|
+
|
112
|
+
Parameters
|
113
|
+
----------
|
114
|
+
abstract_or_alias : Callable[..., Any]
|
115
|
+
The abstract type or alias to check.
|
116
|
+
|
117
|
+
Returns
|
118
|
+
-------
|
119
|
+
bool
|
120
|
+
True if the service is bound, False otherwise.
|
121
|
+
|
122
|
+
Examples
|
123
|
+
--------
|
124
|
+
>>> container.bound(MyService)
|
125
|
+
True
|
126
|
+
"""
|
127
|
+
pass
|
128
|
+
|
129
|
+
@abstractmethod
|
130
|
+
def has(self, abstract_or_alias):
|
131
|
+
"""
|
132
|
+
Alias for `bound()` method.
|
133
|
+
|
134
|
+
Parameters
|
135
|
+
----------
|
136
|
+
abstract_or_alias : Callable[..., Any]
|
137
|
+
The abstract type or alias to check.
|
138
|
+
|
139
|
+
Returns
|
140
|
+
-------
|
141
|
+
bool
|
142
|
+
True if the service is bound, False otherwise.
|
143
|
+
|
144
|
+
Examples
|
145
|
+
--------
|
146
|
+
>>> container.has(MyService)
|
147
|
+
True
|
148
|
+
"""
|
149
|
+
pass
|
150
|
+
|
151
|
+
@abstractmethod
|
152
|
+
def alias(self, alias, abstract):
|
153
|
+
"""
|
154
|
+
Creates an alias for an existing abstract binding.
|
155
|
+
|
156
|
+
Parameters
|
157
|
+
----------
|
158
|
+
alias : Callable[..., Any]
|
159
|
+
The alias name.
|
160
|
+
abstract : Callable[..., Any]
|
161
|
+
The existing abstract type to alias.
|
162
|
+
|
163
|
+
Raises
|
164
|
+
------
|
165
|
+
OrionisContainerValueError
|
166
|
+
If the abstract type is not registered or the alias is already in use.
|
167
|
+
|
168
|
+
Examples
|
169
|
+
--------
|
170
|
+
>>> container.alias("DatabaseService", MyDatabaseService)
|
171
|
+
"""
|
172
|
+
pass
|
173
|
+
|
174
|
+
@abstractmethod
|
175
|
+
def isAlias(self, name):
|
176
|
+
"""
|
177
|
+
Checks if a given name is an alias.
|
178
|
+
|
179
|
+
Parameters
|
180
|
+
----------
|
181
|
+
name : str
|
182
|
+
The name to check.
|
183
|
+
|
184
|
+
Returns
|
185
|
+
-------
|
186
|
+
bool
|
187
|
+
True if the name is an alias, False otherwise.
|
188
|
+
|
189
|
+
Raises
|
190
|
+
------
|
191
|
+
OrionisContainerTypeError
|
192
|
+
If the name is not a string.
|
193
|
+
|
194
|
+
Examples
|
195
|
+
--------
|
196
|
+
>>> container.isAlias("DatabaseService")
|
197
|
+
True
|
198
|
+
"""
|
199
|
+
pass
|
200
|
+
|
201
|
+
@abstractmethod
|
202
|
+
def getBindings(self):
|
203
|
+
"""
|
204
|
+
Retrieves all registered service bindings.
|
205
|
+
|
206
|
+
Returns
|
207
|
+
-------
|
208
|
+
dict
|
209
|
+
A dictionary containing all instances, transient, scoped, singleton, and alias services.
|
210
|
+
|
211
|
+
Examples
|
212
|
+
--------
|
213
|
+
>>> container.getBindings()
|
214
|
+
"""
|
215
|
+
pass
|
216
|
+
|
217
|
+
@abstractmethod
|
218
|
+
def getAlias(self, name):
|
219
|
+
"""
|
220
|
+
Retrieves the abstract type associated with an alias.
|
221
|
+
|
222
|
+
Parameters
|
223
|
+
----------
|
224
|
+
name : str
|
225
|
+
The alias name.
|
226
|
+
|
227
|
+
Returns
|
228
|
+
-------
|
229
|
+
Callable[..., Any]
|
230
|
+
The abstract type associated with the alias.
|
231
|
+
|
232
|
+
Raises
|
233
|
+
------
|
234
|
+
OrionisContainerValueError
|
235
|
+
If the alias is not registered.
|
236
|
+
|
237
|
+
Examples
|
238
|
+
--------
|
239
|
+
>>> container.getAlias("DatabaseService")
|
240
|
+
<class 'MyDatabaseService'>
|
241
|
+
"""
|
242
|
+
pass
|
243
|
+
|
244
|
+
@abstractmethod
|
245
|
+
def forgetScopedInstances(self):
|
246
|
+
"""
|
247
|
+
Clears all scoped instances.
|
248
|
+
|
249
|
+
Examples
|
250
|
+
--------
|
251
|
+
>>> container.forgetScopedInstances()
|
252
|
+
"""
|
253
|
+
pass
|
254
|
+
|
255
|
+
@abstractmethod
|
256
|
+
def newRequest(self):
|
257
|
+
"""
|
258
|
+
Resets scoped instances to handle a new request.
|
259
|
+
|
260
|
+
Examples
|
261
|
+
--------
|
262
|
+
>>> container.newRequest()
|
263
|
+
"""
|
264
|
+
pass
|
265
|
+
|
266
|
+
@abstractmethod
|
267
|
+
async def make(self, abstract_or_alias):
|
268
|
+
"""
|
269
|
+
Resolves and instantiates a service from the container.
|
270
|
+
|
271
|
+
Parameters
|
272
|
+
----------
|
273
|
+
abstract_or_alias : Callable[..., Any]
|
274
|
+
The abstract type or alias to resolve.
|
275
|
+
|
276
|
+
Returns
|
277
|
+
-------
|
278
|
+
Any
|
279
|
+
The instantiated service.
|
280
|
+
|
281
|
+
Raises
|
282
|
+
------
|
283
|
+
OrionisContainerException
|
284
|
+
If the service is not found.
|
285
|
+
|
286
|
+
Examples
|
287
|
+
--------
|
288
|
+
>>> service = await container.make(MyService)
|
289
|
+
"""
|
290
|
+
pass
|
291
|
+
|
292
|
+
@abstractmethod
|
293
|
+
def _resolve(self, concrete, resolving=None):
|
294
|
+
"""
|
295
|
+
Resolves dependencies recursively and instantiates a class.
|
296
|
+
|
297
|
+
Parameters
|
298
|
+
----------
|
299
|
+
concrete : Callable[..., Any]
|
300
|
+
The concrete implementation to instantiate.
|
301
|
+
resolving : Optional[Deque[Type]], optional
|
302
|
+
A queue to track resolving dependencies and prevent circular dependencies.
|
303
|
+
|
304
|
+
Returns
|
305
|
+
-------
|
306
|
+
Any
|
307
|
+
The instantiated object.
|
308
|
+
|
309
|
+
Raises
|
310
|
+
------
|
311
|
+
OrionisContainerException
|
312
|
+
If circular dependencies are detected or instantiation fails.
|
313
|
+
|
314
|
+
Examples
|
315
|
+
--------
|
316
|
+
>>> instance = container._resolve(MyClass)
|
317
|
+
"""
|
318
|
+
pass
|
319
|
+
|
320
|
+
@abstractmethod
|
321
|
+
def _resolve_dependency(self, dep_type, resolving=None):
|
322
|
+
"""
|
323
|
+
Resolves a dependency by instantiating or retrieving it from the container.
|
324
|
+
|
325
|
+
Parameters
|
326
|
+
----------
|
327
|
+
dep_type : Any
|
328
|
+
The dependency type to resolve.
|
329
|
+
resolving : Optional[Deque[Type]], optional
|
330
|
+
A queue to track resolving dependencies.
|
331
|
+
|
332
|
+
Returns
|
333
|
+
-------
|
334
|
+
Any
|
335
|
+
The resolved dependency.
|
336
|
+
|
337
|
+
Raises
|
338
|
+
------
|
339
|
+
OrionisContainerException
|
340
|
+
If the dependency cannot be resolved.
|
341
|
+
|
342
|
+
Examples
|
343
|
+
--------
|
344
|
+
>>> dependency = container._resolve_dependency(MyDependency)
|
345
|
+
"""
|
346
|
+
pass
|
@@ -0,0 +1,168 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
from typing import Any, Callable, Type
|
3
|
+
|
4
|
+
class IContainerIntegrity(ABC):
|
5
|
+
|
6
|
+
@abstractmethod
|
7
|
+
def ensureImplementation(abstract: Type, concrete: Type) -> None:
|
8
|
+
"""
|
9
|
+
Verify at runtime if `concrete` implements all methods of `abstract`.
|
10
|
+
|
11
|
+
:param abstract: Abstract class or interface.
|
12
|
+
:param concrete: Concrete class that should implement the abstract class.
|
13
|
+
:raises TypeError: If `concrete` does not implement all methods of `abstract`.
|
14
|
+
"""
|
15
|
+
pass
|
16
|
+
|
17
|
+
@abstractmethod
|
18
|
+
def ensureIsAbstract(abstract: Callable[..., Any]) -> None:
|
19
|
+
"""
|
20
|
+
Ensure that the given abstract is a valid abstract class.
|
21
|
+
|
22
|
+
:param abstract: Class to check
|
23
|
+
:raises OrionisContainerValueError: If the class is not a valid abstract interface
|
24
|
+
"""
|
25
|
+
pass
|
26
|
+
|
27
|
+
@abstractmethod
|
28
|
+
def ensureIsCallable(concrete: Callable[..., Any]) -> None:
|
29
|
+
"""
|
30
|
+
Ensure that the given implementation is callable or instantiable.
|
31
|
+
|
32
|
+
Parameters
|
33
|
+
----------
|
34
|
+
concrete : Callable[..., Any]
|
35
|
+
The implementation to check.
|
36
|
+
|
37
|
+
Raises
|
38
|
+
------
|
39
|
+
OrionisContainerTypeError
|
40
|
+
If the implementation is not callable.
|
41
|
+
"""
|
42
|
+
pass
|
43
|
+
|
44
|
+
@abstractmethod
|
45
|
+
def ensureIsInstance(instance: Any) -> None:
|
46
|
+
"""
|
47
|
+
Ensure that the given instance is a valid object.
|
48
|
+
|
49
|
+
Parameters
|
50
|
+
----------
|
51
|
+
instance : Any
|
52
|
+
The instance to check.
|
53
|
+
|
54
|
+
Raises
|
55
|
+
------
|
56
|
+
OrionisContainerValueError
|
57
|
+
If the instance is not a valid object.
|
58
|
+
"""
|
59
|
+
pass
|
60
|
+
|
61
|
+
@abstractmethod
|
62
|
+
def ensureNotMain(concrete: Callable[..., Any]) -> str:
|
63
|
+
"""
|
64
|
+
Ensure that a class is not defined in the main script.
|
65
|
+
|
66
|
+
Parameters
|
67
|
+
----------
|
68
|
+
concrete : Callable[..., Any]
|
69
|
+
The class or function to check.
|
70
|
+
|
71
|
+
Returns
|
72
|
+
-------
|
73
|
+
str
|
74
|
+
The fully qualified name of the class.
|
75
|
+
|
76
|
+
Raises
|
77
|
+
------
|
78
|
+
OrionisContainerValueError
|
79
|
+
If the class is defined in the main module.
|
80
|
+
"""
|
81
|
+
pass
|
82
|
+
|
83
|
+
@abstractmethod
|
84
|
+
def ensureIsAlias(name: str) -> bool:
|
85
|
+
"""
|
86
|
+
Ensure that the given alias name is a valid string, with no special characters or spaces,
|
87
|
+
and it is not a primitive type.
|
88
|
+
|
89
|
+
Parameters
|
90
|
+
----------
|
91
|
+
name : str
|
92
|
+
The alias name to check.
|
93
|
+
|
94
|
+
Raises
|
95
|
+
------
|
96
|
+
OrionisContainerValueError
|
97
|
+
If the alias is invalid.
|
98
|
+
"""
|
99
|
+
pass
|
100
|
+
|
101
|
+
@abstractmethod
|
102
|
+
def isAlias(name: str) -> bool:
|
103
|
+
"""
|
104
|
+
Check if the given alias name is a valid string, with no special characters or spaces,
|
105
|
+
and it is not a primitive type.
|
106
|
+
|
107
|
+
Parameters
|
108
|
+
----------
|
109
|
+
name : str
|
110
|
+
The alias name to check.
|
111
|
+
|
112
|
+
Returns
|
113
|
+
-------
|
114
|
+
bool
|
115
|
+
True if the alias is valid, False otherwise.
|
116
|
+
"""
|
117
|
+
pass
|
118
|
+
|
119
|
+
@abstractmethod
|
120
|
+
def isCallable(concrete: Callable[..., Any]) -> bool:
|
121
|
+
"""
|
122
|
+
Check if the given implementation is callable or instantiable.
|
123
|
+
|
124
|
+
Parameters
|
125
|
+
----------
|
126
|
+
concrete : Callable[..., Any]
|
127
|
+
The implementation to check.
|
128
|
+
|
129
|
+
Returns
|
130
|
+
-------
|
131
|
+
bool
|
132
|
+
True if the implementation is callable, False otherwise.
|
133
|
+
"""
|
134
|
+
pass
|
135
|
+
|
136
|
+
@abstractmethod
|
137
|
+
def isInstance(instance: Any) -> bool:
|
138
|
+
"""
|
139
|
+
Check if the given instance is a valid object.
|
140
|
+
|
141
|
+
Parameters
|
142
|
+
----------
|
143
|
+
instance : Any
|
144
|
+
The instance to check.
|
145
|
+
|
146
|
+
Returns
|
147
|
+
-------
|
148
|
+
bool
|
149
|
+
True if the instance is valid, False otherwise.
|
150
|
+
"""
|
151
|
+
pass
|
152
|
+
|
153
|
+
@abstractmethod
|
154
|
+
def isAbstract(abstract: Callable[..., Any]) -> bool:
|
155
|
+
"""
|
156
|
+
Check if the given abstract is a valid abstract class.
|
157
|
+
|
158
|
+
Parameters
|
159
|
+
----------
|
160
|
+
abstract : Callable[..., Any]
|
161
|
+
The class to check.
|
162
|
+
|
163
|
+
Returns
|
164
|
+
-------
|
165
|
+
bool
|
166
|
+
True if the class is a valid abstract interface, False otherwise.
|
167
|
+
"""
|
168
|
+
pass
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
|
+
from typing import List, Type
|
2
3
|
from orionis.luminate.providers.service_provider import ServiceProvider
|
3
4
|
|
4
5
|
class IServiceProvidersBootstrapper(ABC):
|
@@ -19,7 +20,7 @@ class IServiceProvidersBootstrapper(ABC):
|
|
19
20
|
pass
|
20
21
|
|
21
22
|
@abstractmethod
|
22
|
-
def _register(self, concrete: ServiceProvider) -> None:
|
23
|
+
def _register(self, concrete: Type[ServiceProvider]) -> None:
|
23
24
|
"""
|
24
25
|
Validates and registers a service provider class.
|
25
26
|
|
@@ -35,7 +36,7 @@ class IServiceProvidersBootstrapper(ABC):
|
|
35
36
|
pass
|
36
37
|
|
37
38
|
@abstractmethod
|
38
|
-
def getBeforeServiceProviders(self) ->
|
39
|
+
def getBeforeServiceProviders(self) -> List[Type[ServiceProvider]]:
|
39
40
|
"""
|
40
41
|
Retrieve the registered service providers.
|
41
42
|
|
@@ -47,7 +48,7 @@ class IServiceProvidersBootstrapper(ABC):
|
|
47
48
|
pass
|
48
49
|
|
49
50
|
@abstractmethod
|
50
|
-
def getAfterServiceProviders(self) ->
|
51
|
+
def getAfterServiceProviders(self) -> List[Type[ServiceProvider]]:
|
51
52
|
"""
|
52
53
|
Retrieve the registered service providers.
|
53
54
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Any
|
2
|
-
from orionis.luminate.contracts.facades.commands.
|
2
|
+
from orionis.luminate.contracts.facades.commands.commands_facade import ICommand
|
3
3
|
from orionis.luminate.facades.app_facade import app
|
4
4
|
from orionis.luminate.services.commands.reactor_commands_service import ReactorCommandsService
|
5
5
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Any
|
2
|
-
from orionis.luminate.contracts.facades.commands.
|
2
|
+
from orionis.luminate.contracts.facades.commands.scheduler_facade import ISchedule
|
3
3
|
from orionis.luminate.facades.app_facade import app
|
4
4
|
from orionis.luminate.services.commands.scheduler_service import ScheduleService
|
5
5
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Any, Optional
|
2
|
-
from orionis.luminate.contracts.facades.config.
|
2
|
+
from orionis.luminate.contracts.facades.config.config_facade import IConfig
|
3
3
|
from orionis.luminate.facades.app_facade import app
|
4
4
|
from orionis.luminate.services.config.config_service import ConfigService
|
5
5
|
|
@@ -1,34 +1,9 @@
|
|
1
|
-
from orionis.luminate.contracts.facades.environment.
|
1
|
+
from orionis.luminate.contracts.facades.environment.environment_facade import IEnv
|
2
2
|
from orionis.luminate.facades.app_facade import app
|
3
3
|
from orionis.luminate.services.environment.environment_service import EnvironmentService
|
4
4
|
|
5
|
-
def env(key: str, default=None) -> str:
|
6
|
-
"""
|
7
|
-
Retrieves the value of an environment variable.
|
8
|
-
|
9
|
-
This function provides a convenient way to access environment variables
|
10
|
-
stored in the application context. If the variable does not exist, it
|
11
|
-
returns the specified default value.
|
12
|
-
|
13
|
-
Parameters
|
14
|
-
----------
|
15
|
-
key : str
|
16
|
-
The name of the environment variable to retrieve.
|
17
|
-
default : Any, optional
|
18
|
-
The default value to return if the environment variable does not exist.
|
19
|
-
Defaults to None.
|
20
|
-
|
21
|
-
Returns
|
22
|
-
-------
|
23
|
-
str
|
24
|
-
The value of the environment variable, or the default value if the variable
|
25
|
-
does not exist.
|
26
|
-
"""
|
27
|
-
return Env.get(key, default)
|
28
|
-
|
29
5
|
class Env(IEnv):
|
30
6
|
|
31
|
-
|
32
7
|
@staticmethod
|
33
8
|
def get(key: str, default=None) -> str:
|
34
9
|
"""
|
@@ -2,7 +2,7 @@ import importlib
|
|
2
2
|
import pathlib
|
3
3
|
from dataclasses import asdict
|
4
4
|
from typing import Any, Dict
|
5
|
-
from orionis.luminate.contracts.foundation.config.
|
5
|
+
from orionis.luminate.contracts.foundation.config.config_bootstrapper import IConfigBootstrapper
|
6
6
|
from orionis.luminate.contracts.config.i_config import IConfig
|
7
7
|
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
8
8
|
|
@@ -2,7 +2,7 @@ import pathlib
|
|
2
2
|
import importlib
|
3
3
|
import inspect
|
4
4
|
from typing import Any, Callable, Dict, List
|
5
|
-
from orionis.luminate.contracts.foundation.console.
|
5
|
+
from orionis.luminate.contracts.foundation.console.command_bootstrapper import ICommandsBootstrapper
|
6
6
|
from orionis.luminate.foundation.exceptions.exception_bootstrapper import BootstrapRuntimeError
|
7
7
|
from orionis.luminate.console.base.command import BaseCommand
|
8
8
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Dict
|
2
|
-
from orionis.luminate.contracts.foundation.environment.
|
2
|
+
from orionis.luminate.contracts.foundation.environment.environment_bootstrapper import IEnvironmentBootstrapper
|
3
3
|
from orionis.luminate.services.environment.environment_service import EnvironmentService
|
4
4
|
|
5
5
|
class EnvironmentBootstrapper(IEnvironmentBootstrapper):
|