Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6c8c89

Browse files
committed
Allow to pass colors to IPython embed
Step toward Quansight/deshaw#537
1 parent 6cc4d06 commit d6c8c89

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

IPython/core/interactiveshell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def _exiter_default(self):
466466
# Monotonically increasing execution counter
467467
execution_count = Integer(1)
468468
filename = Unicode("<ipython console>")
469-
ipython_dir= Unicode('').tag(config=True) # Set to get_ipython_dir() in __init__
469+
ipython_dir = Unicode("").tag(config=True) # Set to get_ipython_dir() in __init__
470470

471471
# Used to transform cells before running them, and check whether code is complete
472472
input_transformer_manager = Instance('IPython.core.inputtransformer2.TransformerManager',

IPython/terminal/embed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,13 @@ def embed(*, header="", compile_flags=None, **kwargs):
395395
config.InteractiveShellEmbed = config.TerminalInteractiveShell
396396
kwargs["config"] = config
397397
using = kwargs.get("using", "sync")
398+
colors = kwargs.pop("colors", "nocolor")
398399
if using:
399400
kwargs["config"].update(
400401
{
401402
"TerminalInteractiveShell": {
402403
"loop_runner": using,
403-
"colors": "nocolor",
404+
"colors": colors,
404405
"autoawait": using != "sync",
405406
}
406407
}

IPython/terminal/interactiveshell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ def init_alias(self):
974974
self.alias_manager.soft_define_alias(cmd, cmd)
975975

976976
def __init__(self, *args, **kwargs) -> None:
977-
super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
977+
super().__init__(*args, **kwargs)
978978
self._set_autosuggestions(self.autosuggestions_provider)
979979
self.init_prompt_toolkit_cli()
980980
self.init_term_title()

0 commit comments

Comments
 (0)