def isfile(self, path): """ Return True if path is a file Implements the :func:`os.path.isfile` interface. """ return util.is_file(self._direntry(path))
def listdir(self, path): """ Return the directory contents of 'path' Implements the :func:`os.listdir` interface. :param path: filesystem path """ direntry = self._direntry(path) if direntry is None: raise _OSError(errno.ENOENT, path) if util.is_file(direntry): raise _OSError(errno.ENOTDIR, path) if util.is_dir(direntry): return list(sorted(direntry.keys())) raise _OSError(errno.EINVAL, path)
def remove(self, path): """Remove the entry for a file path Implements the :func:`os.remove` interface. """ path = self.abspath(path) dirname = os.path.dirname(path) basename = os.path.basename(path) entry = self._direntry(dirname) if not util.is_dir(entry): raise _OSError(errno.EPERM, path) try: fsentry = entry[basename] except KeyError: raise _OSError(errno.ENOENT, path) if not util.is_file(fsentry): raise _OSError(errno.EPERM, path) del entry[basename]