rgwfuncs 0.0.79__py3-none-any.whl → 0.0.80__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,7 +1,7 @@
1
1
  import os
2
2
  import atexit
3
3
  import code
4
- import readline # Assuming this is imported elsewhere in your module
4
+ import readline # Assuming this is imported elsewhere
5
5
  import sys
6
6
  from typing import Dict, Any
7
7
  from .df_lib import * # noqa: F401, F403, E402
@@ -10,33 +10,36 @@ from .str_lib import * # noqa: F401, F403, E402
10
10
  from .docs_lib import * # noqa: F401, F403, E402
11
11
 
12
12
  class CustomConsole(code.InteractiveConsole):
13
- """Custom console to make user input white while keeping prompts and output default."""
13
+ """Custom console to make user input white while keeping prompts and output blue."""
14
14
  def raw_input(self, prompt=""):
15
- # Print the prompt (>>>), then switch to white for input
16
- sys.stdout.write(prompt) # Prompt in default color
17
- sys.stdout.write("\033[97m") # Switch to white for input
15
+ sys.stdout.write("\033[94m" + prompt) # Blue prompt
16
+ sys.stdout.write("\033[97m") # White for input
18
17
  sys.stdout.flush()
19
18
  try:
20
19
  line = input() # User types in white
21
20
  except EOFError:
22
- raise # Handle Ctrl+D gracefully
21
+ raise
23
22
  finally:
24
- sys.stdout.write("\033[0m") # Reset to default after input
23
+ sys.stdout.write("\033[94m") # Back to blue
25
24
  sys.stdout.flush()
26
25
  return line
27
26
 
28
- def interactive_shell(local_vars: Dict[str, Any], shell_color: str = '') -> None:
27
+ def write(self, data):
28
+ sys.stdout.write("\033[94m" + data) # Blue output
29
+ sys.stdout.flush()
30
+
31
+ def interactive_shell(local_vars: Dict[str, Any], shell_color: str = '\033[94m') -> None:
29
32
  """
30
33
  Launches an interactive prompt for inspecting and modifying local variables, making all methods
31
34
  in the rgwfuncs library available by default. Persists command history across sessions.
32
- User input is displayed in white; other text uses the terminal's default color.
35
+ User input is displayed in white; other text (prompt, banner, output) is blue.
33
36
 
34
37
  Parameters:
35
38
  local_vars (dict): Dictionary of local variables to be available in the interactive shell.
36
- shell_color (str): ANSI color code for shell output (default: empty for terminal default).
39
+ shell_color (str): ANSI color code for shell output (default: blue '\033[94m').
37
40
  """
38
41
 
39
- def setup_readline(shell_color: str = '') -> None:
42
+ def setup_readline(shell_color: str = '\033[94m') -> None:
40
43
  """Set up readline for history persistence with a given shell color."""
41
44
  HISTORY_FILE = os.path.expanduser("~/.rgwfuncs_shell_history")
42
45
  readline.set_history_length(1000)
@@ -45,27 +48,36 @@ def interactive_shell(local_vars: Dict[str, Any], shell_color: str = '') -> None
45
48
  try:
46
49
  readline.read_history_file(HISTORY_FILE)
47
50
  except Exception as e:
48
- print(f"{shell_color}Warning: Could not load history file: {e}")
51
+ print(f"{shell_color}Warning: Could not load history file: {e}\033[94m")
49
52
  atexit.register(readline.write_history_file, HISTORY_FILE)
50
53
 
51
54
  if not isinstance(local_vars, dict):
52
55
  raise TypeError("local_vars must be a dictionary")
53
56
 
54
- # Set up readline for history and completion
57
+ # Test colors explicitly
58
+ sys.stdout.write("\033[94mBLUE TEST\033[0m\n")
59
+ sys.stdout.write("\033[97mWHITE TEST\033[0m\n")
60
+ sys.stdout.flush()
61
+
62
+ # Set initial color to blue
63
+ sys.stdout.write("\033[94m")
64
+ sys.stdout.flush()
65
+
66
+ # Set up readline
55
67
  setup_readline()
