class_docstr: Class providing async download API with checksum validation.
  
  Do not instantiate this class directly. Instead, call `get_downloader()`.
class_docstr_tok: ["Class","providing","async","download","API","with","checksum","validation",".","Do","not","instantiate","this","class","directly",".","Instead",",","call","`","get_downloader","(",")","`","."]
docstr: Synchronous version of `download` method.
  
  To download through a proxy, the `HTTP_PROXY`, `HTTPS_PROXY`,
  `REQUESTS_CA_BUNDLE`,... environment variables can be exported, as
  described in:
  https://requests.readthedocs.io/en/master/user/advanced/#proxies
  
  Args:
    url: url to download
    destination_path: path where to write it
    verify: whether to verify ssl certificates
  
  Returns:
    None
  
  Raises:
    DownloadError: when download fails.
docstr_tok: ["Synchronous","version","of","`","download","`","method",".","To","download","through","a","proxy",",","the","`","HTTP_PROXY","`",",","`","HTTPS_PROXY","`",",","`","REQUESTS_CA_BUNDLE","`",",","...","environment","variables","can","be","exported",",","as","described","in",":","https",":","\/\/requests.readthedocs.io\/en\/master\/user\/advanced\/","#","proxies","Args",":","url",":","url","to","download","destination_path",":","path","where","to","write","it","verify",":","whether","to","verify","ssl","certificates","Returns",":","None","Raises",":","DownloadError",":","when","download","fails","."]
code: def _sync_download(
      self, url: str, destination_path: str, verify: bool = True
  ) -> DownloadResult:
      """Synchronous version of `download` method.
  
      To download through a proxy, the `HTTP_PROXY`, `HTTPS_PROXY`,
      `REQUESTS_CA_BUNDLE`,... environment variables can be exported, as
      described in:
      https://requests.readthedocs.io/en/master/user/advanced/#proxies
  
      Args:
        url: url to download
        destination_path: path where to write it
        verify: whether to verify ssl certificates
  
      Returns:
        None
  
      Raises:
        DownloadError: when download fails.
      """
      try:
          # If url is on a filesystem that gfile understands, use copy. Otherwise,
          # use requests (http) or urllib (ftp).
          if not url.startswith("http"):
              return self._sync_file_copy(url, destination_path)
      except tf.errors.UnimplementedError:
          pass
  
      with _open_url(url, verify=verify) as (response, iter_content):
          fname = _get_filename(response)
          path = os.path.join(destination_path, fname)
          size = 0
  
          # Initialize the download size progress bar
          size_mb = 0
          unit_mb = units.MiB
          total_size = (
              int(response.headers.get("Content-length", 0)) // unit_mb
          )
          self._pbar_dl_size.update_total(total_size)
          with tf.io.gfile.GFile(path, "wb") as file_:
              checksum = self._checksumer_cls()
              for block in iter_content:
                  size += len(block)
                  checksum.update(block)
                  file_.write(block)
  
                  # Update the download size progress bar
                  size_mb += len(block)
                  if size_mb > unit_mb:
                      self._pbar_dl_size.update(size_mb // unit_mb)
                      size_mb %= unit_mb
      self._pbar_url.update(1)
      return DownloadResult(
          path=epath.Path(path),
          url_info=checksums_lib.UrlInfo(
              checksum=checksum.hexdigest(),
              size=utils.Size(size),
              filename=fname,
          ),
      )
  
imports: import concurrent.futures
  import contextlib
  import dataclasses
  import functools
  import hashlib
  import io
  import os
  import re
  from typing import Any, ContextManager, Iterable, Iterator, Optional, Tuple, Union
  import urllib
  from etils import epath
  import promise
  import requests
  from tensorflow_datasets.core import units
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.download import checksums
  from tensorflow_datasets.core.download import util
  from tensorflow_datasets.core.utils import tqdm_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 6 for calling the _Downloader obj's underlying member method code with example usage: obj._sync_download(url, destination_path, verify) and returns: DownloadResult, self