Skip to content

Commit

Permalink
Replace sync open() calls within async functions with `aiofiles.ope…
Browse files Browse the repository at this point in the history
…n()` in code examples (#7383)
  • Loading branch information
cclauss committed Jul 24, 2023
1 parent 9721c65 commit 0b34147
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/bench-asyncio-write.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ async def bench(job_title, w, body, base=None):
base = await bench(t, writes[0], c)
for w in writes[1:]:
await bench("", w, c, base)
with open("bench.md", "w") as f:
for line in res:
f.write("| {} |\n".format(" | ".join(line)))
return res


loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
results = loop.run_until_complete(main(loop))
with open("bench.md", "w") as f:
for line in results:
f.write("| {} |\n".format(" | ".join(line)))

0 comments on commit 0b34147

Please sign in to comment.