
    \Zi                       S r SSKJr  SSKrSSKrSSKrSSKrSSKJrJ	r	  SSK
Jr  SSKJr  SSKJr  SSKJrJr  SS	KJrJr  SSKrS
SKJr  S
SKJrJr  S
SKJr  S
SKJr  S
SK J!r!  S
SK"J#r#J$r$J%r%J&r&J'r'  SSK(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1  SSK2J3r3  SSK4J5r5  SSK6J7r7  \(       ah  SSKJ8r8J9r9  SSKJ:r:J;r;J<r<  SSKJ=r=  SSK>J?r?  S
SK@JArA  S
SKBJCrC  S
SKDJErE  S
SKFJGrG  S
SKHJIrI  SSKJJKrKJLrLJMrMJNrNJOrOJPrPJQrQJRrRJSrSJTrTJUrUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\J]r]J^r^  \R                  " \`5      ra\ " S  S!5      5       rb " S" S#\R                  5      rd\R                  S%S$ j5       rfg)&a0  
This module contains a subclass implementation of pluggy's
`PluginManager <https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluginManager>`_.

Additionally, it contains a function we use to construct the ``PluginManager`` object and
register all plugins during conda's startup process.
    )annotationsN)IterableMapping)suppress)	dataclass)distributions)	getmoduleisclass)TYPE_CHECKINGoverload   )NULL)APP_NAME DEFAULT_CONSOLE_REPORTER_BACKEND)context)dashlist)groupby_to_dict)CondaValueErrorEnvironmentExporterNotDetected EnvironmentSpecPluginNotDetected#EnvironmentSpecPluginSelectionErrorPluginError   )	environment_exportersenvironment_specifierspackage_extractorspost_solvesprefix_data_loadersreporter_backendssolverssubcommandsvirtual_packagesPluginConfig)
