当前位置: 首页>>代码示例>>Python>>正文


Python compat.iteritems方法代码示例

本文整理汇总了Python中jsonschema.compat.iteritems方法的典型用法代码示例。如果您正苦于以下问题:Python compat.iteritems方法的具体用法?Python compat.iteritems怎么用?Python compat.iteritems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jsonschema.compat的用法示例。


在下文中一共展示了compat.iteritems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: dependencies

# 需要导入模块: from jsonschema import compat [as 别名]
# 或者: from jsonschema.compat import iteritems [as 别名]
def dependencies(validator, dependencies, instance, schema):
    if not validator.is_type(instance, "object"):
        return

    for property, dependency in iteritems(dependencies):
        if property not in instance:
            continue

        if validator.is_type(dependency, "object"):
            for error in validator.descend(
                instance, dependency, schema_path=property,
            ):
                yield error
        else:
            dependencies = _utils.ensure_list(dependency)
            for dependency in dependencies:
                if dependency not in instance:
                    yield ValidationError(
                        "%r is a dependency of %r" % (dependency, property)
                    ) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:22,代码来源:_validators.py

示例2: properties_draft3

# 需要导入模块: from jsonschema import compat [as 别名]
# 或者: from jsonschema.compat import iteritems [as 别名]
def properties_draft3(validator, properties, instance, schema):
    if not validator.is_type(instance, "object"):
        return

    for property, subschema in iteritems(properties):
        if property in instance:
            for error in validator.descend(
                instance[property],
                subschema,
                path=property,
                schema_path=property,
            ):
                yield error
        elif subschema.get("required", False):
            error = ValidationError("%r is a required property" % property)
            error._set(
                validator="required",
                validator_value=subschema["required"],
                instance=instance,
                schema=schema,
            )
            error.path.appendleft(property)
            error.schema_path.extend([property, "required"])
            yield error 
开发者ID:remg427,项目名称:misp42splunk,代码行数:26,代码来源:_validators.py

示例3: _set

# 需要导入模块: from jsonschema import compat [as 别名]
# 或者: from jsonschema.compat import iteritems [as 别名]
def _set(self, **kwargs):
        for k, v in iteritems(kwargs):
            if getattr(self, k) is _unset:
                setattr(self, k, v) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:6,代码来源:exceptions.py

示例4: total_errors

# 需要导入模块: from jsonschema import compat [as 别名]
# 或者: from jsonschema.compat import iteritems [as 别名]
def total_errors(self):
        """
        The total number of errors in the entire tree, including children.

        """

        child_errors = sum(len(tree) for _, tree in iteritems(self._contents))
        return len(self.errors) + child_errors 
开发者ID:remg427,项目名称:misp42splunk,代码行数:10,代码来源:exceptions.py

示例5: patternProperties

# 需要导入模块: from jsonschema import compat [as 别名]
# 或者: from jsonschema.compat import iteritems [as 别名]
def patternProperties(validator, patternProperties, instance, schema):
    if not validator.is_type(instance, "object"):
        return

    for pattern, subschema in iteritems(patternProperties):
        for k, v in iteritems(instance):
            if re.search(pattern, k):
                for error in validator.descend(
                    v, subschema, path=k, schema_path=pattern,
                ):
                    yield error 
开发者ID:remg427,项目名称:misp42splunk,代码行数:13,代码来源:_validators.py


注:本文中的jsonschema.compat.iteritems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。