def download_all_titles(
    titles: List[str], dump_path_by_type_list: List[Dict[str, str]], title2qid: Dict[str, str],
) -> Tuple[bool, Dict[str, bool]]:
    """Try to download all wikidata pages with the given titles. Download all or nothing, no partial downloads.

    Args:
        titles (List[str]):
        dump_path_by_type_list (List[Dict[str, str]]):

    Returns:
        bool: True if all wikidata pages can be found and downloaded successfully, else False.
        Dict[str, bool]: The key is the tile str that has been accessed in this function call, the value is whether the
            page exists or not.
    """
    responses: List[Response] = []
    title_valid: Dict[str, bool] = {}
    for title in titles:
        qid = title2qid.get(title, None)
        if qid is None:
            title_valid[title] = False
            return False, title_valid

        url = f"https://www.wikidata.org/wiki/{qid}"
        response = requests.get(url)
        if response.status_code != 200:
            title_valid[title] = False
            return False, title_valid
        responses.append(response)
        title_valid[title] = True

    for response, dump_path_by_type in zip(responses, dump_path_by_type_list):
        for filetype, dump_path in dump_path_by_type.items():
            obj = FILE_TYPE_TO_GET_FUNCTION[filetype](response)
            FILE_TYPE_TO_DUMP_FUNCTION[filetype](obj, dump_path)

    return True, title_valid
Try to download all wikidata pages with the given titles. Download all or nothing, no partial downloads.

    Args:
        titles (List[str]):
        dump_path_by_type_list (List[Dict[str, str]]):

    Returns:
        bool: True if all wikidata pages can be found and downloaded successfully, else False.
        Dict[str, bool]: The key is the tile str that has been accessed in this function call, the value is whether the
            page exists or not.
    
data_process/open_benchmarks/utils/wikidata.py