

def process_pullrequest_payload_files(payload, github_auth):
    ' Return a dictionary of files paths from a pull request event payload.\n    \n        https://developer.github.com/v3/activity/events/types/#pullrequestevent\n    '
    files = dict()
    touched = get_touched_pullrequest_files(payload, github_auth)
    commit_sha = payload['pull_request']['head']['sha']
    for filename in touched:
        if relpath(filename, 'sources').startswith('..'):
            continue
        if (splitext(filename)[1] != '.json'):
            continue
        contents_url = (payload['pull_request']['head']['repo']['contents_url'] + '{?ref}')
        contents_url = expand_uri(contents_url, dict(path=filename, ref=commit_sha))
        current_app.logger.debug('Contents URL {}'.format(contents_url))
        got = get(contents_url, auth=github_auth)
        contents = got.json()
        if (got.status_code not in range(200, 299)):
            current_app.logger.warning('Skipping {} - {}'.format(filename, got.status_code))
            continue
        if (contents['encoding'] != 'base64'):
            raise ValueError('Unrecognized encoding "{encoding}"'.format(**contents))
        current_app.logger.debug('Contents SHA {sha}'.format(**contents))
        files[filename] = (contents['content'], contents['sha'])
    return files

dataset/ETHPy150Open openaddresses/machine/openaddr/ci/__init__.py process_pullrequest_payload_files/original