docstr: Download the specified file to the target folder.
  
  Parameters
  ----------
  target_dir: str
      data save directory
  file_name: str
      dataset name, needs to endwith .zip, value from [rl_data.zip, csv_data_cn.zip, ...]
      may contain folder names, for example: v2/qlib_data_simple_cn_1d_latest.zip
  delete_old: bool
      delete an existing directory, by default True
  
  Examples
  ---------
  # get rl data
  python get_data.py download_data --file_name rl_data.zip --target_dir ~/.qlib/qlib_data/rl_data
  When this command is run, the data will be downloaded from this link: https://qlibpublic.blob.core.windows.net/data/default/stock_data/rl_data.zip?{token}
  
  # get cn csv data
  python get_data.py download_data --file_name csv_data_cn.zip --target_dir ~/.qlib/csv_data/cn_data
  When this command is run, the data will be downloaded from this link: https://qlibpublic.blob.core.windows.net/data/default/stock_data/csv_data_cn.zip?{token}
  -------
docstr_tok: ["Download","the","specified","file","to","the","target","folder",".","Parameters","--","--","--","--","--","target_dir",":","str","data","save","directory","file_name",":","str","dataset","name",",","needs","to","endwith",".zip",",","value","from","[","rl_data.zip",",","csv_data_cn.zip",",","...","]","may","contain","folder","names",",","for","example",":","v2\/qlib_data_simple_cn_1d_latest.zip","delete_old",":","bool","delete","an","existing","directory",",","by","default","True","Examples","--","--","--","--","-","#","get","rl","data","python","get_data.py","download_data","--","file_name","rl_data.zip","--","target_dir","~\/.qlib\/qlib_data\/rl_data","When","this","command","is","run",",","the","data","will","be","downloaded","from","this","link",":","https",":","\/\/qlibpublic.blob.core.windows.net\/data\/default\/stock_data\/rl_data.zip","?","{","token","}","#","get","cn","csv","data","python","get_data.py","download_data","--","file_name","csv_data_cn.zip","--","target_dir","~\/.qlib\/csv_data\/cn_data","When","this","command","is","run",",","the","data","will","be","downloaded","from","this","link",":","https",":","\/\/qlibpublic.blob.core.windows.net\/data\/default\/stock_data\/csv_data_cn.zip","?","{","token","}","--","--","--","-"]
code: def download_data(
      self,
      file_name: str,
      target_dir: [Path, str],
      delete_old: bool = True,
  ):
      """
      Download the specified file to the target folder.
  
      Parameters
      ----------
      target_dir: str
          data save directory
      file_name: str
          dataset name, needs to endwith .zip, value from [rl_data.zip, csv_data_cn.zip, ...]
          may contain folder names, for example: v2/qlib_data_simple_cn_1d_latest.zip
      delete_old: bool
          delete an existing directory, by default True
  
      Examples
      ---------
      # get rl data
      python get_data.py download_data --file_name rl_data.zip --target_dir ~/.qlib/qlib_data/rl_data
      When this command is run, the data will be downloaded from this link: https://qlibpublic.blob.core.windows.net/data/default/stock_data/rl_data.zip?{token}
  
      # get cn csv data
      python get_data.py download_data --file_name csv_data_cn.zip --target_dir ~/.qlib/csv_data/cn_data
      When this command is run, the data will be downloaded from this link: https://qlibpublic.blob.core.windows.net/data/default/stock_data/csv_data_cn.zip?{token}
      -------
  
      """
      target_dir = Path(target_dir).expanduser()
      target_dir.mkdir(exist_ok=True, parents=True)
      # saved file name
      _target_file_name = (
          datetime.datetime.now().strftime("%Y%m%d%H%M%S")
          + "_"
          + os.path.basename(file_name)
      )
      target_path = target_dir.joinpath(_target_file_name)
  
      url = self.merge_remote_url(file_name)
      resp = requests.get(url, stream=True, timeout=60)
      resp.raise_for_status()
      if resp.status_code != 200:
          raise requests.exceptions.HTTPError()
  
      chunk_size = 1024
      logger.warning(
          f"The data for the example is collected from Yahoo Finance. Please be aware that the quality of the data might not be perfect. (You can refer to the original data source: https://finance.yahoo.com/lookup.)"
      )
      logger.info(f"{os.path.basename(file_name)} downloading......")
      with tqdm(
          total=int(resp.headers.get("Content-Length", 0))
      ) as p_bar:
          with target_path.open("wb") as fp:
              for chunk in resp.iter_content(chunk_size=chunk_size):
                  fp.write(chunk)
                  p_bar.update(chunk_size)
  
      self._unzip(target_path, target_dir, delete_old)
      if self.delete_zip_file:
          target_path.unlink()
  
imports: import os
  import re
  import sys
  import qlib
  import shutil
  import zipfile
  import requests
  import datetime
  from tqdm import tqdm
  from pathlib import Path
  from loguru import logger
  from cryptography.fernet import Fernet
  from qlib.utils import exists_qlib_data
label_desc: Use image node_id 3 for calling the GetData obj's underlying member method code with example usage: obj.download_data(file_name, target_dir, delete_old) without return types