-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpipeline_runner_utils_improved.py
More file actions
44 lines (33 loc) · 1.2 KB
/
pipeline_runner_utils_improved.py
File metadata and controls
44 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
Improved pipeline_runner_utils with consolidated functionality.
"""
class ConsolidatedMarkdownWrapper:
"""Consolidated markdown wrapper with reduced complexity."""
def __init__(self):
self._output_buffer = []
self._debug_enabled = False
def print(self, content: str):
"""Consolidated print method."""
if self._debug_enabled:
self._debug_print(content)
else:
self._markdown_print(content)
def _debug_print(self, content: str):
"""Debug print implementation."""
print(f"[DEBUG] {content}")
def _markdown_print(self, content: str):
"""Markdown print implementation."""
self._output_buffer.append(content)
print(content)
def enable_debug(self):
"""Enable debug mode."""
self._debug_enabled = True
def disable_debug(self):
"""Disable debug mode."""
self._debug_enabled = False
def get_output(self) -> list:
"""Get output buffer."""
return self._output_buffer.copy()
# Global instance for backward compatibility
_MarkdownConsoleWrapper = ConsolidatedMarkdownWrapper()
_debug = _MarkdownConsoleWrapper.print