orionis 0.427.0__py3-none-any.whl → 0.428.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.
@@ -0,0 +1,31 @@
1
+ from orionis.console.base.command import BaseCommand
2
+ from orionis.console.exceptions import CLIOrionisRuntimeError
3
+ from orionis.metadata.framework import VERSION
4
+
5
+ class VersionCommand(BaseCommand):
6
+ """
7
+ Command class to display the current version of the Orionis framework.
8
+
9
+ This command prints the version number of the framework in use.
10
+ """
11
+
12
+ signature = "version"
13
+
14
+ description = "Prints the version of the framework in use."
15
+
16
+ def handle(self) -> None:
17
+ """
18
+ Execute the version command.
19
+
20
+ This method retrieves and prints the version of the Orionis framework.
21
+
22
+ Raises
23
+ ------
24
+ ValueError
25
+ If an unexpected error occurs during execution, a ValueError is raised
26
+ with the original exception message.
27
+ """
28
+ try:
29
+ self.textSuccessBold(f"Orionis Framework v{VERSION}")
30
+ except Exception as e:
31
+ raise CLIOrionisRuntimeError(f"An unexpected error occurred: {e}") from e
@@ -0,0 +1,15 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class IKernelCLI(ABC):
4
+ """
5
+ Interface for the Kernel CLI.
6
+ """
7
+
8
+ @abstractmethod
9
+ def handle(self, args: list) -> None:
10
+ """
11
+ Handle the command line arguments.
12
+
13
+ :param args: List of command line arguments (e.g., sys.argv).
14
+ """
15
+ raise NotImplementedError("This method should be overridden by subclasses.")
@@ -0,0 +1,11 @@
1
+ from .cli_exception import CLIOrionisException
2
+ from .cli_runtime_error import CLIOrionisRuntimeError
3
+ from .cli_schedule_exception import CLIOrionisScheduleException
4
+ from .cli_orionis_value_error import CLIOrionisValueError
5
+
6
+ __all__ = [
7
+ 'CLIOrionisException',
8
+ 'CLIOrionisRuntimeError',
9
+ 'CLIOrionisScheduleException',
10
+ 'CLIOrionisValueError'
11
+ ]
@@ -0,0 +1,25 @@
1
+ from orionis.console.contracts.kernel import IKernelCLI
2
+ from orionis.foundation.contracts.application import IApplication
3
+ from orionis.console.exceptions import CLIOrionisValueError
4
+
5
+ class KernelCLI(IKernelCLI):
6
+
7
+ def __init__(
8
+ self,
9
+ app: IApplication
10
+ ) -> None:
11
+
12
+ # Validate that the app is an instance of IApplication
13
+ if not isinstance(app, IApplication):
14
+ raise CLIOrionisValueError(
15
+ f"Failed to initialize TestKernel: expected IApplication, got {type(app).__module__}.{type(app).__name__}."
16
+ )
17
+
18
+ def handle(self, args: list) -> None:
19
+ """
20
+ Handle the command line arguments.
21
+
22
+ :param args: List of command line arguments (e.g., sys.argv).
23
+ """
24
+ # This method should be implemented in subclasses
25
+ print(args)
@@ -114,10 +114,12 @@ class Application(Container, IApplication):
114
114
 
115
115
  # Import core framework kernels
116
116
  from orionis.test.kernel import TestKernel, ITestKernel
117
+ from orionis.console.kelnel import KernelCLI, IKernelCLI
117
118
 
118
119
  # Core framework kernels
119
120
  core_kernels = {
120
- ITestKernel: TestKernel
121
+ ITestKernel: TestKernel,
122
+ IKernelCLI: KernelCLI
121
123
  }
122
124
 
123
125
  # Register each kernel instance
@@ -1255,7 +1257,7 @@ class Application(Container, IApplication):
1255
1257
 
1256
1258
  # Return the entire configuration if key is None, except for paths
1257
1259
  if key is None:
1258
- del self.__config['paths']
1260
+ del self.__config['path']
1259
1261
  return self.__config
