orionis 0.644.0__py3-none-any.whl → 0.645.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.
@@ -1,17 +1,8 @@
1
- import os
2
1
  import sys
3
- from orionis.console.dumper.debug import Debug
4
- from orionis.test.exceptions import OrionisTestRuntimeError
2
+ from orionis.console.output.console import Console
5
3
  from orionis.test.contracts.dumper import ITestDumper
6
4
 
7
5
  class TestDumper(ITestDumper):
8
- """
9
- Utility class for debugging and outputting information during test execution.
10
-
11
- Provides methods to determine if an object is a test case instance, output debugging
12
- information using the Debug class, manage standard output and error streams, and
13
- capture the caller's file and line number for context.
14
- """
15
6
 
16
7
  def __isTestCaseClass(self, value) -> bool:
17
8
  """
@@ -56,67 +47,66 @@ class TestDumper(ITestDumper):
56
47
  # If imports fail or any other exception occurs, return False.
57
48
  return False
58
49
 
59
- def dd(self, *args) -> None:
50
+ def __valuesToDump(self, args: tuple) -> tuple:
60
51
  """
61
- Output debugging information and halt further execution.
62
-
63
- Captures the caller's file and line number for context. Temporarily redirects
64
- standard output and error streams to ensure correct display. If the first argument
65
- is a recognized test case instance, it is skipped in the output. Raises a custom
66
- runtime error if dumping fails.
52
+ Filter out test case instances from the provided arguments.
67
53
 
68
54
  Parameters
69
55
  ----------
70
- *args : tuple
71
- Objects to be dumped.
56
+ args : tuple
57
+ A tuple of objects to be filtered.
72
58
 
73
59
  Returns
74
60
  -------
75
- None
61
+ tuple
62
+ A new tuple containing only the objects that are not instances of recognized
63
+ test case classes.
76
64
  """
77
65
 
78
- # If no arguments are provided, exit the method early.
79
- if not args:
80
- return
66
+ values: tuple = tuple()
67
+ for arg in args:
68
+ if not self.__isTestCaseClass(arg):
69
+ values += (arg,)
81
70
 
82
- # Save the original stdout and stderr to restore them later
83
- original_stdout = sys.stdout
84
- original_stderr = sys.stderr
71
+ return values
85
72
 
86
- try:
73
+ def __tracebackInfo(self) -> tuple[str | None, int | None]:
74
+ """
75
+ Retrieve the module name and line number of the caller.
87
76
 
88
- # Redirect stdout and stderr to the system defaults for proper debug output
89
- sys.stdout = sys.__stdout__
90
- sys.stderr = sys.__stderr__
77
+ This method inspects the call stack to obtain the module name and line number
78
+ from which it was called. This information is useful for debugging and logging
79
+ purposes, as it provides context about where a function was invoked.
91
80
 
92
- # Retrieve the caller's frame to get file and line number context
93
- caller_frame = sys._getframe(1)
94
- _file = os.path.abspath(caller_frame.f_code.co_filename)
95
- _line = caller_frame.f_lineno
81
+ Returns
82
+ -------
83
+ tuple of (str or None, int or None)
84
+ A tuple containing the module name as a string and the line number as an integer.
85
+ If the information cannot be determined due to an error, returns (None, None).
86
+ """
87
+
88
+ try:
96
89
 
97
- # Initialize the Debug dumper with context information
98
- dumper = Debug(f"{_file}:{_line}")
90
+ # Get the caller's frame from the call stack (1 level up)
91
+ caller_frame = sys._getframe(2)
99
92
 
100
- # If the first argument is a test case instance, skip it in the output
101
- if self.__isTestCaseClass(args[0]):
102
- dumper.dd(*args[1:])
103
- else:
104
- dumper.dd(*args)
93
+ # Retrieve the module name from the caller's global variables
94
+ module = caller_frame.f_globals.get("__name__", None)
105
95
 
106
- except Exception as e:
96
+ # Retrieve the line number from the caller's frame
97
+ line_number = caller_frame.f_lineno
107
98
 
108
- # Raise a custom runtime error if dumping fails
109
- raise OrionisTestRuntimeError(f"An error occurred while dumping debug information: {e}")
99
+ # Return the module name and line number
100
+ return (module, line_number)
110
101
 
111
- finally:
102
+ except Exception:
112
103
 
113
- # Restore the original stdout and stderr
114
- sys.stdout = original_stdout
115
- sys.stderr = original_stderr
104
+ # If any error occurs while retrieving the frame, return (None, None)
105
+ return (None, None)
116
106
 
117
- def dump(self, *args) -> None:
107
+ def dd(self, *args) -> None:
118
108
  """
