fated 0.2.1__tar.gz → 0.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fated
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python library for adding visual effects to terminal text output
5
5
  Author-email: Fred <fredised@users.noreply.github.com>
6
6
  Project-URL: Homepage, https://github.com/fredised/fated
@@ -29,7 +29,7 @@ Alternative shortcut syntax:
29
29
  print(fateTypeWriter(speed=20) + "Fast typing!")
30
30
  """
31
31
 
32
- __version__ = "0.2.1"
32
+ __version__ = "0.2.2"
33
33
 
34
34
  from fate.effects import (
35
35
  typewriter,
@@ -27,8 +27,8 @@ def typewriter(text: str, speed: int = 10, end: str = '') -> str:
27
27
  def render_frame(content, step):
28
28
  return content[:step]
29
29
 
30
- # Run the animation
31
- animate_text(text, render_frame, delay)
30
+ # Run the animation without printing the final text
31
+ animate_text(text, render_frame, delay, print_final=False)
32
32
 
33
33
  # Return the full text plus any end character
34
34
  return text + end
@@ -84,7 +84,7 @@ def fade_in(text: str, speed: int = 5) -> str:
84
84
  def render_frame(content, step):
85
85
  return content[:step]
86
86
 
87
- animate_text(text, render_frame, delay)
87
+ animate_text(text, render_frame, delay, print_final=False)
88
88
  return text
89
89
 
90
90
 
@@ -101,7 +101,7 @@ def create_effect(func: Callable) -> Callable:
101
101
  return wrapper
102
102
 
103
103
 
104
- def animate_text(text: str, render_func: Callable, delay: float = 0.05) -> str:
104
+ def animate_text(text: str, render_func: Callable, delay: float = 0.05, print_final: bool = False) -> str:
105
105
  """
106
106
  Base function for text animations that handles rendering to the terminal.
107
107
 
@@ -109,6 +109,7 @@ def animate_text(text: str, render_func: Callable, delay: float = 0.05) -> str:
109
109
  text: The text to animate
110
110
  render_func: A function that takes (text, step) and returns what to print at each step
111
111
  delay: Time delay between animation frames in seconds
112
+ print_final: Whether to print the final text after animation (default: False)
112
113
 
113
114
  Returns:
114
115
  The final text after animation completes
@@ -126,7 +127,7 @@ def animate_text(text: str, render_func: Callable, delay: float = 0.05) -> str:
126
127
  if step < len(text):
127
128
  time.sleep(delay)
128
129
 
129
- # Add newline at the end of the animation
130
+ # Add newline at the end of the animation without printing the text again
130
131
  sys.stdout.write('\n')
131
132
  return text
132
133
  except KeyboardInterrupt:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fated
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python library for adding visual effects to terminal text output
5
5
  Author-email: Fred <fredised@users.noreply.github.com>
6
6
  Project-URL: Homepage, https://github.com/fredised/fated
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fated"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  authors = [
9
9
  { name = "Fred", email = "fredised@users.noreply.github.com" },
10
10
  ]
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