commands.py 文件源码

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

项目:egt 作者: spanezz 项目源码 文件源码
def main(self):
        # TODO: move to Project and unit test it
        cutoff = datetime.datetime.strptime(self.args.month, "%Y-%m").date()
        cutoff = cutoff.replace(day=calendar.monthrange(cutoff.year, cutoff.month)[1])
        e = self.make_egt(self.args.projects)
        archive_results = {}
        for p in e.projects:
            # TODO: copy timebase and entry, ignore commands
            # TODO: generate initial timebase in archived log
            entries = list(l for l in p.log.entries if l.begin.date() <= cutoff)
            if not entries: continue
            archive_results[p.name] = self.write_archive(p, entries, cutoff)
            duration = sum(e.duration for e in entries)
            # TODO: use Meta.print
            if "name" not in p.meta._raw:
                print("Name:", p.name)
            p.meta.print()
            print("{}: {}".format("Total", format_duration(duration)))
            print()
            # TODO: use Log.print or entry.print
            for l in entries:
                l.print()
            print()
        for name, res in sorted(archive_results.items()):
            print("Archived {}: {}".format(name, res))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号