class_docstr: Generates and loads the Charades data set.
class_docstr_tok: ["Generates","and","loads","the","Charades","data","set","."]
docstr: Downloads and extracts data if not already available.
docstr_tok: ["Downloads","and","extracts","data","if","not","already","available","."]
code: def _download_data(self):
      """Downloads and extracts data if not already available."""
      if sys.version_info >= (3, 0):
          urlretrieve = urllib.request.urlretrieve
      else:
          urlretrieve = urllib.request.urlretrieve
      logging.info("Creating data directory.")
      tf.io.gfile.makedirs(self.path_to_data)
      logging.info("Downloading license.")
      local_license_path = os.path.join(
          self.path_to_data, DATA_URL_LICENSE.split("/")[-1]
      )
      if not tf.io.gfile.exists(local_license_path):
          urlretrieve(DATA_URL_LICENSE, local_license_path)
      logging.info("Downloading annotations.")
      local_annotations_path = os.path.join(
          self.path_to_data, DATA_URL_ANNOTATIONS.split("/")[-1]
      )
      if not tf.io.gfile.exists(local_annotations_path):
          urlretrieve(DATA_URL_ANNOTATIONS, local_annotations_path)
      logging.info("Downloading videos.")
      local_videos_path = os.path.join(
          self.path_to_data, DATA_URL_VIDEOS.split("/")[-1]
      )
      if not tf.io.gfile.exists(local_videos_path):
          urlretrieve(DATA_URL_VIDEOS, local_videos_path, progress_hook)
      logging.info("Extracting annotations.")
      # return video dir and annotation_dir by removing .zip from the path.
      annotations_dir = local_annotations_path[:-4]
      if not tf.io.gfile.exists(annotations_dir):
          with zipfile.ZipFile(
              local_annotations_path
          ) as annotations_zip:
              annotations_zip.extractall(self.path_to_data)
      logging.info("Extracting videos.")
      video_dir = local_videos_path[:-4]
      if not tf.io.gfile.exists(video_dir):
          with zipfile.ZipFile(local_videos_path) as videos_zip:
              videos_zip.extractall(self.path_to_data)
      return annotations_dir, video_dir
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  import csv
  import os
  import random
  import subprocess
  import sys
  import tempfile
  import zipfile
  from absl import app
  from absl import flags
  from absl import logging
  from six.moves import range
  from six.moves import urllib
  import tensorflow.compat.v1
  from mediapipe.util.sequence import media_sequence
label_desc: Use image node_id 5 for calling the Charades obj's underlying member method code with example usage: obj._download_data() and returns: annotations_dir,  video_dir