MCPcopy Create free account
hub / github.com/bpython/bpython / get_bpython_history

Method get_bpython_history

bpython/patch_linecache.py:21–28  ·  view source on GitHub ↗

Given a filename provided by remember_bpython_input, returns the associated source string.

(self, key: str)

Source from the content-addressed store, hash-verified

19 return isinstance(fname, str) and fname.startswith("<bpython-input-")
20
21 def get_bpython_history(self, key: str) -> tuple[int, None, list[str], str]:
22 """Given a filename provided by remember_bpython_input,
23 returns the associated source string."""
24 try:
25 idx = int(key.split("-")[2][:-1])
26 return self.bpython_history[idx]
27 except (IndexError, ValueError):
28 raise KeyError
29
30 def remember_bpython_input(self, source: str) -> str:
31 """Remembers a string of source code, and returns

Callers 2

__getitem__Method · 0.95
__contains__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected