MCPcopy Index your code
hub / github.com/python/cpython / read

Method read

Lib/idlelib/run.py:487–506  ·  view source on GitHub ↗
(self, size=-1)

Source from the content-addressed store, hash-verified

485 return True
486
487 def read(self, size=-1):
488 if self.closed:
489 raise ValueError("read from closed file")
490 if size is None:
491 size = -1
492 elif not isinstance(size, int):
493 raise TypeError('must be int, not ' + type(size).__name__)
494 result = self._line_buffer
495 self._line_buffer = ''
496 if size < 0:
497 while line := self.shell.readline():
498 result += line
499 else:
500 while len(result) < size:
501 line = self.shell.readline()
502 if not line: break
503 result += line
504 self._line_buffer = result[size:]
505 result = result[:size]
506 return result
507
508 def readline(self, size=-1):
509 if self.closed:

Callers 10

test_readMethod · 0.95
execfileMethod · 0.45
mainFunction · 0.45
LoadMethod · 0.45
__init__Method · 0.45
checksyntaxMethod · 0.45
loadfileMethod · 0.45
print_windowMethod · 0.45
view_fileFunction · 0.45
setUpClassMethod · 0.45

Calls 1

readlineMethod · 0.45

Tested by 2

test_readMethod · 0.76
setUpClassMethod · 0.36