def _pretty_print_layer_fields(self, terminal_writer: py.io.TerminalWriter): for field_line in self._get_all_field_lines(): if ':' in field_line: field_name, field_line = field_line.split(':', 1) terminal_writer.write(field_name + ':', green=True, bold=True) terminal_writer.write(field_line, bold=True)
def toterminal(self, tw: py.io.TerminalWriter) -> None: for element in self.chain: element[0].toterminal(tw) if element[2] is not None: tw.line("") tw.line(element[2], yellow=True) super().toterminal(tw)
def toterminal(self, tw: py.io.TerminalWriter) -> None: # filename and lineno output for each entry, # using an output format that most editors understand msg = self.message i = msg.find("\n") if i != -1: msg = msg[:i] tw.write(self.path, bold=True, red=True) tw.line(":{}: {}".format(self.lineno, msg))
def toterminal(self, tw: py.io.TerminalWriter) -> None: if self.style == "short": assert self.reprfileloc is not None self.reprfileloc.toterminal(tw) for line in self.lines: red = line.startswith("E ") tw.line(line, bold=True, red=red) return if self.reprfuncargs: self.reprfuncargs.toterminal(tw) for line in self.lines: red = line.startswith("E ") tw.line(line, bold=True, red=red) if self.reprlocals: tw.line("") self.reprlocals.toterminal(tw) if self.reprfileloc: if self.lines: tw.line("") self.reprfileloc.toterminal(tw)
def toterminal(self, tw: py.io.TerminalWriter) -> None: # the entries might have different styles for i, entry in enumerate(self.reprentries): if entry.style == "long": tw.line("") entry.toterminal(tw) if i < len(self.reprentries) - 1: next_entry = self.reprentries[i + 1] if (entry.style == "long" or entry.style == "short" and next_entry.style == "long"): tw.sep(self.entrysep) if self.extraline: tw.line(self.extraline)
def toterminal(self, tw: py.io.TerminalWriter) -> None: if self.args: linesofar = "" for name, value in self.args: ns = "{} = {}".format(name, value) if len(ns) + len(linesofar) + 2 > tw.fullwidth: if linesofar: tw.line(linesofar) linesofar = ns else: if linesofar: linesofar += ", " + ns else: linesofar = ns if linesofar: tw.line(linesofar) tw.line("")
def toterminal(self, tw: py.io.TerminalWriter) -> None: for reprlocation, lines in self.reprlocation_lines: for line in lines: tw.line(line) reprlocation.toterminal(tw)
def toterminal(self, tw: py.io.TerminalWriter) -> None: for name, content, sep in self.sections: tw.sep(sep, name) tw.line(content)
def toterminal(self, tw: py.io.TerminalWriter) -> None: for line in self.lines: tw.line(line)
def toterminal(self, tw: py.io.TerminalWriter) -> None: tw.write("".join(self.lines))
def toterminal(self, tw: py.io.TerminalWriter) -> None: tw.line("я")