MCPcopy Create free account
hub / github.com/ipython/ipython / __format_line

Method __format_line

IPython/core/debugger.py:456–484  ·  view source on GitHub ↗
(self, tpl_line, filename, lineno, line, arrow = False)

Source from the content-addressed store, hash-verified

454 return ''.join(ret)
455
456 def __format_line(self, tpl_line, filename, lineno, line, arrow = False):
457 bp_mark = ""
458 bp_mark_color = ""
459
460 new_line, err = self.parser.format2(line, 'str')
461 if not err:
462 line = new_line
463
464 bp = None
465 if lineno in self.get_file_breaks(filename):
466 bps = self.get_breaks(filename, lineno)
467 bp = bps[-1]
468
469 if bp:
470 Colors = self.color_scheme_table.active_colors
471 bp_mark = str(bp.number)
472 bp_mark_color = Colors.breakpoint_enabled
473 if not bp.enabled:
474 bp_mark_color = Colors.breakpoint_disabled
475
476 numbers_width = 7
477 if arrow:
478 # This is the line with the error
479 pad = numbers_width - len(str(lineno)) - len(bp_mark)
480 num = '%s%s' % (make_arrow(pad), str(lineno))
481 else:
482 num = '%*s' % (numbers_width - len(bp_mark), str(lineno))
483
484 return tpl_line % (bp_mark_color + bp_mark, num, line)
485
486
487 def print_list_lines(self, filename, first, last):

Callers 2

format_stack_entryMethod · 0.95
print_list_linesMethod · 0.95

Calls 2

make_arrowFunction · 0.85
format2Method · 0.80

Tested by

no test coverage detected