
    sidP                    v   S r SSKJr  SSKJrJrJrJrJrJ	r	  SSK
Jr  \(       a
  SSKJrJrJr   " S S\5      r " S S	\5      rS!S
 jrS"S jrS#S jrS"S jr S!     S$S jjrS%S jrS&S jrS&S jrS'S jrS&S jrS&S jrS(S jrS"S jrS"S jrS&S jrS&S jr S"S jr!S"S jr"S r#S)S jr$S"S jr%S*S jr&g )+zE
Collection of helper functions to standardize reused CLI arguments.
    )annotations)SUPPRESSActionBooleanOptionalAction_HelpAction_StoreAction_StoreTrueAction)TYPE_CHECKING)ArgumentParser_ArgumentGroup_MutuallyExclusiveGroupc                  f   ^  \ rS rSrU 4S jr\S 5       r\R                  S 5       rSS jrSr	U =r
$ )LazyChoicesAction   c                B   > X0l         S U l        [        TU ]  " X40 UD6  g N)choices_func_cached_choicessuper__init__)selfoption_stringsdestr   kwargs	__class__s        1lib/python3.13/site-packages/conda/cli/helpers.pyr   LazyChoicesAction.__init__   s#    (#88    c                ^    U R                   c  U R                  5       U l         U R                   $ )z@Dynamically evaluate choices for help generation and validation.r   r   )r   s    r   choicesLazyChoicesAction.choices   s-     '#'#4#4#6D ###r   c                    g)z9Ignore attempts to set choices since we use choices_func.N )r   values     r   r!   r"   $   s    
 	r   c           	         U R                   nX5;  aO  SR                  S U 5       5      nSR                  U R                  5      nUR                  SU SU< SU S35        [	        X R
                  U5        g )Nz, c              3  .   #    U  H  nS U S 3v   M     g7f)'Nr$   ).0vals     r   	<genexpr>-LazyChoicesAction.__call__.<locals>.<genexpr>.   s     &K]c3%qz]s   /z	argument z: invalid choice: z (choose from ))r!   joinr   errorsetattrr   )r   parser	namespacevaluesoption_stringvalid_choiceschoices_stringoption_displays           r   __call__LazyChoicesAction.__call__+   sr    &!YY&K]&KKN XXd&9&9:NLLN++=fZ~VdUeefg 		99f-r   r    r   )__name__
__module____qualname____firstlineno__r   propertyr!   setterr9   __static_attributes____classcell__r   s   @r   r   r      s>    9
 $ $ ^^ 	. 	.r   r   c                  @   ^  \ rS rSrSr\S 5       rSU 4S jjrSrU =r	$ )_ValidatePackages7   z*
Used to validate match specs of packages
c                   ^ SSK Jn  SSKJn  [	        U [
        [        45      (       d  U /n U" U4S j[        X 5       5       5        g)z6
Ensure the packages do not contain denylist_channels
   )validate_channels)	MatchSpecc              3  \   >#    U  H!  nUR                  S 5      =m(       d  M  Tv   M#     g7f)channelN)get_exact_value)r)   specrL   s     r   r+   C_ValidatePackages._validate_no_denylist_channels.<locals>.<genexpr>G   s0      
6//	::: G6s   ,	,N)base.contextrI   models.match_specrJ   
isinstancelisttuplemap)packages_specsrI   rJ   rL   s      @r   _validate_no_denylist_channels0_ValidatePackages._validate_no_denylist_channels<   s>    
 	51.4-88,-N 
I6
 	
r   c                H   > U R                  U5        [        TU ]	  XX45        g r   )rW   r   r9   )r   r2   r3   r4   r5   r   s        r   r9   _ValidatePackages.__call__M   s     ++F3FBr   r$   r   )
r;   r<   r=   r>   __doc__staticmethodrW   r9   rA   rB   rC   s   @r   rE   rE   7   s(     
 
 C Cr   rE   c                R   SSK Jn  [        X5        [        U 5      n[	        U 5      n[        U 5      n[        U 5        [        U 5      nUR                  SSUSS9  [        U5        [        U 5        [        U 5        U R                  S/ SS	S
9  U R                  SS[        SSS9  XEU4$ )NrH   NULLz--download-only
store_truezSolve an environment and ensure package caches are populated, but exit prior to unlinking and linking packages into the prefix.actiondefaulthelpz--fileappendzwRead package versions from the given file. Repeated file specifications can be passed (e.g. --file=file1 --file=file2).)rc   rb   rd   packagespackage_spec*z?List of packages to install or update in the conda environment.)metavarrb   nargsrd   )common.constantsr_   add_parser_prefixadd_parser_channelsadd_parser_solver_mode"add_parser_package_install_optionsadd_parser_networkingadd_output_and_prompt_optionsadd_argumentadd_parser_show_channel_urlsadd_parser_pscheckadd_parser_knownrE   )pprefix_requiredr_   channel_optionssolver_mode_optionspackage_install_optionsoutput_and_prompt_optionss          r    add_parser_create_install_updater|   R   s    'a))!,O03@C! =a @**C	 +  !!:;qQ NNI   NN N   HHr   c                .    U R                  SS[        S9  g )Nz--force-pscheckr`   rb   rd   rr   r   rv   s    r   rt   rt   }   s    NN$\NIr   c                b    SSK Jn  U R                  SSSUSS9  U R                  SS	S[        S
9  g )NrH   r^   z--show-channel-urlsr`   show_channel_urlszXShow channel urls. Overrides the value given by `conda config --show show_channel_urls`.rb   r   rc   rd   z--no-show-channel-urlsstore_falserb   r   rd   rk   r_   rr   r   rv   r_   s     r   rs   rs      sG    'NN P   NN  	  r   c                0    U R                  SS[        SS9  g)z
So we can use consistent capitalization and periods in the help. You must
use the add_help=False argument to ArgumentParser or add_parser to use
this. Add this first to be consistent with the default argparse output.

z-hz--helpz Show this help message and exit.r~   N)rr   r   r   s    r   add_parser_helpr      s!     NN/	  r   c                \    U R                  S5      nUR                  US9n[        U5        U$ )Nz Target Environment Specification)required)add_argument_groupadd_mutually_exclusive_groupadd_parser_prefix_to_group)rv   rw   target_environment_groupnpgroups       r   rl   rl      s>      !334VW&CC  D G w'Nr   c                P    U R                  SSSSSS9  U R                  SSSS	S
S9  g )Nz-nz--namestorezName of environment.ENVIRONMENT)rb   rd   ri   z-pz--prefixz0Full path to environment location (i.e. prefix).PATHrr   )ms    r   r   r      sD    NN#   NN?  r   c                    SSK Jn  U R                  S5      nUR                  SSUSS9  UR                  SUS	S
9  [	        U5        UR                  SSSUSS9  U$ )NrH   r^   z(Output, Prompt, and Flow Control Optionsz--jsonr`   zEReport all output as json. Suitable for using conda programmatically.ra   z	--consolez6Select the backend to use for normal output rendering.)rc   rd   z-qz--quietzDo not display progress bar.)rk   r_   r   rr   add_parser_verboserv   r_   r{   s      r   add_parser_jsonr      s    ' ! 4 42! **T	 +  **E + 
 01**+ +  %$r   c                r    SSK Jn  [        U 5      nUR                  SSSSS9  UR                  SS	SUS
S9  U$ )NrH   r^   z-dz	--dry-runr`   z'Only display what would have been done.r~   z-yz--yesz{Sets any confirmation values to 'yes' automatically. Users will not be asked to confirm any adding, deleting, backups, etc.ra   )rk   r_   r   rr   r   s      r   rq   rq      s^    ' / 2**6	 +  **Q +  %$r   c                6    SSK Jn  U R                  SSUSSS9  g )NrH   r^   z--override-frozenr   zQDANGEROUS. Use at your own risk. Ignore protections if the environment is frozen.protect_frozen_envs)rb   rc   rd   r   )rk   r_   rr   r   s     r   add_parser_frozen_envr      s%    'NN`"  r   c                >   SSK Jn  U R                  S5      nUR                  SSSSSS	9  UR                  S
SUSS9  UR                  SSSSS9  UR                  SSSSS9  UR                  SSSS/SS9  UR                  SSSS9  UR                  S[        SUSS 9  U$ )!NrH   r^   zChannel Customizationz-cz	--channelrL   re   a  Additional channel to search for packages. These are URLs searched in the order they are given (including local directories using the 'file://' syntax or simply a path like '/home/conda/mychan' or '../mychan'). Then, the defaults or channels from .condarc are searched (unless --override-channels is given). You can use 'defaults' to get the default packages for conda. You can also use any name and the .condarc channel_alias value will be prepended. The default channel_alias is https://conda.anaconda.org/.)r   rb   rd   z--use-localr`   z4Use locally built packages. Identical to '-c local'.ra   z-Oz--override-channelsz@Do not search default or .condarc channels.  Requires --channel.r~   z--repodata-fnrepodata_fnsa  Specify file name of repodata on the remote server where your channels are configured or within local backups. Conda will try whatever you specify, but will ultimately fall back to repodata.json if your specs are not satisfiable with what you specify here. This is used to employ repodata that is smaller and reduced in time scope. You may pass this flag more than once. Leftmost entries are tried first, and the fallback to repodata.json is added for you automatically. For more information, see conda config --describe repodata_fns.r   z--experimentaljlaplockzjlap: Download incremental package index data from repodata.jlap; implies 'lock'. lock: use locking when reading, updating index (repodata.json) cache. Now enabled.)rb   r!   rd   z	--no-lockzDDisable locking when reading, updating index (repodata.json) cache. z--repodata-use-zstrepodata_use_zstzACheck for/do not check for repodata.json.zst. Enabled by default.r   )rk   r_   r   rr   r   )rv   r_   channel_customization_optionss      r   rm   rm      s   '$%$8$89P$Q!!.. D / " "..C	 /  "..S	 /  "..4 /  ".. ]	 /  "..S /  "..$P /  )(r   c           	     |   SSK Jn  SSKJn  U R	                  S5      nUR                  5       nUR                  SSSUSS	S
9  UR                  SSSU[        S9  UR                  SSSUSSS
9  UR                  SSUR                  SSUS9  UR                  SSUR                  SSUS9  UR                  SSSUSS9  U$ )NrH   )DepsModifierr^   zSolver Mode Modifiersz--strict-channel-prioritystore_constchannel_prioritystrictz|Packages in lower priority channels are not considered if a package with the same name appears in a higher priority channel.)rb   r   rc   constrd   z--channel-priorityr`   r   z--no-channel-prioritydisabledz|Package version takes precedence over channel priority. Overrides the value given by `conda config --show channel_priority`.z	--no-depsdeps_modifierzDo not install, update, remove, or change dependencies. This WILL lead to broken environments and inconsistent behavior. Use at your own risk.rb   r   r   rd   rc   z--only-depszOnly install dependencies.z--no-pinignore_pinnedzIgnore pinned file.)
base.constantsr   rk   r_   r   r   rr   r   NO_DEPS	ONLY_DEPS)rv   r   r_   ry   deps_modifierss        r   rn   rn   D  s'   -'../FG(EEGN$$#C %  $$ %  $$O %  ""R    $$)    $$" %  r   c           
     n   SSK Jn  SSKJn  U R	                  5       nUR                  SSSUR                  SUSS	9  UR                  S
SUR                  SUSS	9  UR                  SSSUR                  SUSS	9  UR                  SSSUR                  SSUS9  UR                  SSUR                  SSUS9  g )NrH   )UpdateModifierr^   z--freeze-installedz--no-update-depsr   update_modifierz7Do not update or change already-installed dependencies.)rb   r   r   rc   rd   z--update-depsz0Update dependencies that have available updates.z-Sz--satisfied-skip-solveaE  Exit early and do not run the solver if the requested specs are satisfied. Also skips aggressive updates as configured by the 'aggressive_update_packages' config setting. Use 'conda config --describe aggressive_update_packages' to view your setting. --satisfied-skip-solve is similar to the default behavior of 'pip install'.z--update-allz--allz1Update all installed packages in the environment.r   z--update-specsz(Update based on provided specifications.)r   r   rk   r_   r   rr   FREEZE_INSTALLEDUPDATE_DEPSSPECS_SATISFIED_SKIP_SOLVE
UPDATE_ALLUPDATE_SPECS)ry   r   r_   update_modifierss       r   add_parser_update_modifiersr   ~  s   /'*GGI!!--F "  !!((? "  !! 77V "  !!''@ "  !!))7 " r   c                <    SSK Jn  U R                  SSU[        S9  g )NrH   r^   z--pruner`   ra   r   r   s     r   add_parser_pruner     s"    'NN	  r   c           	         SSK Jn  SSKJn  U R	                  5       nUR                  SS[        UR                  R                  SUS9  g)	za
Add a command-line flag for alternative solver backends.

See ``context.solver`` for more info.
rH   contextr^   z--solversolverz#Choose which solver backend to use.)r   rb   r   rd   rc   N)	rP   r   rk   r_   r   rr   r   plugin_managerget_solvers)rv   r   r_   groups       r   add_parser_solverr     sI     ''**,E	 ++772  r   c           	         SSK Jn  U R                  S5      nUR                  SSSSSS	9  UR                  S
SSSUSS9  UR                  SSUSS	9  U$ )NrH   r^   zNetworking Optionsz-Cz--use-index-cacher`   FzUse cache of channel index files, even if it has expired. This is useful if you don't want conda to check whether a new version of the repodata file exists, which will save bandwidth.ra   z-kz
--insecurer   
ssl_verifyzoAllow conda to perform "insecure" SSL connections and transfers. Equivalent to setting 'ssl_verify' to 'false'.r   z	--offlinez,Offline mode. Don't connect to the Internet.)rk   r_   r   rr   )rv   r_   networking_optionss      r   rp   rp     s    '--.BC##2 $  ##9 $  ##;	 $  r   c                ^   SSK Jn  SSKJn  U R	                  S5      nUR                  SSUR                  SS[        S	S
9U[        S9  UR                  SSU[        S9  UR                  SSUSS9  UR                  SS[        SUS9  UR                  SSSSUS9  UR                  SSSSS9  U$ )NrH   r^   )
deprecatedz(Package Linking and Install-time Optionsz-fforcez25.9z26.3zUse `--force` instead.)addendum)r   rb   rc   rd   z--forcer`   ra   z--copyzCInstall all packages using copies instead of hard- or soft-linking.z--shortcuts	shortcutsrb   rd   r   rc   z--no-shortcutsr   z"Don't install start menu shortcutsz--shortcuts-onlyre   zHInstall shortcuts only for this package name. Can be used several times.shortcuts_only)rb   rd   r   )	rk   r_   deprecationsr   r   rr   rb   r	   r   )rv   r_   r   rz   s       r   ro   ro     s   ')222 ((  -	 ! 
  )  ((	 )  ((R	 )  (( )  ((1 )  ((W	 )  #"r   c                2    U R                  SSSS[        S9  g )Nz	--unknownr`   Funknown)rb   rc   r   rd   r   r   s    r   ru   ru   (  s"    NN  r   c                &    U R                  SSSS9  g )Nz--no-default-packagesr`   z4Ignore create_default_packages in the .condarc file.r~   r   r   s    r   add_parser_default_packagesr   2  s    NNC  r   c                    SSK Jn  SSKJn  U R	                  SSUSU Vs/ s H  o3S:w  d  M
  UPM     snSS	S
9  g s  snf )NrH   )KNOWN_SUBDIRSr^   z--subdirz
--platformsubdirnoarchSUBDIRzUse packages built for this platform. The new environment will be configured to remember this choice. Should be formatted like 'osx-64', 'linux-32', 'win-64', and so on. Defaults to the current (native) platform.)rc   r   r!   ri   rd   )r   r   rk   r_   rr   )r2   r   r_   ss       r   add_parser_platformr   :  sJ    .'
);Mq(]M;5  
 <s   	;;c           	         SSK Jn  SSKJn  U R	                  SSUSSUS	9  U R	                  S
S[
        US9  U R	                  SS[
        US9  g )NrH   r^      )NullCountActionz-vz	--verbosezCan be used multiple times. Once for detailed output, twice for INFO logging, thrice for DEBUG logging, four times for TRACE logging.	verbosityr   z--debugr`   )rb   rd   rc   z--trace)rk   r_   actionsr   rr   r   )r2   r_   r   s      r   r   r   L  st    '(
F   
 	   	  r   c           	     t    SSK Jn  SSKJn  U R	                  SS[
        UR                  R                  USS9  g )NrH   r   r^   z--environment-specifierz
--env-specz?(EXPERIMENTAL) Specify the environment specifier plugin to use.)rb   r   rc   rd   )rP   r   rk   r_   rr   r   r   get_environment_specifiers)rv   r   r_   s      r    add_parser_environment_specifierr   i  s7    &'NN! ++FFN  r   c                j    U R                  S5       Vs/ s H  oR                  5       PM     sn$ s  snf )zK
Custom type for argparse to handle comma-separated strings with stripping
,)splitstrip)r%   items     r   comma_separated_strippedr   w  s+     &+[[%56%5TJJL%5666s   0N)F)rv   r   returnNone)rv   ArgumentParser | _ArgumentGroupr   r   )rv   r   rw   boolr   r   )r   r   r   r   )rv   r   r   r   )rv   r   )ry   r   )r2   r   r   r   )r%   strr   z	list[str])'r[   
__future__r   argparser   r   r   r   r   r	   typingr
   r   r   r   r   rE   r|   rt   rs   r   rl   r   r   rq   r   rm   rn   r   r   r   rp   ro   ru   r   r   r   r   r   r$   r   r   <module>r      s    #  !PP. .@C C6(IVJ&" "			 	"%8%*	D)N7t3l(>3#l$:7r   