%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/certbot/_internal/plugins/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/certbot/_internal/plugins/__pycache__/disco.cpython-312.pyc

�

M/�e,���dZddlZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlmZddlm
Z
dd
lmZddlmZddlmZddlmZddlmZddlmZej0dk\rddlmZnddlZej8e�Zej>ej@ejBgZ"	Gd�d�Z#Gd�de
�Z$y)z.Utilities for plugins discovery and selection.�N)�Callable)�cast)�Dict)�Iterable)�Iterator)�List)�Mapping)�Optional)�Type)�Union)�
configuration)�errors)�
interfaces)�	constants)�os)�Error)��
c���eZdZdZdZdejddfd�Zdee	de
fd�Zedejde	fd��Z
ede	fd	��Zede	fd
��Zede	fd��Zede
fd��Zd
eede
fd�Zede
fd��Zddeej0dej4fd�Zede
fd��Zdee
effd�Zede
fd��Z edee!fd��Z"ede
fd��Z#de	fd�Z$de	fd�Z%y)�PluginEntryPointzPlugin entry point.N�entry_point�returnc��|j|�|_|j�|_||_d|_d|_d|_y�N)�entry_point_to_plugin_name�name�load�
plugin_clsr�warning_message�_initialized�	_prepared)�selfrs  �A/usr/lib/python3/dist-packages/certbot/_internal/plugins/disco.py�__init__zPluginEntryPoint.__init__(sC���3�3�K�@��	�3>�3C�3C�3E���&���.2���9=���7;���rc�$�||jk(ryy)z(Check if the name refers to this plugin.TF�r�r"rs  r#�
check_namezPluginEntryPoint.check_name0s���4�9�9���r%c��|jS)z)Unique plugin name for an ``entry_point``r')�clsrs  r#rz+PluginEntryPoint.entry_point_to_plugin_name6s�����r%c�.�|jjS)zDescription of the plugin.)r�description�r"s r#r-zPluginEntryPoint.description;s�����*�*�*r%c�N�dj|j|j�S)z$Description with name. Handy for UI.z	{0} ({1}))�formatr-rr.s r#�description_with_namez&PluginEntryPoint.description_with_name@s!���!�!�$�"2�"2�D�I�I�>�>r%c�D�t|jd|j�S)zLong description of the plugin.�long_description)�getattrrr-r.s r#r3z!PluginEntryPoint.long_descriptionEs���t���(:�D�<L�<L�M�Mr%c�0�t|jdd�S)z%Should this plugin be hidden from UI?�hiddenF)r4rr.s r#r6zPluginEntryPoint.hiddenJs���t����%�8�8r%�
ifaces_groupsc�6��|xst�fd�|D��S)z1Does plugin implement specified interface groups?c3�F�K�|]}t�fd�|D�����y�w)c3�J�K�|]}t�j|����y�wr)�
issubclassr��.0�ifacer"s  �r#�	<genexpr>z4PluginEntryPoint.ifaces.<locals>.<genexpr>.<genexpr>Rs$�����%���4�?�?�E�2�%�s� #N)�all)r=�ifacesr"s  �r#r?z*PluginEntryPoint.ifaces.<locals>.<genexpr>Qs-�����()��
�%�#�%�
%�()�s�!)�any�r"r7s` r#rAzPluginEntryPoint.ifacesOs)��� � �)�C�()�(�()�%)�	)r%c��|jduS)z(Has the plugin been initialized already?N)r r.s r#�initializedzPluginEntryPoint.initializedVs��� � ��,�,r%�configc�t�|js!|j||j�|_|jS)zMemoized plugin initialization.)r rr)r"rFs  r#�initzPluginEntryPoint.init[s0��� � �!%�����	�	� B�D��� � � r%c�b�|jstjd|�|jduS)z%Has the plugin been prepared already?z$.prepared called on uninitialized %rN)rE�logger�debugr!r.s r#�preparedzPluginEntryPoint.preparedcs+������L�L�?��F��~�~�T�)�)r%c�F�|j�td��|j�"	|jj�d|_ttttf|j�S#tj
$r*}tjd||d��||_Yd}~�_d}~wtj$r*}tjd||d��||_Yd}~��d}~wtj$r*}tjd||d��||_Yd}~��d}~wwxYw)zMemoized plugin preparation.NzPlugin is not initialized.TzMisconfigured %r: %s)�exc_infozNo installation (%r): %szOther error:(%r): %s)r �
ValueErrorr!�preparer�MisconfigurationErrorrJrK�NoInstallationError�PluginErrorrr�boolr)r"�errors  r#rPzPluginEntryPoint.preparejs������$��9�:�:��>�>�!�

