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: An object of this class needs to be created with:
  
  Args:
      url (string): URL or Google Drive id to download from
      file_name (string): File name that the file should be named
      hashcode (string, optional): SHA256 hashcode of the downloaded file.
                                   Defaults to None. Won't be checked if not
                                   passed.
      compressed (bool, optional): False if the file is not compressed.
                                   Defaults to True.
      delete_original (bool, optional): If compressed whether to delete original.
                                        Defaults to False.
      dest_folder (str, optional): Folder which will be appended to destination
          path provided when downloading. Defaults to None.
docstr_tok: ["An","object","of","this","class","needs","to","be","created","with",":","Args",":","url","(","string",")",":","URL","or","Google","Drive","id","to","download","from","file_name","(","string",")",":","File","name","that","the","file","should","be","named","hashcode","(","string",",","optional",")",":","SHA256","hashcode","of","the","downloaded","file",".","Defaults","to","None",".","Wo","n't","be","checked","if","not","passed",".","compressed","(","bool",",","optional",")",":","False","if","the","file","is","not","compressed",".","Defaults","to","True",".","delete_original","(","bool",",","optional",")",":","If","compressed","whether","to","delete","original",".","Defaults","to","False",".","dest_folder","(","str",",","optional",")",":","Folder","which","will","be","appended","to","destination","path","provided","when","downloading",".","Defaults","to","None","."]
code: def __init__(
      self,
      url,
      file_name,
      hashcode=None,
      compressed=True,
      delete_original=False,
      dest_folder=None,
  ):
      """
      An object of this class needs to be created with:
  
      Args:
          url (string): URL or Google Drive id to download from
          file_name (string): File name that the file should be named
          hashcode (string, optional): SHA256 hashcode of the downloaded file.
                                       Defaults to None. Won't be checked if not
                                       passed.
          compressed (bool, optional): False if the file is not compressed.
                                       Defaults to True.
          delete_original (bool, optional): If compressed whether to delete original.
                                            Defaults to False.
          dest_folder (str, optional): Folder which will be appended to destination
              path provided when downloading. Defaults to None.
      """
      self._url = self._parse_url(url)
      self._file_name = file_name
      self._hashcode = hashcode
      self._compressed = compressed
      self._from_google = self._url.find(self.GOOGLE_DRIVE_SUBSTR) != -1
  
      if self._from_google:
          assert (
              "id=" in self._url
          ), "Google Drive URL should have Google Drive ID"
          self._url = self._url.split("=")[-1]
  
      self._delete_original = delete_original
      self._dest_folder = dest_folder
  
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 1 to create a new DownloadableFile object  with example: obj = DownloadableFile(url, file_name, hashcode, compressed, delete_original, dest_folder)