예제 #1
0
 def do_list(self, args):
     lines = self.context_lines
     context = (lines - 2) / 2
     if not args:
         first = max(1, self.curframe.f_lineno - context)
         last = first + context * 2
         args = six.text_type('%s, %s') % (
             six.text_type(int(first)),
             six.text_type(int(last)),
         )
     self.lineno = None
     with style(self, (self.curframe.f_code.co_filename,
                       self.curframe.f_lineno - context)):
         Pdb.do_list(self, args)
예제 #2
0
 def do_list(self, arg):
     """overrides default list command to display the surrounding block
     instead of 5 lines of context
     """
     self.lastcmd = "list"
     if not arg:
         try:
             source, start_lineno = getsource(self.curframe)
             print colorize("".join(source), start_lineno, self.curframe.f_lineno)
         except KeyboardInterrupt:
             pass
         except IOError:
             Pdb.do_list(self, arg)
     else:
         Pdb.do_list(self, arg)
예제 #3
0
 def do_list(self, arg):
     """overrides default list command to display the surrounding block
     instead of 5 lines of context
     """
     self.lastcmd = "list"
     if not arg:
         try:
             source, start_lineno = getsource(self.curframe)
             print(colorize("".join(source), start_lineno, self.curframe.f_lineno))
         except KeyboardInterrupt:
             pass
         except IOError:
             Pdb.do_list(self, arg)
     else:
         Pdb.do_list(self, arg)