MCPcopy Index your code
hub / github.com/bpython/bpython / filename_for_console_input

Function filename_for_console_input

bpython/patch_linecache.py:72–81  ·  view source on GitHub ↗

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

(code_string: str)

Source from the content-addressed store, hash-verified

70
71
72def filename_for_console_input(code_string: str) -> str:
73 """Remembers a string of source code, and returns
74 a fake filename to use to retrieve it later."""
75 if isinstance(linecache.cache, BPythonLinecache):
76 return linecache.cache.remember_bpython_input(code_string)
77 else:
78 # If someone else has patched linecache.cache, better for code to
79 # simply be unavailable to inspect.getsource() than to raise
80 # an exception.
81 return "<input>"

Callers 1

runsourceMethod · 0.85

Calls 1

Tested by

no test coverage detected