schema.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:storjnet 作者: StorjRND 项目源码 文件源码
def _validate_indexes(schema, indexes):
    if not isinstance(indexes, list):
        raise jsonschema.exceptions.ValidationError("Indexes must be a list.")
    maximum = len(schema["indexes"])
    for index in indexes:
        try:
            number = Decimal(index)
        except InvalidOperation:
            raise jsonschema.exceptions.ValidationError(
                "Index value {0} not a number.".format(index)
            )
        if not (0 <= number < maximum):
            raise jsonschema.exceptions.ValidationError(
                "Index value {0} not in limits: {1} <= {0} < {2}.".format(
                    number, 0, maximum
                )
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号