parameters: (src, dest)
docstring: Wrap shutil.copy2() but map errors copying socket files to
  
      SpecialFileError as expected.
  
  
  
      See also https://bugs.python.org/issue37700.
docstring_summary: Wrap shutil.copy2() but map errors copying socket files to
docstring_tokens: Wrap shutil . copy2 () but map errors copying socket files to
function: def copy2_fixed(src, dest):
  
      # type: (str, str) -> None
  
      """Wrap shutil.copy2() but map errors copying socket files to
  
      SpecialFileError as expected.
  
  
  
      See also https://bugs.python.org/issue37700.
  
      """
  
      try:
  
          shutil.copy2(src, dest)
  
      except OSError:
  
          for f in [src, dest]:
  
              try:
  
                  is_socket_file = is_socket(f)
  
              except OSError:
  
                  # An error has already occurred. Another error here is not
  
                  # a problem and we can ignore it.
  
                  pass
  
              else:
  
                  if is_socket_file:
  
                      raise shutil.SpecialFileError(
  
                          "`{f}` is a socket".format(**locals()))
  
  
  
          raise
function_tokens: def copy2_fixed ( src , dest ) : # type: (str, str) -> None try : shutil . copy2 ( src , dest ) except OSError : for f in [ src , dest ] : try : is_socket_file = is_socket ( f ) except OSError : # An error has already occurred. Another error here is not # a problem and we can ignore it. pass else : if is_socket_file : raise shutil . SpecialFileError ( "`{f}` is a socket" . format ( * * locals ( ) ) ) raise