MCPcopy Create free account
hub / github.com/ActiveState/code / _readline

Function _readline

recipes/Python/521897_SingleUploadpy/recipe-521897.py:50–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48 pass
49
50 def _readline():
51 el = ''
52 while True:
53 l = stdin.readline(65536)
54 if not l:
55 raise IOError
56
57 if l[:2] == '--' and el:
58 sl = l.strip()
59 if sl == next or sl == last:
60 break
61
62 ol, el = el, l[-2:] == '\r\n' and '\r\n' or (
63 l[-1] == '\n' and '\n' or '')
64
65 p = len(el)
66 if p == 0:
67 yield ol + l
68 else:
69 yield ol + l[:-p]
70 while True:
71 yield None
72
73 rl = _readline().next
74 def _next(size=65536):

Callers 1

openFunction · 0.85

Calls 2

readlineMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected