@@ -442,11 +442,10 @@ def pdb(self, parameter_s=''):
442442 Set break point at LINE in FILE.
443443 """
444444 )
445- @magic_arguments .argument ('statement' , nargs = '*' ,
446- help = """
447- Code to run in debugger.
448- You can omit this in cell magic mode.
449- """
445+ @magic_arguments .kwds (
446+ epilog = """
447+ Any remaining arguments will be treated as code to run in the debugger.
448+ """
450449 )
451450 @no_var_expand
452451 @line_cell_magic
@@ -455,12 +454,12 @@ def debug(self, line="", cell=None, local_ns=None):
455454 """Activate the interactive debugger.
456455
457456 This magic command support two ways of activating debugger.
458- One is to activate debugger before executing code. This way, you
457+ One is to activate debugger before executing code. This way, you
459458 can set a break point, to step through the code from the point.
460459 You can use this mode by giving statements to execute and optionally
461460 a breakpoint.
462461
463- The other one is to activate debugger in post-mortem mode. You can
462+ The other one is to activate debugger in post-mortem mode. You can
464463 activate this mode simply running %debug without any argument.
465464 If an exception has just occurred, this lets you inspect its stack
466465 frames interactively. Note that this will always work only on the last
@@ -476,9 +475,9 @@ def debug(self, line="", cell=None, local_ns=None):
476475 the magic line is always left unmodified.
477476
478477 """
479- args = magic_arguments .parse_argstring (self .debug , line )
478+ args , extra = magic_arguments .parse_argstring (self .debug , line , partial = True )
480479
481- if not (args .breakpoint or args . statement or cell ):
480+ if not (args .breakpoint or extra or cell ):
482481 self ._debug_post_mortem ()
483482 elif not (args .breakpoint or cell ):
484483 # If there is no breakpoints, the line is just code to execute
@@ -487,7 +486,7 @@ def debug(self, line="", cell=None, local_ns=None):
487486 # Here we try to reconstruct the code from the output of
488487 # parse_argstring. This might not work if the code has spaces
489488 # For example this fails for `print("a b")`
490- code = "\n " .join (args . statement )
489+ code = " " .join (extra )
491490 if cell :
492491 code += "\n " + cell
493492 self ._debug_exec (code , args .breakpoint , local_ns )
@@ -1268,13 +1267,10 @@ def timeit(self, line='', cell=None, local_ns=None):
12681267 dest = "no_raise_error" ,
12691268 help = "If given, don't re-raise exceptions" ,
12701269 )
1271- @magic_arguments .argument (
1272- "statement" ,
1273- nargs = "*" ,
1274- help = """
1275- Code to run.
1276- You can omit this in cell magic mode.
1277- """ ,
1270+ @magic_arguments .kwds (
1271+ epilog = """
1272+ Any remaining arguments will be treated as code to run in the debugger.
1273+ """
12781274 )
12791275 @skip_doctest
12801276 @needs_local_scope
@@ -1347,8 +1343,8 @@ def time(self, line="", cell=None, local_ns=None):
13471343 Wall time: 0.00 s
13481344 Compiler : 0.78 s
13491345 """
1350- args = magic_arguments .parse_argstring (self .time , line )
1351- line = "\n " .join (args . statement )
1346+ args , extra = magic_arguments .parse_argstring (self .time , line , partial = True )
1347+ line = " " .join (extra )
13521348
13531349 if line and cell :
13541350 raise UsageError ("Can't use statement directly after '%%time'!" )
0 commit comments