(self, * args, **kwargs)
return "\n".join(svals)
Return the string form of self.

           Unless the argument line_break is set to False, it will
           break the expression in a form that can be printed
           on the terminal without being broken up.
Return the string form of self.
Return the string form of self .
def render(self, * args, **kwargs):
        """Return the string form of self.

           Unless the argument line_break is set to False, it will
           break the expression in a form that can be printed
           on the terminal without being broken up.
         """
        if kwargs["wrap_line"] is False:
            return "\n".join(self.picture)

        if kwargs["num_columns"] is not None:
            # Read the argument num_columns if it is not None
            ncols = kwargs["num_columns"]
        else:
            # Attempt to get a terminal width
            ncols = self.terminal_width()

        ncols -= 2
        if ncols <= 0:
            ncols = 78

        # If smaller than the terminal width, no need to correct
        if self.width() <= ncols:
            return type(self.picture[0])(self)

        # for one-line pictures we don't need v-spacers. on the other hand, for
        # multiline-pictures, we need v-spacers between blocks, compare:
        #
        #    2  2        3    | a*c*e + a*c*f + a*d  | a*c*e + a*c*f + a*d  | 3.14159265358979323
        # 6*x *y  + 4*x*y  +  |                      | *e + a*d*f + b*c*e   | 84626433832795
        #                     | *e + a*d*f + b*c*e   | + b*c*f + b*d*e + b  |
        #      3    4    4    |                      | *d*f                 |
        # 4*y*x  + x  + y     | + b*c*f + b*d*e + b  |                      |
        #                     |                      |                      |
        #                     | *d*f

        i = 0
        svals = []
        do_vspacers = (self.height() > 1)
        while i < self.width():
            svals.extend([ sval[i:i + ncols] for sval in self.picture ])
            if do_vspacers:
                svals.append("")  # a vertical spacer
            i += ncols

        if svals[-1] == '':
            del svals[-1]  # Get rid of the last spacer

        return "\n".join(svals)
def render ( self , * args , * * kwargs ) : if kwargs [ "wrap_line" ] is False : return "\n" . join ( self . picture ) if kwargs [ "num_columns" ] is not None : # Read the argument num_columns if it is not None ncols = kwargs [ "num_columns" ] else : # Attempt to get a terminal width ncols = self . terminal_width ( ) ncols -= 2 if ncols <= 0 : ncols = 78 # If smaller than the terminal width, no need to correct if self . width ( ) <= ncols : return type ( self . picture [ 0 ] ) ( self ) # for one-line pictures we don't need v-spacers. on the other hand, for # multiline-pictures, we need v-spacers between blocks, compare: # #    2  2        3    | a*c*e + a*c*f + a*d  | a*c*e + a*c*f + a*d  | 3.14159265358979323 # 6*x *y  + 4*x*y  +  |                      | *e + a*d*f + b*c*e   | 84626433832795 #                     | *e + a*d*f + b*c*e   | + b*c*f + b*d*e + b  | #      3    4    4    |                      | *d*f                 | # 4*y*x  + x  + y     | + b*c*f + b*d*e + b  |                      | #                     |                      |                      | #                     | *d*f i = 0 svals = [ ] do_vspacers = ( self . height ( ) > 1 ) while i < self . width ( ) : svals . extend ( [ sval [ i : i + ncols ] for sval in self . picture ] ) if do_vspacers : svals . append ( "" ) # a vertical spacer i += ncols if svals [ - 1 ] == '' : del svals [ - 1 ] # Get rid of the last spacer return "\n" . join ( svals )