forked from WikiTeam/wikiteam
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force str() everywhere (also misc stdout formatting)
Signed-off-by: Elsie Hupp <[email protected]>
- Loading branch information
Showing
20 changed files
with
136 additions
and
79 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,37 @@ | ||
import itertools | ||
import threading | ||
import time | ||
import sys | ||
|
||
|
||
def delay(config={}, session=None): | ||
"""Add a delay if configured for that""" | ||
if config["delay"] > 0: | ||
print("Sleeping... %.2f seconds..." % (config["delay"])) | ||
time.sleep(config["delay"]) | ||
class Delay: | ||
|
||
done: bool = True | ||
ellipses: str = "." | ||
|
||
def animate(self): | ||
try: | ||
while not self.done: | ||
sys.stdout.write("\r " + self.ellipses) | ||
sys.stdout.flush() | ||
self.ellipses += "." | ||
time.sleep(0.1) | ||
except KeyboardInterrupt: | ||
sys.exit() | ||
|
||
def __init__(self, config={}, session=None): | ||
"""Add a delay if configured for that""" | ||
if config["delay"] > 0: | ||
self.done = False | ||
|
||
ellipses_animation = threading.Thread(target=self.animate) | ||
ellipses_animation.start() | ||
|
||
# sys.stdout.write("\rSleeping %.2f seconds..." % (config["delay"])) | ||
# sys.stdout.flush() | ||
|
||
time.sleep(config["delay"]) | ||
self.done = True | ||
|
||
sys.stdout.write("\r \r") | ||
sys.stdout.flush() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.