MCPcopy Index your code
hub / github.com/prompt-toolkit/ptpython / __init__

Method __init__

src/ptpython/ipython.py:184–214  ·  view source on GitHub ↗
(self, ipython_shell, *a, **kw)

Source from the content-addressed store, hash-verified

182 """
183
184 def __init__(self, ipython_shell, *a, **kw):
185 kw["_completer"] = create_completer(
186 kw["get_globals"],
187 kw["get_globals"],
188 ipython_shell.magics_manager,
189 ipython_shell.alias_manager,
190 lambda: self.enable_dictionary_completion,
191 )
192 kw["_lexer"] = create_lexer()
193 kw["_validator"] = IPythonValidator(get_compiler_flags=self.get_compiler_flags)
194
195 super().__init__(*a, **kw)
196 self.ipython_shell = ipython_shell
197
198 self.all_prompt_styles["ipython"] = IPythonPrompt(ipython_shell.prompts)
199 self.prompt_style = "ipython"
200
201 # UI style for IPython. Add tokens that are used by IPython>5.0
202 style_dict = {}
203 style_dict.update(default_ui_style)
204 style_dict.update(
205 {
206 "pygments.prompt": "#009900",
207 "pygments.prompt-num": "#00ff00 bold",
208 "pygments.out-prompt": "#990000",
209 "pygments.out-prompt-num": "#ff0000 bold",
210 }
211 )
212
213 self.ui_styles = {"default": Style.from_dict(style_dict)}
214 self.use_ui_colorscheme("default")
215
216 def get_compiler_flags(self):
217 flags = super().get_compiler_flags()

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 5

create_completerFunction · 0.85
create_lexerFunction · 0.85
IPythonValidatorClass · 0.85
use_ui_colorschemeMethod · 0.80
IPythonPromptClass · 0.70

Tested by

no test coverage detected