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

import linecache
from typing import Any, List, Tuple


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, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self.bpython_history: List[Tuple[int, None, List[str], str]] = []

    def is_bpython_filename(self, fname: Any) -> bool:
        if isinstance(fname, str):
            return fname.startswith("

Web Proxy Viewer  |  New URL  |  Original Page