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

Function tail_file

example_code/item_077.py:69–76  ·  view source on GitHub ↗
(handle, interval, write_func)

Source from the content-addressed store, hash-verified

67import time
68
69def tail_file(handle, interval, write_func):
70 while not handle.closed:
71 try:
72 line = readline(handle)
73 except NoNewData:
74 time.sleep(interval)
75 else:
76 write_func(line)
77
78
79print("Example 3")

Callers

nothing calls this directly

Calls 2

readlineFunction · 0.70
tail_asyncFunction · 0.70

Tested by

no test coverage detected