def checksum(self): """ Return an MD5 checksum of this file. If SELF is a directory, raise InappropriateError If SELF is nonexistant, raise DoesNotExistError Return: str """ if not self: raise exceptions.DoesNotExistError() if self.is_dir: raise exceptions.InappropriateError() checksum = hashlib.md5(self.open('rb').read()).hexdigest() return checksum
def mimetype(self): """ Return a guessed mimetype for SELF. If SELF is a directory, raise InappropriateError If SELF is nonexistant, raise DoesNotExistError Return: str Exceptions: InappropriateError, DoesNotExistError """ if not self: raise exceptions.DoesNotExistError() if self.is_dir: raise exceptions.InappropriateError() mime, _ = mimetypes.guess_type(str(self)) return mime
def tempdir(self): raise exceptions.InappropriateError("Can't tempdir() on a Read-only filesystem")
def touch(self, resource): raise exceptions.InappropriateError("Can't touch() on a Read-only filesystem")
def mv(self, resource, target): raise exceptions.InappropriateError("Can't mv() on a Read-only filesystem")
def cd(self, target): raise exceptions.InappropriateError( "Can't cd() on an Archive filesystem")
def getwd(self): raise exceptions.InappropriateError( "Can't getwd() on an Archive filesystem")
def abspath(self, resource): raise exceptions.InappropriateError( "Can't is_abspath() on an Archive filesystem")
def expanduser(self, resource): raise exceptions.InappropriateError( "Can't expanduser() on an Archive filesystem")
def tempdir(self): raise exceptions.InappropriateError( "Can't ln() on an Archive filesystem")
def ln(self, resource, target, symbolic=False): raise exceptions.InappropriateError( "Can't ln() on an Archive filesystem")