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

Method replace_history_item

Lib/_pyrepl/readline.py:499–505  ·  view source on GitHub ↗
(self, index: int, line: str)

Source from the content-addressed store, hash-verified

497 # like readline.c
498
499 def replace_history_item(self, index: int, line: str) -> None:
500 history = self.get_reader().history
501 if 0 <= index < len(history):
502 history[index] = self._histline(line)
503 else:
504 raise ValueError("No history item at position %d" % index)
505 # like readline.c
506
507 def add_history(self, line: str) -> None:
508 self.get_reader().history.append(self._histline(line))

Callers 2

testHistoryUpdatesMethod · 0.80
test_nonascii_historyMethod · 0.80

Calls 2

get_readerMethod · 0.95
_histlineMethod · 0.95

Tested by 2

testHistoryUpdatesMethod · 0.64
test_nonascii_historyMethod · 0.64