Show More
@@ -477,23 +477,51 b' class Pdb(OldPdb):' | |||||
477 | do_l = do_list |
|
477 | do_l = do_list | |
478 |
|
478 | |||
479 | def do_pdef(self, arg): |
|
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 | namespaces = [('Locals', self.curframe.f_locals), |
|
483 | namespaces = [('Locals', self.curframe.f_locals), | |
482 | ('Globals', self.curframe.f_globals)] |
|
484 | ('Globals', self.curframe.f_globals)] | |
483 | self.shell.find_line_magic('pdef')(arg, namespaces=namespaces) |
|
485 | self.shell.find_line_magic('pdef')(arg, namespaces=namespaces) | |
484 |
|
486 | |||
485 | def do_pdoc(self, arg): |
|
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 | namespaces = [('Locals', self.curframe.f_locals), |
|
491 | namespaces = [('Locals', self.curframe.f_locals), | |
488 | ('Globals', self.curframe.f_globals)] |
|
492 | ('Globals', self.curframe.f_globals)] | |
489 | self.shell.find_line_magic('pdoc')(arg, namespaces=namespaces) |
|
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 | def do_pinfo(self, arg): |
|
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 | namespaces = [('Locals', self.curframe.f_locals), |
|
522 | namespaces = [('Locals', self.curframe.f_locals), | |
494 | ('Globals', self.curframe.f_globals)] |
|
523 | ('Globals', self.curframe.f_globals)] | |
495 |
self.shell.find_line_magic('p |
|
524 | self.shell.find_line_magic('psource')(arg, namespaces=namespaces) | |
496 | namespaces=namespaces) |
|
|||
497 |
|
525 | |||
498 | def checkline(self, filename, lineno): |
|
526 | def checkline(self, filename, lineno): | |
499 | """Check whether specified line seems to be executable. |
|
527 | """Check whether specified line seems to be executable. |
@@ -69,7 +69,7 b' class NamespaceMagics(Magics):' | |||||
69 | @skip_doctest |
|
69 | @skip_doctest | |
70 | @line_magic |
|
70 | @line_magic | |
71 | def pdef(self, parameter_s='', namespaces=None): |
|
71 | def pdef(self, parameter_s='', namespaces=None): | |
72 |
"""Print the |
|
72 | """Print the call signature for any callable object. | |
73 |
|
73 | |||
74 | If the object is a class, print the constructor information. |
|
74 | If the object is a class, print the constructor information. | |
75 |
|
75 | |||
@@ -98,7 +98,7 b' class NamespaceMagics(Magics):' | |||||
98 | self.shell._inspect('psource',parameter_s, namespaces) |
|
98 | self.shell._inspect('psource',parameter_s, namespaces) | |
99 |
|
99 | |||
100 | @line_magic |
|
100 | @line_magic | |
101 | def pfile(self, parameter_s=''): |
|
101 | def pfile(self, parameter_s='', namespaces=None): | |
102 | """Print (or run through pager) the file where an object is defined. |
|
102 | """Print (or run through pager) the file where an object is defined. | |
103 |
|
103 | |||
104 | The file opens at the line where the object definition begins. IPython |
|
104 | The file opens at the line where the object definition begins. IPython | |
@@ -111,7 +111,7 b' class NamespaceMagics(Magics):' | |||||
111 | viewer.""" |
|
111 | viewer.""" | |
112 |
|
112 | |||
113 | # first interpret argument as an object name |
|
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 | # if not, try the input as a filename |
|
115 | # if not, try the input as a filename | |
116 | if out == 'not found': |
|
116 | if out == 'not found': | |
117 | try: |
|
117 | try: |
@@ -344,7 +344,7 b' class Inspector:' | |||||
344 | self.set_active_scheme(scheme) |
|
344 | self.set_active_scheme(scheme) | |
345 |
|
345 | |||
346 | def _getdef(self,obj,oname=''): |
|
346 | def _getdef(self,obj,oname=''): | |
347 |
"""Return the |
|
347 | """Return the call signature for any callable object. | |
348 |
|
348 | |||
349 | If any exception is generated, None is returned instead and the |
|
349 | If any exception is generated, None is returned instead and the | |
350 | exception is suppressed.""" |
|
350 | exception is suppressed.""" | |
@@ -373,7 +373,7 b' class Inspector:' | |||||
373 | print() |
|
373 | print() | |
374 |
|
374 | |||
375 | def pdef(self, obj, oname=''): |
|
375 | def pdef(self, obj, oname=''): | |
376 |
"""Print the |
|
376 | """Print the call signature for any callable object. | |
377 |
|
377 | |||
378 | If the object is a class, print the constructor information.""" |
|
378 | If the object is a class, print the constructor information.""" | |
379 |
|
379 |
@@ -337,7 +337,7 b' this is just a summary:' | |||||
337 | * **%pdoc <object>**: Print (or run through a pager if too long) the |
|
337 | * **%pdoc <object>**: Print (or run through a pager if too long) the | |
338 | docstring for an object. If the given object is a class, it will |
|
338 | docstring for an object. If the given object is a class, it will | |
339 | print both the class and the constructor docstrings. |
|
339 | print both the class and the constructor docstrings. | |
340 |
* **%pdef <object>**: Print the |
|
340 | * **%pdef <object>**: Print the call signature for any callable | |
341 | object. If the object is a class, print the constructor information. |
|
341 | object. If the object is a class, print the constructor information. | |
342 | * **%psource <object>**: Print (or run through a pager if too long) |
|
342 | * **%psource <object>**: Print (or run through a pager if too long) | |
343 | the source code for an object. |
|
343 | the source code for an object. |
General Comments 0
You need to be logged in to leave comments.
Login now