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

Method __init__

bpython/curtsiesfrontend/interpreter.py:69–89  ·  view source on GitHub ↗

Constructor. We include an argument for the outfile to pass to the formatter for it to write to.

(
        self,
        locals: dict[str, Any] | None = None,
    )

Source from the content-addressed store, hash-verified

67
68class Interp(ReplInterpreter):
69 def __init__(
70 self,
71 locals: dict[str, Any] | None = None,
72 ) -> None:
73 """Constructor.
74
75 We include an argument for the outfile to pass to the formatter for it
76 to write to.
77 """
78 super().__init__(locals)
79
80 # typically changed after being instantiated
81 # but used when interpreter used corresponding REPL
82 def write(err_line: str | FmtStr) -> None:
83 """Default stderr handler for tracebacks
84
85 Accepts FmtStrs so interpreters can output them"""
86 sys.stderr.write(str(err_line))
87
88 self.write = write # type: ignore
89 self.outfile = self
90
91 def writetb(self, lines: Iterable[str]) -> None:
92 tbtext = "".join(lines)

Callers 1

__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected