class_docstr: Base class of dataset preparer.
  
  Dataset preparer is used to prepare dataset for MMOCR. It mainly consists
  of three steps:
    1. For each split:
      - Obtain the dataset
          - Download
          - Extract
          - Move/Rename
      - Gather the dataset
      - Parse the dataset
      - Pack the dataset to MMOCR format
      - Dump the dataset
    2. Delete useless files
    3. Generate the base config for this dataset
  
  After all these steps, the original datasets have been prepared for
  usage in MMOCR. Check out the dataset format used in MMOCR here:
  https://mmocr.readthedocs.io/en/dev-1.x/user_guides/dataset_prepare.html
  
  Args:
      data_root (str): Root directory of data.
      dataset_name (str): Dataset name.
      task (str): Task type. Options are 'textdet', 'textrecog',
          'textspotter', and 'kie'. Defaults to 'textdet'.
      nproc (int): Number of parallel processes. Defaults to 4.
      train_preparer (OptConfigType): cfg for train data prepare. It contains
          the following keys:
          - obtainer: cfg for data obtainer.
          - gatherer: cfg for data gatherer.
          - parser: cfg for data parser.
          - packer: cfg for data packer.
          - dumper: cfg for data dumper.
          Defaults to None.
      test_preparer (OptConfigType): cfg for test data prepare. Defaults to
          None.
      val_preparer (OptConfigType): cfg for val data prepare. Defaults to
          None.
      config_generator (OptConfigType): cfg for config generator. Defaults to
          None.
      delete (list[str], optional): List of files to be deleted.
          Defaults to None.
docstr: Create a DataPreparer from config file.
  
  Args:
      cfg (ConfigType): A config used for building runner. Keys of
          ``cfg`` can see :meth:`__init__`.
  
  Returns:
      Runner: A DatasetPreparer build from ``cfg``.
docstr_tok: ["Create","a","DataPreparer","from","config","file",".","Args",":","cfg","(","ConfigType",")",":","A","config","used","for","building","runner",".","Keys","of","``","cfg","``","can","see",":","meth",":","`","__init__","`",".","Returns",":","Runner",":","A","DatasetPreparer","build","from","``","cfg","``","."]
code: def from_file(cls, cfg: ConfigType) -> "DatasetPreparer":
      """Create a DataPreparer from config file.
  
      Args:
          cfg (ConfigType): A config used for building runner. Keys of
              ``cfg`` can see :meth:`__init__`.
  
      Returns:
          Runner: A DatasetPreparer build from ``cfg``.
      """
  
      cfg = copy.deepcopy(cfg)
      data_preparer = cls(
          data_root=cfg["data_root"],
          dataset_name=cfg.get("dataset_name", ""),
          task=cfg.get("task", "textdet"),
          nproc=cfg.get("nproc", 4),
          train_preparer=cfg.get("train_preparer", None),
          test_preparer=cfg.get("test_preparer", None),
          val_preparer=cfg.get("val_preparer", None),
          delete=cfg.get("delete", None),
          config_generator=cfg.get("config_generator", None),
      )
      return data_preparer
  
file_path: mmocr/mmocr/datasets/preparers/data_preparer.py
imports: import copy
  import os
  import os.path
  import shutil
  from typing import List, Optional, Union
  from mmocr.registry import CFG_GENERATORS, DATA_DUMPERS, DATA_GATHERERS, DATA_OBTAINERS, DATA_PACKERS, DATA_PARSERS
  from mmocr.utils.typing_utils import ConfigType, OptConfigType
label_desc: Use image node_id 3 for calling the DatasetPreparer obj's underlying member method code with example usage: obj.from_file(cls, cfg) and returns: data_preparer