code: def mock_default_data_dir(tmp_path: pathlib.Path):
      """Changes the default `--data_dir` to tmp_path."""
      tmp_path = tmp_path / "datasets"
      default_data_dir = os.environ.get("TFDS_DATA_DIR")
      try:
          os.environ["TFDS_DATA_DIR"] = os.fspath(tmp_path)
          yield tmp_path
      finally:
          if default_data_dir:
              os.environ["TFDS_DATA_DIR"] = default_data_dir
          else:
              del os.environ["TFDS_DATA_DIR"]
  
imports: import contextlib
  import os
  import pathlib
  from typing import Dict, Iterator, List, Optional
  from unittest import mock
  from absl.testing import parameterized
  from etils import epath
  import pytest
  import tensorflow_datasets
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import download
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils import file_utils
  from tensorflow_datasets.scripts.cli import build
  from tensorflow_datasets.scripts.cli import main
label_desc: Use image node_id 1 for calling a global function with example usage: mock_default_data_dir(tmp_path) without return types