orionis 0.1.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/__init__.py +0 -0
- orionis/cli_manager.py +48 -0
- orionis/framework.py +45 -0
- orionis/luminate/__init__.py +0 -0
- orionis/luminate/app.py +0 -0
- orionis/luminate/bootstrap/__init__.py +0 -0
- orionis/luminate/bootstrap/parser.py +49 -0
- orionis/luminate/bootstrap/register.py +95 -0
- orionis/luminate/cache/__init__.py +0 -0
- orionis/luminate/cache/app/__init__.py +0 -0
- orionis/luminate/cache/app/config.py +96 -0
- orionis/luminate/cache/console/__init__.py +0 -0
- orionis/luminate/cache/console/commands.py +98 -0
- orionis/luminate/config/__init__.py +0 -0
- orionis/luminate/config/dataclass/__init__.py +0 -0
- orionis/luminate/config/dataclass/app.py +50 -0
- orionis/luminate/config/dataclass/auth.py +17 -0
- orionis/luminate/config/dataclass/cache.py +51 -0
- orionis/luminate/config/dataclass/cors.py +58 -0
- orionis/luminate/config/dataclass/database.py +203 -0
- orionis/luminate/config/dataclass/filesystems.py +102 -0
- orionis/luminate/config/dataclass/logging.py +107 -0
- orionis/luminate/config/dataclass/mail.py +81 -0
- orionis/luminate/config/dataclass/queue.py +63 -0
- orionis/luminate/config/dataclass/session.py +59 -0
- orionis/luminate/config/environment.py +110 -0
- orionis/luminate/config/sections.py +37 -0
- orionis/luminate/console/__init__.py +0 -0
- orionis/luminate/console/base/__init__.py +0 -0
- orionis/luminate/console/base/command.py +427 -0
- orionis/luminate/console/cache.py +132 -0
- orionis/luminate/console/command.py +40 -0
- orionis/luminate/console/command_filter.py +40 -0
- orionis/luminate/console/commands/__init__.py +0 -0
- orionis/luminate/console/commands/cache_clear.py +56 -0
- orionis/luminate/console/commands/help.py +59 -0
- orionis/luminate/console/commands/schedule_work.py +50 -0
- orionis/luminate/console/commands/tests.py +40 -0
- orionis/luminate/console/commands/version.py +39 -0
- orionis/luminate/console/exceptions/__init__.py +0 -0
- orionis/luminate/console/exceptions/cli_exception.py +125 -0
- orionis/luminate/console/kernel.py +32 -0
- orionis/luminate/console/output/__init__.py +0 -0
- orionis/luminate/console/output/console.py +426 -0
- orionis/luminate/console/output/executor.py +90 -0
- orionis/luminate/console/output/progress_bar.py +100 -0
- orionis/luminate/console/output/styles.py +95 -0
- orionis/luminate/console/parser.py +159 -0
- orionis/luminate/console/register.py +98 -0
- orionis/luminate/console/runner.py +126 -0
- orionis/luminate/console/scripts/__init__.py +0 -0
- orionis/luminate/console/scripts/management.py +94 -0
- orionis/luminate/console/tasks/__init__.py +0 -0
- orionis/luminate/console/tasks/scheduler.py +616 -0
- orionis/luminate/contracts/__init__.py +0 -0
- orionis/luminate/contracts/bootstrap/parser_interface.py +46 -0
- orionis/luminate/contracts/cache/__init__.py +0 -0
- orionis/luminate/contracts/cache/cache_commands_interface.py +69 -0
- orionis/luminate/contracts/config/__init__.py +0 -0
- orionis/luminate/contracts/config/config_interface.py +27 -0
- orionis/luminate/contracts/config/environment_interface.py +64 -0
- orionis/luminate/contracts/console/__init__.py +0 -0
- orionis/luminate/contracts/console/base_command_interface.py +448 -0
- orionis/luminate/contracts/console/cli_cache_interface.py +34 -0
- orionis/luminate/contracts/console/command_filter_interface.py +32 -0
- orionis/luminate/contracts/console/command_interface.py +36 -0
- orionis/luminate/contracts/console/console_interface.py +305 -0
- orionis/luminate/contracts/console/executor_interface.py +51 -0
- orionis/luminate/contracts/console/kernel_interface.py +32 -0
- orionis/luminate/contracts/console/management_interface.py +63 -0
- orionis/luminate/contracts/console/parser_interface.py +76 -0
- orionis/luminate/contracts/console/progress_bar_interface.py +66 -0
- orionis/luminate/contracts/console/register_interface.py +32 -0
- orionis/luminate/contracts/console/runner_interface.py +50 -0
- orionis/luminate/contracts/console/schedule_interface.py +317 -0
- orionis/luminate/contracts/console/task_manager_interface.py +37 -0
- orionis/luminate/contracts/facades/__init__.py +0 -0
- orionis/luminate/contracts/facades/env_interface.py +64 -0
- orionis/luminate/contracts/facades/log_interface.py +48 -0
- orionis/luminate/contracts/facades/paths_interface.py +141 -0
- orionis/luminate/contracts/facades/tests_interface.py +33 -0
- orionis/luminate/contracts/files/__init__.py +0 -0
- orionis/luminate/contracts/files/paths_interface.py +29 -0
- orionis/luminate/contracts/installer/__init__.py +0 -0
- orionis/luminate/contracts/installer/output_interface.py +125 -0
- orionis/luminate/contracts/installer/setup_interface.py +29 -0
- orionis/luminate/contracts/installer/upgrade_interface.py +24 -0
- orionis/luminate/contracts/log/__init__.py +0 -0
- orionis/luminate/contracts/log/logger_interface.py +33 -0
- orionis/luminate/contracts/pipelines/cli_pipeline_interface.py +84 -0
- orionis/luminate/contracts/publisher/__init__.py +0 -0
- orionis/luminate/contracts/publisher/pypi_publisher_interface.py +36 -0
- orionis/luminate/contracts/test/__init__.py +0 -0
- orionis/luminate/contracts/test/unit_test_interface.py +51 -0
- orionis/luminate/contracts/tools/__init__.py +0 -0
- orionis/luminate/contracts/tools/reflection_interface.py +343 -0
- orionis/luminate/contracts/tools/std_interface.py +56 -0
- orionis/luminate/facades/__init__.py +0 -0
- orionis/luminate/facades/environment.py +81 -0
- orionis/luminate/facades/log.py +56 -0
- orionis/luminate/facades/paths.py +268 -0
- orionis/luminate/facades/tests.py +48 -0
- orionis/luminate/files/__init__.py +0 -0
- orionis/luminate/files/paths.py +56 -0
- orionis/luminate/installer/__init__.py +0 -0
- orionis/luminate/installer/icon.ascii +11 -0
- orionis/luminate/installer/info.ascii +13 -0
- orionis/luminate/installer/output.py +188 -0
- orionis/luminate/installer/setup.py +191 -0
- orionis/luminate/installer/upgrade.py +42 -0
- orionis/luminate/log/__init__.py +0 -0
- orionis/luminate/log/logger.py +116 -0
- orionis/luminate/pipelines/__init__.py +0 -0
- orionis/luminate/pipelines/cli_pipeline.py +116 -0
- orionis/luminate/publisher/__init__.py +0 -0
- orionis/luminate/publisher/pypi.py +206 -0
- orionis/luminate/static/logos/flaskavel.png +0 -0
- orionis/luminate/test/__init__.py +0 -0
- orionis/luminate/test/exception.py +48 -0
- orionis/luminate/test/unit_test.py +108 -0
- orionis/luminate/tools/__init__.py +0 -0
- orionis/luminate/tools/reflection.py +390 -0
- orionis/luminate/tools/std.py +53 -0
- orionis-0.1.0.dist-info/LICENCE +21 -0
- orionis-0.1.0.dist-info/METADATA +27 -0
- orionis-0.1.0.dist-info/RECORD +133 -0
- orionis-0.1.0.dist-info/WHEEL +5 -0
- orionis-0.1.0.dist-info/entry_points.txt +2 -0
- orionis-0.1.0.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/tools/__init__.py +0 -0
- tests/tools/class_example.py +50 -0
- tests/tools/test_reflection.py +128 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
from typing import Any
|
2
|
+
from abc import ABC, abstractmethod
|
3
|
+
|
4
|
+
class ICommand(ABC):
|
5
|
+
"""
|
6
|
+
Interface for managing and executing registered commands.
|
7
|
+
|
8
|
+
This interface ensures that any class implementing it will provide a method
|
9
|
+
for executing commands from a cache by their signature.
|
10
|
+
"""
|
11
|
+
|
12
|
+
@abstractmethod
|
13
|
+
def call(signature: str, vars: dict[str, Any] = {}, *args: Any, **kwargs: Any) -> Any:
|
14
|
+
"""
|
15
|
+
Calls a registered command from the CacheCommands singleton.
|
16
|
+
|
17
|
+
This method retrieves the command class associated with the given
|
18
|
+
signature, instantiates it, and executes the `handle` method of
|
19
|
+
the command instance.
|
20
|
+
|
21
|
+
Parameters
|
22
|
+
----------
|
23
|
+
signature : str
|
24
|
+
The unique identifier (signature) of the command to be executed.
|
25
|
+
**kwargs : dict
|
26
|
+
Additional keyword arguments to be passed to the command instance
|
27
|
+
when it is created.
|
28
|
+
|
29
|
+
Raises
|
30
|
+
------
|
31
|
+
KeyError
|
32
|
+
If no command with the given signature is found in the cache.
|
33
|
+
RuntimeError
|
34
|
+
If an error occurs while executing the command.
|
35
|
+
"""
|
36
|
+
pass
|
@@ -0,0 +1,305 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IConsole(ABC):
|
4
|
+
"""
|
5
|
+
Interface for console utility operations, ensuring consistent method definitions.
|
6
|
+
|
7
|
+
Provides methods to print success, info, warning, and error messages with
|
8
|
+
optional timestamps, as well as general text formatting methods.
|
9
|
+
"""
|
10
|
+
|
11
|
+
# ---- SUCCESS ----
|
12
|
+
@abstractmethod
|
13
|
+
def success(message: str = '', timestamp: bool = True):
|
14
|
+
"""
|
15
|
+
Prints a success message with a green background.
|
16
|
+
|
17
|
+
Parameters
|
18
|
+
----------
|
19
|
+
message : str, optional
|
20
|
+
The success message to print (default is '').
|
21
|
+
timestamp : bool, optional
|
22
|
+
Whether to include a timestamp (default is True).
|
23
|
+
"""
|
24
|
+
pass
|
25
|
+
|
26
|
+
@abstractmethod
|
27
|
+
def textSuccess(message: str = ''):
|
28
|
+
"""Prints a success message in green."""
|
29
|
+
pass
|
30
|
+
|
31
|
+
@abstractmethod
|
32
|
+
def textSuccessBold(message: str = ''):
|
33
|
+
"""Prints a bold success message in green."""
|
34
|
+
pass
|
35
|
+
|
36
|
+
# ---- INFO ----
|
37
|
+
@abstractmethod
|
38
|
+
def info(message: str = '', timestamp: bool = True):
|
39
|
+
"""Prints an informational message with a blue background."""
|
40
|
+
pass
|
41
|
+
|
42
|
+
@abstractmethod
|
43
|
+
def textInfo(message: str = ''):
|
44
|
+
"""Prints an informational message in blue."""
|
45
|
+
pass
|
46
|
+
|
47
|
+
@abstractmethod
|
48
|
+
def textInfoBold(message: str = ''):
|
49
|
+
"""Prints a bold informational message in blue."""
|
50
|
+
pass
|
51
|
+
|
52
|
+
# ---- WARNING ----
|
53
|
+
@abstractmethod
|
54
|
+
def warning(message: str = '', timestamp: bool = True):
|
55
|
+
"""Prints a warning message with a yellow background."""
|
56
|
+
pass
|
57
|
+
|
58
|
+
@abstractmethod
|
59
|
+
def textWarning(message: str = ''):
|
60
|
+
"""Prints a warning message in yellow."""
|
61
|
+
pass
|
62
|
+
|
63
|
+
@abstractmethod
|
64
|
+
def textWarningBold(message: str = ''):
|
65
|
+
"""Prints a bold warning message in yellow."""
|
66
|
+
pass
|
67
|
+
|
68
|
+
# ---- FAIL ----
|
69
|
+
@abstractmethod
|
70
|
+
def fail(message: str = '', timestamp: bool = True):
|
71
|
+
"""Prints an fail message with a red background."""
|
72
|
+
pass
|
73
|
+
|
74
|
+
# ---- ERROR ----
|
75
|
+
@abstractmethod
|
76
|
+
def error(message: str = '', timestamp: bool = True):
|
77
|
+
"""Prints an error message with a red background."""
|
78
|
+
pass
|
79
|
+
|
80
|
+
@abstractmethod
|
81
|
+
def textError(message: str = ''):
|
82
|
+
"""Prints an error message in red."""
|
83
|
+
pass
|
84
|
+
|
85
|
+
@abstractmethod
|
86
|
+
def textErrorBold(message: str = ''):
|
87
|
+
"""Prints a bold error message in red."""
|
88
|
+
pass
|
89
|
+
|
90
|
+
# ---- MUTED ----
|
91
|
+
@abstractmethod
|
92
|
+
def textMuted(message: str = ''):
|
93
|
+
"""Prints a muted (gray) message."""
|
94
|
+
pass
|
95
|
+
|
96
|
+
@abstractmethod
|
97
|
+
def textMutedBold(message: str = ''):
|
98
|
+
"""Prints a bold muted (gray) message."""
|
99
|
+
pass
|
100
|
+
|
101
|
+
# ---- UNDERLINE ----
|
102
|
+
@abstractmethod
|
103
|
+
def textUnderline(message: str = ''):
|
104
|
+
"""
|
105
|
+
Prints an underlined message.
|
106
|
+
|
107
|
+
Parameters
|
108
|
+
----------
|
109
|
+
message : str, optional
|
110
|
+
The message to print (default is '').
|
111
|
+
"""
|
112
|
+
pass
|
113
|
+
|
114
|
+
# ---- CLEAR CONSOLE ----
|
115
|
+
@abstractmethod
|
116
|
+
def clear():
|
117
|
+
"""Clears the console screen."""
|
118
|
+
pass
|
119
|
+
|
120
|
+
@abstractmethod
|
121
|
+
def clearLine():
|
122
|
+
"""Clears the current console line."""
|
123
|
+
pass
|
124
|
+
|
125
|
+
# ---- EMPTY LINE CONSOLE ----
|
126
|
+
@abstractmethod
|
127
|
+
def line(message: str = ''):
|
128
|
+
"""Prints a line of text."""
|
129
|
+
pass
|
130
|
+
|
131
|
+
@abstractmethod
|
132
|
+
def newLine(count: int = 1):
|
133
|
+
"""
|
134
|
+
Prints multiple new lines.
|
135
|
+
|
136
|
+
Parameters
|
137
|
+
----------
|
138
|
+
count : int, optional
|
139
|
+
The number of new lines to print (default is 1).
|
140
|
+
|
141
|
+
Raises
|
142
|
+
------
|
143
|
+
ValueError
|
144
|
+
If count is less than or equal to 0.
|
145
|
+
"""
|
146
|
+
pass
|
147
|
+
|
148
|
+
# ---- WRITE CONSOLE ----
|
149
|
+
@abstractmethod
|
150
|
+
def write(message: str = ''):
|
151
|
+
"""
|
152
|
+
Prints a message without moving to the next line.
|
153
|
+
|
154
|
+
Parameters
|
155
|
+
----------
|
156
|
+
message : str, optional
|
157
|
+
The message to print (default is '').
|
158
|
+
"""
|
159
|
+
pass
|
160
|
+
|
161
|
+
@abstractmethod
|
162
|
+
def writeLine(message: str = ''):
|
163
|
+
"""
|
164
|
+
Prints a message and moves to the next line.
|
165
|
+
|
166
|
+
Parameters
|
167
|
+
----------
|
168
|
+
message : str, optional
|
169
|
+
The message to print (default is '').
|
170
|
+
"""
|
171
|
+
pass
|
172
|
+
|
173
|
+
@abstractmethod
|
174
|
+
def ask(question: str) -> str:
|
175
|
+
"""
|
176
|
+
Prompts the user for input with a message and returns the user's response.
|
177
|
+
|
178
|
+
Parameters
|
179
|
+
----------
|
180
|
+
question : str
|
181
|
+
The question to ask the user.
|
182
|
+
|
183
|
+
Returns
|
184
|
+
-------
|
185
|
+
str
|
186
|
+
The user's input, as a string.
|
187
|
+
"""
|
188
|
+
pass
|
189
|
+
|
190
|
+
@abstractmethod
|
191
|
+
def confirm(question: str, default: bool = False) -> bool:
|
192
|
+
"""
|
193
|
+
Asks a confirmation question and returns True or False based on the user's response.
|
194
|
+
|
195
|
+
Parameters
|
196
|
+
----------
|
197
|
+
question : str
|
198
|
+
The confirmation question to ask.
|
199
|
+
default : bool, optional
|
200
|
+
The default response if the user presses Enter without typing a response.
|
201
|
+
Default is False, which corresponds to a 'No' response.
|
202
|
+
|
203
|
+
Returns
|
204
|
+
-------
|
205
|
+
bool
|
206
|
+
The user's response, which will be True if 'Y' is entered,
|
207
|
+
or False if 'N' is entered or the default is used.
|
208
|
+
"""
|
209
|
+
pass
|
210
|
+
|
211
|
+
@abstractmethod
|
212
|
+
def secret(question: str) -> str:
|
213
|
+
"""
|
214
|
+
Prompts the user for hidden input, typically used for password input.
|
215
|
+
|
216
|
+
Parameters
|
217
|
+
----------
|
218
|
+
question : str
|
219
|
+
The prompt to ask the user.
|
220
|
+
|
221
|
+
Returns
|
222
|
+
-------
|
223
|
+
str
|
224
|
+
The user's hidden input, returned as a string.
|
225
|
+
"""
|
226
|
+
pass
|
227
|
+
|
228
|
+
@abstractmethod
|
229
|
+
def table(headers: list, rows: list):
|
230
|
+
"""
|
231
|
+
Prints a table in the console with the given headers and rows.
|
232
|
+
|
233
|
+
Parameters
|
234
|
+
----------
|
235
|
+
headers : list of str
|
236
|
+
The column headers for the table.
|
237
|
+
rows : list of list of str
|
238
|
+
The rows of the table, where each row is a list of strings representing the columns.
|
239
|
+
|
240
|
+
Notes
|
241
|
+
-----
|
242
|
+
The method calculates the maximum width of each column and formats the output accordingly.
|
243
|
+
It prints a header row followed by a separator and the data rows.
|
244
|
+
"""
|
245
|
+
pass
|
246
|
+
|
247
|
+
@abstractmethod
|
248
|
+
def anticipate(question: str, options: list, default=None):
|
249
|
+
"""
|
250
|
+
Provides autocomplete suggestions based on user input.
|
251
|
+
|
252
|
+
Parameters
|
253
|
+
----------
|
254
|
+
question : str
|
255
|
+
The prompt for the user.
|
256
|
+
options : list of str
|
257
|
+
The list of possible options for autocomplete.
|
258
|
+
default : str, optional
|
259
|
+
The default value if no matching option is found. Defaults to None.
|
260
|
+
|
261
|
+
Returns
|
262
|
+
-------
|
263
|
+
str
|
264
|
+
The chosen option or the default value.
|
265
|
+
|
266
|
+
Notes
|
267
|
+
-----
|
268
|
+
This method allows the user to input a string, and then attempts to provide
|
269
|
+
an autocomplete suggestion by matching the beginning of the input with the
|
270
|
+
available options. If no match is found, the method returns the default value
|
271
|
+
or the user input if no default is provided.
|
272
|
+
"""
|
273
|
+
pass
|
274
|
+
|
275
|
+
@abstractmethod
|
276
|
+
def choice(question: str, choices: list, default_index: int = 0) -> str:
|
277
|
+
"""
|
278
|
+
Allows the user to select an option from a list.
|
279
|
+
|
280
|
+
Parameters
|
281
|
+
----------
|
282
|
+
question : str
|
283
|
+
The prompt for the user.
|
284
|
+
choices : list of str
|
285
|
+
The list of available choices.
|
286
|
+
default_index : int, optional
|
287
|
+
The index of the default choice (zero-based). Defaults to 0.
|
288
|
+
|
289
|
+
Returns
|
290
|
+
-------
|
291
|
+
str
|
292
|
+
The selected choice.
|
293
|
+
|
294
|
+
Raises
|
295
|
+
------
|
296
|
+
ValueError
|
297
|
+
If `default_index` is out of the range of choices.
|
298
|
+
|
299
|
+
Notes
|
300
|
+
-----
|
301
|
+
The user is presented with a numbered list of choices and prompted to select
|
302
|
+
one by entering the corresponding number. If an invalid input is provided,
|
303
|
+
the user will be repeatedly prompted until a valid choice is made.
|
304
|
+
"""
|
305
|
+
pass
|
@@ -0,0 +1,51 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IExecutor(ABC):
|
4
|
+
"""
|
5
|
+
Interface for execution state logging.
|
6
|
+
|
7
|
+
This interface defines methods for logging different execution states:
|
8
|
+
"RUNNING", "DONE", and "FAIL".
|
9
|
+
"""
|
10
|
+
|
11
|
+
@abstractmethod
|
12
|
+
def running(program: str, time: str = ''):
|
13
|
+
"""
|
14
|
+
Logs the execution of a program in a "RUNNING" state.
|
15
|
+
|
16
|
+
Parameters
|
17
|
+
----------
|
18
|
+
program : str
|
19
|
+
The name of the program being executed.
|
20
|
+
time : str, optional
|
21
|
+
The time duration of execution, default is an empty string.
|
22
|
+
"""
|
23
|
+
pass
|
24
|
+
|
25
|
+
@abstractmethod
|
26
|
+
def done(program: str, time: str = ''):
|
27
|
+
"""
|
28
|
+
Logs the execution of a program in a "DONE" state.
|
29
|
+
|
30
|
+
Parameters
|
31
|
+
----------
|
32
|
+
program : str
|
33
|
+
The name of the program being executed.
|
34
|
+
time : str, optional
|
35
|
+
The time duration of execution, default is an empty string.
|
36
|
+
"""
|
37
|
+
pass
|
38
|
+
|
39
|
+
@abstractmethod
|
40
|
+
def fail(program: str, time: str = ''):
|
41
|
+
"""
|
42
|
+
Logs the execution of a program in a "FAIL" state.
|
43
|
+
|
44
|
+
Parameters
|
45
|
+
----------
|
46
|
+
program : str
|
47
|
+
The name of the program being executed.
|
48
|
+
time : str, optional
|
49
|
+
The time duration of execution, default is an empty string.
|
50
|
+
"""
|
51
|
+
pass
|
@@ -0,0 +1,32 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
from typing import Any, Tuple
|
3
|
+
|
4
|
+
class ICLIKernel(ABC):
|
5
|
+
"""
|
6
|
+
Interface for CLIKernel, defining the required method for handling CLI command execution.
|
7
|
+
|
8
|
+
This interface ensures that any implementing class can process CLI arguments
|
9
|
+
and delegate execution accordingly.
|
10
|
+
|
11
|
+
Methods
|
12
|
+
-------
|
13
|
+
handle(*args: tuple[Any, ...]) -> Any
|
14
|
+
Processes CLI arguments and delegates execution to the appropriate command runner.
|
15
|
+
"""
|
16
|
+
|
17
|
+
@abstractmethod
|
18
|
+
def handle(self, *args: Tuple[Any, ...]) -> Any:
|
19
|
+
"""
|
20
|
+
Handles CLI command execution by forwarding arguments to a command runner.
|
21
|
+
|
22
|
+
Parameters
|
23
|
+
----------
|
24
|
+
*args : tuple[Any, ...]
|
25
|
+
A tuple containing CLI arguments passed from the command line.
|
26
|
+
|
27
|
+
Returns
|
28
|
+
-------
|
29
|
+
Any
|
30
|
+
The result of the executed command.
|
31
|
+
"""
|
32
|
+
pass
|
@@ -0,0 +1,63 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IManagement(ABC):
|
4
|
+
"""
|
5
|
+
Interface defining the contract for the Management class.
|
6
|
+
|
7
|
+
This interface ensures that any implementing class provides methods for
|
8
|
+
displaying the framework version, upgrading the framework, creating a new
|
9
|
+
application, and displaying additional information.
|
10
|
+
"""
|
11
|
+
|
12
|
+
@abstractmethod
|
13
|
+
def displayVersion(self) -> str:
|
14
|
+
"""
|
15
|
+
Display the current version of the framework.
|
16
|
+
|
17
|
+
Returns
|
18
|
+
-------
|
19
|
+
str
|
20
|
+
The ASCII representation of the framework version.
|
21
|
+
"""
|
22
|
+
pass
|
23
|
+
|
24
|
+
@abstractmethod
|
25
|
+
def executeUpgrade(self) -> None:
|
26
|
+
"""
|
27
|
+
Execute the framework upgrade process to the latest version.
|
28
|
+
|
29
|
+
Raises
|
30
|
+
------
|
31
|
+
Exception
|
32
|
+
If an error occurs during the upgrade process.
|
33
|
+
"""
|
34
|
+
pass
|
35
|
+
|
36
|
+
@abstractmethod
|
37
|
+
def createNewApp(self, name_app: str) -> None:
|
38
|
+
"""
|
39
|
+
Create a new application with the given name.
|
40
|
+
|
41
|
+
Parameters
|
42
|
+
----------
|
43
|
+
name_app : str
|
44
|
+
The name of the new application.
|
45
|
+
|
46
|
+
Raises
|
47
|
+
------
|
48
|
+
Exception
|
49
|
+
If an error occurs during the application setup.
|
50
|
+
"""
|
51
|
+
pass
|
52
|
+
|
53
|
+
@abstractmethod
|
54
|
+
def displayInfo(self) -> None:
|
55
|
+
"""
|
56
|
+
Display additional information about the framework.
|
57
|
+
|
58
|
+
Raises
|
59
|
+
------
|
60
|
+
Exception
|
61
|
+
If an error occurs while displaying information.
|
62
|
+
"""
|
63
|
+
pass
|
@@ -0,0 +1,76 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
from typing import List, Tuple, Dict, Any
|
3
|
+
import argparse
|
4
|
+
|
5
|
+
|
6
|
+
class IParser(ABC):
|
7
|
+
"""
|
8
|
+
Interface for a command-line argument parser.
|
9
|
+
|
10
|
+
Defines the necessary methods for a command-line parser, ensuring
|
11
|
+
consistency across implementations.
|
12
|
+
"""
|
13
|
+
|
14
|
+
@abstractmethod
|
15
|
+
def __init__(self, vars: Dict[str, Any], args: Tuple[Any, ...], kwargs: Dict[str, Any]):
|
16
|
+
"""
|
17
|
+
Initializes the parser.
|
18
|
+
|
19
|
+
Parameters
|
20
|
+
----------
|
21
|
+
vars : dict
|
22
|
+
A dictionary containing additional variables.
|
23
|
+
args : tuple
|
24
|
+
A tuple containing command-line arguments.
|
25
|
+
kwargs : dict
|
26
|
+
A dictionary containing keyword arguments.
|
27
|
+
"""
|
28
|
+
pass
|
29
|
+
|
30
|
+
@abstractmethod
|
31
|
+
def setArguments(self, arguments: List[Tuple[str, Dict[str, Any]]]) -> None:
|
32
|
+
"""
|
33
|
+
Registers command-line arguments dynamically.
|
34
|
+
|
35
|
+
Parameters
|
36
|
+
----------
|
37
|
+
arguments : list of tuple
|
38
|
+
A list of tuples where each tuple contains:
|
39
|
+
- str: The argument name (e.g., '--value')
|
40
|
+
- dict: A dictionary of options (e.g., {'type': int, 'required': True})
|
41
|
+
|
42
|
+
Raises
|
43
|
+
------
|
44
|
+
ValueError
|
45
|
+
If an argument is already registered.
|
46
|
+
"""
|
47
|
+
pass
|
48
|
+
|
49
|
+
@abstractmethod
|
50
|
+
def recognize(self) -> None:
|
51
|
+
"""
|
52
|
+
Processes and formats command-line arguments before parsing.
|
53
|
+
|
54
|
+
Raises
|
55
|
+
------
|
56
|
+
ValueError
|
57
|
+
If an argument does not follow the correct format.
|
58
|
+
"""
|
59
|
+
pass
|
60
|
+
|
61
|
+
@abstractmethod
|
62
|
+
def get(self) -> argparse.Namespace:
|
63
|
+
"""
|
64
|
+
Parses the collected command-line arguments.
|
65
|
+
|
66
|
+
Returns
|
67
|
+
-------
|
68
|
+
argparse.Namespace
|
69
|
+
The parsed arguments as an object where each argument is an attribute.
|
70
|
+
|
71
|
+
Raises
|
72
|
+
------
|
73
|
+
ValueError
|
74
|
+
If required arguments are missing or an error occurs during parsing.
|
75
|
+
"""
|
76
|
+
pass
|
@@ -0,0 +1,66 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IProgressBar(ABC):
|
4
|
+
"""
|
5
|
+
Interface for a progress bar.
|
6
|
+
|
7
|
+
This interface defines the structure for a progress bar, enforcing
|
8
|
+
the implementation of methods to initialize, update, and complete
|
9
|
+
the progress tracking.
|
10
|
+
|
11
|
+
Methods
|
12
|
+
-------
|
13
|
+
start()
|
14
|
+
Initializes the progress bar and sets it to the starting state.
|
15
|
+
advance(increment)
|
16
|
+
Advances the progress bar by a specific increment.
|
17
|
+
finish()
|
18
|
+
Completes the progress bar and ensures the final state is displayed.
|
19
|
+
"""
|
20
|
+
|
21
|
+
@abstractmethod
|
22
|
+
def start(self):
|
23
|
+
"""
|
24
|
+
Initializes the progress bar.
|
25
|
+
|
26
|
+
This method should be implemented to set the progress bar
|
27
|
+
to its initial state and display the starting progress.
|
28
|
+
|
29
|
+
Raises
|
30
|
+
------
|
31
|
+
NotImplementedError
|
32
|
+
If the method is not implemented in a subclass.
|
33
|
+
"""
|
34
|
+
pass
|
35
|
+
|
36
|
+
@abstractmethod
|
37
|
+
def advance(self, increment: int):
|
38
|
+
"""
|
39
|
+
Advances the progress bar by a given increment.
|
40
|
+
|
41
|
+
Parameters
|
42
|
+
----------
|
43
|
+
increment : int
|
44
|
+
The amount by which the progress should be increased.
|
45
|
+
|
46
|
+
Raises
|
47
|
+
------
|
48
|
+
NotImplementedError
|
49
|
+
If the method is not implemented in a subclass.
|
50
|
+
"""
|
51
|
+
pass
|
52
|
+
|
53
|
+
@abstractmethod
|
54
|
+
def finish(self):
|
55
|
+
"""
|
56
|
+
Completes the progress bar.
|
57
|
+
|
58
|
+
This method should be implemented to ensure the progress bar
|
59
|
+
reaches its final state and is properly displayed.
|
60
|
+
|
61
|
+
Raises
|
62
|
+
------
|
63
|
+
NotImplementedError
|
64
|
+
If the method is not implemented in a subclass.
|
65
|
+
"""
|
66
|
+
pass
|
@@ -0,0 +1,32 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class IRegister(ABC):
|
4
|
+
"""
|
5
|
+
Interface for a command register.
|
6
|
+
"""
|
7
|
+
|
8
|
+
@abstractmethod
|
9
|
+
def command(self, command_class):
|
10
|
+
"""
|
11
|
+
Registers a command class after validating its structure.
|
12
|
+
|
13
|
+
Parameters
|
14
|
+
----------
|
15
|
+
command_class : type
|
16
|
+
The command class to register.
|
17
|
+
|
18
|
+
Returns
|
19
|
+
-------
|
20
|
+
type
|
21
|
+
The registered command class.
|
22
|
+
|
23
|
+
Raises
|
24
|
+
------
|
25
|
+
ValueError
|
26
|
+
If 'signature' is missing, invalid, contains spaces, or is not a string.
|
27
|
+
If 'description' is missing or not a string.
|
28
|
+
If 'handle' method is missing.
|
29
|
+
TypeError
|
30
|
+
If the class does not inherit from 'BaseCommand'.
|
31
|
+
"""
|
32
|
+
pass
|