code: def add_mim_extension():
      """Add extra files that are required to support MIM into the package.
  
      These files will be added by creating a symlink to the originals if the
      package is installed in `editable` mode (e.g. pip install -e .), or by
      copying from the originals otherwise.
      """
  
      # parse installment mode
      if "develop" in sys.argv:
          # installed by `pip install -e .`
          if platform.system() == "Windows":
              # set `copy` mode here since symlink fails on Windows.
              mode = "copy"
          else:
              mode = "symlink"
      elif "sdist" in sys.argv or "bdist_wheel" in sys.argv:
          # installed by `pip install .`
          # or create source distribution by `python setup.py sdist`
          mode = "copy"
      else:
          return
  
      filenames = [
          "tools",
          "configs",
          "demo",
          "model-index.yml",
          "dataset-index.yml",
      ]
      repo_path = osp.dirname(__file__)
      mim_path = osp.join(repo_path, "mmdet", ".mim")
      os.makedirs(mim_path, exist_ok=True)
  
      for filename in filenames:
          if osp.exists(filename):
              src_path = osp.join(repo_path, filename)
              tar_path = osp.join(mim_path, filename)
  
              if osp.isfile(tar_path) or osp.islink(tar_path):
                  os.remove(tar_path)
              elif osp.isdir(tar_path):
                  shutil.rmtree(tar_path)
  
              if mode == "symlink":
                  src_relpath = osp.relpath(
                      src_path, osp.dirname(tar_path)
                  )
                  os.symlink(src_relpath, tar_path)
              elif mode == "copy":
                  if osp.isfile(src_path):
                      shutil.copyfile(src_path, tar_path)
                  elif osp.isdir(src_path):
                      shutil.copytree(src_path, tar_path)
                  else:
                      warnings.warn(f"Cannot copy file {src_path}.")
              else:
                  raise ValueError(f"Invalid mode {mode}")
  
file_path: mmdetection/setup.py
imports: import os
  import os.path
  import platform
  import shutil
  import sys
  import warnings
  from setuptools import find_packages, setup
  import torch
  from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension
label_desc: Use image node_id 5 for calling a global function with example usage: add_mim_extension() without return types