Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions drepl-ipython.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from IPython.utils.tokenutil import token_at_cursor
from traitlets import Unicode

from IPython.terminal.ipapp import launch_new_instance

def encoding_workaround(data):
if isinstance(data, str):
Expand Down Expand Up @@ -84,15 +85,11 @@ class DRepl(InteractiveShell):
help="String prepended to return values displayed in the shell.",
).tag(config=True)

def __init__(self, config) -> None:
def __init__(self, **kwargs) -> None:
# Default settings
self.config.HistoryManager.enabled = False
# User-supplied settings
for k, v in config.items():
k0, dot, k1 = k.rpartition(".")
cfg = getattr(self.config, k0) if dot else self.config.DRepl
setattr(cfg, k1, v)
super().__init__()
super().__init__(**kwargs)
self.confirm_exit = True
try:
self.enable_matplotlib("inline")
Expand All @@ -102,7 +99,6 @@ def __init__(self, config) -> None:
self.mime_renderers = {
k: self.make_mime_renderer(k, v) for k, v in mime_types.items()
}
self.show_banner()

system = InteractiveShell.system_raw
displayhook_class = DReplDisplayHook
Expand Down Expand Up @@ -195,5 +191,4 @@ def drepl_describe(self, id, code, pos):


if __name__ == "__main__":
config = json.loads(stdin.readline())
DRepl.instance(config).mainloop()
launch_new_instance(interactive_shell_class=DRepl)