sc2_datasets.utils.download_utils ================================= .. py:module:: sc2_datasets.utils.download_utils Functions --------- .. autoapisummary:: sc2_datasets.utils.download_utils.download_replaypack Module Contents --------------- .. py:function:: download_replaypack(destination_dir: pathlib.Path, replaypack_name: str, replaypack_url: str) -> pathlib.Path | None Exposes logic for downloading a single StarCraft II replaypack from an url. :param destination_dir: Specifies the destination directory where the replaypack will be saved. :type destination_dir: Path :param replaypack_name: Specifies the name of a replaypack that will be used for the downloaded .zip archive. :type replaypack_name: str :param replaypack_url: Specifies the url that is a direct link to the .zip which will be downloaded. :type replaypack_url: str :returns: Returns the filepath to the downloaded .zip archive. If the download failed, None is returned. :rtype: Path | None .. rubric:: Examples The use of this method is intended to download a .zip replaypack containing StarCraft II games. Replaypack download directory should be empty before running this function. Replaypack name will be used as the name for the downloaded .zip archive. Replaypack url should be valid and poiting directly to a .zip archive hosted on some server. The parameters should be set as in the example below. >>> from pathlib import Path >>> replaypack_download_dir = Path("datasets/download_directory").resolve() >>> replaypack_name = "TournamentName" >>> replaypack_url = "some_url" >>> download_replaypack_object = download_replaypack( ... destination_dir=replaypack_download_dir, ... replaypack_name=replaypack_name, ... replaypack_url=replaypack_url) >>> assert isinstance(replaypack_download_dir, Path) >>> assert isinstance(replaypack_name, str) >>> assert isinstance(replaypack_url, str) >>> assert len(os.listdir(replaypack_download_dir)) == 0 >>> assert existing_files[0].endswith(".zip")