MCPcopy Index your code
hub / github.com/ipython/ipython / __line_content

Method __line_content

IPython/core/debugger.py:777–806  ·  view source on GitHub ↗
(
        self, filename: str, lineno: int, line: str, arrow: bool = False
    )

Source from the content-addressed store, hash-verified

775 return self.theme.format(ret_tok)
776
777 def __line_content(
778 self, filename: str, lineno: int, line: str, arrow: bool = False
779 ):
780 bp_mark = ""
781 BreakpointToken = Token.Breakpoint
782
783 new_line, err = self.parser.format2(line, "str")
784 if not err:
785 assert new_line is not None
786 line = new_line
787
788 bp = None
789 if lineno in self.get_file_breaks(filename):
790 bps = self.get_breaks(filename, lineno)
791 bp = bps[-1]
792
793 if bp:
794 bp_mark = str(bp.number)
795 BreakpointToken = Token.Breakpoint.Enabled
796 if not bp.enabled:
797 BreakpointToken = Token.Breakpoint.Disabled
798 numbers_width = 7
799 if arrow:
800 # This is the line with the error
801 pad = numbers_width - len(str(lineno)) - len(bp_mark)
802 num = "%s%s" % (self.theme.make_arrow(pad), str(lineno))
803 else:
804 num = "%*s" % (numbers_width - len(bp_mark), str(lineno))
805 bp_str = (BreakpointToken, bp_mark)
806 return (bp_str, num, line)
807
808 def print_list_lines(self, filename: str, first: int, last: int) -> None:
809 """The printing (as opposed to the parsing part of a 'list'

Callers 2

format_stack_entryMethod · 0.95
print_list_linesMethod · 0.95

Calls 2

format2Method · 0.80
make_arrowMethod · 0.80

Tested by

no test coverage detected