def get_records(self, etb, number_of_lines_of_context, tb_offset): context = number_of_lines_of_context - 1 after = context // 2 before = context - after options = stack_data.Options(before=before, after=after) return list(stack_data.FrameInfo.stack_data( etb, options=options))[tb_offset:]
def get_records(self, etb, number_of_lines_of_context, tb_offset): context = number_of_lines_of_context - 1 after = context // 2 before = context - after if self.has_colors: style = get_style_by_name('default') style = stack_data.style_with_executing_node(style, 'bg:#00005f') formatter = Terminal256Formatter(style=style) else: formatter = None options = stack_data.Options( before=before, after=after, pygments_formatter=formatter, ) return list(stack_data.FrameInfo.stack_data(etb, options=options))[tb_offset:]
def get_records(self, etb: TracebackType, number_of_lines_of_context: int, tb_offset: int): context = number_of_lines_of_context - 1 after = context // 2 before = context - after if self.has_colors: style = get_style_by_name("default") style = stack_data.style_with_executing_node( style, "bg:ansiyellow") formatter = Terminal256Formatter(style=style) else: formatter = None options = stack_data.Options( before=before, after=after, pygments_formatter=formatter, ) assert etb is not None return list(stack_data.FrameInfo.stack_data( etb, options=options))[tb_offset:]
return s def format_exception_string(): return ''.join(traceback.format_exception_only(*sys.exc_info()[:2])) class Formatter(stack_data.Formatter): def format_frame(self, frame): if frame.filename.startswith(internal_dir): return yield from super().format_frame(frame) formatter = Formatter( options=stack_data.Options(before=0, after=0), pygmented=True, show_executing_node=True, ) def print_exception(): formatter.print_exception() def row_to_dict(row): d = row.__dict__.copy() del d["_sa_instance_state"] return d
def format_traceback_stack_data(e): return "".join( TracebackFormatter( options=stack_data.Options(before=1, after=0), show_variables=True, ).format_exception(e))