pylint/reporters/ureports/text_writer.py
def default_table(self, layout, table_content, cols_width):
        """format a table"""
        cols_width = [size + 1 for size in cols_width]
        format_strings = " ".join(["%%-%ss"] * len(cols_width))
        format_strings = format_strings % tuple(cols_width)
        format_strings = format_strings.split(" ")
        table_linesep = "\n+" + "+".join(["-" * w for w in cols_width]) + "+\n"
        headsep = "\n+" + "+".join(["=" * w for w in cols_width]) + "+\n"
        # FIXME: layout.cheaders
        self.write(table_linesep)
        for index, line in enumerate(table_content):
            self.write("|")
            for line_index, at_index in enumerate(line):
                self.write(format_strings[line_index] % at_index)
                self.write("|")
            if index == 0 and layout.rheaders:
                self.write(headsep)
            else:
                self.write(table_linesep)
def default_table(self, layout, table_content, cols_width):
        cols_width = [size + 1 for size in cols_width]
        format_strings = " ".join(["%%-%ss"] * len(cols_width))
        format_strings = format_strings % tuple(cols_width)
        format_strings = format_strings.split(" ")
        table_linesep = "\n+" + "+".join(["-" * w for w in cols_width]) + "+\n"
        headsep = "\n+" + "+".join(["=" * w for w in cols_width]) + "+\n"
        # FIXME: layout.cheaders
        self.write(table_linesep)
        for index, line in enumerate(table_content):
            self.write("|")
            for line_index, at_index in enumerate(line):
                self.write(format_strings[line_index] % at_index)
                self.write("|")
            if index == 0 and layout.rheaders:
                self.write(headsep)
            else:
                self.write(table_linesep)
def default_table ( self , layout , table_content , cols_width ) : cols_width = [ size + 1 for size in cols_width ] format_strings = " " . join ( [ "%%-%ss" ] * len ( cols_width ) ) format_strings = format_strings % tuple ( cols_width ) format_strings = format_strings . split ( " " ) table_linesep = "\n+" + "+" . join ( [ "-" * w for w in cols_width ] ) + "+\n" headsep = "\n+" + "+" . join ( [ "=" * w for w in cols_width ] ) + "+\n" # FIXME: layout.cheaders self . write ( table_linesep ) for index , line in enumerate ( table_content ) : self . write ( "|" ) for line_index , at_index in enumerate ( line ) : self . write ( format_strings [ line_index ] % at_index ) self . write ( "|" ) if index == 0 and layout . rheaders : self . write ( headsep ) else : self . write ( table_linesep )
format a table
format a table