示例#1
0
文件: tracer.py 项目: asmeurer/xonsh
 def trace(self, frame, event, arg):
     """Implements a line tracing function."""
     if event not in self.valid_events:
         return self.trace
     fname = inspectors.find_file(frame)
     if fname in self.files:
         lineno = frame.f_lineno
         curr = (fname, lineno)
         if curr != self._last:
             line = linecache.getline(fname, lineno).rstrip()
             s = format_line(fname, lineno, line, color=self.usecolor, lexer=self.lexer, formatter=self.formatter)
             print_color(s)
             self._last = curr
     return self.trace
示例#2
0
文件: tracer.py 项目: moealmaw/xonsh
 def trace(self, frame, event, arg):
     """Implements a line tracing function."""
     if event not in self.valid_events:
         return self.trace
     fname = find_file(frame)
     if fname in self.files:
         lineno = frame.f_lineno
         curr = (fname, lineno)
         if curr != self._last:
             line = linecache.getline(fname, lineno).rstrip()
             s = tracer_format_line(fname, lineno, line,
                                    color=self.usecolor,
                                    lexer=self.lexer,
                                    formatter=self.formatter)
             print_color(s)
             self._last = curr
     return self.trace