engine.py 文件源码

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

项目:tm-librarian 作者: FabricAttachedMemory 项目源码 文件源码
def cmd_rmdir(self, cmdict):
        shelf = self._path2shelf(cmdict['path'])
        children = self.db.get_directory_shelves(shelf)
        self.errno = errno.ENOTEMPTY
        assert not children, 'Directory is not empty'
        shelf = self.db.delete_shelf(shelf)

        # handle link counts. put after the delete call, so that if
        # the delete fails, the link counts remain consistent
        parent_shelf = self._path2shelf(self._path2list(
            cmdict['path'])[:-1])  # fingers crossed
        parent_shelf.link_count -= 1
        parent_shelf.matchfields = ('link_count', )
        self.db.modify_shelf(parent_shelf, commit=True)

        return shelf
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号