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

Method readline

Lib/_pyrepl/reader.py:755–769  ·  view source on GitHub ↗

Read a line. The implementation of this method also shows how to drive Reader if you want more control over the event loop.

(self, startup_hook: Callback | None = None)

Source from the content-addressed store, hash-verified

753 self.handle1(block=False)
754
755 def readline(self, startup_hook: Callback | None = None) -> str:
756 """Read a line. The implementation of this method also shows
757 how to drive Reader if you want more control over the event
758 loop."""
759 self.prepare()
760 try:
761 if startup_hook is not None:
762 startup_hook()
763 self.refresh()
764 while not self.finished:
765 self.handle1()
766 return self.get_unicode()
767
768 finally:
769 self.restore()
770
771 def bind(self, spec: KeySpec, command: CommandName) -> None:
772 self.keymap = self.keymap + ((spec, command),)

Callers 6

parse_config_hFunction · 0.45
_readline_side_effectFunction · 0.45
inputMethod · 0.45
multiline_inputMethod · 0.45
read_history_fileMethod · 0.45
getcharFunction · 0.45

Calls 5

prepareMethod · 0.95
refreshMethod · 0.95
handle1Method · 0.95
get_unicodeMethod · 0.95
restoreMethod · 0.95

Tested by

no test coverage detected