code: def _chmod_and_replace(src: str, dst: str) -> None:
      """Set correct permission before moving a blob from tmp directory to cache dir.
  
      Do not take into account the `umask` from the process as there is no convenient way
      to get it that is thread-safe.
  
      See:
      - About umask: https://docs.python.org/3/library/os.html#os.umask
      - Thread-safety: https://stackoverflow.com/a/70343066
      - About solution: https://github.com/huggingface/huggingface_hub/pull/1220#issuecomment-1326211591
      - Fix issue: https://github.com/huggingface/huggingface_hub/issues/1141
      - Fix issue: https://github.com/huggingface/huggingface_hub/issues/1215
      """
      # Get umask by creating a temporary file in the cached repo folder.
      tmp_file = Path(dst).parent.parent / f"tmp_{uuid.uuid4()}"
      try:
          tmp_file.touch()
          cache_dir_mode = Path(tmp_file).stat().st_mode
          os.chmod(src, stat.S_IMODE(cache_dir_mode))
      finally:
          tmp_file.unlink()
  
      shutil.move(src, dst)
  
imports: import copy
  import fnmatch
  import inspect
  import io
  import json
  import os
  import re
  import shutil
  import stat
  import tempfile
  import time
  import uuid
  import warnings
  from contextlib import contextmanager
  from dataclasses import dataclass
  from functools import partial
  from pathlib import Path
  from typing import Any, BinaryIO, Dict, Generator, Literal, Optional, Tuple, Union
  from urllib.parse import quote, urlparse
  import requests
  from filelock import FileLock
  from huggingface_hub import constants
  from .None import __version__
  from .constants import DEFAULT_ETAG_TIMEOUT, DEFAULT_REQUEST_TIMEOUT, DEFAULT_REVISION, DOWNLOAD_CHUNK_SIZE, ENDPOINT, HF_HUB_CACHE, HF_HUB_DISABLE_SYMLINKS_WARNING, HF_HUB_DOWNLOAD_TIMEOUT, HF_HUB_ENABLE_HF_TRANSFER, HF_HUB_ETAG_TIMEOUT, HF_TRANSFER_CONCURRENCY, HUGGINGFACE_CO_URL_TEMPLATE, HUGGINGFACE_HEADER_X_LINKED_ETAG, HUGGINGFACE_HEADER_X_LINKED_SIZE, HUGGINGFACE_HEADER_X_REPO_COMMIT, HUGGINGFACE_HUB_CACHE, REPO_ID_SEPARATOR, REPO_TYPES, REPO_TYPES_URL_PREFIXES
  from .utils import EntryNotFoundError, FileMetadataError, GatedRepoError, LocalEntryNotFoundError, OfflineModeIsEnabled, RepositoryNotFoundError, RevisionNotFoundError, SoftTemporaryDirectory, build_hf_headers, get_fastai_version, get_fastcore_version, get_graphviz_version, get_jinja_version, get_pydot_version, get_session, get_tf_version, get_torch_version, hf_raise_for_status, is_fastai_available, is_fastcore_available, is_graphviz_available, is_jinja_available, is_pydot_available, is_tf_available, is_torch_available, logging, reset_sessions, tqdm, validate_hf_hub_args
  from .utils._deprecation import _deprecate_method
  from .utils._headers import _http_user_agent
  from .utils._runtime import _PY_VERSION
  from .utils._typing import HTTP_METHOD_T
  from .utils.insecure_hashlib import sha256
label_desc: Use image node_id 19 for calling a global function with example usage: _chmod_and_replace(src, dst) without return types