Allow passing extra options to TerminalPdb.pt_init...
Maor Kleinberger -
r25866:cc9da29a
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -26,12 +26,21 PTK3 = ptk_version.startswith('3.')
26 class TerminalPdb(Pdb):
26 class TerminalPdb(Pdb):
27 """Standalone IPython debugger."""
27 """Standalone IPython debugger."""
28
28
29 def __init__(self, *args, **kwargs):
29 def __init__(self, *args, pt_session_options=None, **kwargs):
30 Pdb.__init__(self, *args, **kwargs)
30 Pdb.__init__(self, *args, **kwargs)
31 self._ptcomp = None
31 self._ptcomp = None
32 self.pt_init()
32 self.pt_init(pt_session_options)
33
33
34 def pt_init(self):
34 def pt_init(self, pt_session_options=None):
35 """Initialize the prompt session and the prompt loop
36 and store them in self.pt_app and self.pt_loop.
37
38 Additional keyword arguments for the PromptSession class
39 can be specified in pt_session_options.
40 """
41 if pt_session_options is None:
42 pt_session_options = {}
43
35 def get_prompt_tokens():
44 def get_prompt_tokens():
36 return [(Token.Prompt, self.prompt)]
45 return [(Token.Prompt, self.prompt)]
37
46
@@ -68,6 +77,7 class TerminalPdb(Pdb):
68
77
69 if not PTK3:
78 if not PTK3:
70 options['inputhook'] = self.shell.inputhook
79 options['inputhook'] = self.shell.inputhook
80 options.update(pt_session_options)
71 self.pt_loop = asyncio.new_event_loop()
81 self.pt_loop = asyncio.new_event_loop()
72 self.pt_app = PromptSession(**options)
82 self.pt_app = PromptSession(**options)
73
83
Comments 0
You need to be logged in to leave comments. Login now