class_docstr: Base class for a downloadable dataset.
  
  It is recommended to extend this class if a dataset can be downloaded from
  the internet. This implementation codes the recommended behaviour for
  downloading and verifying the dataset.
  
  The dataset child class must implement the `_download_dataset`,
  `_load_metadata` and `_download_error_message` methods
  
  The child class, in its constructor, must call the already implemented
  `_load_dataset` method (otherwise nothing will happen).
  
  A further simplification can be obtained by extending
  :class:`SimpleDownloadableDataset` instead of this class.
  :class:`SimpleDownloadableDataset` is recommended if a single archive is to
  be downloaded and extracted to the root folder "as is".
  
  The standardized procedure coded by `_load_dataset` is as follows:
  
  - First, `_load_metadata` is called to check if the dataset can be correctly
    loaded at the `root` path. This method must check if the data found
    at the `root` path is correct and that metadata can be correctly loaded.
    If this method succeeds (by returning True) the process is completed.
  - If `_load_metadata` fails (by returning False or by raising an error),
    then a download will be attempted if the download flag was set to True.
    The download must be implemented in `_download_dataset`. The
    procedure can be drastically simplified by using the `_download_file`,
    `_extract_archive` and `_download_and_extract_archive` helpers.
  - If the download succeeds (doesn't raise an error), then `_load_metadata`
    will be called again.
  
  If an error occurs, the `_download_error_message` will be called to obtain
  a message (a string) to show to the user. That message should contain
  instructions on how to download and prepare the dataset manually.
class_docstr_tok: ["Base","class","for","a","downloadable","dataset",".","It","is","recommended","to","extend","this","class","if","a","dataset","can","be","downloaded","from","the","internet",".","This","implementation","codes","the","recommended","behaviour","for","downloading","and","verifying","the","dataset",".","The","dataset","child","class","must","implement","the","`","_download_dataset","`",",","`","_load_metadata","`","and","`","_download_error_message","`","methods","The","child","class",",","in","its","constructor",",","must","call","the","already","implemented","`","_load_dataset","`","method","(","otherwise","nothing","will","happen",")",".","A","further","simplification","can","be","obtained","by","extending",":","class",":","`","SimpleDownloadableDataset","`","instead","of","this","class",".",":","class",":","`","SimpleDownloadableDataset","`","is","recommended","if","a","single","archive","is","to","be","downloaded","and","extracted","to","the","root","folder","``","as","is","''",".","The","standardized","procedure","coded","by","`","_load_dataset","`","is","as","follows",":","-","First",",","`","_load_metadata","`","is","called","to","check","if","the","dataset","can","be","correctly","loaded","at","the","`","root","`","path",".","This","method","must","check","if","the","data","found","at","the","`","root","`","path","is","correct","and","that","metadata","can","be","correctly","loaded",".","If","this","method","succeeds","(","by","returning","True",")","the","process","is","completed",".","-","If","`","_load_metadata","`","fails","(","by","returning","False","or","by","raising","an","error",")",",","then","a","download","will","be","attempted","if","the","download","flag","was","set","to","True",".","The","download","must","be","implemented","in","`","_download_dataset","`",".","The","procedure","can","be","drastically","simplified","by","using","the","`","_download_file","`",",","`","_extract_archive","`","and","`","_download_and_extract_archive","`","helpers",".","-","If","the","download","succeeds","(","does","n't","raise","an","error",")",",","then","`","_load_metadata","`","will","be","called","again",".","If","an","error","occurs",",","the","`","_download_error_message","`","will","be","called","to","obtain","a","message","(","a","string",")","to","show","to","the","user",".","That","message","should","contain","instructions","on","how","to","download","and","prepare","the","dataset","manually","."]
docstr: The dataset metadata loading procedure.
  
  This procedure is called at least once to load the dataset metadata.
  
  This procedure should return False if the dataset is corrupted or if it
  can't be loaded.
  
  :return: True if the dataset is not corrupted and could be successfully
  loaded.
docstr_tok: ["The","dataset","metadata","loading","procedure",".","This","procedure","is","called","at","least","once","to","load","the","dataset","metadata",".","This","procedure","should","return","False","if","the","dataset","is","corrupted","or","if","it","ca","n't","be","loaded",".",":","return",":","True","if","the","dataset","is","not","corrupted","and","could","be","successfully","loaded","."]
code: def _load_metadata(self) -> bool:
      """
      The dataset metadata loading procedure.
  
      This procedure is called at least once to load the dataset metadata.
  
      This procedure should return False if the dataset is corrupted or if it
      can't be loaded.
  
      :return: True if the dataset is not corrupted and could be successfully
      loaded.
      """
      pass
  
imports: from abc import abstractmethod, ABC
  from pathlib import Path
  from typing import TypeVar, Union, Optional
  import shutil
  import os
  from torch.utils.data.dataset import Dataset
  from torchvision.datasets.utils import download_and_extract_archive, extract_archive, download_url, check_integrity
  from avalanche.benchmarks.datasets.dataset_utils import default_dataset_location
label_desc: Use image node_id 4 for calling the DownloadableDataset obj's underlying member method code with example usage: obj._load_metadata() without return types