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')
git-nautilus-icons.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录