示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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))
示例#4
0
 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)
示例#5
0
    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)
示例#6
0
 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("")
示例#7
0
 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)
示例#8
0
 def toterminal(self, tw: py.io.TerminalWriter) -> None:
     for name, content, sep in self.sections:
         tw.sep(sep, name)
         tw.line(content)
示例#9
0
 def toterminal(self, tw: py.io.TerminalWriter) -> None:
     for line in self.lines:
         tw.line(line)
示例#10
0
 def toterminal(self, tw: py.io.TerminalWriter) -> None:
     tw.write("".join(self.lines))
示例#11
0
 def toterminal(self, tw: py.io.TerminalWriter) -> None:
     tw.line("я")