&��!�!�)�)�+�"&����E�$��+�&����7�7���/�/�
'����3�T�5�4��P�!&������-�-�
'����.��e�d��L�!&������%�%�
'����3�T�5�4��P�!&�����
'�s/�A-�-D � B%�%D �; C � D �6 D�D c�J�t|jtj�S)zIs plugin misconfigured?)�
isinstancer!rrQr.s r#�
misconfiguredzPluginEntryPoint.misconfigured�s���$�.�.�&�*F�*F�G�Gr%c�P�t|jt�r|jSy)zGReturn the Exception raised during plugin setup, or None if all is wellN)rWr!�	Exceptionr.s r#�problemzPluginEntryPoint.problem�s���d�n�n�i�0��>�>�!�r%c�:�|jduxs|jS)z4Is plugin available, i.e. prepared or misconfigured?T)r!rXr.s r#�	availablezPluginEntryPoint.available�s���~�~��%�;��);�);�;r%c�8�dj|j�S)NzPluginEntryPoint#{0})r0rr.s r#�__repr__zPluginEntryPoint.__repr__�s��%�,�,�T�Y�Y�7�7r%c���dj�j�dj�jj�djdj	�fd�t
D���dj�j�g}�jrh|jdj�j����jr.|jdj�j���d	j	|�S)
Nz* {0}zDescription: {0}zInterfaces: {0}z, c3�b�K�|]&}t�j|�r|j���(y�wr)r;r�__name__r<s  �r#r?z+PluginEntryPoint.__str__.<locals>.<genexpr>�s+�����/�#(��d�o�o�u�5����/�s�,/zEntry point: {0}zInitialized: {0}z	Prep: {0}�
)r0rrr-�join�PLUGIN_INTERFACESrrE�appendrHrLrP)r"�liness` r#�__str__zPluginEntryPoint.__str__�s�����N�N�4�9�9�%��%�%�d�o�o�&A�&A�B��$�$�T�Y�Y�/�,=�/�&�
�
�%�%�d�&6�&6�7�
������L�L�+�2�2�4�9�9�;�?�@��}�}����[�/�/�����?�@��y�y���r%r)&rb�
__module__�__qualname__�__doc__�__hash__�importlib_metadata�
EntryPointr$r
�strrTr)�classmethodr�propertyr-r1r3r6rrrArEr
�NamespaceConfigr�PluginrHrLrrrPrXrZr[r]r_rh�r%r#rr"s�����H�<�$6�$A�$A�<�d�<��x��}����� �5G�5R�5R� �WZ� �� ��+�S�+��+��?�s�?��?��N�#�N��N��9��9��9�)�X�d�^�)��)��-�T�-��-�!�8�M�$A�$A�B�!�j�N_�N_�!��*�$�*��*�8��t�U�{�+�8�,�H�t�H��H����)�,�����<�4�<��<�8�#�8� �� r%rc��eZdZdZdeeefddfd�Zedd��Z	ede
jdeeefddfd��Z
d	edefd
�Zdeefd�Zdefd�Zd
ej(deej.fd�Zdeegefddfd�Zdd�Zdeeddfd�Zdee ee!ffd�Z"dd�Z#dej.de$efd�Z%defd�Z&defd�Z'y)�PluginsRegistryzPlugins registry.�pluginsrNc�R�tt|j���|_yr)�dict�sorted�items�_plugins)r"rws  r#r$zPluginsRegistry.__init__�s��
�V�G�M�M�O�4�5��
r%c	��i}tjd�}|r|jd�ng}tjj|�t
tjtj���}t
tjtj���}||zD]}	|j||��||�S#t$r,}tjd|j �d|�d��|�d}~wwxYw)z+Find plugins using setuptools entry points.�CERTBOT_PLUGIN_PATH�:)�groupzThe 'z ' plugin errored while loading: z�. You may need to remove or update this plugin. The Certbot log will contain the full error details and this should be reported to the plugin developer.N)r�getenv�split�sys�path�extend�listrm�entry_pointsr�SETUPTOOLS_PLUGINS_ENTRY_POINT�"OLD_SETUPTOOLS_PLUGINS_ENTRY_POINT�_load_entry_pointrZrrS�module)r+rw�plugin_paths_string�plugin_pathsr��old_entry_pointsr�es        r#�find_allzPluginsRegistry.find_all�s��02�� �i�i�(=�>��9L�*�0�0��5�RT��������%��.�;�;��:�:�<�=��� 2� ?� ?��>�>�!@�A��'�*:�:�	0�K�
0��%�%�k�7�;�	0��7�|���
�
0��(�(��K�.�.�/�/O�PQ�s�S(�(�)�/0�	0��
0�s�/C�	D�'C;�;Drc��t|�}|j|vr�||j}|jj}|jj}|r|jj	�nd}|r|jj	�nd}tdj
|j||���t|jtj�r|||j<ytjd|�y)N�unknownz+Duplicate plugin name {0} from {1} and {2}.z)%r does not inherit from Plugin, skipping)
rrr�dist�lowerrZr0r;rrrsrJ�warning)	r+rrw�	plugin_ep�other_ep�plugin1_dist�plugin2_dist�plugin1�plugin2s	         r#r�z!PluginsRegistry._load_entry_point�s���%�[�1�	��>�>�W�$��y�~�~�.�H�$�0�0�5�5�L�#�/�/�4�4�L�3?�l�'�'�-�-�/�Y�G�3?�l�'�'�-�-�/�Y�G��I�P�P������2�3�
3��i�*�*�J�,=�,=�>�&/�G�I�N�N�#��N�N�;�Y�
Hr%rc� �|j|Sr)r|r(s  r#�__getitem__zPluginsRegistry.__getitem__�s���}�}�T�"�"r%c�,�t|j�Sr)�iterr|r.s r#�__iter__zPluginsRegistry.__iter__�s���D�M�M�"�"r%c�,�t|j�Sr)�lenr|r.s r#�__len__zPluginsRegistry.__len__�s���4�=�=�!�!r%rFc�z�|jj�D�cgc]}|j|���c}Scc}w)z'Initialize all plugins in the registry.)r|�valuesrH)r"rFr�s   r#rHzPluginsRegistry.init�s6���=�=�'�'�)�+�9�	���v�&�+�	+��+s�8�predc	��t|�|jj�D��cic]\}}||�r||��c}}�Scc}}w)z"Filter plugins based on predicate.)�typer|r{)r"r�rr�s    r#�filterzPluginsRegistry.filter�sP���t�D�z�"�m�m�1�1�3�H��t�Y�7;�I�� ��?�H�I�	I��Hs�A
c�&�|jd��S)z#Filter plugins based on visibility.c��|jSr)r6)r�s r#�<lambda>z)PluginsRegistry.visible.<locals>.<lambda>�s���1A�1A�-A�r%�r�r.s r#�visiblezPluginsRegistry.visible�s���{�{�A�B�Br%r7c�,��|j�fd��S)z#Filter plugins based on interfaces.c�"��|j��Sr)rA)�p_epr7s �r#r�z(PluginsRegistry.ifaces.<locals>.<lambda>�s�������]�(C�r%r�rCs `r#rAzPluginsRegistry.ifaces�s����{�{�C�D�Dr%c�x�|jj�D�cgc]}|j���c}Scc}w)z$Prepare all plugins in the registry.)r|r�rP)r"r�s  r#rPzPluginsRegistry.prepare�s,��59�]�]�5I�5I�5K�L�	�	�!�!�#�L�L��Ls�7c�&�|jd��S)z%Filter plugins based on availability.c��|jSr)r])r�s r#r�z+PluginsRegistry.available.<locals>.<lambda>�s
�����r%r�r.s r#r]zPluginsRegistry.available�s���{�{�6�7�7r%�pluginc���|jj�D�cgc]"}|jr|j�|ur|��$}}t	|�dksJ�|r|dSycc}w)aMFind an initialized plugin.

        This is particularly useful for finding a name for the plugin::

          # plugin is an instance providing Plugin, initialized
          # somewhere else in the code
          plugin_registry.find_init(plugin).name

        Returns ``None`` if ``plugin`` is not found in the registry.

        �rN)r|r�rErHr�)r"r�r��
candidatess    r#�	find_initzPluginsRegistry.find_init�so��26���1E�1E�1G�O�I�"�.�.�9�>�>�3C�v�3M� �O�
�O��:��!�#�#�#���a�=� ���Os�'Ac��dj|jjdjd�|jj�D���S)Nz{0}({1})�,c3�2K�|]}t|����y�wr)�repr�r=r�s  r#r?z+PluginsRegistry.__repr__.<locals>.<genexpr>s����.?�#��T�
�.?���)r0�	__class__rbrdr|r�r.s r#r_zPluginsRegistry.__repr__sI��� � ��N�N�#�#�S�X�X�.?�'+�}�}�';�';�'=�.?�&?�@�	@r%c�|�|jsydjd�|jj�D��S)Nz
No pluginsz

c3�2K�|]}t|����y�wr)ror�s  r#r?z*PluginsRegistry.__str__.<locals>.<genexpr>s����H��3�t�9�H�r�)r|rdr�r.s r#rhzPluginsRegistry.__str__s.���}�}���{�{�H����1E�1E�1G�H�H�Hr%)rrv)(rbrirjrkr	rorr$rpr�rmrnrr�r�rr��intr�r
rrrrrsrHrrTr�r�rrrArrrPr]r
r�r_rhrtr%r#rvrv�so���6���-=�(=� >�6�4�6�����,�H�,>�,I�,I�H�#'��-=�(=�#>�H�CG�H��H�$#��#�(8�#�#�(�3�-�#�"��"�+�=�8�8�+�T�*�BS�BS�=T�+�
I�8�%5�$6��$<�=�I�BS�I�
C�E�X�d�^�E�8I�E�M��e�D�%�K�0�1�M�8�
�
� 1� 1��h�?O�6P��(@�#�@�
I��Ir%rv)%rk�loggingr��typingrrrrrrr	r
rr�certbotr
rr�certbot._internalr�certbot.compatr�certbot.errorsr�version_info�importlib.metadata�metadatarm�	getLoggerrbrJ�
Authenticator�	Installerrsrerrvrtr%r#�<module>r�s���4��
�����������!���'�� ����w��3��	��	�	�8�	$�� �-�-�z�/C�/C�Z�EV�EV�W��B�B �B �JtI�g�tIr%

Zerion Mini Shell 1.0