(item_completion, item_type=None,
                                     height=14,
                                     width=250)
return ''.join(parts)
Get HTML representation of and item.
Get HTML representation of and item.
Get HTML representation of and item .
def get_html_item_representation(item_completion, item_type=None,
                                     height=14,
                                     width=250):
        """Get HTML representation of and item."""
        height = str(height)
        width = str(width)

        # Unfortunately, both old- and new-style Python string formatting
        # have poor performance due to being implemented as functions that
        # parse the format string.
        # f-strings in new versions of Python are fast due to Python
        # compiling them into efficient string operations, but to be
        # compatible with old versions of Python, we manually join strings.
        parts = [
            '<table width="', width, '" height="', height, '">', '<tr>',

            '<td valign="middle" style="color: black;" style="margin-left:22px;">',
            html.escape(item_completion).replace(' ', '&nbsp;'),
            '</td>',
        ]
        if item_type is not None:
            parts.extend(['<td valign="middle" align="right" float="right" '
                          'style="color: black;">',
                          item_type,
                          '</td>'
                          ])
        parts.extend([
            '</tr>', '</table>',
        ])

        return ''.join(parts)
def get_html_item_representation ( item_completion , item_type = None , height = 14 , width = 250 ) : height = str ( height ) width = str ( width ) # Unfortunately, both old- and new-style Python string formatting # have poor performance due to being implemented as functions that # parse the format string. # f-strings in new versions of Python are fast due to Python # compiling them into efficient string operations, but to be # compatible with old versions of Python, we manually join strings. parts = [ '<table width="' , width , '" height="' , height , '">' , '<tr>' , '<td valign="middle" style="color: black;" style="margin-left:22px;">' , html . escape ( item_completion ) . replace ( ' ' , '&nbsp;' ) , '</td>' , ] if item_type is not None : parts . extend ( [ '<td valign="middle" align="right" float="right" ' 'style="color: black;">' , item_type , '</td>' ] ) parts . extend ( [ '</tr>' , '</table>' , ] ) return '' . join ( parts )