(self, header, line)
Items left aligned in space padded columns.  They are
        truncated if they do not fit. If the width hasn't been
        specified for a column then 10 is used unless the column name
        (header) is longer in which case that width is used.  Use the
        .width command to change column sizes.
Items left aligned in space padded columns.  They are
        truncated if they do not fit. If the width hasn't been
        specified for a column then 10 is used unless the column name
        (header) is longer in which case that width is used.  Use the
        .width command to change column sizes.
Items left aligned in space padded columns . They are truncated if they do not fit . If the width hasn t been specified for a column then 10 is used unless the column name ( header ) is longer in which case that width is used . Use the . width command to change column sizes .
def output_column(self, header, line):
        """
        Items left aligned in space padded columns.  They are
        truncated if they do not fit. If the width hasn't been
        specified for a column then 10 is used unless the column name
        (header) is longer in which case that width is used.  Use the
        .width command to change column sizes.
        """
        # as an optimization we calculate self._actualwidths which is
        # reset for each query
        if header:

            def gw(n):
                if n < len(self.widths) and self.widths[n] != 0:
                    return self.widths[n]
                # if width is not present or 0 then autosize
                text = self._fmt_text_col(line[n])
                return max(len(text), 10)

            widths = [gw(i) for i in range(len(line))]

            if self.truncate:
                self._actualwidths = ["%" + ("-%d.%ds", "%d.%ds")[w < 0] % (abs(w), abs(w)) for w in widths]
            else:
                self._actualwidths = ["%" + ("-%ds", "%ds")[w < 0] % (abs(w), ) for w in widths]

            if self.header:
                # output the headers
                c = self.colour
                cols = [
                    c.header + (self._actualwidths[i] % (self._fmt_text_col(line[i]), )) + c.header_
                    for i in range(len(line))
                ]
                # sqlite shell uses two spaces between columns
                self.write(self.stdout, "  ".join(cols) + "\n")
                if c is self._colours["off"]:
                    self.output_column(False, ["-" * abs(widths[i]) for i in range(len(widths))])
            return
        cols = [
            self.colour.colour_value(line[i], self._actualwidths[i] % (self._fmt_text_col(line[i]), ))
            for i in range(len(line))
        ]
        # sqlite shell uses two spaces between columns
        self.write(self.stdout, "  ".join(cols) + "\n")
def output_column ( self , header , line ) : # as an optimization we calculate self._actualwidths which is # reset for each query if header : def gw ( n ) : if n < len ( self . widths ) and self . widths [ n ] != 0 : return self . widths [ n ] # if width is not present or 0 then autosize text = self . _fmt_text_col ( line [ n ] ) return max ( len ( text ) , 10 ) widths = [ gw ( i ) for i in range ( len ( line ) ) ] if self . truncate : self . _actualwidths = [ "%" + ( "-%d.%ds" , "%d.%ds" ) [ w < 0 ] % ( abs ( w ) , abs ( w ) ) for w in widths ] else : self . _actualwidths = [ "%" + ( "-%ds" , "%ds" ) [ w < 0 ] % ( abs ( w ) , ) for w in widths ] if self . header : # output the headers c = self . colour cols = [ c . header + ( self . _actualwidths [ i ] % ( self . _fmt_text_col ( line [ i ] ) , ) ) + c . header_ for i in range ( len ( line ) ) ] # sqlite shell uses two spaces between columns self . write ( self . stdout , "  " . join ( cols ) + "\n" ) if c is self . _colours [ "off" ] : self . output_column ( False , [ "-" * abs ( widths [ i ] ) for i in range ( len ( widths ) ) ] ) return cols = [ self . colour . colour_value ( line [ i ] , self . _actualwidths [ i ] % ( self . _fmt_text_col ( line [ i ] ) , ) ) for i in range ( len ( line ) ) ] # sqlite shell uses two spaces between columns self . write ( self . stdout , "  " . join ( cols ) + "\n" )