class_docstr: Base class for downloading sample datasets.
  
  This class is used by inherited classes for each specific dataset, providing basic functionality to
  download a dataset from a URL.
  
  The default download path of ~/stellargraph-datasets can be changed by setting the STELLARGRAPH_DATASETS_PATH environment variable,
  and each dataset will be downloaded to a subdirectory within this path.
class_docstr_tok: ["Base","class","for","downloading","sample","datasets",".","This","class","is","used","by","inherited","classes","for","each","specific","dataset",",","providing","basic","functionality","to","download","a","dataset","from","a","URL",".","The","default","download","path","of","~\/stellargraph-datasets","can","be","changed","by","setting","the","STELLARGRAPH_DATASETS_PATH","environment","variable",",","and","each","dataset","will","be","downloaded","to","a","subdirectory","within","this","path","."]
docstr: Download the dataset (if not already downloaded)
  
  Args:
      ignore_cache (bool, optional): Ignore a cached dataset and force a re-download.
  
  Raises:
      FileNotFoundError: If the dataset is not successfully downloaded.
docstr_tok: ["Download","the","dataset","(","if","not","already","downloaded",")","Args",":","ignore_cache","(","bool",",","optional",")",":","Ignore","a","cached","dataset","and","force","a","re-download",".","Raises",":","FileNotFoundError",":","If","the","dataset","is","not","successfully","downloaded","."]
code: def download(self, ignore_cache: Optional[bool] = False) -> None:
      """
      Download the dataset (if not already downloaded)
  
      Args:
          ignore_cache (bool, optional): Ignore a cached dataset and force a re-download.
  
      Raises:
          FileNotFoundError: If the dataset is not successfully downloaded.
      """
      if ignore_cache:
          self._delete_existing_files()  # remove any existing dataset files to ensure we re-download
  
      if ignore_cache or not self._is_downloaded():
          log.info(
              "%s dataset downloading to %s from %s",
              self.name,
              self.base_directory,
              self.url,
          )
          temporary_filename, _ = urlretrieve(self.url)
          if self.url_archive_format is None:
              # not an archive, so the downloaded file is our data and just needs to be put into place
              self._create_base_directory()
              move(
                  temporary_filename,
                  self._resolve_path(self.expected_files[0]),
              )
          else:
              # an archive to unpack.  The folder is created by unpack_archive - therefore the
              # directory_name for this dataset must match the directory name inside the archive file
              unpack_archive(
                  temporary_filename,
                  self._resolve_unpack_path(),
                  self.url_archive_format,
              )
          # verify the download
          missing_files = self._missing_files()
          if missing_files:
              missing = ", ".join(missing_files)
              raise FileNotFoundError(
                  f"{self.name} dataset failed to download file(s): {missing} to {self.data_directory}"
              )
      else:
          log.info("%s dataset is already downloaded", self.name)
  
file_path: stellargraph/stellargraph/datasets/dataset_loader.py
imports: import os
  import logging
  from shutil import unpack_archive, move
  from urllib.request import urlretrieve
  from typing import List, Optional, Any
  from urllib.error import URLError
label_desc: Use image node_id 12 for calling the DatasetLoader obj's underlying member method code with example usage: obj.download(ignore_cache) without return types