Skip to content

Commit

Permalink
Use f-strings in examples where possible.
Browse files Browse the repository at this point in the history
Thanks: @tahadnan
  • Loading branch information
jonathanslenders committed Nov 9, 2024
1 parent 546f864 commit 9e3ad2a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/progress-bar/a-lot-of-parallel-tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def stop_task(label, total, sleep_time):
threads = []

for i in range(160):
label = "Task %i" % i
label = f"Task {i}"
total = random.randrange(50, 200)
sleep_time = random.randrange(5, 20) / 100.0

Expand Down
2 changes: 1 addition & 1 deletion examples/prompts/asyncio-prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def print_counter():
try:
i = 0
while True:
print("Counter: %i" % i)
print(f"Counter: {i}")
i += 1
await asyncio.sleep(3)
except asyncio.CancelledError:
Expand Down
2 changes: 1 addition & 1 deletion examples/prompts/patch-stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def thread():
i = 0
while running:
i += 1
print("i=%i" % i)
print(f"i={i}")
time.sleep(1)

t = threading.Thread(target=thread)
Expand Down

0 comments on commit 9e3ad2a

Please sign in to comment.