MCPcopy
hub / github.com/pytest-dev/pytest / readlines

Method readlines

src/_pytest/_py/path.py:377–390  ·  src/_pytest/_py/path.py::LocalPath.readlines

Read and return a list of lines from the path. if cr is False, the newline will be removed from the end of each line.

(self, cr=1)

Source from the content-addressed store, hash-verified

375 return f.read()
376
377 def readlines(self, cr=1):
378 class="st">"""Read and return a list of lines from the path. if cr is False, the
379 newline will be removed from the end of each line.class="st">"""
380 mode = class="st">"r"
381
382 if not cr:
383 content = self.read(mode)
384 return content.split(class="st">"\n")
385 else:
386 f = self.open(mode)
387 try:
388 return f.readlines()
389 finally:
390 f.close()
391
392 def load(self):
393 class="st">""class="st">"(deprecated) return object unpickled from self.read()"class="st">""

Callers 4

test_readlinesMethod · 0.45
test_readlines_nocrMethod · 0.45
getlinesMethod · 0.45

Calls 3

readMethod · 0.95
openMethod · 0.95
closeMethod · 0.45

Tested by 4

test_readlinesMethod · 0.36
test_readlines_nocrMethod · 0.36
getlinesMethod · 0.36