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

Skip to content

Commit d38a2b7

Browse files
authored
Merge pull request #12920 from Carreau/c1
Minor syntax cleanup and simplification.
2 parents 40823e2 + 6a4a375 commit d38a2b7

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

IPython/core/display_functions.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,17 @@ def _new_id():
8585
return b2a_hex(os.urandom(16)).decode('ascii')
8686

8787

88-
def display(*objs, include=None, exclude=None, metadata=None, transient=None, display_id=None, **kwargs):
88+
def display(
89+
*objs,
90+
include=None,
91+
exclude=None,
92+
metadata=None,
93+
transient=None,
94+
display_id=None,
95+
raw=False,
96+
clear=False,
97+
**kwargs
98+
):
8999
"""Display a Python object in all frontends.
90100
91101
By default all representations will be computed and sent to the frontends.
@@ -242,8 +252,6 @@ def display(*objs, include=None, exclude=None, metadata=None, transient=None, di
242252
print(*objs)
243253
return
244254

245-
raw = kwargs.pop("raw", False)
246-
clear = kwargs.pop("clear", False)
247255
if transient is None:
248256
transient = {}
249257
if metadata is None:

IPython/core/magic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def parse_options(self, arg_str, opt_str, *long_opts, **kw):
636636
'%s ( allowed: "%s" %s)' % (e.msg, opt_str, " ".join(long_opts))
637637
) from e
638638
for o, a in opts:
639-
if mode is "string" and preserve_non_opts:
639+
if mode == "string" and preserve_non_opts:
640640
# remove option-parts from the original args-string and preserve remaining-part.
641641
# This relies on the arg_split(...) and getopt(...)'s impl spec, that the parsed options are
642642
# returned in the original order.

IPython/terminal/embed.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def mainloop(self, local_ns=None, module=None, stack_depth=0,
336336
self.compile.flags = orig_compile_flags
337337

338338

339-
def embed(**kwargs):
339+
def embed(*, header="", compile_flags=None, **kwargs):
340340
"""Call this to embed IPython at the current point in your program.
341341
342342
The first invocation of this will create an :class:`InteractiveShellEmbed`
@@ -362,8 +362,6 @@ def embed(**kwargs):
362362
config argument.
363363
"""
364364
config = kwargs.get('config')
365-
header = kwargs.pop('header', u'')
366-
compile_flags = kwargs.pop('compile_flags', None)
367365
if config is None:
368366
config = load_default_config()
369367
config.InteractiveShellEmbed = config.TerminalInteractiveShell

0 commit comments

Comments
 (0)