Entities.py 文件源码

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

项目:sdk 作者: vt-dev 项目源码 文件源码
def map_from_json(json_slots):
        slots = []
        for json_slot in json_slots:
            from_long = json_slot['start'] / 1e3
            if from_long < TimeSlot.time_to_long(datetime.min):
                from_long = TimeSlot.time_to_long(datetime.min)

            duration_long = json_slot['duration'] / 1e3
            to_long = from_long + duration_long
            if to_long > TimeSlot.time_to_long(datetime.max):
                to_long = TimeSlot.time_to_long(datetime.max)

            fr = datetime.fromtimestamp(from_long)
            to = datetime.fromtimestamp(to_long)
            slots.append(TimeSlot(fr, to))
        return slots
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号