def _validate_condition_keys(self, field, value, error):
        """
        Validates that all of the keys in one of the sets of keys are defined
        as keys of ``value``.
        """
        if 'field' in value:
            operators = self.nonscalar_conditions + self.scalar_conditions
            matches = sum(1 for k in operators if k in value)
            if matches == 0:
                error(field, 'Must contain one of {}'.format(operators))
                return False
            elif matches > 1:
                error(
                    field,
                    'Must contain no more than one of {}'.format(operators)
                )
                return False
            return True
        elif 'and' in value:
            for condition in value['and']:
                self._validate_condition_keys(field, condition, error)
        elif 'or' in value:
            for condition in value['or']:
                self._validate_condition_keys(field, condition, error)
        else:
            error(field, "Must contain field + operator keys, 'and', or 'or'.")
            return False
def _validate_condition_keys ( self , field , value , error ) : if 'field' in value : operators = self . nonscalar_conditions + self . scalar_conditions matches = sum ( 1 for k in operators if k in value ) if matches == 0 : error ( field , 'Must contain one of {}' . format ( operators ) ) return False elif matches > 1 : error ( field , 'Must contain no more than one of {}' . format ( operators ) ) return False return True elif 'and' in value : for condition in value [ 'and' ] : self . _validate_condition_keys ( field , condition , error ) elif 'or' in value : for condition in value [ 'or' ] : self . _validate_condition_keys ( field , condition , error ) else : error ( field , "Must contain field + operator keys, 'and', or 'or'." ) return False
Validates that all of the keys in one of the sets of keys are defined
        as keys of ``value``.