src/lsi/utils/hosts.py
def filter_entries(entries, filters, exclude):
    """
    Filters a list of host entries according to the given filters.

    :param entries: A list of host entries.
    :type entries: [:py:class:`HostEntry`]
    :param filters: Regexes that must match a `HostEntry`.
    :type filters: [``str``]
    :param exclude: Regexes that must NOT match a `HostEntry`.
    :type exclude: [``str``]

    :return: The filtered list of host entries.
    :rtype: [:py:class:`HostEntry`]
    """
    filtered = [entry
                for entry in entries
                if all(entry.matches(f) for f in filters)
                and not any(entry.matches(e) for e in exclude)]
    return filtered
def filter_entries(entries, filters, exclude):
    """
    Filters a list of host entries according to the given filters.

    :param entries: A list of host entries.
    :type entries: [:py:class:`HostEntry`]
    :param filters: Regexes that must match a `HostEntry`.
    :type filters: [``str``]
    :param exclude: Regexes that must NOT match a `HostEntry`.
    :type exclude: [``str``]

    :return: The filtered list of host entries.
    :rtype: [:py:class:`HostEntry`]
    """
    filtered = [entry
                for entry in entries
                if all(entry.matches(f) for f in filters)
                and not any(entry.matches(e) for e in exclude)]
    return filtered
Filters a list of host entries according to the given filters.

    :param entries: A list of host entries.
    :type entries: [:py:class:`HostEntry`]
    :param filters: Regexes that must match a `HostEntry`.
    :type filters: [``str``]
    :param exclude: Regexes that must NOT match a `HostEntry`.
    :type exclude: [``str``]

    :return: The filtered list of host entries.
    :rtype: [:py:class:`HostEntry`]