ó
    ×çðiÆ  ã                  ó˜   • S r SSK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  \(       a  SSKJr  SS	KJr  SS
K	JrJr   " S S\
5      rg)a  
Handles plugin configuration functionality including:
  - Managing plugin-specific settings
  - Processing configuration data from various sources
  - Dynamically adding and removing plugin settings
  - Providing a standardized interface for plugins to access their configurations
é    )Úannotations)Údefaultdict)ÚMapping)ÚTYPE_CHECKINGé   )ÚConfigurationÚEnvRawParameterÚParameterLoader)ÚPath)ÚAny)Ú	ParameterÚRawParameterc                  ó¾   ^ • \ rS rSr% SrSrS\S'   SrS\S'   \ S     SS jj5       r	\SS j5       r
S	 r\SS
 j5       r\SS j5       rSS jrSU 4S jjrSrU =r$ )ÚPluginConfigé   a  
Class used to hold settings for conda plugins.

The object created by this class should only be accessed via
:class:`conda.base.context.Context.plugins`.

When this class is updated via the :func:`add_plugin_setting` function it adds new setting
properties which can be accessed later via the context object.

We currently call that function in
:meth:`conda.plugins.manager.CondaPluginManager.load_settings`.
because ``CondaPluginManager`` has access to all registered plugin settings via the settings
plugin hook.
© útuple[str, ...]Úparameter_namesÚparameter_names_and_aliasesc                óœ   • / U R                   QUP7U l         [        X#S9nUR                  U5      n[        XU5        U R	                  5         g)z3
Adds a setting to the :class:`PluginConfig` class
)ÚaliasesN)r   r
   Ú	_set_nameÚsetattrÚ _set_parameter_names_and_aliases)ÚclsÚnameÚ	parameterr   Úloaders        Ú)Lib\site-packages\conda\plugins\config.pyÚadd_plugin_settingÚPluginConfig.add_plugin_setting1   sN   € ð ; × 3Ñ 3Ð:°TÑ:ˆÔÜ  Ñ<ˆØ×Ñ Ó%ˆÜ�˜6Ô"ð 	×,Ñ,Õ.ó    c                ó‚   • U R                    H  n [        X5        M     [        5       U l         g! [         a     M0  f = f)zD
Removes all attached settings from the :class:`PluginConfig` class
N)r   ÚdelattrÚAttributeErrorÚtuple)r   r   s     r   Úremove_all_plugin_settingsÚ'PluginConfig.remove_all_plugin_settings@   sA   € ð
 ×'Ô'ˆDðÜ˜Ö"ñ (ô $›gˆÕøô "ó Úðús   ‘0°
>½>c                ó   • 0 U l         Xl        g )N©Ú_cache_Ú_data)ÚselfÚdatas     r   Ú__init__ÚPluginConfig.__init__M   s   € ØˆŒØ�
r"   c                óð  • [        [        5      nU R                  R                  5        HÈ  u  p#UR	                  S5      =n(       aJ  UR                  S5      n[        U[        5      (       d  ME  UR                  5        H  u  pgXqU   U'   M     Mg  U[        R                  :X  d  M}  UR                  5        H7  u  p‡UR                  S5      (       d  M  UR                  S5      u  p–XqU   U'   M9     MÊ     U$ )zÄ
This is used to move everything under the key "plugins" from the provided dictionary
to the top level of the returned dictionary. The returned dictionary is then passed
to :class:`PluginConfig`.
ÚpluginsNÚplugins_)r   Údictr,   ÚitemsÚgetÚvalueÚ
isinstancer   r	   ÚsourceÚ
startswithÚsplit)
r-   Únew_datar9   ÚconfigÚplugin_dataÚplugin_data_valueÚ
param_nameÚ	raw_paramÚenv_varÚ_s
             r   Úraw_dataÚPluginConfig.raw_dataQ   sÙ   € ô œtÓ$ˆà"Ÿj™j×.Ñ.Ö0‰NˆFØ$Ÿj™j¨Ó3Ð3ˆ{Õ3Ø$/×$5Ñ$5°dÓ$;Ð!ä!Ð"3´W×=Ñ=Ùà->×-DÑ-DÖ-FÑ)�JØ3<˜VÑ$ ZÓ0ó .Gð œ?×1Ñ1Õ1Ø*0¯,©,®.Ñ&�GØ×)Ñ)¨*×5Ó5Ø(/¯©°jÓ(A™˜Ø7@ Ñ(¨Ó4ó +9ñ 1ð  ˆr"   c                ó   • SU R                   0$ )Nz'Additional settings provided by plugins)r   )r-   s    r   Úcategory_mapÚPluginConfig.category_mapl   s   € à9¸4×;OÑ;OÐPÐPr"   c                ó¨   • SSK Jn  UR                  R                  5       R	                  5        VVs0 s H  u  p#X#R
                  _M     snn$ s  snnf )Nr   )Úcontext)Úbase.contextrJ   Úplugin_managerÚget_settingsr5   Údescription)r-   rJ   r   Úsettings       r   Úget_descriptionsÚPluginConfig.get_descriptionsp   sO   € Ý*ð ")×!7Ñ!7×!DÑ!DÓ!F×!LÑ!LÔ!Nô
â!N‘�ð ×%Ñ%Ò%Ù!Nò
ð 	
ùó 
s   ²Ac                ó<   >• [         TU ]  U5      nSUS    3US'   U$ )z�
Returns the description of a parameter.

We add to this method in order to change the "name" key that is returned to prepend "plugins."
to it.
zplugins.r   )ÚsuperÚdescribe_parameter)r-   Úparameter_namerN   Ú	__class__s      €r   rT   ÚPluginConfig.describe_parameterx   s1   ø€ ô ‘gÑ0°Ó@ˆØ (¨°VÑ)<Ð(=Ð>ˆ�FÑàÐr"   r*   )r   )r   Ústrr   r   r   r   )ÚreturnÚNone)rY   z#dict[Path, dict[str, RawParameter]])rY   zdict[str, tuple[str, ...]])rY   zdict[str, str])rY   zdict[str, Any])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   Úclassmethodr    r'   r/   ÚpropertyrD   rG   rP   rT   Ú__static_attributes__Ú__classcell__)rV   s   @r   r   r      sž   ø‡ ñð (*€O�_Ó)Ø35Ð Ó5ààIKð/Øð/Ø#,ð/Ø7Fô/ó ð/ð ó
&ó ð
&òð óó ðð4 óQó ðQô
÷
õ 
r"   r   N)r_   Ú
__future__r   Úcollectionsr   Úcollections.abcr   Útypingr   Úcommon.configurationr   r	   r
   Úpathlibr   r   r   r   r   r   r"   r   Ú<module>rk      s>   ðñõ #å #Ý #Ý  ÷ñ ö ÝÝç>ôd�=õ dr"   