watch.py 文件源码

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

项目:ivy 作者: dmulholland 项目源码 文件源码
def hashsite(sitepath):
    hash = hashlib.sha256()

    def hashdir(dirpath, is_home):
        for entry in os.scandir(dirpath):
            if entry.is_file():
                if entry.name.endswith('~'):
                    continue
                mtime = os.path.getmtime(entry.path)
                hash.update(str(mtime).encode())
                hash.update(entry.name.encode())
            if entry.is_dir():
                if is_home and entry.name == 'out':
                    continue
                hashdir(entry.path, False)

    hashdir(sitepath, True)
    return hash.digest()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号