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

Method readline

Lib/_pyrepl/reader.py:792–806  ·  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

790 self.handle1(block=False)
791
792 def readline(self, startup_hook: Callback | None = None) -> str:
793 """Read a line. The implementation of this method also shows
794 how to drive Reader if you want more control over the event
795 loop."""
796 self.prepare()
797 try:
798 if startup_hook is not None:
799 startup_hook()
800 self.refresh()
801 while not self.finished:
802 self.handle1()
803 return self.get_unicode()
804
805 finally:
806 self.restore()
807
808 def bind(self, spec: KeySpec, command: CommandName) -> None:
809 self.keymap = self.keymap + ((spec, command),)

Callers 4

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