def _check_for_definition(iface, cls, tag, defines):
    """Check for a valid definition of a value.

    Args:
        iface (Iface): An Iface specification.
        cls (type): Some type to check for a definition.
        tag (str): The name of the tag attribute used to mark the abstract
            methods.
        defines (callable): A callable that accepts an attribute and returns
            True if the attribute is a valid definition.

    Returns:
        bool: Whether or not the definition is found.
    """
    attributes = (
        attr
        for attr in iface.__abstractmethods__
        if hasattr(getattr(iface, attr), tag)
    )
    for attribute in attributes:

        for node in cls.__mro__:

            if hasattr(node, attribute) and defines(getattr(node, attribute)):

                return True

    try:

        attribute
        return False

    except NameError:

        # Pass the test if the loop was never executed. This indicates there
        # were no iface elements defined in the search.
        return True
def _check_for_definition ( iface , cls , tag , defines ) : attributes = ( attr for attr in iface . __abstractmethods__ if hasattr ( getattr ( iface , attr ) , tag ) ) for attribute in attributes : for node in cls . __mro__ : if hasattr ( node , attribute ) and defines ( getattr ( node , attribute ) ) : return True try : attribute return False except NameError : return True
Check for a valid definition of a value.

    Args:
        iface (Iface): An Iface specification.
        cls (type): Some type to check for a definition.
        tag (str): The name of the tag attribute used to mark the abstract
            methods.
        defines (callable): A callable that accepts an attribute and returns
            True if the attribute is a valid definition.

    Returns:
        bool: Whether or not the definition is found.