# Path: planb/common/human.py
# BYTE_UNITS = (
#     ('{:.1f} KB', 1 << 10),
#     ('{:.1f} MB', 1 << 20),
#     ('{:.1f} GB', 1 << 30),
#     ('{:.1f} TB', 1 << 40),
#     ('{:.1f} PB', 1 << 50),
# )
# def bytes(bytes_):
# def seconds(seconds_):


from django.template.library import Library
from planb.common import human
    """
    if value is None:
        return None

    value = str(value)
    lines = [line.rstrip() for line in value.split('\n')]
    lines = ['    ' + line if line else '' for line in lines]
    return '\n'.join(lines)


@register.filter(is_safe=False)
def replaceany(value, token):
    """
    Replace any/all characters with the supplied token.
    """
    if value is None:
        return None

    value = str(value)
    return str(token) * len(value)


@register.filter(is_safe=False)
def formatseconds(value):
    """
    Format seconds as hours/minutes/seconds.
    """
    if value is None:
        return None


# Path: planb/common/human.py
# BYTE_UNITS = (
#     ('{:.1f} KB', 1 << 10),
#     ('{:.1f} MB', 1 << 20),
#     ('{:.1f} GB', 1 << 30),
#     ('{:.1f} TB', 1 << 40),
#     ('{:.1f} PB', 1 << 50),
# )
# def bytes(bytes_):
# def seconds(seconds_):


# Path: planb/common/templatetags/rst.py
from django.template.library import Library
from planb.common import human

    """
    if value is None:
        return None

    value = str(value)
    lines = [line.rstrip() for line in value.split('\n')]
    lines = ['    ' + line if line else '' for line in lines]
    return '\n'.join(lines)


@register.filter(is_safe=False)
def replaceany(value, token):
    """
    Replace any/all characters with the supplied token.
    """
    if value is None:
        return None

    value = str(value)
    return str(token) * len(value)


@register.filter(is_safe=False)
def formatseconds(value):
    """
    Format seconds as hours/minutes/seconds.
    """
    if value is None:
        return None


    return human.seconds(value)