CondaSpecs)health_checks)CallableSequence)AnyLiteralcast)HookImpl)AuthBase)PathType)Action)Solver)	MatchSpec)PackageRecord)CondaAuthHandlerCondaEnvironmentExporterCondaEnvironmentSpecifierCondaHealthCheckCondaPackageExtractorCondaPluginCondaPostCommandCondaPostSolveCondaPostTransactionActionCondaPreCommandCondaPrefixDataLoaderCondaPrefixDataLoaderCallableCondaPreSolveCondaPreTransactionActionCondaReporterBackendCondaRequestHeaderCondaSettingCondaSolverCondaSubcommandCondaVirtualPackagec                  L    \ rS rSr% S\S'   S rS r\S 5       r\S 5       r	Sr
g	)
_HookImplWrapper[   r,   implc                P  ^  T R                   R                  " U6 nT R                   R                  (       d  T R                   R                  (       a  U$ T R	                  U5      (       a#  [
        (       a  [        SU5      nU 4S jU 5       $ T R                  UT R                   5      $ )NzIterable[Any]c              3  \   >#    U  H!  nTR                  UTR                  5      v   M#     g 7fN)	_set_implrJ   ).0itemselfs     5lib/python3.13/site-packages/conda/plugins/manager.py	<genexpr>,_HookImplWrapper.function.<locals>.<genexpr>h   s#     GDNN433s   ),)rJ   functionhookwrapperwrapper_isiterabler   r+   rN   )rQ   argsresults   `  rR   rU   _HookImplWrapper.function_   sy    ##T*99  DII$5$5Mf%%}ov6GGG >>&$))44    c                .    [        U R                  U5      $ rM   )getattrrJ   rQ   names     rR   __getattr___HookImplWrapper.__getattr__m   s    tyy$''r\   c                z    [        U [        5      =(       a%    [        U [        [        [        [
        45      (       + $ rM   )
isinstancer   strbytes	bytearrayr   )objs    rR   rX   _HookImplWrapper._isiterableq   s2     #x( 
#ui12
 .
 	
r\   c                ~    [        [        [        5         [        U SU5        S S S 5        U $ ! , (       d  f       U $ = f)NrJ   )r   AttributeError	TypeErrorsetattr)rZ   rJ   s     rR   rN   _HookImplWrapper._set_implx   s0    ni0FFD) 1 10s   -
< N)__name__
__module____qualname____firstlineno____annotations__rU   ra   staticmethodrX   rN   __static_attributes__ro   r\   rR   rH   rH   [   s9    
N5( 
 
  r\   rH   c                    ^  \ rS rSr% SrS\S'    S\S'    S\S'    U 4S	 jrSKS
 jrSLSMU 4S jjjrSNS jr	SLSOS jjr
          SPU 4S jjr\    SQS j5       r\    SRS j5       r\SSS j5       r\    STS j5       r\    SUS j5       r\    SVS j5       r\    SWS j5       r\SXS j5       r\    SYS j5       r\      SZS j5       r\        S[S j5       r\S\S j5       r\    S]S j5       r\    S^S j5       r\    S_S j5       r\    S`S j5       r\    SaS  j5       r\    SbS! j5       r\    ScS" j5       rS# rSdS$ jrSLSeS% jjrSfS& jrSgS' jrShS( jrShS) jrSiS* jrSjS+ jrSkS, jrSlS- jrSmS. jrSnS/ jrSoS0 jrSpS1 jrSqS2 jr      SrS3 jr        SsS4 jrSiS5 jrStS6 jr SS7S8.     SuS9 jjr!    SvS: jr"      SwS; jr#        SxS< jr$\%      SyS= j5       r&SzS> jr' SL     S{S? jjr(S|S@ jr)S}SA jr*S~SB jr+    SSC jr,       S               SSD jjr-       S               SSE jjr.SSF jr/    SSG jr0      SSH jr1SSI jr2SJr3U =r4$ )CondaPluginManager   z_
The conda plugin manager to implement behavior additional to pluggy's default plugin manager.
z$Callable[[str | None], type[Solver]]get_cached_solver_backendzCallable[[str], dict[str, str]]get_cached_session_headersz$Callable[[str, str], dict[str, str]]get_cached_request_headersc                  > [         TU ]  " [        /UQ70 UD6  [        R                  " U R
                  5      U l        [        R                  " U R                  5      U l        [        R                  " U R                  5      U l
        g rM   )super__init__r   	functoolscacheget_solver_backendrz   get_session_headersr{   get_request_headersr|   )rQ   rY   kwargs	__class__s      rR   r   CondaPluginManager.__init__   sa    3D3F3 *39P9P)Q&*3//$:R:R*S'*3//$:R:R*S'r\   c                   Sn[        U5      =n(       a'  UR                  (       a  UR                  R                  nX1L a  U$ [        U5      (       a  U SUR                   3$ U SUR
                  R                   S[        U5       S3$ )Nz<unknown_module>.[])r	   __spec__r`   r
   rr   r   id)rQ   pluginprefixmodules       rR   get_canonical_name%CondaPluginManager.get_canonical_name   s    #''F'V____))F M V__XQv22344 XQv//<<=Qr&zl!LLr\   Nc                ,  >  [         TU ]  XS9n[        [        [        5         [        USU5        SSS5        U$ ! , (       d  f       U$ = f! [         a     g[         a0  n[        SU=(       d    U R                  U5       SU S35      UeSnAff = f)z
Call :meth:`pluggy.PluginManager.register` and return the result or
ignore errors raised, except ``ValueError``, which means the plugin
had already been registered.
r`   plugin_nameNz"Error while loading conda plugin:  ())
r~   registerr   rk   rl   rm   
ValueError	Exceptionr   r   )rQ   r   r`   r   errr   s        rR   r   CondaPluginManager.register   s    	  '*6*=K.)4{; 5 54 	 	4:4226:;2cU!E 	s7   !A <	A 
AA A 
B	B#+BBc                V    SnU H   nU R                  U5      (       d  M  US-  nM"     U$ )z
Load the provided list of plugins and fail gracefully on error.
The provided list of plugins can either be classes or modules with
:attr:`~conda.plugins.hookimpl`.
r   r   )r   )rQ   pluginscountr   s       rR   load_pluginsCondaPluginManager.load_plugins   s2     F}}V$$
  r\   c           
        Sn[        5        Hi  nUR                   HV  nUR                  U:w  d  Ub  UR                  U:w  a  M(   UR	                  5       nU R                  U5      (       d  MQ  US-  nMX     Mk     U$ ! [
         aG  n[        R                  SUR                   SU S3[        R                  (       a  UOSS9   SnAM  SnAff = f)zLoad modules from querying the specified setuptools ``group``.

:param str group: Entry point group to load plugins.
:param str name: If given, loads only plugins with the given ``name``.
:rtype: int
:return: The number of plugins loaded by this call.
r   Nz'Error while loading conda entry point: r   r   )exc_infor   )r   entry_pointsgroupr`   loadr   logwarningr   infor   )rQ   r   r`   r   distentry_pointr   r   s           rR   load_entrypoints#CondaPluginManager.load_entrypoints   s     !OD#00$$-$)9)9T)A(--/F ==((QJE/  1 $2  ! 
 KKA+BRBRASSUVYUZZ[\(/$    
s   A<<
C<CCc                   > U Vs/ s H  n[        U5      PM     nn[        (       a  [        SU5      nOUn[        TU ]  XX45      $ s  snf )NSequence[HookImpl])rH   r   r+   r~   	_hookexec)rQ   	hook_namemethodsr   firstresultmethodwrapped_methodsr   s          rR   r   CondaPluginManager._hookexec   sP     CJJ'+F3'J=/AG%Gw VII Ks   Ac                    g rM   ro   r_   s     rR   get_hook_results#CondaPluginManager.get_hook_results        !$r\   c                    g rM   ro   r_   s     rR   r   r      s     %(r\   c                    g rM   ro   r_   s     rR   r   r     s    ORr\   c                    g rM   ro   r_   s     rR   r   r     r   r\   c                    g rM   ro   r_   s     rR   r   r          "%r\   c                    g rM   ro   r_   s     rR   r   r     r   r\   c                    g rM   ro   r_   s     rR   r   r     r   r\   c                    g rM   ro   r_   s     rR   r   r     s    TWr\   c                    g rM   ro   r_   s     rR   r   r     s      #r\   c                   g rM   ro   )rQ   r`   hosts      rR   r   r   #       $'r\   c                   g rM   ro   )rQ   r`   r   paths       rR   r   r   (  r   r\   c                    g rM   ro   r_   s     rR   r   r   -  s    QTr\   c                    g rM   ro   r_   s     rR   r   r   0  s     &)r\   c                    g rM   ro   r_   s     rR   r   r   5       +.r\   c                    g rM   ro   r_   s     rR   r   r   :  s     ,/r\   c                    g rM   ro   r_   s     rR   r   r   ?       '*r\   c                    g rM   ro   r_   s     rR   r   r   D  r   r\   c                    g rM   ro   r_   s     rR   r   r   I  r   r\   c                    g rM   ro   r_   s     rR   r   r   N  s     *-r\   c           	     *   U R                    SU 3n[        U R                  US5      nUc  [        SU S35      eU" S0 UD6 VVs/ s H  oU  H  ofPM     M     snnnU Vs/ s Hm  n[	        US5      (       aW  [        UR                  [        5      (       a8  UR                  UR                  R                  5       R                  5       :w  d  Mk  UPMo     nnU(       a$  S U 5       n[        SU S[        U5       S	35      e[        S
 U5      R                  5        VVs/ s H   n[        U5      S:  d  M  U  H  nUPM     M"     n	nnU	(       a'  S U	 5       n[        SU S[        U5       SU S35      e[        WS S9$ s  snnf s  snf s  snnf )zc
Return results of the plugin hooks with the given name and
raise an error if there is a conflict.
_NzCould not find requested `z	` pluginsr`   c              3  l   #    U  H*  n[        U5       S UR                  R                   S3v   M,     g7f)r   r   N)reprrJ   r   rO   r   s     rR   rS   6CondaPluginManager.get_hook_results.<locals>.<genexpr>h  s/      LS&4<.6;;#:#:";1=Gs   24z Invalid plugin names found for `z`:
z3

Please report this issue to the plugin author(s).c                    U R                   $ rM   r   r   s    rR   <lambda>5CondaPluginManager.get_hook_results.<locals>.<lambda>u  s    &++r\   r   c              3     #    U  HB  nUR                   R                   S UR                   SUR                  R                   S3v   MD     g7f)z(name=z) (source: r   N)r   rp   r`   rJ   r   r   s     rR   rS   r   z  sG      'F ##,,-VFKK=FKKLcLcKddef's   A
AzConflicting plugins found for `z1

Multiple conda plugins are registered via the `zP` hook. Please make sure that you don't have any incompatible plugins installed.c                    U R                   $ rM   r   r   s    rR   r   r     s    &++r\   )keyro   )project_namer^   hookr   hasattrrd   r`   re   lowerstripr   r   valueslensorted)
rQ   r`   r   specnamer   r   r   invalidplugin_names	conflictss
             rR   r   r   S  s   
 ''($0tyy(D1< :4&	JKK)-NggF6g6N
 "
!66**fkk3//{{fkk//17799	 ! 	 
 LSL 24&L)* +DE  ++EwOVVX
X7|a  "  " X 	 
 'L 1$tL)* +BBJ L[\  g#=>>S O
&
s   F"A*F
F
!F8Fc                f    U R                  S5       Vs0 s H  nUR                  U_M     sn$ s  snf )z2Return a mapping from solver name to solver class.r    r   r`   )rQ   solver_plugins     rR   get_solversCondaPluginManager.get_solvers  s?     "&!6!6y!A
!A -!A
 	
 
   .c                   U=(       d    [         R                  R                  5       R                  5       nU R	                  5       nUR                  US5      nUc   [        SU SSR                  U5       35      eUR                  $ )a2  
Get the solver backend with the given name (or fall back to the
name provided in the context).

See ``context.solver`` for more details.

Please use the cached version of this method called
:meth:`get_cached_solver_backend` for high-throughput code paths
which is set up as a instance-specific LRU cache.
Nz.You have chosen a non-default solver backend (z,) but it was not recognized. Choose one of: , )	r   solverr   r   r   getr   joinbackend)rQ   r`   solvers_mappingr   s       rR   r   %CondaPluginManager.get_solver_backend  s     &--/557**, (++D$7 !@ G=99_-.0  $$$r\   c                    UR                  5       R                  5       nU R                  S5      nU Vs/ s H  o3R                  U:X  d  M  UPM     nn[	        U5      S:  a  US   R
                  $ gs  snf )z2
Get the auth handler with the given name or None
auth_handlersr   N)r   r   r   r`   r   handler)rQ   r`   r   rP   matchess        rR   get_auth_handler#CondaPluginManager.get_auth_handler  sj     zz|!!#--o>$1GMDYY$5F4MGw<!1:%%%	 Hs   A2A2c                f    U R                  S5       Vs0 s H  nUR                  U_M     sn$ s  snf )z
Return a mapping of plugin setting name to CondaSetting objects.

This method intentionally overwrites any duplicates that may be present
settingsr   )rQ   config_params     rR   get_settingsCondaPluginManager.get_settings  s?     !% 5 5j A
 A |+ A
 	
 
r   c                x    U R                  S5       H%  nXR                  ;   d  M  UR                  U5        M'     g)z
Invokes ``CondaPreCommand.action`` functions registered with ``conda_pre_commands``.

:param command: name of the command that is currently being invoked
pre_commandsNr   run_foractionrQ   commandr   s      rR   invoke_pre_commands&CondaPluginManager.invoke_pre_commands  s/     )).9D,,&G$ :r\   c                x    U R                  S5       H%  nXR                  ;   d  M  UR                  U5        M'     g)z
Invokes ``CondaPostCommand.action`` functions registered with ``conda_post_commands``.

:param command: name of the command that is currently being invoked
post_commandsNr  r
  s      rR   invoke_post_commands'CondaPluginManager.invoke_post_commands  s/     ))/:D,,&G$ ;r\   c                    U R                  5        HF  u  pUR                  S5      (       a  M  U R                  U5      (       a  M5  U R                  U5        MH     g)zI
Disables all currently registered plugins except built-in conda plugins
zconda.plugins.N)list_name_plugin
startswith
is_blockedset_blocked)rQ   r`   r   s      rR   disable_external_plugins+CondaPluginManager.disable_external_plugins  sE     !113LD??#344T__T=R=R  & 4r\   c                f    U R                  S5       Vs0 s H  nUR                  U_M     sn$ s  snf )Nr!   r   )rQ   
subcommands     rR   get_subcommands"CondaPluginManager.get_subcommands  s=     #33MB
B
 OOZ'B
 	
 
r   c                d    U R                  S5       Vs0 s H  oR                  U_M     sn$ s  snf )z6Return a mapping of health check name to health check.r&   r   )rQ   checks     rR   get_health_checks$CondaPluginManager.get_health_checks  s.    /3/D/D_/UV/Ue

E!/UVVVs   -c                6    [        U R                  S5      5      $ )Nr   tupler   rQ   s    rR   get_reporter_backends(CondaPluginManager.get_reporter_backends  s    T**+>?@@r\   c                    U R                  5        Vs0 s H  nUR                  U_M     nnUR                  US5      nUc5  [        R	                  SU S[
         S35        UR                  [
        5      $ U$ s  snf )z
Attempts to find a reporter backend while providing a fallback option if it is
not found.

This method must return a valid ``CondaReporterBackend`` object or else it will
raise an exception.
Nz"Unable to find reporter backend: "z"; falling back to using "")r%  r`   r   r   r   r   )rQ   r`   reporter_backendreporter_backends_maps       rR   get_reporter_backend'CondaPluginManager.get_reporter_backend  s     %)$>$>$@!
$@  !!#33$@ 	 !
 144T4@#KK4TF ;**J)K1N ),,-MNN##!
s   A8c                L   ^ [        U4S jU R                  S5       5       5      $ )Nc              3  ^   >#    U  H"  nUR                  5       =m[        Ld  M  Tv   M$     g 7frM   )to_virtual_packager   )rO   r   virtual_packages     rR   rS   ACondaPluginManager.get_virtual_package_records.<locals>.<genexpr>  s0      
A#'#:#:#<<TI OAs   -	-r"   r"  )rQ   r0  s    @rR   get_virtual_package_records.CondaPluginManager.get_virtual_package_records  s)     
--.@A
 
 	
r\   c                x    U R                  SUS9 Vs0 s H  nUR                  UR                  _M     sn$ s  snf )Nsession_headers)r   r   r`   value)rQ   r   r   s      rR   r   &CondaPluginManager.get_session_headers  sG     --.?d-K
K IItzz!K
 	
 
   !7c                x    U R                  SXS9 Vs0 s H  nUR                  UR                  _M     sn$ s  snf )Nrequest_headers)r   r   r6  )rQ   r   r   r   s       rR   r   &CondaPluginManager.get_request_headers  sG     --.?d-V
V IItzz!V
 	
 
r9  c              #  X   #    U R                  S5       H  nUR                  v   M     g 7f)Nr   )r   loader)rQ   r   s     rR   get_prefix_data_loaders*CondaPluginManager.get_prefix_data_loaders  s&     ))*?@D++ As   (*c                V    U R                  S5       H  nUR                  X5        M     g)z
Invokes ``CondaPreSolve.action`` functions registered with ``conda_pre_solves``.

:param specs_to_add:
:param specs_to_remove:

pre_solvesNr   r	  )rQ   specs_to_addspecs_to_remover   s       rR   invoke_pre_solves$CondaPluginManager.invoke_pre_solves  s%     )),7DKK6 8r\   c                X    U R                  S5       H  nUR                  XU5        M     g)z
Invokes ``CondaPostSolve.action`` functions registered with ``conda_post_solves``.

:param repodata_fn:
:param unlink_precs:
:param link_precs:
r   NrC  )rQ   repodata_fnunlink_precs
link_precsr   s        rR   invoke_post_solves%CondaPluginManager.invoke_post_solves&  s'     ))-8DKK:> 9r\   c                    U R                  5       R                  5        H0  u  p[        R                  " XR                  UR
                  5        M2     g)zw
Iterates through all registered settings and adds them to the
:class:`conda.common.configuration.PluginConfig` class.
N)r  itemsr$   add_plugin_setting	parameteraliases)rQ   r`   settings      rR   load_settings CondaPluginManager.load_settings6  s<    
 "..0668MD++D2C2CW__U 9r\   c                    [        U5      $ )z
Retrieve the configuration for the plugin.
Returns:
    PluginConfig: The configuration object for the plugin, initialized with raw data from the context.
r#   )rQ   datas     rR   
get_configCondaPluginManager.get_config>  s     D!!r\   Tsupports_detectionwith_aliasesc                  Uc!  U R                  S5       Vs/ s H  o3PM     nnO=U R                  S5       Vs/ s H!  nUR                  R                  U:X  d  M  UPM#     nnU(       d  U Vs0 s H  oUR                  U_M     sn$  U R	                  U5      $ s  snf s  snf s  snf ! [
         a  n[        SU 35      eSnAff = f)a>  
 Returns a mapping from environment specifier name to environment specifier.

 :param supports_detection: ternary value that returns either everything, only supporting
                            detection or not supporting detection.
:param with_aliases: whether to include aliased values of environment specifiers.
Nr   z:Plugin name conflicts detected in environment specifiers.
)r   environment_specdetection_supportedr`   _get_name_and_alias_mappingr   )rQ   r[  r\  henv_spec_hooksr   r   s          rR   get_environment_specifiers-CondaPluginManager.get_environment_specifiersF  s     %001IJJaJ  N ../GHHA%%99=OO H   0>?IItO??	33NCC @  	McUS 	s.   BBB-B"B' '
C1B??Cc                   0 n0 nU Hb  nUR                   /UR                  Q7 HA  nXR;   a5  XS;  a  X%   R                   1X5'   X5   R                  UR                   5        M=  XBU'   MC     Md     U(       am  / n[        UR	                  5       5       H6  u  pWSR                  [        U5      5      nUR                  SU SU 35        M8     [        S[        U5       S35      eU$ )a  
Get a mapping from plugin names (including aliases) to plugin.

:param plugins: List of plugins that have a name and aliases attribute.
:return: Dict mapping format name to CondaEnvironmentExporter
:raises PluginError: If multiple exporters use the same format name or alias
r   'z!' name or alias used by plugins: z3Multiple plugins cannot use the same name or alias:
)	r`   rR  addr   rO  r   appendr   r   )	rQ   r   mappingr   r   format_nameconflict_detailsr   plugins_strs	            rR   r`  .CondaPluginManager._get_name_and_alias_mappinge  s     	F &=fnn=)"3292F2K2K1L	.*..v{{;+1K(  >  !-3IOO4E-F)"ii|(<= ''}$Ek]S .G E,-.b2 
 r\   c                   UR                  5       R                  5       nU R                  5       n X2   n UR                  U5      R	                  5       (       a  U$  [        SU SU S35      e! [         aK  n[        SU SU SU S[        U5      R                   S[        U5       S	U S
3U R                  SS9S9eSnAff = f! [         a    [        SU S[        U5       35      ef = f)a  Get an environment specifier plugin by name

:param source: full path to the environment spec file/source
:param name: name of the environment plugin to load
:raises CondaValueError: if the requested plugin is not available.
:raises PluginError: if the requested plugin is unable to handle the provided file.
:returns: an environment specifier plugin that matches the provided plugin name, or can handle the provided file
zRequested plugin 'z(' is unable to handle environment spec 'rf  zCould not parse 'z' as 'zQ'. Check that the file contents match the expected format. Errors reported from 'z':

    ->  z: zJ

If this environment is a different format, try:
    conda create --file z --format <format>
F)r\  )msgplugin_specsNz<You have chosen an unrecognized environment specifier type (z). Choose one of: )r   r   rc  r^  
can_handler   r   r   typerp   re   KeyErrorr   r   )rQ   sourcer`   r   r   es         rR   !get_environment_specifier_by_name4CondaPluginManager.get_environment_specifier_by_name  s7    zz|!!#113	]F**62==??!M @  "(.VW]V^^_`   9+F86$ @115 7##'7#3#3"4Bs1vh ?339(:NP "&!@!@e!@!T
 
  	!$$(6);G$%' 	s#   C %A. .
C8AB>>C%C+c           	       ^ UR                  5        VVs/ s H@  u  pEUR                  (       d  M  [        U4S jUR                   5       5      (       d  M>  UPMB     nnn[        U5      S:  a(  [	        SU S[        U R                  5       5       35      e[        U5      S:X  a-   US   R                  U5      R                  5       (       a  U$  U$ U$ s  snnf ! [         a  n[	        SU 35      UeSnAff = f)zDetect environment specifier by filename pattern matching.

:param basename: basename of the source file
:param hooks: mapping of environment specifier plugins
:returns: list of matching plugins, or None if no filename matches
c              3  R   >#    U  H  n[         R                   " TU5      v   M     g 7frM   fnmatchrO   patternbasenames     rR   rS   ?CondaPluginManager._detect_filename_env_spec.<locals>.<genexpr>  s#      BXw'22BX   $'r   =Too many plugins found that can handle the environment file ''.

Try using --env-spec=<spec-name> to more exactly specify the environment spec
parser you want to use.

Available env specs:
r   z5Failed to parse environment specification from file: N)
rO  default_filenamesanyr   r   r   rc  r^  rr  r   )rQ   ru  r  hooksr   r   foundrv  s     `     rR   _detect_filename_env_spec,CondaPluginManager._detect_filename_env_spec  s    $);;=
#0	%%   BFBXBX  #0 	 
 u:>OPVx X) D;;=>?	A  u:?8,,V4??AA L B u7
,  !KA3Os(   C"CC&(C 
C8$C33C8c                (   / nUR                  5        Hj  u  p4[        R                  SU5         UR                  U 5      R	                  5       (       a*  [        R                  SU U5        UR                  U5        Mj  Ml     U$ ! [         a     M}  f = f)zDetect environment specifier by content-based autodetection.

:param source: full path to the environment spec file or source
:param hooks: mapping of environment specifier plugins
:returns: tuple of (found plugins, autodetect disabled plugin names)
z!EnvironmentSpec hook: checking %sz"EnvironmentSpec hook: %s can be %s)rO  r   debugr^  rr  ri  r   )ru  r  r  r   r   s        rR   _detect_content_env_spec+CondaPluginManager._detect_content_env_spec  s     ${{}OIII99E	((0;;==II<!
 LL& >  -   s   AB
BBc           	        U R                  SSS9n[        R                  R                  U5      nU R	                  XU5      n[        U5      S:X  aH  U R                  X5      n[        U5      S:  a(  [        SU S[        U R                  5       5       35      e[        U5      S:X  a  US   $  U R                  USS	9$ ! [        [        [        4 a  n[        UUU R                  SS
9S9UeSnAff = f)a  Detect the environment specifier plugin for a given spec source

Uses two-phase detection:
1. Filename-based filtering using fnmatch patterns
2. Fallback to content-based autodetection (can_handle())

Raises PluginError if more than one environment_spec plugin is found to be able to handle the file.
Raises EnvironmentSpecPluginNotDetected if no plugins were found.

:param source: full path to the environment spec file or source
:returns: an environment specifier plugin that can handle the provided file
TFrZ  r   r   r  r  zenvironment.ymlru  r`   )r[  )r`   r   autodetect_disabled_pluginsN)rc  osr   r  r  r   r  r   r   rw  r   r   r   )rQ   ru  r  r  r  excs         rR   detect_environment_specifier/CondaPluginManager.detect_environment_specifier  s-    //#% 0 
 77##F+ ..vGu:?11&@E5zA~!STZS[ \-   ? ? ABC	E  u:?8O	99$5 :   /
 	 3",0,K,K', -L - 	s   .B> >C1C,,C1c                P    U(       d  U R                  U5      $ U R                  XS9$ )a!  Get the environment specifier plugin for a given spec source, or given a plugin name
Raises PluginError if more than one environment_spec plugin is found to be able to handle the file.
Raises EnvironmentSpecPluginNotDetected if no plugins were found.
Raises CondaValueError if the requested plugin is not available.

:param filename: full path to the environment spec file/source
:param name: name of the environment plugin to load
:returns: an environment specifier plugin that matches the provided plugin name, or can handle the provided file
r  )r  rw  )rQ   ru  r`   s      rR   get_environment_specifier,CondaPluginManager.get_environment_specifier9  s,     44V<<999SSr\   c              #  B   #    U R                  S5       Sh  vN   g N7f)z,
Yields all detected environment exporters.
r   N)r   r$  s    rR   get_environment_exporters,CondaPluginManager.get_environment_exportersL  s      (()@AAAs   c                     U R                  U R                  5       5      $ ! [         a  n[        SU 35      eSnAff = f)z
Get a mapping from format names (including aliases) to environment exporters.

:return: Dict mapping format name to CondaEnvironmentExporter
:raises PluginError: If multiple exporters use the same format name or alias
z9Format name conflicts detected in environment exporters.
N)r`  r  r   )rQ   r   s     rR   get_exporter_format_mapping.CondaPluginManager.get_exporter_format_mappingR  sH    	33D4R4R4TUU 	LSER 	s   ! 
>9>c                  ^ [         R                  R                  U5      m/ nU R                  5        H:  n[	        U4S jUR
                   5       5      (       d  M)  UR                  U5        M<     U(       d  [        TU R                  5       S9e[        U5      S:  a5  [        ST S[        U Vs/ s H  oDR                  PM     sn5       S35      eUS   $ s  snf )a  
Detect an environment exporter based on filename matching against default_filenames.

Uses fnmatch pattern matching for flexible filename patterns (e.g., *.conda-lock.yml).

:param filename: Filename to find an exporter for (basename is used for detection)
:return: CondaEnvironmentExporter that supports the filename
:raises EnvironmentExporterNotDetected: If no exporter supports the filename
:raises PluginError: If multiple exporters claim to support the same filename
c              3  R   >#    U  H  n[         R                   " TU5      v   M     g 7frM   r{  r}  s     rR   rS   ACondaPluginManager.detect_environment_exporter.<locals>.<genexpr>q  s&      @G '22@r  )filename	exportersr   z?Multiple environment exporters found that can handle filename 'z':zR

Please make sure that you don't have any conflicting exporter plugins installed.r   )r  r   r  r  r  r  ri  r   r   r   r   r`   )rQ   r  r   exporter_configmatchr  s        @rR   detect_environment_exporter.CondaPluginManager.detect_environment_exporter`  s     77##H-#==?O .@@   /  @ 0!88:  \AQRZQ[[]W=WEZZW=>? @cd  qz	 >s   1Cc                    U R                  5       nUR                  U5      nUc1  [        SU S[        [	        UR                  5       5      5       35      eU$ )a  
Get an environment exporter based on the format name.

:param format_name: Format name to find an exporter for (e.g., 'yaml', 'json', 'environment-yaml')
:return: CondaEnvironmentExporter that supports the format
:raises CondaValueError: If no exporter is found for the given format
zUnknown export format 'z'. Available formats:)r  r   r   r   r   keys)rQ   rk  format_mappingexporters       rR   "get_environment_exporter_by_format5CondaPluginManager.get_environment_exporter_by_format  sg     99;!%%k2!)+ 7%%-f^5H5H5J.K%L$MO 
 r\   c                z    U R                  S5       Vs/ s H  nUR                  UUUUUUU5      PM     sn$ s  snf )a  Get the plugin-defined pre-transaction actions.

:param transaction_context: Mapping between target prefixes and PrefixActionGroup
    instances
:param target_prefix: Target prefix for the action
:param unlink_precs: Package records to be unlinked
:param link_precs: Package records to link
:param remove_specs: Specs to be removed
:param update_specs: Specs to be updated
:param neutered_specs: Specs to be neutered
:return: The plugin-defined pre-transaction actions
pre_transaction_actionsrC  	rQ   transaction_contexttarget_prefixrJ  rK  remove_specsupdate_specsneutered_specsr   s	            rR   get_pre_transaction_actions.CondaPluginManager.get_pre_transaction_actions  sZ    @ --.GH
 I KK# I
 	
 
   !8c                z    U R                  S5       Vs/ s H  nUR                  UUUUUUU5      PM     sn$ s  snf )a  Get the plugin-defined post-transaction actions.

:param transaction_context: Mapping between target prefixes and PrefixActionGroup
    instances
:param target_prefix: Target prefix for the action
:param unlink_precs: Package records to be unlinked
:param link_precs: Package records to link
:param remove_specs: Specs to be removed
:param update_specs: Specs to be updated
:param neutered_specs: Specs to be neutered
:return: The plugin-defined post-transaction actions
post_transaction_actionsrC  r  s	            rR   get_post_transaction_actions/CondaPluginManager.get_post_transaction_actions  sZ    @ --.HI
 J KK# J
 	
 
r  c                    U R                  S5       VVs0 s H(  nUR                    H  nUR                  5       U_M     M*     snn$ s  snnf )a  
Return a mapping from file extension to package extractor plugin.

Extensions are lowercased for case-insensitive matching.

:return: Dictionary mapping lowercased extensions (e.g., ``".conda"``) to their
    :class:`~conda.plugins.types.CondaPackageExtractor` plugins.
r   )r   
extensionsr   )rQ   r   	extensions      rR   get_package_extractors)CondaPluginManager.get_package_extractors  sR     --.BC
C!__	 OOt#, C
 	
 
s   /Ac                    [         R                  " U5      R                  5       nU R                  5       R	                  5        H  u  p4UR                  U5      (       d  M  Us  $    [        SU 35      e)a  
Get the package extractor plugin for a given package path.

Searches through registered package extractor plugins to find one that
handles the file extension of the provided package path.

:param source_full_path: Full path to the package archive file.
:return: The matching :class:`~conda.plugins.types.CondaPackageExtractor` plugin.
:raises PluginError: If no registered extractor handles the file extension.
z=No registered 'package_extractors' plugin found for package: )r  fspathr   r  rO  endswithr   )rQ   source_full_path
source_strr  	extractors        rR   get_package_extractor(CondaPluginManager.get_package_extractor  sn     YY/0668
$($?$?$A$G$G$I I""9--   %J KL\K]^
 	
r\   c                H    U R                  U5      nUR                  X5        g)an  
Extract a package archive to a destination directory.

Finds the appropriate extractor plugin based on the file extension
and extracts the package.

:param source_full_path: Full path to the package archive file.
:param destination_directory: Directory to extract the package contents to.
:raises PluginError: If no registered extractor handles the file extension.
N)r  extract)rQ   r  destination_directoryr  s       rR   extract_package"CondaPluginManager.extract_package  s$     ../?@	*Br\   c                    [         R                  " U5      R                  5       nU R                  5        H  nUR	                  U5      (       d  M  Us  $    g)z
Check if a path has a supported package file extension.

:param path: Path to check.
:return: The matched extension (lowercased) if found, None otherwise.
N)r  r  r   r  r  )rQ   r   path_strexts       rR   has_package_extension(CondaPluginManager.has_package_extension  sH     99T?((*..0C  %%
 1 r\   )r|   r{   rz   )r   objectreturnre   rM   )r`   
str | Noner  r  )r  int)r   re   r`   r  r  r  )
r   re   r   r   r   zMapping[str, object]r   boolr  zobject | list[object])r`   zLiteral['subcommands']r  zlist[CondaSubcommand])r`   zLiteral['virtual_packages']r  zlist[CondaVirtualPackage])r`   zLiteral['solvers']r  zlist[CondaSolver])r`   zLiteral['pre_commands']r  zlist[CondaPreCommand])r`   zLiteral['post_commands']r  zlist[CondaPostCommand])r`   zLiteral['auth_handlers']r  zlist[CondaAuthHandler])r`   zLiteral['health_checks']r  zlist[CondaHealthCheck])r`   zLiteral['pre_solves']r  zlist[CondaPreSolve])r`   zLiteral['post_solves']r  zlist[CondaPostSolve])r`   zLiteral['session_headers']r   re   r  list[CondaRequestHeader])r`   zLiteral['request_headers']r   re   r   re   r  r  )r`   zLiteral['settings']r  zlist[CondaSetting])r`   zLiteral['reporter_backends']r  zlist[CondaReporterBackend])r`   z"Literal['pre_transaction_actions']r  zlist[CondaPreTransactionAction])r`   z#Literal['post_transaction_actions']r  z list[CondaPostTransactionAction])r`   zLiteral['prefix_data_loaders']r  zlist[CondaPrefixDataLoader])r`   z!Literal['environment_specifiers']r  list[CondaEnvironmentSpecifier])r`   zLiteral['package_extractors']r  zlist[CondaPackageExtractor])r`   z Literal['environment_exporters']r  zlist[CondaEnvironmentExporter])r  zdict[str, CondaSolver])r`   r  r  ztype[Solver])r`   re   r  ztype[AuthBase] | None)r  zdict[str, CondaSetting])r  re   r  None)r  r  )r  zdict[str, CondaSubcommand])r  zdict[str, CondaHealthCheck])r  z tuple[CondaReporterBackend, ...])r`   re   r  rA   )r  tuple[PackageRecord, ...])r   re   r  dict[str, str])r   re   r   re   r  r  )r  z'Iterable[CondaPrefixDataLoaderCallable])rD  frozenset[MatchSpec]rE  r  r  r  )rI  re   rJ  r  rK  r  r  r  )r  r$   )r[  zbool | Noner\  r  r  $dict[str, CondaEnvironmentSpecifier])r   zIterable[CondaPlugin]r  r  )ru  re   r`   re   r  r5   )ru  re   r  re   r  r  r  r  )ru  re   r  r  r  r  )ru  re   r  r5   )ru  re   r`   r  r  r5   )r  z"Iterable[CondaEnvironmentExporter])r  z#dict[str, CondaEnvironmentExporter])r  re   r  r4   )rk  re   r  r4   )NNNNNNN)r  zdict[str, str] | Noner  r  rJ  Iterable[PackageRecord] | NonerK  r  r  Iterable[MatchSpec] | Noner  r  r  r  r  zlist[Action])r  z dict[str, CondaPackageExtractor])r  r.   r  r7   )r  r.   r  r.   r  r  )r   r.   r  r  )5rp   rq   rr   rs   __doc__rt   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r%  r+  r2  r   r   r?  rF  rL  rT  rX  rc  r`  rw  r  ru   r  r  r  r  r  r  r  r  r  r  r  r  r  rv   __classcell__)r   s   @rR   rx   rx      s     DCl ??m DDmTM$ *
"HJJ $J %	J
 J 
J $*$	$ $ (/(	"( ( R R$+$	$ $ %,%	% % %,%	% % %,%	% % W W#*#	# # '.'9<'	!' ' '.'9<'DG'	!' ' T T)0)	#) ) .6.	(. . /7/	)/ / *2*	$* * .5.	(. . *1*	$* * -4-	'- -3?j
%8
	
%%'
WA$,


7*7 .7 
	7?? 0? .	?
 
? V" 48d%0GK	->#,#	-#J-- - 
#	-^'' ' 4	'
 
)'R 3 
) 69|  TT T 
#	T&B#J	!. 6:$(7;59373759!
2!
 "!
 5	!

 3!
 1!
 1!
 3!
 
!
J 6:$(7;59373759!
2!
 "!
 5	!

 3!
 1!
 1!
 3!
 
!
F

"
 

.C"C  (C 
	C$ r\   rx   c                    [        5       n U R                  [        5        U R                  " [        /[
        R                  Q[        R                  Q[        R                  Q[        R                  Q[        R                  Q[        R                  Q[        R                  Q[        R                  Q[        R                  Q76   U R                  [         5        U $ )z
Get a cached version of the :class:`~conda.plugins.manager.CondaPluginManager` instance,
with the built-in and entrypoints provided by the plugins loaded.
)rx   add_hookspecsr%   r   r    r"   r   r!   r&   r   r   r   r   r   r   r   r   )plugin_managers    rR   get_plugin_managerr  &  s     ()N  ,		!	! 
		 
			
 
		 
	"	" 
	#	# 
	$	$ 
 	'	' 
	&	& ##H-r\   )r  rx   )gr  
__future__r   r|  r   loggingr  collections.abcr   r   
contextlibr   dataclassesr   importlib.metadatar   inspectr	   r
   typingr   r   pluggyauxlibr   base.constantsr   r   base.contextr   	common.ior   common.iteratorsr   
exceptionsr   r   r   r   r    r   r   r   r   r   r   r    r!   r"   configr$   hookspecr%   subcommands.doctorr&   r'   r(   r)   r*   r+   r,   requests.authr-   common.pathr.   core.path_actionsr/   
core.solver0   models.match_specr1   models.recordsr2   typesr3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   	getLoggerrp   r   rH   PluginManagerrx   r   r  ro   r\   rR   <module>r     s    #    	 -  ! , & *   G "   . 
 
 
 !   -2))&&*#-.     . !      Fd-- dN  r\   