rgwfuncs 0.0.70__tar.gz → 0.0.72__tar.gz
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.
- {rgwfuncs-0.0.70/src/rgwfuncs.egg-info → rgwfuncs-0.0.72}/PKG-INFO +1 -1
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/pyproject.toml +1 -1
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/setup.cfg +1 -1
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs/interactive_shell_lib.py +4 -26
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72/src/rgwfuncs.egg-info}/PKG-INFO +1 -1
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/LICENSE +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/README.md +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs/__init__.py +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs/algebra_lib.py +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs/df_lib.py +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs/docs_lib.py +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs/str_lib.py +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs.egg-info/SOURCES.txt +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs.egg-info/dependency_links.txt +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs.egg-info/entry_points.txt +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs.egg-info/requires.txt +0 -0
- {rgwfuncs-0.0.70 → rgwfuncs-0.0.72}/src/rgwfuncs.egg-info/top_level.txt +0 -0
@@ -22,10 +22,10 @@ def interactive_shell(local_vars: Dict[str, Any], shell_color: str = '\033[37m')
|
|
22
22
|
"""
|
23
23
|
|
24
24
|
def setup_readline(shell_color: str = '\033[37m') -> None:
|
25
|
-
"""Set up readline for
|
25
|
+
"""Set up readline for history persistence with a given shell color."""
|
26
26
|
HISTORY_FILE = os.path.expanduser("~/.rgwfuncs_shell_history")
|
27
|
-
readline.set_history_length(1000)
|
28
|
-
readline.parse_and_bind("tab: complete")
|
27
|
+
readline.set_history_length(1000)
|
28
|
+
readline.parse_and_bind("tab: complete")
|
29
29
|
if os.path.exists(HISTORY_FILE):
|
30
30
|
try:
|
31
31
|
readline.read_history_file(HISTORY_FILE)
|
@@ -33,13 +33,6 @@ def interactive_shell(local_vars: Dict[str, Any], shell_color: str = '\033[37m')
|
|
33
33
|
print(f"{shell_color}Warning: Could not load history file: {e}\033[0m")
|
34
34
|
atexit.register(readline.write_history_file, HISTORY_FILE)
|
35
35
|
|
36
|
-
def colorize_output(text: str, shell_color: str) -> str:
|
37
|
-
"""Apply shell color to text only if it doesn’t already contain ANSI codes, preserving existing codes."""
|
38
|
-
# Check if the text contains any ANSI escape sequences
|
39
|
-
if '\033[' not in text and '\x1b[' not in text:
|
40
|
-
return f"{shell_color}{text}\033[0m"
|
41
|
-
return text # Return unchanged if it already has ANSI codes
|
42
|
-
|
43
36
|
if not isinstance(local_vars, dict):
|
44
37
|
raise TypeError("local_vars must be a dictionary")
|
45
38
|
|
@@ -56,20 +49,5 @@ def interactive_shell(local_vars: Dict[str, Any], shell_color: str = '\033[37m')
|
|
56
49
|
banner = f"{shell_color}Welcome to the rgwfuncs interactive shell.\nUse up/down arrows for command history.\nType 'exit()' or Ctrl+D to quit.\033[0m"
|
57
50
|
exitmsg = f"{shell_color}Goodbye.\033[0m"
|
58
51
|
|
59
|
-
#
|
60
|
-
original_write = sys.stdout.write
|
61
|
-
|
62
|
-
# Define a pure function to wrap stdout.write
|
63
|
-
def colored_write(text: str) -> None:
|
64
|
-
# Pass text through colorize_output to handle coloring
|
65
|
-
colored_text = colorize_output(text, shell_color)
|
66
|
-
original_write(colored_text)
|
67
|
-
|
68
|
-
# Temporarily replace stdout.write
|
69
|
-
sys.stdout.write = colored_write
|
70
|
-
|
71
|
-
# Start the interactive session
|
52
|
+
# Run the interactive session without modifying sys.stdout
|
72
53
|
console.interact(banner=banner, exitmsg=exitmsg)
|
73
|
-
|
74
|
-
# Restore original stdout.write after exiting
|
75
|
-
sys.stdout.write = original_write
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|