

def _find_batch_source_urls(owner, repository, github_auth):
    " Starting with a Github repo API URL, return a list of sources.\n    \n        Sources are dictionaries, with keys commit_sha, url to content on Github,\n        blob_sha for git blob, and path like 'sources/xx/yy.json'.\n    "
    resp = get('https://api.github.com/', auth=github_auth)
    if (resp.status_code >= 400):
        raise Exception('Got status {} from Github API'.format(resp.status_code))
    start_url = expand_uri(resp.json()['repository_url'], dict(owner=owner, repo=repository))
    _L.info('Starting batch sources at {start_url}'.format(**locals()))
    got = get(start_url, auth=github_auth).json()
    (contents_url, commits_url) = (got['contents_url'], path_base['commits_url'])
    master_url = expand_uri(commits_url, dict(sha=got['default_branch']))
    _L.debug('Getting {ref} branch {master_url}'.format(ref=got['default_branch'], **locals()))
    got = get(master_url, auth=github_auth).json()
    (commit_sha, commit_date) = (got['sha'], got['commit']['committer']['date'])
    contents_url += '{?ref}'
    sources_urls = [expand_uri(contents_url, dict(path='sources', ref=commit_sha))]
    sources_list = list()
    for sources_url in sources_urls:
        _L.debug('Getting sources {sources_url}'.format(**locals()))
        sources = get(sources_url, auth=github_auth).json()
        for source in sources:
            if (source['type'] == 'dir'):
                params = dict(path=source['path'], ref=commit_sha)
                sources_urls.append(expand_uri(contents_url, params))
                continue
            if (source['type'] != 'file'):
                continue
            (path_base, ext) = splitext(source['path'])
            if (ext == '.json'):
                sources_list.append(dict(commit_sha=commit_sha, url=source['url'], blob_sha=source['sha'], path=source['path']))
    return sources_list

dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py _find_batch_source_urls/VarMisuse@119/278 `got`->`path_base`