git-nautilus-icons.py 文件源码

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

项目:git_nautilus_icons 作者: chrisjbillington 项目源码 文件源码
def get_statuses_by_dir(path, file_statuses):
    """Sort the file statuses into which directory at the current level they
    are under. Only keep unique statuses, and return a dictionary of sets for
    each directory rooted at the given path."""
    statuses_by_dir = defaultdict(set)
    prefix = path + '/'
    len_prefix = len(prefix)
    for name, status in file_statuses.items():
        if not name.startswith(prefix):
            continue
        dirname = name[:name.find('/', len_prefix)]
        statuses_by_dir[dirname].add(status)
    return statuses_by_dir


# import bprofile
# @bprofile.BProfile('test.png')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号