code: def replace_symlinks_with_junctions():
      """
      Per default Windows requires admin access to create symlinks, while
      junctions (which behave similarly) can be created by users.
  
      This function replaces symlinks (which might be broken when checked
      out without admin rights) with junctions so Ray can be built both
      with and without admin access.
      """
      assert is_native_windows_or_msys()
  
      # Update this list if new symlinks are introduced to the source tree
      _LINKS = {
          r"ray\dashboard": "../../dashboard",
          r"ray\rllib": "../../rllib",
      }
      root_dir = os.path.dirname(__file__)
      for link, default in _LINKS.items():
          path = os.path.join(root_dir, link)
          try:
              out = subprocess.check_output(
                  "DIR /A:LD /B", shell=True, cwd=os.path.dirname(path)
              )
          except subprocess.CalledProcessError:
              out = b""
          if os.path.basename(path) in out.decode("utf8").splitlines():
              logger.info(
                  f"'{link}' is already converted to junction point"
              )
          else:
              logger.info(f"Converting '{link}' to junction point...")
              if os.path.isfile(path):
                  with open(path) as inp:
                      target = inp.read()
                  os.unlink(path)
              elif os.path.isdir(path):
                  target = default
                  try:
                      # unlink() works on links as well as on regular files,
                      # and links to directories are considered directories now
                      os.unlink(path)
                  except OSError as err:
                      # On Windows attempt to unlink a regular directory results
                      # in a PermissionError with errno set to errno.EACCES.
                      if err.errno != errno.EACCES:
                          raise
                      # For regular directories deletion is done with rmdir call.
                      os.rmdir(path)
              else:
                  raise ValueError(
                      f"Unexpected type of entry: '{path}'"
                  )
              target = os.path.abspath(
                  os.path.join(os.path.dirname(path), target)
              )
              logger.info("Setting {} -> {}".format(link, target))
              subprocess.check_call(
                  f'MKLINK /J "{os.path.basename(link)}" "{target}"',
                  shell=True,
                  cwd=os.path.dirname(path),
              )
  
imports: import argparse
  import errno
  import io
  import logging
  import os
  import pathlib
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import urllib.error
  import urllib.parse
  import urllib.request
  import warnings
  from enum import Enum
  from itertools import chain
label_desc: Use image node_id 7 for calling a global function with example usage: replace_symlinks_with_junctions() without return types