+
    3jt@                       R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ^ RI	Ht ^ RI	Ht ^ RIHt ^ RIHt ^ RIt^ RIt^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHt ^ RIH t  ^ RI!H"t" ^ RI#H$t$ ^ RI%H&t& ^ RI'H(t( ^ RI)H*t* ^ RI+H,t, ^ RI-H.t. ]$P^                  ! ]P`                  4      t1]Pd                  ! RR4      t3Rt4RR.t5. RKOt6]
! ]! R4      4      t7]7Pq                  RR4      t9]
! ]! ]Pt                  R4      4      Pq                  RR4      t;R R  lt< ! R! R"]=4      t> ! R# R$]?4      t@RLR% R& lltAR' R( ltBR) R* ltCRMR+ R, lltDRMR- R. lltERLR/ R0 lltFRLR1 R2 lltGRLR3 R4 lltHRLR5 R6 lltIRLR7 R8 lltJRNR9 R: lltKROR; R< lltLRLR= R> lltMRLR? R@ lltNRA RB ltORPRC RD lltPRE RF ltQRLRG RH lltRRQRI RJ lltSR# )Rz5
Configure Conda to use Anaconda Commercial Edition.
)annotationsN)abspath)
expanduser)join)Any)urljoin)context)main)CondaKeyErrorread_binstar_tokens)remove_binstar_token)set_binstar_token)CondaSession)Channel)version)Confirm)Commands)CondaRC)_build_channel_settings)consoleCONDA_TOKEN_REPO_URLz!https://repo.anaconda.cloud/repo/r	   rmsys2z
~/.condarc%z%%z.condarcc               $    V ^8  d   QhRRRRRR/# )   argsr   kwargsreturnint )formats   "@lib/python3.14/site-packages/anaconda_auth/_conda/repo_config.py__annotate__r$   1   s!     + +s +c +c +    c                     \         P                  ! 4       ;_uu_ 4        \         P                  ! R \        4       \	        V / VB uuRRR4       #   + '       g   i     R# ; i)ignoreN)warningscatch_warningssimplefilterPendingDeprecationWarning
conda_main)r   r   s   *,r#   run_commandr-   1   s>    		 	 	"	"h(AB4*6* 
#	"	"	"s   &AA 	c                      ] tR t^8tRtR# )CondaTokenErrorr!   N__name__
__module____qualname____firstlineno____static_attributes__r!   r%   r#   r/   r/   8       r%   r/   c                      ] tR t^<tRtR# )CondaVersionWarningr!   Nr0   r!   r%   r#   r8   r8   <   r6   r%   r8   c               (    V ^8  d   QhRRRRRRRR/# r   condarc_systemboolcondarc_envcondarc_file
str | Noner   z	list[str]r!   )r"   s   "r#   r$   r$   @   s0        	r%   c                    . pV '       d   VP                  R4       V# V'       d   VP                  R4       V# V'       d   VP                  RV 24       V# )z5Construct conda CLI args related to condarc location.z--systemz--envz--file=)append)r;   r=   r>   config_argss   &&& r#   _get_condarc_argsrC   @   s]     K:&  
7#  
W\N34r%   c                   V ^8  d   QhRR/# r   r   r<   r!   )r"   s   "r#   r$   r$   R   s      $ r%   c                     \         \        P                  ! R 4      8  ;'       d    \         \        P                  ! R4      8  # )z4.7.0z25.9.0)CONDA_VERSIONr   parser!   r%   r#   can_restore_free_channelrI   R   s8    GMM'22  }w}}H 8 r%   c                   V ^8  d   QhRR/# )r   r   Noner!   )r"   s   "r#   r$   r$   Y   s     2 2T 2r%   c                 >    \        \        P                  RRR4       R# )zRuns conda clean -i.

It is important to remove index cache when
changing the condarc to ensure that the downloaded
repodata is correct.
z-iz-yz-qN)r-   r   CLEANr!   r%   r#   clean_indexrN   Y   s     dD1r%   c               $    V ^8  d   QhRRRRRR/# )r   tokenstrno_ssl_verifyr<   r   rK   r!   )r"   s   "r#   r$   r$   c   s!     "
 "
# "
d "
t "
r%   c                   V'       d   R\         P                  n        \        \        R4      '       d   \        P
                  ! 4        M) \        P                  P                  P                  4        \	        4       p\        4        \        \        \        R4      4      pWn        \        VP!                  RR7      4      pVP#                  WBP$                  R7      pVP&                  ^8w  d   \)        R4      hR#   \         d     Li ; i)	z2Checks that token can be used with the repository.Fcache_clearzmain/noarch/repodata.jsonT)with_credentials)verifyzPThe token could not be validated. Please check that you have typed it correctly.N)context_moduler   
ssl_verifyhasattrr   rT   _thread_localsessionsclearAttributeErrorrN   r   r   REPO_URLrP   rQ   urlheadrV   status_coder/   )rP   rR   sessionchannel	token_urlr   s   &&    r#   validate_tokenre   c   s     ,1)
 |]++  "	&&//557
 nG Mgh(CDEGMGKKK67IY~~6A}}^
 	
   		s   (C; ;D	D	c                    V ^8  d   QhRRRR/# )r   should_set_default_channelsr<   r   rK   r!   )r"   s   "r#   r$   r$      s      $ 4 r%   c                    \        RR7      pV'       g   R# \        4       pVP                  4        V F%  pVP                  VR,          VR,          RR7       K'  	  VP	                  4        R# )zConfigure the user's .condarc file with the anaconda-auth plugin.

We install the auth-handler plugin by writing the "channel_settings" key and associate
all premium repo channels with this auth handler.

F)include_defaultsNrc   auth)username)r   r   backupupdate_channel_settingssave)rg   settingscondarcss   &   r#   configure_pluginrr      sU     '>HiGNN'')ai$'O LLNr%   c               (    V ^8  d   QhRRRRRRRR/# r   r;   r<   r=   r>   r?   r   rK   r!   )r"   s   "r#   r$   r$      s0     5 555 5 
	5r%   c                   \         \        P                  ! R4      8  d   \        P                  ! R\
        4       R# \        V VVR7      p. ROpVP                  V4       \        \        P                  .VO5!   RR\        P                  R4      .pVP                  V4       \        \        P                  .VO5!   R# )	zEnable package signature verification.

This will set extra_safety_checks: True and
signing_metadata_url_base in the CondaRC file.
4.10.1z[You need upgrade to at least Conda version 4.10.1 to enable package signature verification.Nr;   r=   r>   --setsigning_metadata_url_base/)rx   extra_safety_checkstrue)rG   r   rH   r(   warnr8   rC   extendr-   r   CONFIGr^   rstripr;   r=   r>   condarc_file_argssafety_check_argsmetadata_url_argss   &&&   r#   enable_extra_safety_checksr      s     w}}X..i	
 	)%! A./4"34 "=xs?ST./4"34r%   c               (    V ^8  d   QhRRRRRRRR/# rt   r!   )r"   s   "r#   r$   r$      s0             
	 r%   c                n   \         \        P                  ! R4      8  d   R# \        V VVR7      p. ROpVP	                  V4        \        \        P                  .VO5!   RR.pVP	                  V4        \        \        P                  .VO5!   R#   \         d     L@i ; i  \         d     R# i ; i)zDisable package signature verification.

This will set extra_safety_checks: false and remove
signing_metadata_url_base in the CondaRC file.
rv   Nrw   --remove-keyry   )rx   r{   false)	rG   r   rH   rC   r~   r-   r   r   r
   r   s   &&&   r#   disable_extra_safety_checksr      s     w}}X..)%! B./HOO8&78 ()DE./HOO8&78    s$   B 7B% B"!B"%B43B4c               (    V ^8  d   QhRRRRRRRR/# rt   r!   )r"   s   "r#   r$   r$      0     / /// / 
	/r%   c                    . ROp\        V VVR7      pVP                  V4       \        \        P                  .VO5!   R# )zRun conda config --set add_anaconda_token true.

Setting this parameter to true ensures that the token
is used when making requests to the repository.
rw   N)rx   add_anaconda_tokenr|   rC   r~   r-   r   r   r;   r=   r>   rB   r   s   &&&  r#   _set_add_anaconda_tokenr      s?     :K)%!
 ().+.r%   c               (    V ^8  d   QhRRRRRRRR/# rt   r!   )r"   s   "r#   r$   r$      r   r%   c                    . ROp\        V VVR7      pVP                  V4       \        \        P                  .VO5!   R# )z}Run conda config --set ssl_verify false.

Setting this parameter to false disables all
SSL verification for conda activities
rw   N)rx   rX   r   r   r   s   &&&  r#   _set_ssl_verify_falser      s?     3K)%!
 ().+.r%   c               (    V ^8  d   QhRRRRRRRR/# rt   r!   )r"   s   "r#   r$   r$     s6     K KKK K 
	Kr%   c                    . ROp\        V VVR7      pVP                  V4       \        \        P                  .VO5RR/  R# )zRuns conda config --set restore_free_channel false.

The free channel is provided by Commercial Edition as
and should be added directly.rw   use_exception_handlerTN)rx   restore_free_channelr   r   r   s   &&&  r#   _unset_restore_free_channelr     sD     =K)%!
 ()J+JTJr%   c               0    V ^8  d   QhRRRRRRRRRRR	R
/# )r   rc   rQ   prependr<   r;   r=   r>   r?   r   rK   r!   )r"   s   "r#   r$   r$     sD     / /// / 	/
 / 
/r%   c                    \        \        V 4      pV'       d   RMRRV.p\        VVVR7      pVP                  V4       \	        \
        P                  .VO5!   R# )z<Adds a named Commercial Edition channel to default_channels.z	--prependz--appenddefault_channelsrw   N)r   r^   rC   r~   r-   r   r   )rc   r   r;   r=   r>   channel_urlrB   r   s   &&&&&   r#   _set_channelr     s^     (G,K JK *%!
 ().+.r%   c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   keyrQ   defaultr   r;   r<   r=   r>   r?   r   r!   )r"   s   "r#   r$   r$   7  sD     3 3	33 3 	3
 3 	3r%   c                   RV R.p\        VVVR7      pVP                  V4       \        P                  ! 4       p\        P
                  ! V4      ;_uu_ 4        \        \        P                  .VO5!   RRR4        \        P                  ! VP                  4       4      pVP                  R/ 4      P                  W4      #   + '       g   i     LV; i  \        P                   d    / p LMi ; i)Retrieve the existing default_channels from the user's `.condarc` file.

If the user does not have a "default_channels" section, an empty list is returned.

z--getz--jsonrw   Nget)rC   r~   ioStringIO
contextlibredirect_stdoutr-   r   r   jsonloadsgetvalueJSONDecodeErrorr   )	r   r   r;   r=   r>   rB   r   	string_ioresults	   &&&&&    r#   _get_from_condarcr   7  s     C*K)%!
 () I		#	#I	.	.HOO2k2 
/I..01 ::eR $$S22 
/	.
  s   C=$C C	C/.C/c               (    V ^8  d   QhRRRRRRRR/# r:   r!   )r"   s   "r#   r$   r$   Y  s0        	r%   c                "    \        R. V VVR7      # )r   r   )r   r;   r=   r>   )r   rw   s   &&&r#   _get_default_channelsr   Y  s      %! r%   c               (    V ^8  d   QhRRRRRRRR/# rt   r!   )r"   s   "r#   r$   r$   l  s0     + +++ + 
	+r%   c                   RR.p\        V VVR7      pVP                  V4       \        P                  ! 4       p\        P
                  ! V4      ;_uu_ 4         \        \        P                  .VO5!   RRR4       VP                  4       pRVP                  4       9  d   \        V\        P                  R7       R# R#   \         d     LYi ; i  + '       g   i     Le; i)zRuns conda config --remove-key default_channels

It is best to remove the default_channels in case they
are not set at the default values before configuring
Commercial Edition.
r   r   rw   Nr
   )file)rC   r~   r   r   r   redirect_stderrr-   r   r   r
   r   stripprintsysstderr)r;   r=   r>   rB   r   err_io
err_strings   &&&    r#   _remove_default_channelsr   l  s     "#56K)%!
 () [[]F		#	#F	+	+	6+6 
, "Jj..00jszz* 1	  		 
,	+s*   CC  CCCCC!	c                   V ^8  d   QhRR/# rE   r!   )r"   s   "r#   r$   r$     s     2 2 2r%   c                     \        4       p V '       dP   \        P                  ! R4       V  F  p\        P                  ! RV 24       K  	  \        P                  ! R4       M\        P                  ! R4       \        P                  ! RRR7      # )zJPrompt the user for whether they would like to set their default channels.z Existing default channels found:z- z@This action will override the existing default_channels setting.z-Prepared to set default channels in .condarc.zProceed?F)r   )r   r   r   r   ask)existing_default_channelscs     r#   _prompt_to_set_default_channelsr     sf     5 7 89*AMMBqc(# +N	
 	EF;;z511r%   c               0    V ^8  d   QhRRRRRRRRRRR	R
/# )r   r;   r<   r=   r>   r?   include_archive_channelslist[str] | Noneforcer   rK   r!   )r"   s   "r#   r$   r$     sL     K KKK K /	K
 K 
Kr%   c           	        \         P                  ! R4       \        4       pV Uu. uF  qfP                  \        4      NK  	  pp\        V4      \        \        .\        ,           4      8X  d   \         P                  ! R4       R# V'       g   \        4       '       g   R# \        WV4       \        4       '       d"   \        RV VVR7      '       d   \        WV4       \        \        RV VVR7       \         F  p\        VRV VVR7       K  	  Vf   R# V FB  pV\        9   d   \        VRV VVR7       K   \        R	V R
RP!                  \        4       24      h	  R# u upi )ak  Configure the default_channels to utilize only Commercial Edition.


This function performs the following actions
1. unset default_channels if it exists in the condarc
2. unset restore_free_channel if it exists in the condarc
3. Add the main, r, and msys2 channels to default_channels
4. Optionally add any of the archive channels:
   free, pro, mro, mro-archive
z+Configuring your [cyan].condarc[/cyan] filez3Default channels already configured, nothing to do.Nr   rw   T)r   r;   r=   r>   FzThe archive channel z is not one of z, )r   r   r   removeprefixr^   setMAIN_CHANNELACTIVE_CHANNELSr   r   rI   r   r   r   ARCHIVE_CHANNELS
ValueErrorr   )r;   r=   r>   r   r   r   r   %existing_default_channels_short_namess   &&&&&   r#   configure_default_channelsr     sZ   " MM?@ 5 7 +D-*CQx *C * - 01S	(6  	KL466^,G!!&7%!	' ' 	$NN%! )#%	
   '%  -') &qcCS9T8UV  &U-s   Ec                   V ^8  d   QhRR/# )r   r   zdict[str, str]r!   )r"   s   "r#   r$   r$     s     ! !N !r%   c                     \        4       # )zReturn a dictionary of tokens for all configured repository urls.

Note that this function will return tokens configured for non-Commercial Edition
urls.r   r!   r%   r#   
token_listr     s    
   r%   c               (    V ^8  d   QhRRRRRRRR/# )r   systemr<   envr   r?   r   rK   r!   )r"   s   "r#   r$   r$     s,      #3=	r%   c                h    \        \        4       \        WV4       \        WV4       \	        4        R# )zCompletely remove the Commercial Edition token and default_channels.

This function performs three actions.
1. Remove the token
2. Remove the custom default_channels in the condarc
3. Disable package signature verification
4. Run conda clean -i
N)r   r^   r   r   rN   )r   r   r   s   &&&r#   token_remover     s%     "V$/T2Mr%   c               <    V ^8  d   QhRRRRRRRRRR	R
RRRRRRR/	# )r   rP   rQ   r   r<   r   r   r?   r   r   rR   enable_signature_verificationr   r   rK   r!   )r"   s   "r#   r$   r$     sb           
  	 
 /    $(    
 r%   c                    \        \        4       \        \        V 4       \        WV4       V'       d   \	        WV4       V'       d   \        WV4       \        WW4VR7       \        4        R# )a.  Set the Commercial Edition token and configure default_channels.


This function performs 4 actions.
1. Remove previous Commercial Edition token if present.
2. Add token.
3. Configure default_channels in the condarc file.
4. Optionally enable Conda package signature verification
5. Run conda clean -i
)r   N)r   r^   r   r   r   r   r   rN   )rP   r   r   r   r   rR   r   r   s   &&&&&&&&r#   	token_setr     sL    ( "h&F.f40$"65vDRWXMr%   )freezmro-archivepro)FFN)F)TFFN)NFFN)FFNNF)FFNNFFF)T__doc__
__future__r   r   r   r   osr   r(   os.pathr   r   r   typingr   urllib.parser   condaconda.gateways.logging
conda.baser   rW   	conda.clir	   r,   conda.exceptionsr
   conda.gateways.anaconda_clientr   r   r   !conda.gateways.connection.sessionr   conda.models.channelr   	packagingr   rich.promptr   anaconda_auth._conda.conda_apir   anaconda_auth._conda.condarcr   anaconda_auth._conda.configr   anaconda_cli_baser   rH   __version__rG   getenvr^   r   r   r   user_rc_pathreplaceescaped_user_rc_pathprefixescaped_sys_rc_pathr-   RuntimeErrorr/   UserWarningr8   rC   rI   rN   re   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r%   r#   <module>r      sh   #  	  	 
          0 ( * > ? < : (   3 0 ? %e//099+-PQ.1 z,/0#++C6 d3::z:;CCCN +	l 		+ 	$2"
J"5@ F/,/,K*/43D&+D2 K\!"   r%   