main.py 文件源码

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

项目:oscars2016 作者: 0x0ece 项目源码 文件源码
def _create_list_zerofill(self, data, start,stop):
        next = self._to_timestamp(start)/10*10+10
        stop = self._to_timestamp(stop)/10*10-180
        now = 0
        prev = 0
        prev_t = next
        for i in data:
            # now = self._to_timestamp(i.timestamp)
            # while now > next:
            #     w = 1.*(now - next)/(now - prev_t)
            #     yield {
            #         "time": datetime.utcfromtimestamp(next).isoformat()+'.000Z',
            #         "count": int(prev * w + i.frequency * (1-w)),
            #         }
            #     next += 10
            yield {
                "time": i.timestamp.isoformat()+'.000Z',
                "count": int(i.frequency),
            }
            prev = i.frequency
            prev_t = now
            next = now+10
        # while next < stop:
        #     yield {
        #         "time": datetime.utcfromtimestamp(next).isoformat()+'.000Z',
        #         "count": 0,
        #         }
        #     next += 10
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号