##// END OF EJS Templates
Add pfile command to ipdb.
Bradley M. Froehle -
Show More
@@ -492,6 +492,15 class Pdb(OldPdb):
492 492 ('Globals', self.curframe.f_globals)]
493 493 self.shell.find_line_magic('pdoc')(arg, namespaces=namespaces)
494 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
495 504 def do_pinfo(self, arg):
496 505 """Provide detailed information about an object.
497 506
@@ -98,7 +98,7 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 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:
General Comments 0
You need to be logged in to leave comments. Login now