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

Method get_prompt

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

532 return self.arg
533
534 def get_prompt(self, lineno: int, cursor_on_line: bool) -> str:
535 """Return what should be in the left-hand margin for line
536 `lineno'."""
537 if self.arg is not None and cursor_on_line:
538 prompt = f"(arg: {self.arg}) "
539 elif self.paste_mode and not self.in_bracketed_paste:
540 prompt = "(paste) "
541 elif "\n" in self.buffer:
542 if lineno == 0:
543 prompt = self.ps2
544 elif self.ps4 and lineno == self.buffer.count("\n"):
545 prompt = self.ps4
546 else:
547 prompt = self.ps3
548 else:
549 prompt = self.ps1
550
551 if self.can_colorize:
552 prompt = f"{ANSIColors.BOLD_MAGENTA}{prompt}{ANSIColors.RESET}"
553 return prompt
554
555 def push_input_trans(self, itrans: input.KeymapTranslator) -> None:
556 self.input_trans_stack.append(self.input_trans)

Callers 1

calc_screenMethod · 0.95

Calls 1

countMethod · 0.45

Tested by

no test coverage detected