MCPcopy Index your code
hub / github.com/dabeaz-course/python-mastery / follow

Function follow

Solutions/8_3/cofollow.py:5–13  ·  view source on GitHub ↗
(filename, target)

Source from the content-addressed store, hash-verified

3import time
4
5def follow(filename, target):
6 with open(filename, 'r') as f:
7 f.seek(0,os.SEEK_END)
8 while True:
9 line = f.readline()
10 if line != '':
11 target.send(line)
12 else:
13 time.sleep(0.1)
14
15# Decorator for coroutines
16from functools import wraps

Callers 2

coticker.pyFile · 0.90
cofollow.pyFile · 0.70

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected