
    eN                     n    d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 dd	l
mZ d
Z G d de          ZdS )a  
Remove an object from your Anaconda Server.

Example::


    # Remove specific package by providing version and package filename
    conda repo remove mychannel::mypackage/1.2.0/mypackage.tar.gz

    # Remove specific package by providing package filename
    conda repo remove mychannel::mypackage//mypackage.tar.gz

    # Remove all package files
    conda repo remove mychannel::mypackage

    N)RawTextHelpFormatter   )errors)
bool_input)PackageSpec   )SubCommandBase   c                   (    e Zd ZdZd Z	 ddZd ZdS )
SubCommandremovec           	      <   | j         j        D ]}	 |j        r9|                     |j        | j         j        |j        |j        |j        |           n|j	        r4|                     |j        | j         j        |j        |j        |           nP|j
        r.|                     |j        | j         j        |j        |           n| j                            d|           # t          j        $ r- | j         j        r| j                            dd           Y 
 w xY wd S )N)specz!Invalid package specification: %s T)exc_info)argsspecs	_filenameremove_artifactchannelfamilypackageversionfilename_version_packagelogerrorr   NotFoundforcewarning)selfr   s     8lib/python3.11/site-packages/repo_cli/commands/remove.pymainzSubCommand.main   s[   IO 	 	D> N((	(    ] N((	(! )     ] N((di&64 )     HNN#FMMM?   9? H$$R$$777H5	 	s   CC7DDNc                    ||d}g }|s|r| j                             |||||          \  }	}
|	s| j                            d|z             d S g }|	D ]Q}|                     dj        di |           t          |          }|d         |d<   |                    |           Rd                    |          }d|d|d}n	d	|d
}|g}| j        j	        st          |d          r;| j                             |d|           | j                            d|z             d S | j                            d|z             d S )N)namer   z6No files matches were found for the provided spec: %s
zFPACKAGE: {name}:{version}-{ckey}; PLATFORM: {platform}; FILENAME: {fn}ckey
z4Are you sure you want to remove the package release z& ? The following will be affected: 

 z


Confirm?z,Are you sure you want to remove the package z ? (and all data with it?)FdeletezSpec %s succesfully removed
zNot removing release %s
 )apiget_channel_artifacts_filesr   r!   appendformatdictjoinr   r    r   channel_artifacts_bulk_actionsinfo)r"   r   r   artifactr   r   r   	base_itemitemspackagestotal_countfiles_descrfilepitemaffected_filesmsgs                   r#   r   zSubCommand.remove_artifactB   s    
 
	
  !	 h !	 $(H$H$H7H% %!Hk    MQUV   K! # #""c\c     
 I$V}VT""""!YY{33NN <@44Q C/!	 > 44  KE9? 	Cje44 	CH33GXuMMMHMM9TBCCCCCH8DABBBBB    c                 *   |                     ddt          t                    }|                    ddt          j        d           |                    dd	d
d           |                    ddd           |                    | j                   d S )Nr   a  Remove an object from your Anaconda Server repository. Must refer to the formal package name as it appears in the URL of the package. Also use anaconda show <USERNAME> to see list of package names. Example: anaconda remove continuumio/empty-example-notebook)helpdescriptionformatter_classr   zOPackage written as <channel>/<subchannel>[::<package>[/<version>[/<filename>]]]+)r?   typenargsz-fz--forcezDo not prompt removal
store_true)r?   actionz--familycondazVartifact family (i.e.: conda, python, cran, anaconda_project, anaconda_env, nootebook))defaultr?   )r$   )
add_parser__doc__r   add_argumentr   from_stringset_defaultsr$   )r"   
subparsersparsers      r#   rI   zSubCommand.add_parseru   s    &&J  0 ' 
 
 	b(	 	 	
 	
 	
 	)"9, 	 	
 	
 	
 	' 	 	
 	
 	
 	+++++r=   )NNN)__name__
__module____qualname__r&   r$   r   rI   r*   r=   r#   r   r      sX        D! ! !H LP1C 1C 1C 1Cf, , , , ,r=   r   )rJ   sysargparser   r   r   utilsr   utils.artifactsr   baser	   WAIT_SECONDSr   r*   r=   r#   <module>rY      s      


 ) ) ) ) ) )             ) ) ) ) ) )            u, u, u, u, u, u, u, u, u, u,r=   