(required_state, local_state, req_type=None)
return True
Checks a list of requirements against a dictionary representing local state.

    Args:
        required_state ([str]): List of strings representing required state
                                using comparison operators
        local_state (dict): Dictionary representing current state
        req_type (type): Casts values to req_type before comparing them.
                         Defaults to local_state type.
Checks a list of requirements against a dictionary representing local state.
Checks a list of requirements against a dictionary representing local state .
def requirementsSatisfied(required_state, local_state, req_type=None):
    """
    Checks a list of requirements against a dictionary representing local state.

    Args:
        required_state ([str]): List of strings representing required state
                                using comparison operators
        local_state (dict): Dictionary representing current state
        req_type (type): Casts values to req_type before comparing them.
                         Defaults to local_state type.
    """
    for req_string in required_state:
        # parse requirement
        req = None
        for op_str in op_map:
            split = req_string.split(op_str)
            # if operation is not in req_string, continue
            if len(split) == 2:
                req = _Requirement(split[0], op_map[op_str], split[1])
                break

        if req is None:
            log.error("Invalid requirement specification: %s", req_string)
            return False

        compare_type = req_type or type(local_state[req.name])
        # check if local state satisfies required state (specification)
        if compare_type is bool:
            # boolean is a special case, where simply casting to bool does not produce target result
            required_value = bool_map[req.value]
        else:
            required_value = compare_type(req.value)
        local_value = compare_type(local_state[req.name])

        # finally, compare the values
        if not req.op(local_value, required_value):
            return False
    return True
def requirementsSatisfied ( required_state , local_state , req_type = None ) : for req_string in required_state : # parse requirement req = None for op_str in op_map : split = req_string . split ( op_str ) # if operation is not in req_string, continue if len ( split ) == 2 : req = _Requirement ( split [ 0 ] , op_map [ op_str ] , split [ 1 ] ) break if req is None : log . error ( "Invalid requirement specification: %s" , req_string ) return False compare_type = req_type or type ( local_state [ req . name ] ) # check if local state satisfies required state (specification) if compare_type is bool : # boolean is a special case, where simply casting to bool does not produce target result required_value = bool_map [ req . value ] else : required_value = compare_type ( req . value ) local_value = compare_type ( local_state [ req . name ] ) # finally, compare the values if not req . op ( local_value , required_value ) : return False return True