async def _metadata_folder( self, path: GitLabPath) -> typing.List[BaseGitLabMetadata]: """Fetch metadata for the contents of the folder at ``path`` and return a `list` of `GitLabFileMetadata` and `GitLabFolderMetadata` objects. :param GitLabPath path: `GitLabPath` representing a folder :rtype: `list` """ data = await self._fetch_tree_contents(path) ret = [] # type: typing.List[BaseGitLabMetadata] for item in data: name = item['name'] if item['type'] == 'tree': folder_path = path.child(name, folder=True) ret.append(GitLabFolderMetadata(item, folder_path)) else: file_path = path.child(name, folder=False) item['mime_type'] = mimetypes.guess_type(name)[0] ret.append( GitLabFileMetadata(item, file_path, host=self.VIEW_URL, owner=self.owner, repo=self.repo)) return ret
async def _metadata_folder(self, path: GitLabPath) -> typing.List[BaseGitLabMetadata]: """Fetch metadata for the contents of the folder at ``path`` and return a `list` of `GitLabFileMetadata` and `GitLabFolderMetadata` objects. :param GitLabPath path: `GitLabPath` representing a folder :rtype: `list` """ data = await self._fetch_tree_contents(path) ret = [] # type: typing.List[BaseGitLabMetadata] for item in data: name = item['name'] if item['type'] == 'tree': folder_path = path.child(name, folder=True) ret.append(GitLabFolderMetadata(item, folder_path)) else: file_path = path.child(name, folder=False) item['mime_type'] = mimetypes.guess_type(name)[0] ret.append(GitLabFileMetadata(item, file_path, host=self.VIEW_URL, owner=self.owner, repo=self.repo)) return ret
def path_from_metadata( self, # type: ignore parent_path: GitLabPath, metadata) -> GitLabPath: """Build a GitLabPath for a the child of ``parent_path`` described by ``metadata``.""" return parent_path.child(metadata.name, folder=metadata.is_folder)
def path_from_metadata(self, # type: ignore parent_path: GitLabPath, metadata) -> GitLabPath: """Build a GitLabPath for a the child of ``parent_path`` described by ``metadata``.""" return parent_path.child(metadata.name, folder=metadata.is_folder)