119
- Output debugging information.
109
+ Output debugging information and halt further execution.
120
110
 
121
111
  Captures the caller's file and line number for context. Temporarily redirects
122
112
  standard output and error streams to ensure correct display. If the first argument
@@ -133,41 +123,49 @@ class TestDumper(ITestDumper):
133
123
  None
134
124
  """
135
125
 
136
- # If no arguments are provided, exit the method early.
137
- if not args:
138
- return
139
-
140
- # Save the original stdout and stderr to restore them later
141
- original_stdout = sys.stdout
142
- original_stderr = sys.stderr
143
-
144
- try:
145
-
146
- # Redirect stdout and stderr to the system defaults for proper debug output
147
- sys.stdout = sys.__stdout__
148
- sys.stderr = sys.__stderr__
149
-
150
- # Retrieve the caller's frame to get file and line number context
151
- caller_frame = sys._getframe(1)
152
- _file = os.path.abspath(caller_frame.f_code.co_filename)
153
- _line = caller_frame.f_lineno
126
+ # Retrieve the caller's module and line number for context
127
+ module, line = self.__tracebackInfo()
154
128
 
155
- # Initialize the Debug dumper with context information
156
- dumper = Debug(f"{_file}:{_line}")
129
+ # Filter out test case instances from the arguments
130
+ Console().dump(
131
+ *self.__valuesToDump(args),
132
+ module_path=module,
133
+ line_number=line,
134
+ force_exit=True, # Halt execution after dumping
135
+ redirect_output=True, # Redirect stdout/stderr for proper display
136
+ insert_line=True
137
+ )
157
138
 
158
- # If the first argument is a test case instance, skip it in the output
159
- if self.__isTestCaseClass(args[0]):
160
- dumper.dump(*args[1:])
161
- else:
162
- dumper.dump(*args)
139
+ def dump(self, *args) -> None:
140
+ """
141
+ Output debugging information without halting execution.
163
142
 
164
- except Exception as e:
143
+ This method captures the caller's module and line number to provide context for the output.
144
+ It filters out any recognized test case instances from the provided arguments to avoid dumping
145
+ unnecessary or sensitive test case objects. The method then delegates the actual output operation
146
+ to the internal console, ensuring that standard output and error streams are redirected for
147
+ correct display. Unlike `dd`, this method does not terminate the program after dumping.
165
148
 
166
- # Raise a custom runtime error if dumping fails
167
- raise OrionisTestRuntimeError(f"An error occurred while dumping debug information: {e}")
149
+ Parameters
150
+ ----------
151
+ *args : tuple
152
+ Objects to be dumped. Test case instances are automatically filtered out.
168
153
 
