_google_appengine_ext_db.py 文件源码

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

项目:Tinychat-Bot--Discontinued 作者: Tinychat 项目源码 文件源码
def decode_list_property(obj, prop, value):
    if value is None:
        return []

    # there is an issue with large ints and ListProperty(int) AMF leaves
    # ints > amf3.MAX_29B_INT as floats db.ListProperty complains pretty
    # hard in this case so we try to work around the issue.
    if prop.item_type in (int, long):
        for i, x in enumerate(value):
            if isinstance(x, float):
                y = int(x)

                # only convert the type if there is no mantissa
                # otherwise let the chips fall where they may
                if x == y:
                    value[i] = y

    return value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号