code: def cp(
      path1: str,
      path2: str,
      extract: bool = False,
      log: bool = True,
      use_cache: bool = True,
      clear_cache: bool = True,
  ) -> None:
      kwargs: Dict[str, Any] = {}
  
      is_path1_dir = isdir(path1)
      is_path2_dir = isdir(path2)
  
      # Cache result if the protocol is not local:
      cache_dir: Optional[str] = None
      if not islocal(path1):
          if log and "pytest" not in sys.modules:
              print(f"Downloading {path1}", file=sys.stderr)
  
          if (
              extract and use_cache
          ):  # Cache seems to confuse the gcs filesystem.
              home_dir = torch_geometric.get_home_dir()
              cache_dir = osp.join(home_dir, "simplecache", uuid4().hex)
              kwargs.setdefault(
                  "simplecache", dict(cache_storage=cache_dir)
              )
              path1 = f"simplecache::{path1}"
  
      # Handle automatic extraction:
      multiple_files = False
      if extract and path1.endswith(".tar.gz"):
          kwargs.setdefault("tar", dict(compression="gzip"))
          path1 = f"tar://**::{path1}"
          multiple_files = True
      elif extract and path1.endswith(".zip"):
          path1 = f"zip://**::{path1}"
          multiple_files = True
      elif extract and path1.endswith(".gz"):
          kwargs.setdefault("compression", "infer")
      elif extract:
          raise NotImplementedError(
              f"Automatic extraction of '{path1}' not yet supported"
          )
  
      # If the source path points to a directory, we need to make sure to
      # recursively copy all files within this directory. Additionally, if the
      # destination folder does not yet exist, we inherit the basename from the
      # source folder.
      if is_path1_dir:
          if exists(path2):
              path2 = osp.join(path2, osp.basename(path1))
          path1 = osp.join(path1, "**")
          multiple_files = True
  
      # Perform the copy:
      for open_file in fsspec.open_files(path1, **kwargs):
          with open_file as f_from:
              if not multiple_files:
                  if is_path2_dir:
                      basename = osp.basename(path1)
                      if extract and path1.endswith(".gz"):
                          basename = ".".join(basename.split(".")[:-1])
                      to_path = osp.join(path2, basename)
                  else:
                      to_path = path2
              else:
                  # Open file has protocol stripped.
                  common_path = osp.commonprefix(
                      [
                          fsspec.core.strip_protocol(path1),
                          open_file.path,
                      ]
                  )
                  to_path = osp.join(
                      path2, open_file.path[len(common_path) :]
                  )
              with fsspec.open(to_path, "wb") as f_to:
                  while True:
                      chunk = f_from.read(10 * 1024 * 1024)
                      if not chunk:
                          break
                      f_to.write(chunk)
  
      if use_cache and clear_cache and cache_dir is not None:
          try:
              rm(cache_dir)
          except PermissionError:  # FIXME
              # Windows test yield "PermissionError: The process cannot access
              # the file because it is being used by another process"
              # This is a quick workaround until we figure out the deeper issue.
              pass
  
imports: import io
  import os.path
  import sys
  from typing import Any, Dict, List, Literal, Optional, Union, overload
  from uuid import uuid4
  import fsspec
  import torch
  import torch_geometric
label_desc: Use image node_id 12 for calling a global function with example usage: cp(path1, path2, extract, log, use_cache, clear_cache) without return types