MCPcopy Index your code
hub / github.com/bpython/bpython / readline

Method readline

bpython/curtsiesfrontend/repl.py:177–189  ·  view source on GitHub ↗
(self, size: int = -1)

Source from the content-addressed store, hash-verified

175 self.cursor_offset += 1
176
177 def readline(self, size: int = -1) -> str:
178 if not isinstance(size, int):
179 raise TypeError(
180 f"'{type(size).__name__}' object cannot be interpreted as an integer"
181 )
182 elif size == 0:
183 return ""
184 self.has_focus = True
185 self.repl.send_to_stdin(self.current_line)
186 value = self.coderunner.request_from_main_context()
187 assert isinstance(value, str)
188 self.readline_results.append(value)
189 return value if size <= -1 else value[:size]
190
191 def readlines(self, size: int | None = -1) -> list[str]:
192 if size is None:

Callers 3

readlinesMethod · 0.95
get_encoding_fileFunction · 0.45
get_inputMethod · 0.45

Calls 3

send_to_stdinMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected