How to use the yamale.util.is_list function in yamale

To help you get started, we’ve selected a few yamale examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 23andMe / Yamale / yamale / schema / schema.py View on Github external
def _validate_static_map_list(self, validator, data, path, strict):
        if util.is_map(validator) and not util.is_map(data):
            return ["%s : '%s' is not a map" % (path, data)]

        if util.is_list(validator) and not util.is_list(data):
            return ["%s : '%s' is not a list" % (path, data)]

        errors = []

        if strict:
            data_keys = set(util.get_keys(data))
            validator_keys = set(util.get_keys(validator))
            for key in data_keys - validator_keys:
                error_path = path + DataPath(key)
                errors += ['%s: Unexpected element' % error_path]

        for key, sub_validator in util.get_iter(validator):
            errors += self._validate_item(sub_validator,
                                          data,
                                          path,
                                          strict,