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

Function tail_async

example_code/item_078.py:161–170  ·  view source on GitHub ↗
(handle, interval, write_func)

Source from the content-addressed store, hash-verified

159 return handle.readline()
160
161async def tail_async(handle, interval, write_func):
162 loop = asyncio.get_event_loop()
163
164 while not handle.closed:
165 try:
166 line = await loop.run_in_executor(None, readline, handle)
167 except NoNewData:
168 await asyncio.sleep(interval)
169 else:
170 await write_func(line)
171
172async def run_fully_async(handles, interval, output_path):
173 async with (

Callers 3

run_tasksFunction · 0.70
run_tasks_simplerFunction · 0.70
run_fully_asyncFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected