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

Method readlines

recipes/Python/173071_ReseekFile/recipe-173071.py:96–108  ·  view source on GitHub ↗

read all remaining lines from the file

(self)

Source from the content-addressed store, hash-verified

94 return s + t
95
96 def readlines(self):
97 """read all remaining lines from the file"""
98 s = self.read()
99 lines = []
100 i, j = 0, s.find("\n")
101 while j > -1:
102 lines.append(s[i:j+1])
103 i = j+1
104 j = s.find("\n", i)
105 if i < len(s):
106 # Only get here if the last line doesn't have a newline
107 lines.append(s[i:])
108 return lines
109
110 def _check_no_buffer(self):
111 # If 'nobuffer' called and finished with the buffer file

Callers 7

__init__Method · 0.45
executeMethod · 0.45
recipe-117237.pyFile · 0.45
printfileFunction · 0.45
recipe-119596.pyFile · 0.45
__init__Method · 0.45
parseFunction · 0.45

Calls 3

readMethod · 0.95
findMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected