def deconstruct_github_url(url):
"""
Helper function for deconstructing GitHub repository URL and returning its
owner and name
:param url: GitHub repository URL
:type url: str
:returns: repository owner and name
:rtype: tuple
"""
if not url.startswith(GITHUB_PREFIX):
raise ValueError(
"Passed URL is not a GitHub repository: {}".format(url)
)
owner, repo = remove_prefix(url, GITHUB_PREFIX).split('/')[:2]
return owner, repo
评论列表
文章目录