async def async_download_all_titles(
    batch_titles: List[List[str]],
    batch_path_lists: List[List[Dict[str, str]]],
) -> List[Tuple[bool, Dict[str, bool]]]:
    """For each (titles, path_lists) pair in the given batch list, try to download all or nothing, no partial downloads.

    Args:
        batch_titles (List[List[str]]):
        batch_path_lists (List[List[Dict[str, str]]]):

    Returns:
        List[Tuple[bool, Dict[str, bool]]]: Each element is this list contains two items:
            - bool: True if all wikipedia 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.
    """
    # I tried several methods here, async cannot be applied to check page exists, I only use it in downloading
    valid_batch_titles = []
    valid_batch_lists = []
    title_valid: Dict[str, bool] = {}

    # keep the batch that all pages exist
    for titles, batch_path in zip(batch_titles, batch_path_lists):
        list_all_exist = True
        valid_pages = []
        for title in titles:
            page = WIKI_WIKI.page(title)
            if not page.exists():
                list_all_exist = False
                title_valid[title] = False
                return False, title_valid
            valid_pages.append(page)
            title_valid[title] = True

        if list_all_exist:
            valid_batch_titles.extend(valid_pages)
            valid_batch_lists.extend(batch_path)

    # create download tasks
    download_tasks = []

    for page, dump_path_by_type in zip(valid_batch_titles, valid_batch_lists):
        for filetype, dump_path in dump_path_by_type.items():
            download_tasks.append(
                async_connect_and_save(page, filetype, dump_path)
            )

    await asyncio.gather(*download_tasks)

    return True, title_valid
For each (titles, path_lists) pair in the given batch list, try to download all or nothing, no partial downloads.

    Args:
        batch_titles (List[List[str]]):
        batch_path_lists (List[List[Dict[str, str]]]):

    Returns:
        List[Tuple[bool, Dict[str, bool]]]: Each element is this list contains two items:
            - bool: True if all wikipedia 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/wikipedia.py