orionis 0.365.0__py3-none-any.whl → 0.367.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/{console → _console}/base/command.py +2 -2
- orionis/{console → _console}/commands/cache_clear.py +2 -2
- orionis/{console → _console}/commands/help.py +2 -2
- orionis/{console → _console}/commands/schedule_work.py +2 -2
- orionis/{console → _console}/commands/version.py +2 -2
- orionis/_console/output/console.py +587 -0
- orionis/{console → _console}/output/executor.py +1 -1
- orionis/{console → _console}/output/progress_bar.py +1 -1
- orionis/_contracts/console/base/command.py +1 -1
- orionis/_foundation/console/command_bootstrapper.py +1 -1
- orionis/_services/commands/reactor_commands_service.py +6 -6
- orionis/_services/commands/scheduler_service.py +1 -1
- orionis/console/dumper/contracts/dump.py +35 -0
- orionis/console/dumper/dump.py +627 -0
- orionis/console/dynamic/progress_bar.py +100 -0
- orionis/console/output/console.py +55 -89
- orionis/console/output/contracts/console.py +453 -0
- orionis/console/output/enums/__init__.py +5 -0
- orionis/foundation/application.py +2 -1
- orionis/foundation/providers/console_provider.py +21 -0
- orionis/foundation/providers/dumper_provider.py +21 -0
- orionis/foundation/providers/path_resolver_provider.py +21 -0
- orionis/foundation/providers/progress_bar_provider.py +21 -0
- orionis/foundation/providers/workers_provider.py +21 -0
- orionis/metadata/framework.py +1 -1
- orionis/services/environment/core/dot_env.py +1 -1
- orionis/services/paths/contracts/resolver.py +4 -4
- orionis/services/paths/resolver.py +11 -0
- orionis/services/system/contracts/workers.py +12 -0
- orionis/services/system/workers.py +11 -0
- orionis/support/facades/console.py +15 -0
- orionis/support/facades/dumper.py +15 -0
- orionis/support/facades/path_resolver.py +15 -0
- orionis/support/facades/progress_bar.py +15 -0
- orionis/support/facades/workers.py +15 -0
- orionis/support/formatter/exceptions/__init__.py +0 -0
- orionis/support/formatter/exceptions/contracts/__init__.py +0 -0
- orionis/{services → support}/formatter/exceptions/parser.py +1 -1
- orionis/{services → support}/formatter/serializer.py +1 -1
- orionis/support/patterns/__init__.py +0 -0
- orionis/support/patterns/singleton/__init__.py +5 -0
- orionis/test/output/dumper.py +2 -2
- {orionis-0.365.0.dist-info → orionis-0.367.0.dist-info}/METADATA +1 -1
- {orionis-0.365.0.dist-info → orionis-0.367.0.dist-info}/RECORD +79 -55
- tests/support/parsers/__init__.py +0 -0
- tests/support/parsers/mocks/__init__.py +0 -0
- tests/{services → support}/parsers/test_services_parser_exceptions.py +2 -2
- tests/support/patterns/__init__.py +0 -0
- tests/support/patterns/singleton/__init__.py +0 -0
- tests/{patterns → support/patterns}/singleton/test_patterns_singleton.py +1 -1
- /orionis/{console/base → _console}/__init__.py +0 -0
- /orionis/{console/commands → _console/base}/__init__.py +0 -0
- /orionis/{console → _console}/command_filter.py +0 -0
- /orionis/{console/exceptions → _console/commands}/__init__.py +0 -0
- /orionis/{patterns → _console/dumper}/__init__.py +0 -0
- /orionis/{console → _console}/dumper/dump_die.py +0 -0
- /orionis/{patterns/singleton → _console/exceptions}/__init__.py +0 -0
- /orionis/{console → _console}/exceptions/cli-orionis-value-error.py +0 -0
- /orionis/{console → _console}/exceptions/cli_exception.py +0 -0
- /orionis/{console → _console}/exceptions/cli_runtime_error.py +0 -0
- /orionis/{console → _console}/exceptions/cli_schedule_exception.py +0 -0
- /orionis/{console → _console}/kernel.py +0 -0
- /orionis/{services/formatter → _console/output}/__init__.py +0 -0
- /orionis/{console → _console}/parser.py +0 -0
- /orionis/{services/formatter/exceptions → console/dumper/contracts}/__init__.py +0 -0
- /orionis/{services/formatter/exceptions/contracts → console/dynamic}/__init__.py +0 -0
- {tests/patterns → orionis/console/dynamic/contracts}/__init__.py +0 -0
- /orionis/{_contracts/console/output → console/dynamic/contracts}/progress_bar.py +0 -0
- {tests/patterns/singleton → orionis/console/output/contracts}/__init__.py +0 -0
- /orionis/console/output/{styles.py → enums/styles.py} +0 -0
- {tests/services/parsers → orionis/support/facades}/__init__.py +0 -0
- {tests/services/parsers/mocks → orionis/support/formatter}/__init__.py +0 -0
- /orionis/{services → support}/formatter/exceptions/contracts/parser.py +0 -0
- /orionis/{patterns → support/patterns}/singleton/meta.py +0 -0
- {orionis-0.365.0.dist-info → orionis-0.367.0.dist-info}/WHEEL +0 -0
- {orionis-0.365.0.dist-info → orionis-0.367.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.365.0.dist-info → orionis-0.367.0.dist-info}/top_level.txt +0 -0
- {orionis-0.365.0.dist-info → orionis-0.367.0.dist-info}/zip-safe +0 -0
- /tests/{services → support}/parsers/mocks/mock_custom_error.py +0 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List, Union, Optional
|
|
3
|
+
|
|
4
|
+
class IConsole(ABC):
|
|
5
|
+
"""
|
|
6
|
+
Interface contract for Console output functionality.
|
|
7
|
+
|
|
8
|
+
Defines the contract for printing formatted messages to the console with ANSI colors,
|
|
9
|
+
providing methods to print success, info, warning, and error messages with
|
|
10
|
+
optional timestamps, as well as general text formatting methods.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def success(self, message: str, timestamp: bool = True) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Prints a success message with a green background.
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
message : str
|
|
21
|
+
The success message to print.
|
|
22
|
+
timestamp : bool, optional
|
|
23
|
+
Whether to include a timestamp (default is True).
|
|
24
|
+
"""
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
@abstractmethod
|
|
28
|
+
def textSuccess(self, message: str) -> None:
|
|
29
|
+
"""
|
|
30
|
+
Prints a success message in green.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
message : str
|
|
35
|
+
The success message to print.
|
|
36
|
+
"""
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
@abstractmethod
|
|
40
|
+
def textSuccessBold(self, message: str) -> None:
|
|
41
|
+
"""
|
|
42
|
+
Prints a bold success message in green.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
message : str
|
|
47
|
+
The success message to print.
|
|
48
|
+
"""
|
|
49
|
+
pass
|
|
50
|
+
|
|
51
|
+
@abstractmethod
|
|
52
|
+
def info(self, message: str, timestamp: bool = True) -> None:
|
|
53
|
+
"""
|
|
54
|
+
Prints an informational message with a blue background.
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
message : str
|
|
59
|
+
The informational message to print.
|
|
60
|
+
timestamp : bool, optional
|
|
61
|
+
Whether to include a timestamp (default is True).
|
|
62
|
+
"""
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def textInfo(self, message: str) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Prints an informational message in blue.
|
|
69
|
+
|
|
70
|
+
Parameters
|
|
71
|
+
----------
|
|
72
|
+
message : str
|
|
73
|
+
The informational message to print.
|
|
74
|
+
"""
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
@abstractmethod
|
|
78
|
+
def textInfoBold(self, message: str) -> None:
|
|
79
|
+
"""
|
|
80
|
+
Prints a bold informational message in blue.
|
|
81
|
+
|
|
82
|
+
Parameters
|
|
83
|
+
----------
|
|
84
|
+
message : str
|
|
85
|
+
The informational message to print.
|
|
86
|
+
"""
|
|
87
|
+
pass
|
|
88
|
+
|
|
89
|
+
@abstractmethod
|
|
90
|
+
def warning(self, message: str, timestamp: bool = True) -> None:
|
|
91
|
+
"""
|
|
92
|
+
Prints a warning message with a yellow background.
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
message : str
|
|
97
|
+
The warning message to print.
|
|
98
|
+
timestamp : bool, optional
|
|
99
|
+
Whether to include a timestamp (default is True).
|
|
100
|
+
"""
|
|
101
|
+
pass
|
|
102
|
+
|
|
103
|
+
@abstractmethod
|
|
104
|
+
def textWarning(self, message: str) -> None:
|
|
105
|
+
"""
|
|
106
|
+
Prints a warning message in yellow.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
message : str
|
|
111
|
+
The warning message to print.
|
|
112
|
+
"""
|
|
113
|
+
pass
|
|
114
|
+
|
|
115
|
+
@abstractmethod
|
|
116
|
+
def textWarningBold(self, message: str) -> None:
|
|
117
|
+
"""
|
|
118
|
+
Prints a bold warning message in yellow.
|
|
119
|
+
|
|
120
|
+
Parameters
|
|
121
|
+
----------
|
|
122
|
+
message : str
|
|
123
|
+
The warning message to print.
|
|
124
|
+
"""
|
|
125
|
+
pass
|
|
126
|
+
|
|
127
|
+
@abstractmethod
|
|
128
|
+
def fail(self, message: str, timestamp: bool = True) -> None:
|
|
129
|
+
"""
|
|
130
|
+
Prints a failure message with a red background.
|
|
131
|
+
|
|
132
|
+
Parameters
|
|
133
|
+
----------
|
|
134
|
+
message : str
|
|
135
|
+
The failure message to print.
|
|
136
|
+
timestamp : bool, optional
|
|
137
|
+
Whether to include a timestamp (default is True).
|
|
138
|
+
"""
|
|
139
|
+
pass
|
|
140
|
+
|
|
141
|
+
@abstractmethod
|
|
142
|
+
def error(self, message: str, timestamp: bool = True) -> None:
|
|
143
|
+
"""
|
|
144
|
+
Prints an error message with a red background.
|
|
145
|
+
|
|
146
|
+
Parameters
|
|
147
|
+
----------
|
|
148
|
+
message : str
|
|
149
|
+
The error message to print.
|
|
150
|
+
timestamp : bool, optional
|
|
151
|
+
Whether to include a timestamp (default is True).
|
|
152
|
+
"""
|
|
153
|
+
pass
|
|
154
|
+
|
|
155
|
+
@abstractmethod
|
|
156
|
+
def textError(self, message: str) -> None:
|
|
157
|
+
"""
|
|
158
|
+
Prints an error message in red.
|
|
159
|
+
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
message : str
|
|
163
|
+
The error message to print.
|
|
164
|
+
"""
|
|
165
|
+
pass
|
|
166
|
+
|
|
167
|
+
@abstractmethod
|
|
168
|
+
def textErrorBold(self, message: str) -> None:
|
|
169
|
+
"""
|
|
170
|
+
Prints a bold error message in red.
|
|
171
|
+
|
|
172
|
+
Parameters
|
|
173
|
+
----------
|
|
174
|
+
message : str
|
|
175
|
+
The error message to print.
|
|
176
|
+
"""
|
|
177
|
+
pass
|
|
178
|
+
|
|
179
|
+
@abstractmethod
|
|
180
|
+
def textMuted(self, message: str) -> None:
|
|
181
|
+
"""
|
|
182
|
+
Prints a muted (gray) message.
|
|
183
|
+
|
|
184
|
+
Parameters
|
|
185
|
+
----------
|
|
186
|
+
message : str
|
|
187
|
+
The message to print.
|
|
188
|
+
"""
|
|
189
|
+
pass
|
|
190
|
+
|
|
191
|
+
@abstractmethod
|
|
192
|
+
def textMutedBold(self, message: str) -> None:
|
|
193
|
+
"""
|
|
194
|
+
Prints a bold muted (gray) message.
|
|
195
|
+
|
|
196
|
+
Parameters
|
|
197
|
+
----------
|
|
198
|
+
message : str
|
|
199
|
+
The message to print.
|
|
200
|
+
"""
|
|
201
|
+
pass
|
|
202
|
+
|
|
203
|
+
@abstractmethod
|
|
204
|
+
def textUnderline(self, message: str) -> None:
|
|
205
|
+
"""
|
|
206
|
+
Prints an underlined message.
|
|
207
|
+
|
|
208
|
+
Parameters
|
|
209
|
+
----------
|
|
210
|
+
message : str
|
|
211
|
+
The message to print.
|
|
212
|
+
"""
|
|
213
|
+
pass
|
|
214
|
+
|
|
215
|
+
@abstractmethod
|
|
216
|
+
def clear(self) -> None:
|
|
217
|
+
"""
|
|
218
|
+
Clears the console screen.
|
|
219
|
+
"""
|
|
220
|
+
pass
|
|
221
|
+
|
|
222
|
+
@abstractmethod
|
|
223
|
+
def clearLine(self) -> None:
|
|
224
|
+
"""
|
|
225
|
+
Clears the current line in the console.
|
|
226
|
+
"""
|
|
227
|
+
pass
|
|
228
|
+
|
|
229
|
+
@abstractmethod
|
|
230
|
+
def line(self) -> None:
|
|
231
|
+
"""
|
|
232
|
+
Prints a horizontal line in the console.
|
|
233
|
+
"""
|
|
234
|
+
pass
|
|
235
|
+
|
|
236
|
+
@abstractmethod
|
|
237
|
+
def newLine(self, count: int = 1) -> None:
|
|
238
|
+
"""
|
|
239
|
+
Prints multiple new lines.
|
|
240
|
+
|
|
241
|
+
Parameters
|
|
242
|
+
----------
|
|
243
|
+
count : int, optional
|
|
244
|
+
The number of new lines to print (default is 1).
|
|
245
|
+
|
|
246
|
+
Raises
|
|
247
|
+
------
|
|
248
|
+
ValueError
|
|
249
|
+
If count is less than or equal to 0.
|
|
250
|
+
"""
|
|
251
|
+
pass
|
|
252
|
+
|
|
253
|
+
@abstractmethod
|
|
254
|
+
def write(self, message: str) -> None:
|
|
255
|
+
"""
|
|
256
|
+
Prints a message without moving to the next line.
|
|
257
|
+
|
|
258
|
+
Parameters
|
|
259
|
+
----------
|
|
260
|
+
message : str
|
|
261
|
+
The message to print.
|
|
262
|
+
"""
|
|
263
|
+
pass
|
|
264
|
+
|
|
265
|
+
@abstractmethod
|
|
266
|
+
def writeLine(self, message: str) -> None:
|
|
267
|
+
"""
|
|
268
|
+
Prints a message and moves to the next line.
|
|
269
|
+
|
|
270
|
+
Parameters
|
|
271
|
+
----------
|
|
272
|
+
message : str
|
|
273
|
+
The message to print.
|
|
274
|
+
"""
|
|
275
|
+
pass
|
|
276
|
+
|
|
277
|
+
@abstractmethod
|
|
278
|
+
def ask(self, question: str) -> str:
|
|
279
|
+
"""
|
|
280
|
+
Prompts the user for input with a message and returns the user's response.
|
|
281
|
+
|
|
282
|
+
Parameters
|
|
283
|
+
----------
|
|
284
|
+
question : str
|
|
285
|
+
The question to ask the user.
|
|
286
|
+
|
|
287
|
+
Returns
|
|
288
|
+
-------
|
|
289
|
+
str
|
|
290
|
+
The user's input, as a string.
|
|
291
|
+
"""
|
|
292
|
+
pass
|
|
293
|
+
|
|
294
|
+
@abstractmethod
|
|
295
|
+
def confirm(self, question: str, default: bool = False) -> bool:
|
|
296
|
+
"""
|
|
297
|
+
Asks a confirmation question and returns True or False based on the user's response.
|
|
298
|
+
|
|
299
|
+
Parameters
|
|
300
|
+
----------
|
|
301
|
+
question : str
|
|
302
|
+
The confirmation question to ask.
|
|
303
|
+
default : bool, optional
|
|
304
|
+
The default response if the user presses Enter without typing a response.
|
|
305
|
+
Default is False, which corresponds to a 'No' response.
|
|
306
|
+
|
|
307
|
+
Returns
|
|
308
|
+
-------
|
|
309
|
+
bool
|
|
310
|
+
The user's response, which will be True if 'Y' is entered,
|
|
311
|
+
or False if 'N' is entered or the default is used.
|
|
312
|
+
"""
|
|
313
|
+
pass
|
|
314
|
+
|
|
315
|
+
@abstractmethod
|
|
316
|
+
def secret(self, question: str) -> str:
|
|
317
|
+
"""
|
|
318
|
+
Prompts the user for hidden input, typically used for password input.
|
|
319
|
+
|
|
320
|
+
Parameters
|
|
321
|
+
----------
|
|
322
|
+
question : str
|
|
323
|
+
The prompt to ask the user.
|
|
324
|
+
|
|
325
|
+
Returns
|
|
326
|
+
-------
|
|
327
|
+
str
|
|
328
|
+
The user's hidden input, returned as a string.
|
|
329
|
+
"""
|
|
330
|
+
pass
|
|
331
|
+
|
|
332
|
+
@abstractmethod
|
|
333
|
+
def table(self, headers: List[str], rows: List[List[str]]) -> None:
|
|
334
|
+
"""
|
|
335
|
+
Prints a table in the console with the given headers and rows, with bold headers.
|
|
336
|
+
|
|
337
|
+
Parameters
|
|
338
|
+
----------
|
|
339
|
+
headers : List[str]
|
|
340
|
+
The column headers for the table.
|
|
341
|
+
rows : List[List[str]]
|
|
342
|
+
The rows of the table, where each row is a list of strings representing the columns.
|
|
343
|
+
|
|
344
|
+
Raises
|
|
345
|
+
------
|
|
346
|
+
ValueError
|
|
347
|
+
If headers or rows are empty.
|
|
348
|
+
|
|
349
|
+
Notes
|
|
350
|
+
-----
|
|
351
|
+
The table adjusts column widths dynamically, includes bold headers, and uses box-drawing characters for formatting.
|
|
352
|
+
"""
|
|
353
|
+
pass
|
|
354
|
+
|
|
355
|
+
@abstractmethod
|
|
356
|
+
def anticipate(self, question: str, options: List[str], default: Optional[str] = None) -> str:
|
|
357
|
+
"""
|
|
358
|
+
Provides autocomplete suggestions based on user input.
|
|
359
|
+
|
|
360
|
+
Parameters
|
|
361
|
+
----------
|
|
362
|
+
question : str
|
|
363
|
+
The prompt for the user.
|
|
364
|
+
options : List[str]
|
|
365
|
+
The list of possible options for autocomplete.
|
|
366
|
+
default : Optional[str], optional
|
|
367
|
+
The default value if no matching option is found. Defaults to None.
|
|
368
|
+
|
|
369
|
+
Returns
|
|
370
|
+
-------
|
|
371
|
+
str
|
|
372
|
+
The chosen option or the default value.
|
|
373
|
+
|
|
374
|
+
Notes
|
|
375
|
+
-----
|
|
376
|
+
This method allows the user to input a string, and then attempts to provide
|
|
377
|
+
an autocomplete suggestion by matching the beginning of the input with the
|
|
378
|
+
available options. If no match is found, the method returns the default value
|
|
379
|
+
or the user input if no default is provided.
|
|
380
|
+
"""
|
|
381
|
+
pass
|
|
382
|
+
|
|
383
|
+
@abstractmethod
|
|
384
|
+
def choice(self, question: str, choices: List[str], default_index: int = 0) -> str:
|
|
385
|
+
"""
|
|
386
|
+
Allows the user to select an option from a list.
|
|
387
|
+
|
|
388
|
+
Parameters
|
|
389
|
+
----------
|
|
390
|
+
question : str
|
|
391
|
+
The prompt for the user.
|
|
392
|
+
choices : List[str]
|
|
393
|
+
The list of available choices.
|
|
394
|
+
default_index : int, optional
|
|
395
|
+
The index of the default choice (zero-based). Defaults to 0.
|
|
396
|
+
|
|
397
|
+
Returns
|
|
398
|
+
-------
|
|
399
|
+
str
|
|
400
|
+
The selected choice.
|
|
401
|
+
|
|
402
|
+
Raises
|
|
403
|
+
------
|
|
404
|
+
ValueError
|
|
405
|
+
If `default_index` is out of the range of choices.
|
|
406
|
+
|
|
407
|
+
Notes
|
|
408
|
+
-----
|
|
409
|
+
The user is presented with a numbered list of choices and prompted to select
|
|
410
|
+
one by entering the corresponding number. If an invalid input is provided,
|
|
411
|
+
the user will be repeatedly prompted until a valid choice is made.
|
|
412
|
+
"""
|
|
413
|
+
pass
|
|
414
|
+
|
|
415
|
+
@abstractmethod
|
|
416
|
+
def exception(self, e: Exception) -> None:
|
|
417
|
+
"""
|
|
418
|
+
Prints an exception message with detailed information.
|
|
419
|
+
|
|
420
|
+
Parameters
|
|
421
|
+
----------
|
|
422
|
+
e : Exception
|
|
423
|
+
The exception to print.
|
|
424
|
+
|
|
425
|
+
Notes
|
|
426
|
+
-----
|
|
427
|
+
This method prints the exception type, message, and a detailed stack trace.
|
|
428
|
+
"""
|
|
429
|
+
pass
|
|
430
|
+
|
|
431
|
+
@abstractmethod
|
|
432
|
+
def exitSuccess(self, message: Optional[str] = None) -> None:
|
|
433
|
+
"""
|
|
434
|
+
Exits the program with a success message.
|
|
435
|
+
|
|
436
|
+
Parameters
|
|
437
|
+
----------
|
|
438
|
+
message : Optional[str], optional
|
|
439
|
+
The success message to print before exiting.
|
|
440
|
+
"""
|
|
441
|
+
pass
|
|
442
|
+
|
|
443
|
+
@abstractmethod
|
|
444
|
+
def exitError(self, message: Optional[str] = None) -> None:
|
|
445
|
+
"""
|
|
446
|
+
Exits the program with an error message.
|
|
447
|
+
|
|
448
|
+
Parameters
|
|
449
|
+
----------
|
|
450
|
+
message : Optional[str], optional
|
|
451
|
+
The error message to print before exiting.
|
|
452
|
+
"""
|
|
453
|
+
pass
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Type, List
|
|
2
2
|
from orionis.container.container import Container
|
|
3
3
|
from orionis.container.contracts.service_provider import IServiceProvider
|
|
4
|
+
from orionis.foundation.providers.dumper_provider import DebugProvider
|
|
4
5
|
|
|
5
6
|
class App(Container):
|
|
6
7
|
"""
|
|
@@ -98,7 +99,7 @@ class App(Container):
|
|
|
98
99
|
before user-defined providers are loaded.
|
|
99
100
|
"""
|
|
100
101
|
core_providers = [
|
|
101
|
-
|
|
102
|
+
DebugProvider
|
|
102
103
|
]
|
|
103
104
|
|
|
104
105
|
for provider_cls in core_providers:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from orionis.console.output.console import Console
|
|
2
|
+
from orionis.console.output.contracts.console import IConsole
|
|
3
|
+
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
|
+
|
|
5
|
+
class ConsoleProvider(ServiceProvider):
|
|
6
|
+
"""
|
|
7
|
+
Debug provider for the Orionis framework.
|
|
8
|
+
This provider is responsible for debugging functionalities.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def register(self) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Register services into the application container.
|
|
14
|
+
"""
|
|
15
|
+
self.app.transient(IConsole, Console, alias="core.orionis.console")
|
|
16
|
+
|
|
17
|
+
def boot(self) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Perform any post-registration bootstrapping or initialization.
|
|
20
|
+
"""
|
|
21
|
+
pass
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from orionis._console.dumper.dump_die import Debug
|
|
2
|
+
from orionis.console.dumper.contracts.dump import IDebug
|
|
3
|
+
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
|
+
|
|
5
|
+
class DumperProvider(ServiceProvider):
|
|
6
|
+
"""
|
|
7
|
+
Debug provider for the Orionis framework.
|
|
8
|
+
This provider is responsible for debugging functionalities.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def register(self) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Register services into the application container.
|
|
14
|
+
"""
|
|
15
|
+
self.app.transient(IDebug, Debug, alias="core.orionis.dumper")
|
|
16
|
+
|
|
17
|
+
def boot(self) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Perform any post-registration bootstrapping or initialization.
|
|
20
|
+
"""
|
|
21
|
+
pass
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from orionis.container.providers.service_provider import ServiceProvider
|
|
2
|
+
from orionis.services.paths.contracts.resolver import IResolver
|
|
3
|
+
from orionis.services.paths.resolver import Resolver
|
|
4
|
+
|
|
5
|
+
class PathResolverProvider(ServiceProvider):
|
|
6
|
+
"""
|
|
7
|
+
Debug provider for the Orionis framework.
|
|
8
|
+
This provider is responsible for debugging functionalities.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def register(self) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Register services into the application container.
|
|
14
|
+
"""
|
|
15
|
+
self.app.transient(IResolver, Resolver, alias="core.orionis.path_resolver")
|
|
16
|
+
|
|
17
|
+
def boot(self) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Perform any post-registration bootstrapping or initialization.
|
|
20
|
+
"""
|
|
21
|
+
pass
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from orionis.console.dynamic.contracts.progress_bar import IProgressBar
|
|
2
|
+
from orionis.console.dynamic.progress_bar import ProgressBar
|
|
3
|
+
from orionis.container.providers.service_provider import ServiceProvider
|
|
4
|
+
|
|
5
|
+
class ProgressBarProvider(ServiceProvider):
|
|
6
|
+
"""
|
|
7
|
+
Debug provider for the Orionis framework.
|
|
8
|
+
This provider is responsible for debugging functionalities.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def register(self) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Register services into the application container.
|
|
14
|
+
"""
|
|
15
|
+
self.app.transient(IProgressBar, ProgressBar, alias="core.orionis.progress_bar")
|
|
16
|
+
|
|
17
|
+
def boot(self) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Perform any post-registration bootstrapping or initialization.
|
|
20
|
+
"""
|
|
21
|
+
pass
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from orionis.container.providers.service_provider import ServiceProvider
|
|
2
|
+
from orionis.services.system.contracts.workers import IWorkers
|
|
3
|
+
from orionis.services.system.workers import Workers
|
|
4
|
+
|
|
5
|
+
class WorkersProvider(ServiceProvider):
|
|
6
|
+
"""
|
|
7
|
+
Debug provider for the Orionis framework.
|
|
8
|
+
This provider is responsible for debugging functionalities.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def register(self) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Register services into the application container.
|
|
14
|
+
"""
|
|
15
|
+
self.app.transient(IWorkers, Workers, alias="core.orionis.workers")
|
|
16
|
+
|
|
17
|
+
def boot(self) -> None:
|
|
18
|
+
"""
|
|
19
|
+
Perform any post-registration bootstrapping or initialization.
|
|
20
|
+
"""
|
|
21
|
+
pass
|
orionis/metadata/framework.py
CHANGED
|
@@ -5,7 +5,7 @@ import threading
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from typing import Any, Optional, Union
|
|
7
7
|
from dotenv import dotenv_values, load_dotenv, set_key, unset_key
|
|
8
|
-
from orionis.patterns.singleton
|
|
8
|
+
from orionis.support.patterns.singleton import Singleton
|
|
9
9
|
from orionis.services.environment.exceptions import OrionisEnvironmentValueException, OrionisEnvironmentValueError
|
|
10
10
|
from orionis.services.environment.dynamic.types import EnvTypes
|
|
11
11
|
|
|
@@ -55,13 +55,13 @@ class IResolver(ABC):
|
|
|
55
55
|
pass
|
|
56
56
|
|
|
57
57
|
@abstractmethod
|
|
58
|
-
def
|
|
58
|
+
def get(self):
|
|
59
59
|
"""
|
|
60
|
-
Returns the resolved path as a
|
|
60
|
+
Returns the resolved path as a Path object.
|
|
61
61
|
|
|
62
62
|
Returns
|
|
63
63
|
-------
|
|
64
|
-
|
|
64
|
+
Path
|
|
65
65
|
The resolved path.
|
|
66
66
|
"""
|
|
67
|
-
pass
|
|
67
|
+
pass
|
|
@@ -75,6 +75,17 @@ class Resolver(IResolver):
|
|
|
75
75
|
"""
|
|
76
76
|
return str(self.resolved_path)
|
|
77
77
|
|
|
78
|
+
def get(self) -> Path:
|
|
79
|
+
"""
|
|
80
|
+
Returns the resolved path as a Path object.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
Path
|
|
85
|
+
The resolved path.
|
|
86
|
+
"""
|
|
87
|
+
return self.resolved_path
|
|
88
|
+
|
|
78
89
|
def __str__(self) -> str:
|
|
79
90
|
"""
|
|
80
91
|
Returns the string representation of the resolved path.
|
|
@@ -10,6 +10,18 @@ class IWorkers(ABC):
|
|
|
10
10
|
according to the available CPU and memory resources of the current machine.
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def setRamPerWorker(self, ram_per_worker: float) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Set the amount of RAM allocated per worker.
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
ram_per_worker : float
|
|
21
|
+
Amount of RAM (in GB) allocated per worker.
|
|
22
|
+
"""
|
|
23
|
+
pass
|
|
24
|
+
|
|
13
25
|
@abstractmethod
|
|
14
26
|
def calculate(self) -> int:
|
|
15
27
|
"""
|
|
@@ -38,6 +38,17 @@ class Workers(IWorkers):
|
|
|
38
38
|
self._ram_total_gb = psutil.virtual_memory().total / (1024 ** 3)
|
|
39
39
|
self._ram_per_worker = ram_per_worker
|
|
40
40
|
|
|
41
|
+
def setRamPerWorker(self, ram_per_worker: float) -> None:
|
|
42
|
+
"""
|
|
43
|
+
Set the amount of RAM allocated per worker.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
ram_per_worker : float
|
|
48
|
+
Amount of RAM (in GB) allocated per worker.
|
|
49
|
+
"""
|
|
50
|
+
self._ram_per_worker = ram_per_worker
|
|
51
|
+
|
|
41
52
|
def calculate(self) -> int:
|
|
42
53
|
"""
|
|
43
54
|
Compute the maximum number of workers supported by the current machine.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from orionis.container.facades.facade import Facade
|
|
2
|
+
|
|
3
|
+
class Console(Facade):
|
|
4
|
+
|
|
5
|
+
@classmethod
|
|
6
|
+
def getFacadeAccessor(cls) -> str:
|
|
7
|
+
"""
|
|
8
|
+
Get the service container binding key for the dumper component.
|
|
9
|
+
|
|
10
|
+
Returns
|
|
11
|
+
-------
|
|
12
|
+
str
|
|
13
|
+
The service container binding key.
|
|
14
|
+
"""
|
|
15
|
+
return "core.orionis.console"
|