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

Method interact

Lib/pydoc.py:2023–2043  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2021''')
2022
2023 def interact(self):
2024 self.output.write('\n')
2025 while True:
2026 try:
2027 request = self.getline('help> ')
2028 except (KeyboardInterrupt, EOFError):
2029 break
2030 request = request.strip()
2031 if not request:
2032 continue # back to the prompt
2033
2034 # Make sure significant trailing quoting marks of literals don't
2035 # get deleted while cleaning input
2036 if (len(request) > 2 and request[0] == request[-1] in ("'", '"')
2037 and request[0] not in request[1:-1]):
2038 request = request[1:-1]
2039 if request.lower() in ('q', 'quit', 'exit'): break
2040 if request == 'help':
2041 self.intro()
2042 else:
2043 self.help(request)
2044
2045 def getline(self, prompt):
2046 """Read one line, using input() when appropriate."""

Callers 15

__call__Method · 0.95
do_interactMethod · 0.45
runMethod · 0.45
mainFunction · 0.45
test_ps1Method · 0.45
test_ps2Method · 0.45
test_console_stderrMethod · 0.45
test_syntax_errorMethod · 0.45
test_unicode_errorMethod · 0.45
test_sysexcepthookMethod · 0.45

Calls 6

getlineMethod · 0.95
introMethod · 0.95
helpMethod · 0.95
writeMethod · 0.45
stripMethod · 0.45
lowerMethod · 0.45