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

Skip to content

Commit 6a4a375

Browse files
committed
Minor syntax cleanup and silification.
Remove a syntax warning; and use explicit kwargs instead of kwargs.pop.
1 parent bb21d60 commit 6a4a375

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
@@ -334,7 +334,7 @@ def mainloop(self, local_ns=None, module=None, stack_depth=0,
334334
self.compile.flags = orig_compile_flags
335335

336336

337-
def embed(**kwargs):
337+
def embed(*, header="", compile_flags=None, **kwargs):
338338
"""Call this to embed IPython at the current point in your program.
339339
340340
The first invocation of this will create an :class:`InteractiveShellEmbed`
@@ -360,8 +360,6 @@ def embed(**kwargs):
360360
config argument.
361361
"""
362362
config = kwargs.get('config')
363-
header = kwargs.pop('header', u'')
364-
compile_flags = kwargs.pop('compile_flags', None)
365363
if config is None:
366364
config = load_default_config()
367365
config.InteractiveShellEmbed = config.TerminalInteractiveShell

0 commit comments

Comments
 (0)