<commit_before>import netaddr


def filters():
    return {
        "netmask_to_cidr": netmask_to_cidr,
        "cidr_to_netmask": cidr_to_netmask,
    }


def netmask_to_cidr(value):
    """ Converts a network mask to it's CIDR value. """
    return netaddr.IPAddress(value).netmask_bits()


def cidr_to_netmask(value):
    """ Converts a CIDR prefix-length to a network mask. """
    return netaddr.IPNetwork("1.1.1.1/{}".format(value)).netmask<commit_msg>Add examples<commit_after>import netaddr


def filters():
    return {
        "netmask_to_cidr": netmask_to_cidr,
        "cidr_to_netmask": cidr_to_netmask,
    }


def netmask_to_cidr(value):
    """
    Converts a network mask to it's CIDR value.

    Examples:
        >>> "{{ '255.255.255.0'|netmask_to_cidr }}" -> "24"
    """
    return netaddr.IPAddress(value).netmask_bits()


def cidr_to_netmask(value):
    """
    Converts a CIDR prefix-length to a network mask.

    Examples:
        >>> "{{ '24'|cidr_to_netmask }}" -> "255.255.255.0"
    """
    return netaddr.IPNetwork("1.1.1.1/{}".format(value)).netmask
{'fraction_non_alphanumeric': 0.1461609620721554, 'fraction_numerical': 0.02960222016651249, 'mean_word_length': 3.193798449612403, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3091732', 'n_tokens_mistral': 428, 'n_tokens_neox': 413, 'n_words': 72}