[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/darrenatrealpython/bpython/main/bpython/patch_linecache.py [Back]  [Original]

import linecache
from typing import Any, List, Tuple, Optional


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: Optional[
            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("

Web Proxy Viewer  |  New URL  |  Original Page