MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / run_tasks_simpler

Function run_tasks_simpler

example_code/item_078.py:72–82  ·  view source on GitHub ↗
(handles, interval, output_path)

Source from the content-addressed store, hash-verified

70
71print("Example 2")
72async def run_tasks_simpler(handles, interval, output_path):
73 with open(output_path, "wb") as output: # Changed
74
75 async def write_async(data):
76 output.write(data) # Changed
77
78 async with asyncio.TaskGroup() as group:
79 for handle in handles:
80 group.create_task(
81 tail_async(handle, interval, write_async)
82 )
83
84
85print("Example 3")

Callers

nothing calls this directly

Calls 2

openFunction · 0.85
tail_asyncFunction · 0.70

Tested by

no test coverage detected