1260
1262
 
1261
1263
  # If key is None, raise an error to prevent ambiguity
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.427.0"
8
+ VERSION = "0.428.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
orionis/test/kernel.py CHANGED
@@ -2,11 +2,12 @@ from pathlib import Path
2
2
  import re
3
3
  from typing import List
4
4
  from os import walk
5
+ from orionis.console.output.contracts.console import IConsole
5
6
  from orionis.foundation.config.testing.entities.testing import Testing
6
7
  from orionis.foundation.contracts.application import IApplication
7
8
  from orionis.test.contracts.kernel import ITestKernel
8
9
  from orionis.test.contracts.unit_test import IUnitTest
9
- from orionis.test.exceptions import OrionisTestConfigException
10
+ from orionis.test.exceptions import OrionisTestConfigException, OrionisTestFailureException
10
11
 
11
12
  class TestKernel(ITestKernel):
12
13
 
@@ -42,6 +43,9 @@ class TestKernel(ITestKernel):
42
43
  self.__unit_test._UnitTest__app = app
43
44
  self.__unit_test._UnitTest__storage = app.path('storage_testing')
44
45
 
46
+ # Initialize the console for output
47
+ self.__console: IConsole = app.make('core.orionis.console')
48
+
45
49
  def __listMatchingFolders(
46
50
  self,
47
51
  base_path: Path,
@@ -92,54 +96,65 @@ class TestKernel(ITestKernel):
92
96
  IUnitTest
93
97
  The configured and executed unit test instance.
94
98
  """
99
+ try:
100
+
101
+ # Configure the unit test with parameters from the configuration
102
+ self.__unit_test.configure(
103
+ verbosity=self.__config.verbosity,
104
+ execution_mode=self.__config.execution_mode,
105
+ max_workers=self.__config.max_workers,
106
+ fail_fast=self.__config.fail_fast,
107
+ print_result=self.__config.print_result,
108
+ throw_exception=self.__config.throw_exception,
109
+ persistent=self.__config.persistent,
110
+ persistent_driver=self.__config.persistent_driver,
111
+ web_report=self.__config.web_report
112
+ )
113
+
114
+ # Prepare paths and pattern for test discovery
115
+ base_path = (Path.cwd() / self.__config.base_path).resolve()
116
+ folder_path = self.__config.folder_path
117
+ pattern = self.__config.pattern
118
+
119
+ # Set to hold discovered folders
120
+ discovered_folders = set()
121
+
122
+ # Discover folders containing test files according to the configuration
123
+
124
+ # Search all folders under base_path
125
+ if folder_path == '*':
126
+ discovered_folders.update(self.__listMatchingFolders(base_path, base_path, pattern))
95
127
 
96
- # Configure the unit test with parameters from the configuration
97
- self.__unit_test.configure(
98
- verbosity=self.__config.verbosity,
99
- execution_mode=self.__config.execution_mode,
100
- max_workers=self.__config.max_workers,
101
- fail_fast=self.__config.fail_fast,
102
- print_result=self.__config.print_result,
103
- throw_exception=self.__config.throw_exception,
104
- persistent=self.__config.persistent,
105
- persistent_driver=self.__config.persistent_driver,
106
- web_report=self.__config.web_report
107
- )
108
-
109
- # Prepare paths and pattern for test discovery
110
- base_path = (Path.cwd() / self.__config.base_path).resolve()
111
- folder_path = self.__config.folder_path
112
- pattern = self.__config.pattern
113
-
114
- # Set to hold discovered folders
115
- discovered_folders = set()
116
-
117
- # Discover folders containing test files according to the configuration
118
-
119
- # Search all folders under base_path
120
- if folder_path == '*':
121
- discovered_folders.update(self.__listMatchingFolders(base_path, base_path, pattern))
122
-
123
- # Search each custom folder in the list
124
- elif isinstance(folder_path, list):
125
- for custom in folder_path:
126
- custom_path = (base_path / custom).resolve()
128
+ # Search each custom folder in the list
129
+ elif isinstance(folder_path, list):
130
+ for custom in folder_path:
131
+ custom_path = (base_path / custom).resolve()
132
+ discovered_folders.update(self.__listMatchingFolders(base_path, custom_path, pattern))
133
+
134
+ # Search a single custom folder
135
+ else:
136
+ custom_path = (base_path / folder_path).resolve()
127
137
  discovered_folders.update(self.__listMatchingFolders(base_path, custom_path, pattern))
128
138
 
129
- # Search a single custom folder
130
- else:
131
- custom_path = (base_path / folder_path).resolve()
132
- discovered_folders.update(self.__listMatchingFolders(base_path, custom_path, pattern))
133
-
134
- # Register discovered folders with the unit test for test discovery
135
- for folder in discovered_folders:
136
- self.__unit_test.discoverTestsInFolder(
137
- folder_path=folder,
138
- base_path=self.__config.base_path,
139
- pattern=pattern,
140
- test_name_pattern=self.__config.test_name_pattern or None,
141
- tags=self.__config.tags or None
142
- )
139
+ # Register discovered folders with the unit test for test discovery
140
+ for folder in discovered_folders:
141
+ self.__unit_test.discoverTestsInFolder(
142
+ folder_path=folder,
143
+ base_path=self.__config.base_path,
144
+ pattern=pattern,
145
+ test_name_pattern=self.__config.test_name_pattern or None,
146
+ tags=self.__config.tags or None
147
+ )
148
+
149
+ # Run the unit tests and return the result
150
+ return self.__unit_test.run()
151
+
152
+ except OrionisTestFailureException as e:
153
+
154
+ # Handle test failures and exit with an error message
155
+ self.__console.exitError(f"Test execution failed: {e}")
156
+
157
+ except Exception as e:
143
158
 
144
- # Run the unit tests and return the result
145
- return self.__unit_test.run()
159
+ # Handle unexpected errors and exit with a generic error message
160
+ self.__console.exitError(f"An unexpected error occurred: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.427.0
3
+ Version: 0.428.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -3,8 +3,6 @@ orionis/_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
3
3
  orionis/_console/command_filter.py,sha256=bn0fcWfQg13DrQBaV4NopNxdP-6up0G54Qmhg7r_BKA,1211
4
4
  orionis/_console/kernel.py,sha256=M4Zc9x-1hrQP7Dq6Ons5UnGoq73XV1Fwa9cwY7zqWbw,883
5
5
  orionis/_console/parser.py,sha256=s-e7I4vr2rwg2g8eesvrOnp1jcEiLlBJN4wLh3JyKUE,5578
6
- orionis/_console/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- orionis/_console/base/command.py,sha256=J1BluZaVOeWwwm7NkvFcQqPjzZe_aYXW3icUJA38mZU,12320
8
6
  orionis/_console/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
7
  orionis/_console/commands/cache_clear.py,sha256=TNrAyB84QZQv_etn7srt_TPE9j6fLNkqymC-1jZ9XEI,2892
10
8
  orionis/_console/commands/help.py,sha256=KWHemD2j8YZdX-J6GYL3CNcoByb3XAgxGFzZRZsTKrk,2538
@@ -12,20 +10,18 @@ orionis/_console/commands/schedule_work.py,sha256=IcraCM_jvEXGyQpMUz6qWA2uW4ILhE
12
10
  orionis/_console/commands/version.py,sha256=r7I782jVS_1kbxAVfViGGj1m4GoDJtrb_V_L4MKYGfU,1051
13
11
  orionis/_console/dumper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
12
  orionis/_console/dumper/dump_die.py,sha256=AsKrcuPwVgTT3UA8DxqFCzuZsGkaGm7bwkm-pr9XlaE,17089
15
- orionis/_console/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- orionis/_console/exceptions/cli-orionis-value-error.py,sha256=RQP0HRwxDG8hxFOT1kUoZ1Ab1CZ1KLoSIl5yqlmgG4M,1147
17
- orionis/_console/exceptions/cli_exception.py,sha256=HsZ_vSeNiJWQ0gznVFNcIdhM0Bj_vkSRVBJs0wMjEKY,1141
18
- orionis/_console/exceptions/cli_runtime_error.py,sha256=DaCDGu6mXBk1LIzc7cwRROw1mePAigPNASjNZHhUSBE,1154
19
- orionis/_console/exceptions/cli_schedule_exception.py,sha256=IBbXb_5zi02pyo1laHdjGn6FYZK7WWRp4j2fkZOCT6I,1161
20
13
  orionis/_console/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
14
  orionis/_console/output/console.py,sha256=6KlvtE4ys6jJU9yLjAVYIHWDmHfWcOHIn_QGcHiJgq0,18894
22
15
  orionis/_console/output/executor.py,sha256=sk1l_SmTDE9ZDCUQ95XCwfx7HfBNJFOVs7Kjez9wBSc,3358
23
16
  orionis/_console/output/progress_bar.py,sha256=EX1d_sw9JRlE2gWu24bBBRpP2mWfgO_P9S6ztvWuZ2Q,3088
24
17
  orionis/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ orionis/console/kelnel.py,sha256=1CuBCLR6KItRt0_m50YQXirJUMX6lJf4Z4vvOjBqaUU,856
25
19
  orionis/console/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
20
  orionis/console/base/command.py,sha256=2kKyTaEzI16Up-XCUeNeJmDWPLN-CweQm3EgrN9U8NQ,3027
27
21
  orionis/console/base/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
22
  orionis/console/base/contracts/command.py,sha256=s9yjma-s1URkVm0EbVvSkETAm-N8xX7OnZS43P8pvk8,1957
23
+ orionis/console/commands/version.py,sha256=6usAWQnhmpCY5S95gRm1xVQc0ph-qd7UwMI_5OaDKmQ,1031
24
+ orionis/console/contracts/kernel.py,sha256=fzD8FNVSKEQ5gW5D83hVecz9dVHgy28rRDORDdghp4s,409
29
25
  orionis/console/dumper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
26
  orionis/console/dumper/dump.py,sha256=CATERiQ6XuIrKQsDaWcVxzTtlAJI9qLJX44fQxEX8ws,22443
31
27
  orionis/console/dumper/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -34,6 +30,11 @@ orionis/console/dynamic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
34
30
  orionis/console/dynamic/progress_bar.py,sha256=Cw6YqTVhD39TOZe7Ofz1qcDswHm_UVbs-wyS4jOMNzs,3126
35
31
  orionis/console/dynamic/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
32
  orionis/console/dynamic/contracts/progress_bar.py,sha256=NYebL2h-vg2t2H6IhJjuC37gglRkpT-MW71wbJtpLNg,1784
33
+ orionis/console/exceptions/__init__.py,sha256=0qlHNuHMVZO87M-rP8lThUUyljRM1jSFNikaxSCjSbw,366
34
+ orionis/console/exceptions/cli_exception.py,sha256=HsZ_vSeNiJWQ0gznVFNcIdhM0Bj_vkSRVBJs0wMjEKY,1141
35
+ orionis/console/exceptions/cli_orionis_value_error.py,sha256=RQP0HRwxDG8hxFOT1kUoZ1Ab1CZ1KLoSIl5yqlmgG4M,1147
36
+ orionis/console/exceptions/cli_runtime_error.py,sha256=DaCDGu6mXBk1LIzc7cwRROw1mePAigPNASjNZHhUSBE,1154
37
+ orionis/console/exceptions/cli_schedule_exception.py,sha256=IBbXb_5zi02pyo1laHdjGn6FYZK7WWRp4j2fkZOCT6I,1161
37
38
  orionis/console/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
39
  orionis/console/output/console.py,sha256=cN0Jq0KEJaOfM5Y9La3Eel1o6nkVqx_TCWcQ-xyarFw,18725
39
40
  orionis/console/output/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -75,7 +76,7 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
75
76
  orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
76
77
  orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
77
78
  orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
- orionis/foundation/application.py,sha256=FVQqZgv3_lMvpPZ6vYk24MknUtd2VIXwAcxSzdn09t4,49494
79
+ orionis/foundation/application.py,sha256=0dzMnxCJkFDU3dQWHcGu8V6Vl6GTgJbcAj3KU-bZqFY,49595
79
80
  orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
81
  orionis/foundation/config/startup.py,sha256=vbzduprRCNyYeR2nnMaqc1uKXw6PTzAY2jVfXNQKN8I,9691
81
82
  orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -185,7 +186,7 @@ orionis/foundation/providers/progress_bar_provider.py,sha256=WW3grNgH-yV2meSSTeO
185
186
  orionis/foundation/providers/testing_provider.py,sha256=iJSN2RIChbYIL-1ue6vmPmDMCSrvERDkti4Er9MPiLA,1102
186
187
  orionis/foundation/providers/workers_provider.py,sha256=kiQjQRyUEyiBX2zcbF_KmqRgvc7Bvxsvg5oMtIvYniM,1075
187
188
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
188
- orionis/metadata/framework.py,sha256=2KxhlB8r7AO29c8aZHEQvsU7tqRPvUHrrD0lueqzjWg,4960
189
+ orionis/metadata/framework.py,sha256=hQtH6dmV2_XxGLqwzTefzmVqoGk-BXn8vio170CjW9Q,4960
189
190
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
190
191
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
191
192
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -306,7 +307,7 @@ orionis/support/standard/exceptions/value.py,sha256=7xry_TZz3k-BLAZTR_uDiQ0RfXOk
306
307
  orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
307
308
  orionis/support/wrapper/dot_dict.py,sha256=L4J_3id0EHXyjv5FCofXK0ONC2WOoAXZSwX1csitf5E,9299
308
309
  orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
309
- orionis/test/kernel.py,sha256=i1VlWl4ZqfGxpc1-JiV3RS0rTrfOMqZJAde1GADK00c,5500
310
+ orionis/test/kernel.py,sha256=ClBrsS0D9jRjlrE3Wqs1plODVlw2GrEN8rodEmTdiqE,6270
310
311
  orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
311
312
  orionis/test/cases/asynchronous.py,sha256=PLdeU4-oked-wU4Z8e588RE09aip2MnkNpLkLpR1J_Q,4304
312
313
  orionis/test/cases/synchronous.py,sha256=qAGxxYD9OR9hk54uzOBtZGlkhk7F5XN5-sQ22HIInjU,3526
@@ -353,7 +354,7 @@ orionis/test/validators/web_report.py,sha256=-h3Fe9jY93_kzUhd2NBIqEfCcBpu-8Ei9x3
353
354
  orionis/test/validators/workers.py,sha256=LGffDKtK6SKixFKzIYPQpI5aFeQPAGXpv_LUtmEu6g4,1102
354
355
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
355
356
  orionis/test/view/render.py,sha256=3ICz68l-WF3BtnYqH5m-ktN9UD00MELMbmMnyJDV74A,4768
356
- orionis-0.427.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
357
+ orionis-0.428.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
357
358
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
358
359
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
360
  tests/container/test_container.py,sha256=asv8TkkupVoex6SWod74NBl4dSs7wb9mLmu_glNdNy8,14815
@@ -498,8 +499,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
498
499
  tests/testing/validators/test_testing_validators.py,sha256=QdcF0Vhnnl_kD-PzceHJbUYOqwPTB1Td7YaTv8LTr30,19612
499
500
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
500
501
  tests/testing/view/test_render.py,sha256=-ghGG8rimyb2b2wtvMuSPPH7Zac5_NlVCiUcHRA5SNg,1172
501
- orionis-0.427.0.dist-info/METADATA,sha256=CH-YpDiN7kxfyiyqdCKofD7IDFgQZaklGeeIbrMbJSw,4772
502
- orionis-0.427.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
503
- orionis-0.427.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
504
- orionis-0.427.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
505
- orionis-0.427.0.dist-info/RECORD,,
502
+ orionis-0.428.0.dist-info/METADATA,sha256=4OYvok4BsiU9G8T-GxmzYGDJiuQUyc7w9e72KPAGJts,4772
503
+ orionis-0.428.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
504
+ orionis-0.428.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
505
+ orionis-0.428.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
506
+ orionis-0.428.0.dist-info/RECORD,,
File without changes
@@ -1,436 +0,0 @@
1
- import argparse
2
- from orionis._console.output.console import Console
3
- from orionis._console.output.progress_bar import ProgressBar
4
- from orionis._contracts.console.base.command import IBaseCommand
5
-
6
- class BaseCommand(IBaseCommand):
7
- """
8
- A base class for handling common console output functionalities. This class provides methods to print messages of
9
- various types (success, info, warning, etc.) in different styles (e.g., text, bold, colored).
10
-
11
- This class acts as a foundation for command classes, offering utility methods to interact with the console.
12
-
13
- Parameters
14
- ----------
15
- args : dict, optional
16
- A dictionary containing the command arguments (default is an empty dictionary).
17
- """
18
- args = {}
19
-
20
- def success(self, message: str, timestamp: bool = True) -> None:
21
- """
22
- Prints a success message with a green background.
23
-
24
- Parameters
25
- ----------
26
- message : str
27
- The message to display.
28
- timestamp : bool, optional
29
- Whether to include a timestamp (default is True).
30
- """
31
- Console.success(message, timestamp)
32
-
33
- def textSuccess(self, message: str) -> None:
34
- """
35
- Prints a success message in green.
36
-
37
- Parameters
38
- ----------
39
- message : str
40
- The message to display.
41
- """
42
- Console.textSuccess(message)
43
-
44
- def textSuccessBold(self, message: str) -> None:
45
- """
46
- Prints a bold success message in green.
47
-
48
- Parameters
49
- ----------
50
- message : str
51
- The message to display.
52
- """
53
- Console.textSuccessBold(message)
54
-
55
- def info(self, message: str, timestamp: bool = True) -> None:
56
- """
57
- Prints an informational message with a blue background.
58
-
59
- Parameters
60
- ----------
61
- message : str
62
- The message to display.
63
- timestamp : bool, optional
64
- Whether to include a timestamp (default is True).
65
- """
66
- Console.info(message, timestamp)
67
-
68
- def textInfo(self, message: str) -> None:
69
- """
70
- Prints an informational message in blue.
71
-
72
- Parameters
73
- ----------
74
- message : str
75
- The message to display.
76
- """
77
- Console.textInfo(message)
78
-
79
- def textInfoBold(self, message: str) -> None:
80
- """
81
- Prints a bold informational message in blue.
82
-
83
- Parameters
84
- ----------
85
- message : str
86
- The message to display.
87
- """
88
- Console.textInfoBold(message)
89
-
90
- def warning(self, message: str, timestamp: bool = True):
91
- """
92
- Prints a warning message with a yellow background.
93
-
94
- Parameters
95
- ----------
96
- message : str
97
- The message to display.
98
- timestamp : bool, optional
99
- Whether to include a timestamp (default is True).
100
- """
101
- Console.warning(message, timestamp)
102
-
103
- def textWarning(self, message: str) -> None:
104
- """
105
- Prints a warning message in yellow.
106
-
107
- Parameters
108
- ----------
109
- message : str
110
- The message to display.
111
- """
112
- Console.textWarning(message)
113
-
114
- def textWarningBold(self, message: str) -> None:
115
- """
116
- Prints a bold warning message in yellow.
117
-
118
- Parameters
119
- ----------
120
- message : str
121
- The message to display.
122
- """
123
- Console.textWarningBold(message)
124
-
125
- def fail(self, message: str, timestamp: bool = True) -> None:
126
- """
127
- Prints a failure message with a red background.
128
-
129
- Parameters
130
- ----------
131
- message : str
132
- The message to display.
133
- timestamp : bool, optional
134
- Whether to include a timestamp (default is True).
135
- """
136
- Console.fail(message, timestamp)
137
-
138
- def error(self, message: str, timestamp: bool = True) -> None:
139
- """
140
- Prints an error message with a red background.
141
-
142
- Parameters
143
- ----------
144
- message : str
145
- The message to display.
146
- timestamp : bool, optional
147
- Whether to include a timestamp (default is True).
148
- """
149
- Console.error(message, timestamp)
150
-
151
- def textError(self, message: str) -> None:
152
- """
153
- Prints an error message in red.
154
-
155
- Parameters
156
- ----------
157
- message : str
158
- The message to display.
159
- """
160
- Console.textError(message)
161
-
162
- def textErrorBold(self, message: str) -> None:
163
- """
164
- Prints a bold error message in red.
165
-
166
- Parameters
167
- ----------
168
- message : str
169
- The message to display.
170
- """
171
- Console.textErrorBold(message)
172
-
173
- def textMuted(self, message: str) -> None:
174
- """
175
- Prints a muted (gray) message.
176
-
177
- Parameters
178
- ----------
179
- message : str
180
- The message to display.
181
- """
182
- Console.textMuted(message)
183
-
184
- def textMutedBold(self, message: str) -> None:
185
- """
186
- Prints a bold muted (gray) message.
187
-
188
- Parameters
189
- ----------
190
- message : str
191
- The message to display.
192
- """
193
- Console.textMutedBold(message)
194
-
195
- def textUnderline(self, message: str) -> None:
196
- """
197
- Prints an underlined message.
198
-
199
- Parameters
200
- ----------
201
- message : str
202
- The message to display.
203
- """
204
- Console.textUnderline(message)
205
-
206
- def clear(self) -> None:
207
- """
208
- Clears the console screen.
209
- """
210
- Console.clear()
211
-
212
- def clearLine(self) -> None:
213
- """
214
- Clears the current console line.
215
- """
216
- Console.clearLine()
217
-
218
- def line(self) -> None:
219
- """
220
- Prints a line empty.
221
- """
222
- Console.line()
223
-
224
- def newLine(self, count: int = 1) -> None:
225
- """
226
- Prints multiple new lines.
227
-
228
- Parameters
229
- ----------
230
- count : int, optional
231
- The number of new lines to print (default is 1).
232
- """
233
- Console.newLine(count)
234
-
235
- def write(self, message: str) -> None:
236
- """
237
- Prints a message without moving to the next line.
238
-
239
- Parameters
240
- ----------
241
- message : str, optional
242
- The message to display.
243
- """
244
- Console.write(message)
245
-
246
- def writeLine(self, message: str) -> None:
247
- """
248
- Prints a message and moves to the next line.
249
-
250
- Parameters
251
- ----------
252
- message : str, optional
253
- The message to display (default is an empty string).
254
- """
255
- Console.writeLine(message)
256
-
257
- def ask(self, question: str) -> str:
258
- """
259
- Prompts the user for input and returns the response.
260
-
261
- Parameters
262
- ----------
263
- question : str
264
- The question to ask the user.
265
-
266
- Returns
267
- -------
268
- str
269
- The user's input.
270
- """
271
- return Console.ask(question).strip()
272
-
273
- def confirm(self, question: str, default: bool = False) -> bool:
274
- """
275
- Asks a confirmation question and returns True/False based on the user's response.
276
-
277
- Parameters
278
- ----------
279
- question : str
280
- The confirmation question to ask.
281
- default : bool, optional
282
- The default response if the user presses Enter without typing a response (default is False).
283
-
284
- Returns
285
- -------
286
- bool
287
- The user's response.
288
- """
289
- return Console.confirm(question, default)
290
-
291
- def secret(self, question: str) -> str:
292
- """
293
- Prompts for hidden input (e.g., password).
294
-
295
- Parameters
296
- ----------
297
- question : str
298
- The prompt to ask the user.
299
-
300
- Returns
301
- -------
302
- str
303
- The user's hidden input.
304
- """
305
- return Console.secret(question)
306
-
307
- def table(self, headers: list, rows: list):
308
- """
309
- Prints a formatted table in the console.
310
-
311
- Parameters
312
- ----------
313
- headers : list of str
314
- The column headers for the table.
315
- rows : list of list of str
316
- The rows of the table.
317
-
318
- Raises
319
- ------
320
- ValueError
321
- If headers or rows are empty.
322
- """
323
- Console.table(headers, rows)
324
-
325
- def anticipate(self, question: str, options: list, default=None):
326
- """
327
- Provides autocomplete suggestions for user input.
328
-
329
- Parameters
330
- ----------
331
- question : str
332
- The prompt for the user.
333
- options : list of str
334
- The list of possible options for autocomplete.
335
- default : str, optional
336
- The default value if no matching option is found (default is None).
337
-
338
- Returns
339
- -------
340
- str
341
- The chosen option or the default value.
342
- """
343
- Console.anticipate(question, options, default)
344
-
345
- def choice(self, question: str, choices: list, default_index: int = 0) -> str:
346
- """
347
- Prompts the user to select a choice from a list.
348
-
349
- Parameters
350
- ----------
351
- question : str
352
- The prompt for the user.
353
- choices : list of str
354
- The list of available choices.
355
- default_index : int, optional
356
- The index of the default choice (default is 0).
357
-
358
- Returns
359
- -------
360
- str
361
- The selected choice.
362
-
363
- Raises
364
- ------
365
- ValueError
366
- If `default_index` is out of the range of choices.
367
- """
368
- Console.choice(question, choices, default_index)
369
-
370
- def createProgressBar(self, total: int = 100, width: int = 50) -> ProgressBar:
371
- """
372
- Creates and returns a new progress bar.
373
-
374
- This method initializes a `ProgressBar` object with the specified total and width.
375
-
376
- Parameters
377
- ----------
378
- total : int, optional
379
- The total number of steps for the progress bar. Default is 100.
380
- width : int, optional
381
- The width (in characters) of the progress bar. Default is 50.
382
-
383
- Returns
384
- -------
385
- ProgressBar
386
- A new instance of the `ProgressBar` class, initialized with the specified `total` and `width`.
387
-
388
- Notes
389
- -----
390
- The progress bar can be used to visually track the progress of a task.
391
- The `total` parameter represents the number of steps to complete the task,
392
- and the `width` parameter controls the number of characters used to represent the progress bar in the console.
393
- """
394
- return ProgressBar(total=total, width=width)
395
-
396
- def handle(self, **kwargs):
397
- """
398
- Abstract method to define the logic of the command.
399
-
400
- This method must be overridden in subclasses.
401
-
402
- Arguments:
403
- **kwargs: Arbitrary keyword arguments.
404
-
405
- Raises:
406
- NotImplementedError: If the method is not implemented in a subclass. This ensures that all command classes
407
- adhere to the expected structure.
408
- """
409
- raise NotImplementedError("The 'handle' method must be implemented in the child class.")
410
-
411
- def setArgs(self, args) -> None:
412
- """
413
- Define the logic of setting command arguments.
414
-
415
- Parameters
416
- ----------
417
- args : argparse.Namespace or dict
418
- Contain the arguments to be set for the command.
419
- """
420
- if isinstance(args, argparse.Namespace):
421
- self.args = vars(args)
422
- elif isinstance(args, dict):
423
- self.args = args
424
- else:
425
- raise ValueError("Invalid argument type. Expected 'argparse.Namespace' or 'dict'.")
426
-
427
- def getArgs(self) -> dict:
428
- """
429
- Get the command arguments.
430
-
431
- Returns
432
- -------
433
- dict
434
- The command arguments.
435
- """
436
- return self.args
File without changes