169
- finally:
154
+ Returns
155
+ -------
156
+ None
157
+ This method does not return any value. It performs output as a side effect.
158
+ """
170
159
 
171
- # Restore the original stdout and stderr
172
- sys.stdout = original_stdout
173
- sys.stderr = original_stderr
160
+ # Retrieve the caller's module and line number for context
161
+ module, line = self.__tracebackInfo()
162
+
163
+ # Filter out test case instances from the arguments and output the rest
164
+ Console().dump(
165
+ *self.__valuesToDump(args),
166
+ module_path=module,
167
+ line_number=line,
168
+ force_exit=False, # Do not halt execution after dumping
169
+ redirect_output=True, # Redirect stdout/stderr for proper display
170
+ insert_line=True
171
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.644.0
3
+ Version: 0.645.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
@@ -23,8 +23,8 @@ orionis/console/contracts/base_command.py,sha256=UlDN41Ts0ulxM-B2kgeKNr9_gNv_0LC
23
23
  orionis/console/contracts/base_scheduler.py,sha256=RSxEW57MoMU3pXfliIrQw9WuMk95p-xHXi1yACp1qsU,7728
24
24
  orionis/console/contracts/cli_request.py,sha256=qIV8ig8PG39LYp1acnUD8GYsNRSHncxIxGjO3B3YsUo,6755
25
25
  orionis/console/contracts/command.py,sha256=Wvm62hw2gDIPNmoEUFyhKUERjZ6wnAbI-UDY_5gJE24,3626
26
- orionis/console/contracts/console.py,sha256=phaQhCLWa81MLzB5ydOSaUfEIdDq7fOjvym8Rmi-arc,11908
27
- orionis/console/contracts/debug.py,sha256=tEdF3_HJwDAgccXVEk_LGf43Am2ylbcx9i0Qvj3MFyU,1011
26
+ orionis/console/contracts/console.py,sha256=TuoyCLInhp5ztlyJ82rBsw_1Ki3_fOnF_gtaWUxSW1M,14253
27
+ orionis/console/contracts/dumper.py,sha256=qJAEVRaKyfLtxPFgO2Thk-nUYrSlNiEzxN0vDag7DwE,3918
28
28
  orionis/console/contracts/event.py,sha256=KQESAycPzBE3xoDTnbYLz_XXg-7dwrybYKbaJjgkCMY,119842
29
29
  orionis/console/contracts/executor.py,sha256=JAzK64_5HfIGm3_BwsUv7-ZeC2Y-3mpxOByHaXwuy9A,4278
30
30
  orionis/console/contracts/kernel.py,sha256=mh4LlhEYHh3FuGZZQ0GBhD6ZLa5YQvaNj2r01IIHI5Y,826
@@ -34,8 +34,8 @@ orionis/console/contracts/schedule.py,sha256=xtXgp4BPhvhg3YSM4mrIdbyoBdr4OJBi1gB
34
34
  orionis/console/contracts/schedule_event_listener.py,sha256=h06qsBxuEMD3KLSyu0JXdUDHlQW19BX9lA09Qrh2QXg,3818
35
35
  orionis/console/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  orionis/console/core/reactor.py,sha256=x_bRFLBq5MiKZdlMG1gZR1GCZgFkUDnG5l_nh2YKiR8,44044
37
- orionis/console/dumper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- orionis/console/dumper/debug.py,sha256=p8uflSXeDJDrVM9mZY4JMYEus73Z6TsLnQQtgP0QUak,22427
37
+ orionis/console/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ orionis/console/debug/dumper.py,sha256=4AOo9iNRLdU9VTKrsvraQIKCzOzK5JFMqOjAix-Zrus,6245
39
39
  orionis/console/dynamic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  orionis/console/dynamic/progress_bar.py,sha256=58wne7E_QZb_uN9jjqQ_V28Ci19SVNhCQQ4zzXCiOu0,2872
41
41
  orionis/console/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -58,7 +58,7 @@ orionis/console/fluent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
58
58
  orionis/console/fluent/command.py,sha256=0jyhB45LIjDS7nkjNhkkvEXEzdOBmT49qKIooYY_DbI,8261
59
59
  orionis/console/fluent/event.py,sha256=RM6Aaz-2MYQg4RWxYdr6oBNaAjNVp9DE_tI5iwl2mAk,166672
60
60
  orionis/console/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
- orionis/console/output/console.py,sha256=EtSDWRBW8wk0iJdPfB1mzU49krLJBaSAUdVdVOzzhQ4,17888
61
+ orionis/console/output/console.py,sha256=5j8Cr67dZWvxBpeJS2cOXR1UpjE-rYKAD0o10olPumM,23463
62
62
  orionis/console/output/executor.py,sha256=uQjFPOlyZLFj9pcyYPugCqxwJog0AJgK1OcmQH2ELbw,7314
63
63
  orionis/console/request/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  orionis/console/request/cli_request.py,sha256=lO7088xlVK1VP-NhCIgAo7qXGzCW3nXVOJag43fUv20,13207
@@ -206,7 +206,7 @@ orionis/foundation/providers/catch_provider.py,sha256=E8LtH8mKyeAFGS7PZrgT4t-bIk
206
206
  orionis/foundation/providers/cli_request_provider.py,sha256=bbCU-wQN49MEXW1CJJCupNmz2FsaNuk24fSJ80k-guo,1313
207
207
  orionis/foundation/providers/console_provider.py,sha256=X81VAGT2wt7pbnCOWto2We9V4G9Xoz95t63RwCA9qXo,1499
208
208
  orionis/foundation/providers/directory_provider.py,sha256=n-TL0GTDt51sC1c__Q-ZolpldK9mHR3-R15Ob6EhSYY,1280
209
- orionis/foundation/providers/dumper_provider.py,sha256=AD8ejfSCDciH1jO0xhVQT__rP8XnsOiOgAKsA3h02dA,1472
209
+ orionis/foundation/providers/dumper_provider.py,sha256=pC3rll3E2ZwBxCPUL8yEERtkeOf1Zu3Mfu3F1Gv8KRM,1472
210
210
  orionis/foundation/providers/executor_provider.py,sha256=fAD0zMVlznxbCweakQ6XcxVEpZck8bwGfXgjhjI0Tek,1430
211
211
  orionis/foundation/providers/inspirational_provider.py,sha256=qiuvzE4sZMFhE2q4-0PLdwKAYoGzmLk1EN0KKzesQBU,1446
212
212
  orionis/foundation/providers/logger_provider.py,sha256=EPn3W6Hk1DD03iJckeX1lWjLWg3kA7swhF0O_6VSFAg,1583
@@ -217,7 +217,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=IrPQJwvQVLRm5Qnz0Cxon4
217
217
  orionis/foundation/providers/testing_provider.py,sha256=eI1p2lUlxl25b5Z487O4nmqLE31CTDb4c3Q21xFadkE,1615
218
218
  orionis/foundation/providers/workers_provider.py,sha256=GdHENYV_yGyqmHJHn0DCyWmWId5xWjD48e6Zq2PGCWY,1674
219
219
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
220
- orionis/metadata/framework.py,sha256=an5KPFMKvms3aFMs99cuOOb4s4oXvBeWR38Bdzycsz8,4089
220
+ orionis/metadata/framework.py,sha256=L0N1XstaoGMEV58t5NpJ9fhvVLtM0N_tkYDqkRBzTuo,4089
221
221
  orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
222
222
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
223
223
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -318,7 +318,7 @@ orionis/support/facades/console.pyi,sha256=nWrYF-N5BIHbOSU7lAICb5KKrpzMX0QC7go3e
318
318
  orionis/support/facades/directory.py,sha256=85ho4t9APMULBtJ58MPl-rRit9ub48XpYWPzEjLU3_8,946
319
319
  orionis/support/facades/directory.pyi,sha256=3WnIpvLMunTgzR5un49XzAkqOKkOtkrVko34SNJVcAY,592
320
320
  orionis/support/facades/dumper.py,sha256=oh9L3s-526Lk7l19sRniyCeCzzv-ConqC98FO_oIXsw,900
321
- orionis/support/facades/dumper.pyi,sha256=SAplVqQgW7cKANqJL6lMu-rfG5sWQaAOZ7MaSkirdvg,508
321
+ orionis/support/facades/dumper.pyi,sha256=ELzP_jY2RKHcQtjwjH56H2-P-ro9U-pSUsR_lBxlTZo,509
322
322
  orionis/support/facades/executor.py,sha256=276MKqXsvrW947SvSzEcl8wleAtsjxhVq_r8FcySGH4,1061
323
323
  orionis/support/facades/executor.pyi,sha256=JS0h8ddYD62o79yXL5UzeZmPWOXNasyMgXKL8ZCOkBE,547
324
324
  orionis/support/facades/inspire.py,sha256=oGPMP_mNEmQRbPx7W-TwvW_xwbn4c04rHzu_ivgVKdw,964
@@ -383,7 +383,7 @@ orionis/test/exceptions/persistence.py,sha256=8Oakaey35DpByLoGnfbwHxFKntxgWaGl49
383
383
  orionis/test/exceptions/runtime.py,sha256=h9gQ0pS8tJTmuXNG-GHky8tTqpdz-cNqkntOOlRXZJg,612
384
384
  orionis/test/exceptions/value.py,sha256=CoqYOkViU_RaKCMNpB82tgEsR3XhI1pw6YQ8sH8CJh4,588
385
385
  orionis/test/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
386
- orionis/test/output/dumper.py,sha256=_FPetJq96fiWJhN29gMG8Rt6MEEgiyFHC5k95ACNtKY,5906
386
+ orionis/test/output/dumper.py,sha256=x2VbmO1uwAVMrHTTXbxsn1-tMwUviL1zThAgSM8O5Qo,6038
387
387
  orionis/test/output/printer.py,sha256=3nevE9nyhMn0n8UpE-Nwsy4d1l3GE0wnBf4fAGPQxf4,29623
388
388
  orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
389
389
  orionis/test/records/logs.py,sha256=Dtu5HaWa2meblgTUXVAcOFaxkSJ3YxfDRaFoc_nhMCU,22043
@@ -404,8 +404,8 @@ orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnI
404
404
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
405
405
  orionis/test/view/render.py,sha256=R55ykeRs0wDKcdTf4O1YZ8GDHTFmJ0IK6VQkbJkYUvo,5571
406
406
  orionis/test/view/report.stub,sha256=QLqqCdRoENr3ECiritRB3DO_MOjRQvgBh5jxZ3Hs1r0,28189
407
- orionis-0.644.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
408
- orionis-0.644.0.dist-info/METADATA,sha256=W6c-hofzs4pavn7cx6JPrhMfGr5ShsVcS6BinVXz3Mo,4772
409
- orionis-0.644.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
410
- orionis-0.644.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
411
- orionis-0.644.0.dist-info/RECORD,,
407
+ orionis-0.645.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
408
+ orionis-0.645.0.dist-info/METADATA,sha256=MXLWEwJdR0UwrfF6UR4RLdF8vXKWL6TKhhkJytiSQhc,4772
409
+ orionis-0.645.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
410
+ orionis-0.645.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
411
+ orionis-0.645.0.dist-info/RECORD,,
@@ -1,34 +0,0 @@
1
- from abc import ABC, abstractmethod
2
- from typing import Any
3
-
4
- class IDebug(ABC):
5
- """
6
- Abstract base class for debugging utilities that provide enhanced output and inspection of Python objects.
7
-
8
- This class defines the interface for dumping and inspecting data in various formats,
9
- supporting features such as recursion handling and customizable indentation.
10
- """
11
-
12
- @abstractmethod
13
- def dd(self, *args: Any) -> None:
14
- """
15
- Dump the provided arguments to the output and terminate the program.
16
-
17
- Parameters
18
- ----------
19
- *args : Any
20
- Variable length argument list to be dumped and displayed.
21
- """
22
- pass
23
-
24
- @abstractmethod
25
- def dump(self, *args: Any) -> None:
26
- """
27
- Dump the provided arguments for debugging or logging purposes.
28
-
29
- Parameters
30
- ----------
31
- *args : Any
32
- Variable length argument list to be dumped and displayed.
33
- """
34
- pass