from __future__ import absolute_import, print_function, unicode_literals

# Allowed characters in tag names
TAG_CHARS = {
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
    'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
    'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', '-', '_', '.'
}
# Allowed characters in directory paths
PATH_CHARS = {
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
    'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D',
    'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
    'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', '-', '_', '.', '/', '~', ' '
}


def get_invalid_tag_chars(tag):
    """Return any invalid characters in the directory tag.

    :param tag: the directory tag
    :returns: set of all invalid characters
    """
    return set(char for char in tag if char not in TAG_CHARS)


def get_invalid_path_chars(path):
    """Return any invalid characters in the directory path.

    :param path: the directory path
    :returns: set of all invalid characters
    """
    return set(char for char in path if char not in PATH_CHARS)
