storage.py 文件源码

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

项目:SuperOcto 作者: mcecchi 项目源码 文件源码
def remove_folder(self, path, recursive=True):
        path, name = self.sanitize(path)

        folder_path = os.path.join(path, name)
        if not os.path.exists(folder_path):
            return

        empty = True
        for entry in scandir(folder_path):
            if entry.name == ".metadata.yaml":
                continue
            empty = False
            break

        if not empty and not recursive:
            raise StorageError("{name} in {path} is not empty".format(**locals()), code=StorageError.NOT_EMPTY)

        import shutil
        shutil.rmtree(folder_path)

        self._delete_metadata(folder_path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号