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

Method get_prompt

Lib/_pyrepl/reader.py:484–504  ·  view source on GitHub ↗

Return what should be in the left-hand margin for line 'lineno'.

(self, lineno: int, cursor_on_line: bool)

Source from the content-addressed store, hash-verified

482 return self.arg
483
484 def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
485 """Return what should be in the left-hand margin for line
486 'lineno'."""
487 if self.arg is not None and cursor_on_line:
488 prompt = f"(arg: {self.arg}) "
489 elif self.paste_mode:
490 prompt = "(paste) "
491 elif "\n" in self.buffer:
492 if lineno == 0:
493 prompt = self.ps2
494 elif self.ps4 and lineno == self.buffer.count("\n"):
495 prompt = self.ps4
496 else:
497 prompt = self.ps3
498 else:
499 prompt = self.ps1
500
501 if self.can_colorize:
502 t = THEME()
503 prompt = f"{t.prompt}{prompt}{t.reset}"
504 return prompt
505
506 def push_input_trans(self, itrans: input.KeymapTranslator) -> None:
507 self.input_trans_stack.append(self.input_trans)

Callers 1

calc_screenMethod · 0.95

Calls 2

THEMEFunction · 0.85
countMethod · 0.45

Tested by

no test coverage detected