##// END OF EJS Templates
Merge pull request #2559 from bfroehle/ipdb_magic_improvements...
Thomas Kluyver -
r8708:04a71d3a merge
parent child Browse files
Show More
@@ -477,23 +477,51 b' class Pdb(OldPdb):'
477 477 do_l = do_list
478 478
479 479 def do_pdef(self, arg):
480 """The debugger interface to magic_pdef"""
480 """Print the call signature for any callable object.
481
482 The debugger interface to %pdef"""
481 483 namespaces = [('Locals', self.curframe.f_locals),
482 484 ('Globals', self.curframe.f_globals)]
483 485 self.shell.find_line_magic('pdef')(arg, namespaces=namespaces)
484 486
485 487 def do_pdoc(self, arg):
486 """The debugger interface to magic_pdoc"""
488 """Print the docstring for an object.
489
490 The debugger interface to %pdoc."""
487 491 namespaces = [('Locals', self.curframe.f_locals),
488 492 ('Globals', self.curframe.f_globals)]
489 493 self.shell.find_line_magic('pdoc')(arg, namespaces=namespaces)
490 494
495 def do_pfile(self, arg):
496 """Print (or run through pager) the file where an object is defined.
497
498 The debugger interface to %pfile.
499 """
500 namespaces = [('Locals', self.curframe.f_locals),
501 ('Globals', self.curframe.f_globals)]
502 self.shell.find_line_magic('pfile')(arg, namespaces=namespaces)
503
491 504 def do_pinfo(self, arg):
492 """The debugger equivalant of ?obj"""
505 """Provide detailed information about an object.
506
507 The debugger interface to %pinfo, i.e., obj?."""
508 namespaces = [('Locals', self.curframe.f_locals),
509 ('Globals', self.curframe.f_globals)]
510 self.shell.find_line_magic('pinfo')(arg, namespaces=namespaces)
511
512 def do_pinfo2(self, arg):
513 """Provide extra detailed information about an object.
514
515 The debugger interface to %pinfo2, i.e., obj??."""
516 namespaces = [('Locals', self.curframe.f_locals),
517 ('Globals', self.curframe.f_globals)]
518 self.shell.find_line_magic('pinfo2')(arg, namespaces=namespaces)
519
520 def do_psource(self, arg):
521 """Print (or run through pager) the source code for an object."""
493 522 namespaces = [('Locals', self.curframe.f_locals),
494 523 ('Globals', self.curframe.f_globals)]
495 self.shell.find_line_magic('pinfo')("pinfo %s" % arg,
496 namespaces=namespaces)
524 self.shell.find_line_magic('psource')(arg, namespaces=namespaces)
497 525
498 526 def checkline(self, filename, lineno):
499 527 """Check whether specified line seems to be executable.
@@ -69,7 +69,7 b' class NamespaceMagics(Magics):'
69 69 @skip_doctest
70 70 @line_magic
71 71 def pdef(self, parameter_s='', namespaces=None):
72 """Print the definition header for any callable object.
72 """Print the call signature for any callable object.
73 73
74 74 If the object is a class, print the constructor information.
75 75
@@ -98,7 +98,7 b' class NamespaceMagics(Magics):'
98 98 self.shell._inspect('psource',parameter_s, namespaces)
99 99
100 100 @line_magic
101 def pfile(self, parameter_s=''):
101 def pfile(self, parameter_s='', namespaces=None):
102 102 """Print (or run through pager) the file where an object is defined.
103 103
104 104 The file opens at the line where the object definition begins. IPython
@@ -111,7 +111,7 b' class NamespaceMagics(Magics):'
111 111 viewer."""
112 112
113 113 # first interpret argument as an object name
114 out = self.shell._inspect('pfile',parameter_s)
114 out = self.shell._inspect('pfile',parameter_s, namespaces)
115 115 # if not, try the input as a filename
116 116 if out == 'not found':
117 117 try:
@@ -344,7 +344,7 b' class Inspector:'
344 344 self.set_active_scheme(scheme)
345 345
346 346 def _getdef(self,obj,oname=''):
347 """Return the definition header for any callable object.
347 """Return the call signature for any callable object.
348 348
349 349 If any exception is generated, None is returned instead and the
350 350 exception is suppressed."""
@@ -373,7 +373,7 b' class Inspector:'
373 373 print()
374 374
375 375 def pdef(self, obj, oname=''):
376 """Print the definition header for any callable object.
376 """Print the call signature for any callable object.
377 377
378 378 If the object is a class, print the constructor information."""
379 379
@@ -337,7 +337,7 b' this is just a summary:'
337 337 * **%pdoc <object>**: Print (or run through a pager if too long) the
338 338 docstring for an object. If the given object is a class, it will
339 339 print both the class and the constructor docstrings.
340 * **%pdef <object>**: Print the definition header for any callable
340 * **%pdef <object>**: Print the call signature for any callable
341 341 object. If the object is a class, print the constructor information.
342 342 * **%psource <object>**: Print (or run through a pager if too long)
343 343 the source code for an object.
General Comments 0
You need to be logged in to leave comments. Login now