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

Method __init__

bpython/history.py:38–54  ·  view source on GitHub ↗
(
        self,
        entries: Iterable[str] | None = None,
        duplicates: bool = True,
        hist_size: int = 100,
    )

Source from the content-addressed store, hash-verified

36 """Stores readline-style history and current place in it"""
37
38 def __init__(
39 self,
40 entries: Iterable[str] | None = None,
41 duplicates: bool = True,
42 hist_size: int = 100,
43 ) -> None:
44 if entries is None:
45 self.entries = [""]
46 else:
47 self.entries = list(entries)
48 # how many lines back in history is currently selected where 0 is the
49 # saved typed line, 1 the prev entered line
50 self.index = 0
51 # what was on the prompt before using history
52 self.saved_line = ""
53 self.duplicates = duplicates
54 self.hist_size = hist_size
55
56 def append(self, line: str) -> None:
57 self.append_to(self.entries, line)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected