mds_plugin/core.py
def fixed_len(s, length, append=None, no_linebreaks=False, align_right=False):
    """Returns the given string with a new length of len

    If the given string is too long, it is truncated and ellipsis are added.
    If it is too short, spaces are added. Linebreaks are removed.

    Args:
        s (str): The string to 
        length (int): The new length of the string
        append (str): The string to append
        no_linebreaks (bool): Whether line breaks should be filtered out

    Returns:
       The string with a fixed length plus the append string
    """

    if not s:
        return " " * length + append if append else ''

    if no_linebreaks:
        s = s.replace('\n', ' ').replace('\r', '')

    s = f"{s[:length-2]}.." if len(s) > length else \
        s.rjust(length, ' ') if align_right else s.ljust(length, ' ')

    return s + append if append else ''
Returns the given string with a new length of len

    If the given string is too long, it is truncated and ellipsis are added.
    If it is too short, spaces are added. Linebreaks are removed.

    Args:
        s (str): The string to 
        length (int): The new length of the string
        append (str): The string to append
        no_linebreaks (bool): Whether line breaks should be filtered out

    Returns:
       The string with a fixed length plus the append string
    
Returns the given string with a new length of len
If the given string is too long, it is truncated and ellipsis are added.
If it is too short, spaces are added. Linebreaks are removed.
Returns the given string with a new length of len If the given string is too long it is truncated and ellipsis are added . If it is too short spaces are added . Linebreaks are removed .
def fixed_len(s, length, append=None, no_linebreaks=False, align_right=False):
    if not s:
        return " " * length + append if append else ''
    if no_linebreaks:
        s = s.replace('\n', ' ').replace('\r', '')
    s = f"{s[:length-2]}.." if len(s) > length else \
        s.rjust(length, ' ') if align_right else s.ljust(length, ' ')
    return s + append if append else ''
def fixed_len ( s , length , append = None , no_linebreaks = False , align_right = False ) : if not s : return " " * length + append if append else '' if no_linebreaks : s = s . replace ( '\n' , ' ' ) . replace ( '\r' , '' ) s = f"{s[:length-2]}.." if len ( s ) > length else s . rjust ( length , ' ' ) if align_right else s . ljust ( length , ' ' ) return s + append if append else ''
Returns the given string with a new length of len
If the given string is too long, it is truncated and ellipsis are added.
Returns the given string with a new length of len If the given string is too long it is truncated and ellipsis are added .
"""Returns the given string with a new length of len

    If the given string is too long, it is truncated and ellipsis are added.
    If it is too short, spaces are added. Linebreaks are removed.

    Args:
        s (str): The string to 
        length (int): The new length of the string
        append (str): The string to append
        no_linebreaks (bool): Whether line breaks should be filtered out

    Returns:
       The string with a fixed length plus the append string
    """
The string with a fixed length plus the append string
The string with a fixed length plus the append string
s
The string to
The string to
length
The new length of the string
The new length of the string
append
The string to append
The string to append
no_linebreaks
Whether line breaks should be filtered out
Whether line breaks should be filtered out
align_right