import linecache
from typing import Any
class BPythonLinecache(dict):
"""Replaces the cache dict in the standard-library linecache module,
to also remember (in an unerasable way) bpython console input."""
def __init__(
self,
bpython_history: None | (list[tuple[int, None, list[str], str]]) = None,
*args,
**kwargs,
) -> None:
super().__init__(*args, **kwargs)
self.bpython_history = bpython_history or []
def is_bpython_filename(self, fname: Any) -> bool:
return isinstance(fname, str) and fname.startswith("