_tasks.py 文件源码

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

项目:myriagon 作者: hawkowl 项目源码 文件源码
def load_tasks():

    dest = FilePath(appdirs.user_data_dir("myriagon", "hawkowl"))
    task_file = dest.child("tasks.json")

    if not task_file.exists():
        dest.makedirs(True)
        task_file.setContent(b"[]")

    loaded = cattr.loads(
        json.loads(task_file.getContent().decode('utf8')),
        List[Task])

    def sort(x):
        time = load_time_spent(x)
        return get_time_needed_for_session(x) - get_time_for_session(x, time)

    loaded.sort(key=sort, reverse=True)
    return loaded
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号