code: def tmp_current_directory() -> Generator[str, None, None]:
      """Change current directory to a tmp dir and revert back when exiting."""
      with SoftTemporaryDirectory() as tmp_dir:
          cwd = os.getcwd()
          os.chdir(tmp_dir)
          try:
              yield tmp_dir
          except:
              raise
          finally:
              os.chdir(cwd)
  
imports: import os
  import unittest
  import warnings
  from argparse import ArgumentParser, Namespace
  from contextlib import contextmanager
  from pathlib import Path
  from typing import Generator
  from unittest.mock import Mock, patch
  from huggingface_hub.commands.delete_cache import DeleteCacheCommand
  from huggingface_hub.commands.download import DownloadCommand
  from huggingface_hub.commands.scan_cache import ScanCacheCommand
  from huggingface_hub.commands.upload import UploadCommand
  from huggingface_hub.utils import RevisionNotFoundError, SoftTemporaryDirectory, capture_output
  from .testing_utils import DUMMY_MODEL_ID
label_desc: Use image node_id 1 for calling a global function with example usage: tmp_current_directory() without return types