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

Method remember_bpython_input

bpython/patch_linecache.py:30–37  ·  view source on GitHub ↗

Remembers a string of source code, and returns a fake filename to use to retrieve it later.

(self, source: str)

Source from the content-addressed store, hash-verified

28 raise KeyError
29
30 def remember_bpython_input(self, source: str) -> str:
31 """Remembers a string of source code, and returns
32 a fake filename to use to retrieve it later."""
33 filename = f"<bpython-input-{len(self.bpython_history)}>"
34 self.bpython_history.append(
35 (len(source), None, source.splitlines(True), filename)
36 )
37 return filename
38
39 def __getitem__(self, key: Any) -> Any:
40 if self.is_bpython_filename(key):

Callers 1

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected