def isdir(self, fn): # type: (unicode) -> bool collection, rest = self.get_collection(fn) if collection: if rest: return isinstance(collection.find(rest), arvados.collection.RichCollectionBase) else: return True else: return super(CollectionFsAccess, self).isdir(fn)
def isdir(self, fn): # type: (unicode) -> bool collection, rest = self.get_collection(fn) if collection is not None: if rest: return isinstance(collection.find(rest), arvados.collection.RichCollectionBase) else: return True else: return super(CollectionFsAccess, self).isdir(fn)
def isfile(self, fn): # type: (unicode) -> bool collection, rest = self.get_collection(fn) if collection: if rest: return isinstance(collection.find(rest), arvados.arvfile.ArvadosFile) else: return False else: return super(CollectionFsAccess, self).isfile(fn)
def isfile(self, fn): # type: (unicode) -> bool collection, rest = self.get_collection(fn) if collection is not None: if rest: return isinstance(collection.find(rest), arvados.arvfile.ArvadosFile) else: return False else: return super(CollectionFsAccess, self).isfile(fn)
def size(self, fn): # type: (unicode) -> bool collection, rest = self.get_collection(fn) if collection is not None: if rest: arvfile = collection.find(rest) if isinstance(arvfile, arvados.arvfile.ArvadosFile): return arvfile.size() raise IOError(errno.EINVAL, "Not a path to a file %s" % (fn)) else: return super(CollectionFsAccess, self).size(fn)
def listdir(self, fn): # type: (unicode) -> List[unicode] collection, rest = self.get_collection(fn) if rest: dir = collection.find(rest) else: dir = collection if collection: return [abspath(l, fn) for l in dir.keys()] else: return super(CollectionFsAccess, self).listdir(fn)
def size(self, fn): # type: (unicode) -> bool collection, rest = self.get_collection(fn) if collection is not None: if rest: arvfile = collection.find(rest) if isinstance(arvfile, arvados.arvfile.ArvadosFile): return arvfile.size() raise IOError(errno.EINVAL, "Not a path to a file %s" % (fn)) else: return super(CollectionFsAccess, self).size(fn)
def listdir(self, fn): # type: (unicode) -> List[unicode] collection, rest = self.get_collection(fn) if collection: if rest: dir = collection.find(rest) else: dir = collection return [abspath(l, fn) for l in dir.keys()] else: return super(CollectionFsAccess, self).listdir(fn)
def listdir(self, fn): # type: (unicode) -> List[unicode] collection, rest = self.get_collection(fn) if collection: if rest: dir = collection.find(rest) else: dir = collection if dir is None: raise IOError(errno.ENOENT, "Directory '%s' in '%s' not found" % (rest, collection.portable_data_hash())) if not isinstance(dir, arvados.collection.RichCollectionBase): raise IOError(errno.ENOENT, "Path '%s' in '%s' is not a Directory" % (rest, collection.portable_data_hash())) return [abspath(l, fn) for l in dir.keys()] else: return super(CollectionFsAccess, self).listdir(fn)
def listdir(self, fn): # type: (unicode) -> List[unicode] collection, rest = self.get_collection(fn) if collection is not None: if rest: dir = collection.find(rest) else: dir = collection if dir is None: raise IOError(errno.ENOENT, "Directory '%s' in '%s' not found" % (rest, collection.portable_data_hash())) if not isinstance(dir, arvados.collection.RichCollectionBase): raise IOError(errno.ENOENT, "Path '%s' in '%s' is not a Directory" % (rest, collection.portable_data_hash())) return [abspath(l, fn) for l in list(dir.keys())] else: return super(CollectionFsAccess, self).listdir(fn)