python_hosts.utils module

This module contains utility functions used by the Hosts and HostsEntry methods

python_hosts.utils.dedupe_list(seq)[source]

Utility function to remove duplicates from a list :param seq: The sequence (list) to deduplicate :return: A list with original duplicates removed

python_hosts.utils.is_ipv4(entry)[source]

Check if the string provided is a valid ipv4 address :param entry: A string representation of an IP address :return: True if valid, False if invalid

python_hosts.utils.is_ipv6(entry)[source]

Check if the string provided is a valid ipv6 address :param entry: A string representation of an IP address :return: True if valid, False if invalid

python_hosts.utils.is_readable(path=None)[source]

Test if the supplied filesystem path can be read :param path: A filesystem path :return: True if the path is a file that can be read. Otherwise, False

python_hosts.utils.valid_hostnames(hostname_list)[source]

Check if the supplied list of strings are valid hostnames :param hostname_list: A list of strings :return: True if the strings are valid hostnames, False if not