__init__.py 文件源码

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

项目:jsonschema2db 作者: better 项目源码 文件源码
def _is_valid_type(self, t, value):
        try:
            if t == 'number':
                float(value)
            elif t == 'integer':
                int(value)
            elif t == 'boolean':
                assert type(value) == bool
            elif t == 'timestamp':
                iso8601.parse_date(value)
            elif t == 'date':
                iso8601.parse_date(value + 'T00:00:00Z')
            elif t == 'string':
                # Allow coercing ints/floats, but nothing else
                assert type(value) in [str, int, float]
        except:
            return False
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号