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