56
68
 
57
69
  # Make imported functions available in the REPL
58
70
  local_vars.update(globals())
59
71
 
60
- # Set prompt to plain text (no color)
72
+ # Set prompt (color handled by raw_input)
61
73
  sys.ps1 = ">>> "
62
74
 
63
- # Create custom console with local context
75
+ # Create custom console
64
76
  console = CustomConsole(locals=local_vars)
65
77
 
66
- # Start interactive session with a custom banner and exit message in default color
67
- banner = f"{shell_color}Welcome to the rgwfuncs interactive shell.\nUse up/down arrows for command history.\nType 'exit()' or Ctrl+D to quit."
68
- exitmsg = f"{shell_color}Goodbye."
78
+ # Banner and exit message in blue
79
+ 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[94m"
80
+ exitmsg = f"{shell_color}Goodbye.\033[94m"
69
81
 
70
82
  # Run the interactive session
71
83
  console.interact(banner=banner, exitmsg=exitmsg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rgwfuncs
3
- Version: 0.0.79
3
+ Version: 0.0.80
4
4
  Summary: A functional programming paradigm for mathematical modelling and data science
5
5
  Home-page: https://github.com/ryangerardwilson/rgwfunc
6
6
  Author: Ryan Gerard Wilson
@@ -2,11 +2,11 @@ rgwfuncs/__init__.py,sha256=LSn54Tlyskcb6Wab_wUpPLB6UGMe5LdrB3GU88mDEbU,1712
2
2
  rgwfuncs/algebra_lib.py,sha256=rKFITfpWfgdBswnbMUuS41XgndEt-jUVz2ObO_ik7eM,42234
3
3
  rgwfuncs/df_lib.py,sha256=r6T-MwyDq9NAPW1Xf6NzSy7ZFicIKdemR-UKu6TZt5g,71111
4
4
  rgwfuncs/docs_lib.py,sha256=y3wSAOPO3qsA4HZ7xAtW8HimM8w-c8hjcEzMRLJ96ao,1960
5
- rgwfuncs/interactive_shell_lib.py,sha256=Pdujo-XdtfnCpudzHz0jSnYes0hNbHfPpREu4Fq1K0M,2979
5
+ rgwfuncs/interactive_shell_lib.py,sha256=j2whOZEcGOQA7PWYA1ZItzELDQh-PDdpmF-W1zH3220,3140
6
6
  rgwfuncs/str_lib.py,sha256=rtAdRlnSJIu3JhI-tA_A0wCiPK2m-zn5RoGpBxv_g-4,2228
7
- rgwfuncs-0.0.79.dist-info/LICENSE,sha256=jLvt20gcUZYB8UOvyBvyKQ1qhYYhD__qP7ZDx2lPFkU,1062
8
- rgwfuncs-0.0.79.dist-info/METADATA,sha256=gTXvRXdi0hv7sSEW8TQIZdAHL0nrgtFx7kskQyL2FpM,60288
9
- rgwfuncs-0.0.79.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10
- rgwfuncs-0.0.79.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
11
- rgwfuncs-0.0.79.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
12
- rgwfuncs-0.0.79.dist-info/RECORD,,
7
+ rgwfuncs-0.0.80.dist-info/LICENSE,sha256=jLvt20gcUZYB8UOvyBvyKQ1qhYYhD__qP7ZDx2lPFkU,1062
8
+ rgwfuncs-0.0.80.dist-info/METADATA,sha256=wnQPQypnkNsi7RWzrBecvpQGeU-9RXXO7vUSqzOfNP4,60288
9
+ rgwfuncs-0.0.80.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
10
+ rgwfuncs-0.0.80.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
11
+ rgwfuncs-0.0.80.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
12
+ rgwfuncs-0.0.80.dist-info/RECORD,,