Skip to content

Commit

Permalink
Merge pull request Significant-Gravitas#1323 from sagarishere/patch-13
Browse files Browse the repository at this point in the history
update to modern python format syntax
  • Loading branch information
p-i- authored Apr 14, 2023
2 parents 9706ae8 + b18530a commit 71ae22f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/spinner.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def __init__(self, message="Loading...", delay=0.1):
def spin(self):
"""Spin the spinner"""
while self.running:
sys.stdout.write(next(self.spinner) + " " + self.message + "\r")
sys.stdout.write(f"{next(self.spinner)} {self.message}\r")
sys.stdout.flush()
time.sleep(self.delay)
sys.stdout.write('\r' + ' ' * (len(self.message) + 2) + '\r')
sys.stdout.write(f"\r{' ' * (len(self.message) + 2)}\r")

def __enter__(self):
"""Start the spinner"""
Expand All @@ -32,5 +32,5 @@ def __exit__(self, exc_type, exc_value, exc_traceback):
"""Stop the spinner"""
self.running = False
self.spinner_thread.join()
sys.stdout.write('\r' + ' ' * (len(self.message) + 2) + '\r')
sys.stdout.write(f"\r{' ' * (len(self.message) + 2)}\r")
sys.stdout.flush()

0 comments on commit 71ae22f

Please sign in to comment.