original_docstring: 
          Download an artifact file or directory to a local directory if applicable, and return a
          local path for it.
          The caller is responsible for managing the lifecycle of the downloaded artifacts.
  
          :param artifact_path: Relative source path to the desired artifacts.
          :param dst_path: Absolute path of the local filesystem destination directory to which to
                           download the specified artifacts. This directory must already exist.
                           If unspecified, the artifacts will either be downloaded to a new
                           uniquely-named directory on the local filesystem or will be returned
                           directly in the case of the LocalArtifactRepository.
  
          :return: Absolute path of the local filesystem location containing the desired artifacts.
          
docstring: Download an artifact file or directory to a local directory if applicable, and return a
  local path for it.
  The caller is responsible for managing the lifecycle of the downloaded artifacts.
docstring_tokens: Download an artifact file or directory to a local directory if applicable and return a local path for it . The caller is responsible for managing the lifecycle of the downloaded artifacts .
code: def download_artifacts(self, artifact_path, dst_path=None):
          """
          Download an artifact file or directory to a local directory if applicable, and return a
          local path for it.
          The caller is responsible for managing the lifecycle of the downloaded artifacts.
  
          :param artifact_path: Relative source path to the desired artifacts.
          :param dst_path: Absolute path of the local filesystem destination directory to which to
                           download the specified artifacts. This directory must already exist.
                           If unspecified, the artifacts will either be downloaded to a new
                           uniquely-named directory on the local filesystem or will be returned
                           directly in the case of the LocalArtifactRepository.
  
          :return: Absolute path of the local filesystem location containing the desired artifacts.
          """
  
          # TODO: Probably need to add a more efficient method to stream just a single artifact
          #       without downloading it, or to get a pre-signed URL for cloud storage.
          def download_file(fullpath):
              fullpath = fullpath.rstrip("/")  # Prevents incorrect split if fullpath ends with a '/'
              dirpath, _ = posixpath.split(fullpath)
              local_dir_path = os.path.join(dst_path, dirpath)
              local_file_path = os.path.join(dst_path, fullpath)
              if not os.path.exists(local_dir_path):
                  os.makedirs(local_dir_path)
              self._download_file(remote_file_path=fullpath, local_path=local_file_path)
              return local_file_path
  
          def download_artifact_dir(dir_path):
              local_dir = os.path.join(dst_path, dir_path)
              dir_content = [  # prevent infinite loop, sometimes the dir is recursively included
                  file_info
                  for file_info in self.list_artifacts(dir_path)
                  if file_info.path != "." and file_info.path != dir_path
              ]
              if not dir_content:  # empty dir
                  if not os.path.exists(local_dir):
                      os.makedirs(local_dir)
              else:
                  for file_info in dir_content:
                      if file_info.is_dir:
                          download_artifact_dir(dir_path=file_info.path)
                      else:
                          download_file(file_info.path)
              return local_dir
  
          if dst_path is None:
              dst_path = tempfile.mkdtemp()
          dst_path = os.path.abspath(dst_path)
  
          if not os.path.exists(dst_path):
              raise MlflowException(
                  message=(
                      "The destination path for downloaded artifacts does not"
                      " exist! Destination path: {dst_path}".format(dst_path=dst_path)
                  ),
                  error_code=RESOURCE_DOES_NOT_EXIST,
              )
          elif not os.path.isdir(dst_path):
              raise MlflowException(
                  message=(
                      "The destination path for downloaded artifacts must be a directory!"
                      " Destination path: {dst_path}".format(dst_path=dst_path)
                  ),
                  error_code=INVALID_PARAMETER_VALUE,
              )
  
          # Check if the artifacts points to a directory
          if self._is_directory(artifact_path):
              return download_artifact_dir(artifact_path)
          else:
              return download_file(artifact_path)
code_tokens: def download_artifacts ( self , artifact_path , dst_path = None ) : def download_file ( fullpath ) : fullpath = fullpath . rstrip ( "/" ) dirpath , _ = posixpath . split ( fullpath ) local_dir_path = os . path . join ( dst_path , dirpath ) local_file_path = os . path . join ( dst_path , fullpath ) if not os . path . exists ( local_dir_path ) : os . makedirs ( local_dir_path ) self . _download_file ( remote_file_path = fullpath , local_path = local_file_path ) return local_file_path def download_artifact_dir ( dir_path ) : local_dir = os . path . join ( dst_path , dir_path ) dir_content = [ file_info for file_info in self . list_artifacts ( dir_path ) if file_info . path != "." and file_info . path != dir_path ] if not dir_content : if not os . path . exists ( local_dir ) : os . makedirs ( local_dir ) else : for file_info in dir_content : if file_info . is_dir : download_artifact_dir ( dir_path = file_info . path ) else : download_file ( file_info . path ) return local_dir if dst_path is None : dst_path = tempfile . mkdtemp ( ) dst_path = os . path . abspath ( dst_path ) if not os . path . exists ( dst_path ) : raise MlflowException ( message = ( "The destination path for downloaded artifacts does not" " exist! Destination path: {dst_path}" . format ( dst_path = dst_path ) ) , error_code = RESOURCE_DOES_NOT_EXIST , ) elif not os . path . isdir ( dst_path ) : raise MlflowException ( message = ( "The destination path for downloaded artifacts must be a directory!" " Destination path: {dst_path}" . format ( dst_path = dst_path ) ) , error_code = INVALID_PARAMETER_VALUE , ) if self . _is_directory ( artifact_path ) : return download_artifact_dir ( artifact_path ) else : return download_file ( artifact_path )
short_docstring: Download an artifact file or directory to a local directory if applicable, and return a
  local path for it.
short_docstring_tokens: Download an artifact file or directory to a local directory if applicable and return a local path for it .
comment: """
          Download an artifact file or directory to a local directory if applicable, and return a
          local path for it.
          The caller is responsible for managing the lifecycle of the downloaded artifacts.
  
          :param artifact_path: Relative source path to the desired artifacts.
          :param dst_path: Absolute path of the local filesystem destination directory to which to
                           download the specified artifacts. This directory must already exist.
                           If unspecified, the artifacts will either be downloaded to a new
                           uniquely-named directory on the local filesystem or will be returned
                           directly in the case of the LocalArtifactRepository.
  
          :return: Absolute path of the local filesystem location containing the desired artifacts.
          """$SEP$# TODO: Probably need to add a more efficient method to stream just a single artifact$SEP$#       without downloading it, or to get a pre-signed URL for cloud storage.$SEP$# Prevents incorrect split if fullpath ends with a '/'$SEP$# prevent infinite loop, sometimes the dir is recursively included$SEP$# empty dir$SEP$# Check if the artifacts points to a directory