class_docstr: A class used to abstract any file that has to be downloaded online.
  
  Originally taken from ParlAI, this file has been modified for MMF specific
  use cases.
  
  Any dataset/model that needs to download a file needs to have a list RESOURCES
  that have objects of this class as elements.
  
  The class automatically figures out if the file is from Google Drive.
  
  This class provides the following functionality:
  
  - Download a file from a URL / Google Drive
  - Decompress the file if compressed
  - Checksum for the downloaded file
  - Send HEAD request to validate URL or Google Drive link
  - If the file is present and checksum is same, it won't be redownloaded
  
  Raises:
      AssertionError: If while downloading checksum of the files fails.
class_docstr_tok: ["A","class","used","to","abstract","any","file","that","has","to","be","downloaded","online",".","Originally","taken","from","ParlAI",",","this","file","has","been","modified","for","MMF","specific","use","cases",".","Any","dataset\/model","that","needs","to","download","a","file","needs","to","have","a","list","RESOURCES","that","have","objects","of","this","class","as","elements",".","The","class","automatically","figures","out","if","the","file","is","from","Google","Drive",".","This","class","provides","the","following","functionality",":","-","Download","a","file","from","a","URL","\/","Google","Drive","-","Decompress","the","file","if","compressed","-","Checksum","for","the","downloaded","file","-","Send","HEAD","request","to","validate","URL","or","Google","Drive","link","-","If","the","file","is","present","and","checksum","is","same",",","it","wo","n't","be","redownloaded","Raises",":","AssertionError",":","If","while","downloading","checksum","of","the","files","fails","."]
docstr: Checksum on a given file.
  
  Args:
      download_path (string): path to the downloaded file.
docstr_tok: ["Checksum","on","a","given","file",".","Args",":","download_path","(","string",")",":","path","to","the","downloaded","file","."]
code: def checksum(self, download_path):
      """
      Checksum on a given file.
  
      Args:
          download_path (string): path to the downloaded file.
      """
      if self._hashcode is None:
          print(
              f"[ Checksum not provided, skipping for {self._file_name}]"
          )
          return
  
      sha256_hash = hashlib.sha256()
      destination = os.path.join(download_path, self._file_name)
  
      if not PathManager.isfile(destination):
          # File is not present, nothing to checksum
          return
  
      with PathManager.open(destination, "rb") as f:
          print(f"[ Starting checksum for {self._file_name}]")
          for byte_block in iter(lambda: f.read(65536), b""):
              sha256_hash.update(byte_block)
          if sha256_hash.hexdigest() != self._hashcode:
              # remove_dir(download_path)
              raise AssertionError(
                  f"[ Checksum for {self._file_name} from \n{self._url}\n"
                  "does not match the expected checksum. Please try again. ]"
              )
          else:
              print(f"[ Checksum successful for {self._file_name}]")
  
imports: import collections
  import datetime
  import hashlib
  import io
  import json
  import os
  import shutil
  import time
  from pathlib import Path
  import numpy
  import requests
  import tqdm
  from mmf.utils.file_io import PathManager
  from mmf.utils.general import get_absolute_path
  from PIL import Image
label_desc: Use image node_id 3 for calling the DownloadableFile obj's underlying member method code with example usage: obj.checksum(download_path) without return types