rgwfuncs 0.0.112__py3-none-any.whl → 0.0.113__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.
rgwfuncs/str_lib.py CHANGED
@@ -101,17 +101,19 @@ def send_telegram_message(message: str, preset_name: Optional[str] = None, bot_t
101
101
  response.raise_for_status()
102
102
 
103
103
 
104
- def title(text: str, font: str = "slant", typing_speed: float = 0.005) -> None:
104
+ def title(text: str, font: str = "slant", typing_speed: float = 0.005, animate: bool = True) -> None:
105
105
  """
106
- Print text as ASCII art with a typewriter effect using the specified font (default: slant),
106
+ Print text as ASCII art with an optional typewriter effect using the specified font (default: slant),
107
107
  indented by 4 spaces. All output, including errors and separators, is printed with the
108
- typewriter effect within this function.
108
+ typewriter effect if animate is True.
109
109
 
110
110
  Args:
111
111
  text (str): The text to convert to ASCII art.
112
112
  font (str, optional): The pyfiglet font to use. Defaults to "slant".
113
113
  typing_speed (float, optional): Delay between printing each character in seconds.
114
114
  Defaults to 0.005.
115
+ animate (bool, optional): If True, applies typewriter effect. If False, prints instantly.
116
+ Defaults to True.
115
117
 
116
118
  Raises:
117
119
  ValueError: If the specified font is invalid or unavailable.
@@ -129,20 +131,26 @@ def title(text: str, font: str = "slant", typing_speed: float = 0.005) -> None:
129
131
  # Indent each line by 4 spaces
130
132
  indented_ascii_art = '\n'.join(' ' + line for line in ascii_art.splitlines())
131
133
 
132
- # Print ASCII art with typewriter effect
134
+ # Print ASCII art with or without typewriter effect
133
135
  print(heading_color, end='')
134
- for char in indented_ascii_art + '\n':
135
- print(char, end='', flush=True)
136
- if char != '\n': # Don't delay on newlines
137
- time.sleep(typing_speed)
136
+ if animate:
137
+ for char in indented_ascii_art + '\n':
138
+ print(char, end='', flush=True)
139
+ if char != '\n': # Don't delay on newlines
140
+ time.sleep(typing_speed)
141
+ else:
142
+ print(indented_ascii_art + '\n', end='', flush=True)
138
143
  print(reset_color, end='')
139
144
 
140
- # Print separator line with typewriter effect
145
+ # Print separator line with or without typewriter effect
141
146
  print(heading_color, end='')
142
- for char in '=' * 79 + '\n':
143
- print(char, end='', flush=True)
144
- if char != '\n':
145
- time.sleep(typing_speed)
147
+ if animate:
148
+ for char in '=' * 79 + '\n':
149
+ print(char, end='', flush=True)
150
+ if char != '\n':
151
+ time.sleep(typing_speed)
152
+ else:
153
+ print('=' * 79 + '\n', end='', flush=True)
146
154
  print(reset_color, end='')
147
155
 
148
156
  except Exception as e:
@@ -150,19 +158,26 @@ def title(text: str, font: str = "slant", typing_speed: float = 0.005) -> None:
150
158
  if "font" in str(e).lower():
151
159
  error_msg = f"Invalid or unavailable font: {font}. Ensure the font is supported by pyfiglet.\n"
152
160
  print(reset_color, end='')
161
+ if animate:
162
+ for char in error_msg:
163
+ print(char, end='', flush=True)
164
+ if char != '\n':
165
+ time.sleep(typing_speed)
166
+ else:
167
+ print(error_msg, end='', flush=True)
168
+ raise ValueError(error_msg)
169
+ error_msg = f"Error generating ASCII art for \"{text}\" with font {font}: {e}\n"
170
+ print(reset_color, end='')
171
+ if animate:
153
172
  for char in error_msg:
154
173
  print(char, end='', flush=True)
155
174
  if char != '\n':
156
175
  time.sleep(typing_speed)
157
- raise ValueError(error_msg)
158
- error_msg = f"Error generating ASCII art for \"{text}\" with font {font}: {e}\n"
159
- print(reset_color, end='')
160
- for char in error_msg:
161
- print(char, end='', flush=True)
162
- if char != '\n':
163
- time.sleep(typing_speed)
176
+ else:
177
+ print(error_msg, end='', flush=True)
164
178
  raise RuntimeError(error_msg)
165
179
 
180
+
166
181
  def heading(text: str, typing_speed: float = 0.002) -> None:
167
182
  """
168
183
  Print a heading with the specified text in uppercase,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rgwfuncs
3
- Version: 0.0.112
3
+ Version: 0.0.113
4
4
  Summary: A functional programming paradigm for mathematical modelling and data science
5
5
  Home-page: https://github.com/ryangerardwilson/rgwfuncs
6
6
  Author: Ryan Gerard Wilson
@@ -0,0 +1,11 @@
1
+ rgwfuncs/__init__.py,sha256=WafmLtqJRnQ7LWU7Son0inje75tF-m6qHJqrmCgiM84,1354
2
+ rgwfuncs/df_lib.py,sha256=lcKrMj8IpxWxnWkBFekWBQd9-Ed2nXTsHo57gTeATjE,85153
3
+ rgwfuncs/docs_lib.py,sha256=i63NzX-V8cGhikYdtkRGAEe2VcuwpXxDUyTRa9xI7l8,1972
4
+ rgwfuncs/interactive_shell_lib.py,sha256=YeJBW9YgH5Nv77ONdOyIKFgtf0ItXStdlKGN9GGf8bU,4228
5
+ rgwfuncs/str_lib.py,sha256=vQ4CYzSLYDIWh4WM1Kjhbg6DqbX4rX6VKdJ_EBJJVyE,11322
6
+ rgwfuncs-0.0.113.dist-info/licenses/LICENSE,sha256=jLvt20gcUZYB8UOvyBvyKQ1qhYYhD__qP7ZDx2lPFkU,1062
7
+ rgwfuncs-0.0.113.dist-info/METADATA,sha256=a7_g8iP1CxnhsQJFe7kmnYa6eIahl0jiRLlq4B7B-Ww,42972
8
+ rgwfuncs-0.0.113.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ rgwfuncs-0.0.113.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
10
+ rgwfuncs-0.0.113.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
11
+ rgwfuncs-0.0.113.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- rgwfuncs/__init__.py,sha256=WafmLtqJRnQ7LWU7Son0inje75tF-m6qHJqrmCgiM84,1354
2
- rgwfuncs/df_lib.py,sha256=lcKrMj8IpxWxnWkBFekWBQd9-Ed2nXTsHo57gTeATjE,85153
3
- rgwfuncs/docs_lib.py,sha256=i63NzX-V8cGhikYdtkRGAEe2VcuwpXxDUyTRa9xI7l8,1972
4
- rgwfuncs/interactive_shell_lib.py,sha256=YeJBW9YgH5Nv77ONdOyIKFgtf0ItXStdlKGN9GGf8bU,4228
5
- rgwfuncs/str_lib.py,sha256=rfzRd7bOc0KQ7UxUN-J6yxY23pHEUHqerVR1u-TyIAY,10690
6
- rgwfuncs-0.0.112.dist-info/licenses/LICENSE,sha256=jLvt20gcUZYB8UOvyBvyKQ1qhYYhD__qP7ZDx2lPFkU,1062
7
- rgwfuncs-0.0.112.dist-info/METADATA,sha256=m6mY9nOaQYzPpXJ1grlouqQ6JpQUYFLFK4cvxVpiZrA,42972
8
- rgwfuncs-0.0.112.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- rgwfuncs-0.0.112.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
10
- rgwfuncs-0.0.112.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
11
- rgwfuncs-0.0.112.dist-info/RECORD,,