def consolidate_repo_list()

in link-verifier/verify-links.py [0:0]


def consolidate_repo_list(repo_list):
    """Combines each list of repos into a single main list"""

    global use_gh_cache
    global main_repo_list
    for repo, stats in repo_list.items():
        if repo not in main_repo_list:
            main_repo_list[repo] = stats
            main_repo_list[repo][PR_CACHED_KEY] = False
            main_repo_list[repo][ISSUE_CACHED_KEY] = False
            main_repo_list[repo][PR_KEY] = set()
            main_repo_list[repo][ISSUE_KEY] = set()
        else:
            main_repo_list[repo][NUM_PR_KEY] += stats[NUM_PR_KEY]
            main_repo_list[repo][NUM_IS_KEY] += stats[NUM_IS_KEY]
        # Fetch the list of GH PRs and cache them. If we run into an error then we
        # stop trying to use the cached list.
        if use_gh_cache:
            if main_repo_list[repo][NUM_PR_KEY] > GITHUB_FETCH_THRESHOLD and main_repo_list[repo][PR_CACHED_KEY] == False:
                try:
                    fetch_issues(repo, 'pr', 1500)
                except Exception as e:
                    traceback.print_exc()
                    use_gh_cache = False
                main_repo_list[repo][PR_CACHED_KEY] = True
            if main_repo_list[repo][NUM_IS_KEY] > GITHUB_FETCH_THRESHOLD and main_repo_list[repo][ISSUE_CACHED_KEY] == False:
                try:
                    fetch_issues(repo, 'issue', 1000)
                except Exception as e:
                    traceback.print_exc()
                    use_gh_cache = False
                main_repo_list[repo][ISSUE_CACHED_KEY] = True