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

Method get_prompt_text

Lib/idlelib/pyshell.py:988–1002  ·  view source on GitHub ↗

Return text between first and last with prompts added.

(self, first, last)

Source from the content-addressed store, hash-verified

986 return idleConf.GetExtensions(shell_only=True)
987
988 def get_prompt_text(self, first, last):
989 """Return text between first and last with prompts added."""
990 text = self.text.get(first, last)
991 lineno_range = range(
992 int(float(first)),
993 int(float(last))
994 )
995 prompts = [
996 self.shell_sidebar.line_prompts.get(lineno)
997 for lineno in lineno_range
998 ]
999 return "\n".join(
1000 line if prompt is None else f"{prompt} {line}"
1001 for prompt, line in zip(prompts, text.splitlines())
1002 ) + "\n"
1003
1004
1005 def copy_with_prompts_callback(self, event=None):

Callers 2

fixnewlinesMethod · 0.80

Calls 3

getMethod · 0.45
joinMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected