twstats.py 文件源码

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

项目:twtools 作者: fradeve 项目源码 文件源码
def _generate_intervals(self):
        """ Export TimeWarrior data as JSON and calculate bins. """
        assert len(self.time_span.split(' ')) >= 1

        if len(self.time_span.split(' ')) == 1:
            command = [':{d}'.format(d=self.time_span)]
        elif len(self.time_span.split(' ')) > 1:
            command = self.time_span.split(' ')

        process = subprocess.Popen(
            ['timew', 'export'] + command + [self.tag],
            stdout=subprocess.PIPE
        )
        out, err = process.communicate()
        intervals = json.loads(out.decode('utf8').replace('\n', ''))

        if intervals and (not intervals[-1].get('end')):
            del intervals[-1]

        return intervals
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号