%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/twisted/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/twisted/__pycache__/plugin.cpython-312.pyc

�

Ϫ�f!���dZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
mZmZddl
mZddlmZddlmZddlmZGd	�d
e�ZGd�d�ZGd
�d�Zd�Z	ej4Zd�Zdej:fd�Ze	de��Z	ddeedeej:deefd�Z e Z!d�Z"ddgZ#y#e$rdd�ZY�QwxYw)zL
Plugin system for Twisted.

@author: Jp Calderone
@author: Glyph Lefkowitz
�N)�Iterable�Optional�Type�TypeVar)�	Interface�
providedBy)�log)�getAdapterFactory)�	getModule)�namedAnyc��eZdZdZy)�IPluginz�
    Interface that must be implemented by all plugins.

    Only objects which implement this interface will be considered for return
    by C{getPlugins}.  To be useful, plugins should also implement some other
    application-specific interface.
    N)�__name__�
__module__�__qualname__�__doc__���0/usr/lib/python3/dist-packages/twisted/plugin.pyrrs��rrc�0�eZdZd�Zdefd�Zd�Zdd�ZeZy)�CachedPluginc��||_||_||_||_|jjj|�y�N)�dropin�name�description�provided�plugins�append)�selfrrrrs     r�__init__zCachedPlugin.__init__'s7�������	�&��� ��
������"�"�4�(r�returnc
���dj|j|jjdj	|j
D�cgc]}|j��c}��Scc}w)Nz(<CachedPlugin {!r}/{!r} (provides {!r})>z, )�formatrr�
moduleName�joinrr)r �is  r�__repr__zCachedPlugin.__repr__.sM��9�@�@��I�I��K�K�"�"��I�I�4�=�=�9�a�q�z�z�9�:�
�	
��:s�A#c�`�t|jjdz|jz�S)N�.)rrr%r)r s r�loadzCachedPlugin.load5s%������.�.��4�t�y�y�@�A�ArNc��|jD]K}|j|�r|j�cSt||d���4||j�|�cS|Sr)r�isOrExtendsr+r
)r �	interface�registry�default�providedInterfaces     r�__conform__zCachedPlugin.__conform__8sZ��!%���	7�� �,�,�Y�7��y�y�{�"� �!2�I�t�D�P� �����g�6�6�		7�
�r)NN)	rrrr!�strr(r+r2�getComponentrrrrr&s%��)�
�#�
�B���Lrrc��eZdZdZd�Zy)�CachedDropina�
    A collection of L{CachedPlugin} instances from a particular module in a
    plugin package.

    @type moduleName: C{str}
    @ivar moduleName: The fully qualified name of the plugin module this
        represents.

    @type description: C{str} or L{None}
    @ivar description: A brief explanation of this collection of plugins
        (probably the plugin module's docstring).

    @type plugins: C{list}
    @ivar plugins: The L{CachedPlugin} instances which were loaded from this
        dropin.
    c�.�||_||_g|_yr)r%rr)r r%rs   rr!zCachedDropin.__init__Vs��$���&�����rN)rrrrr!rrrr6r6Ds���"rr6c��t|j|j�}|jj	�D]>\}}t|d�}|��t
|||jtt|����@|Sr)	r6rr�__dict__�itemsrr�listr)�providerr�k�v�plugins     r�_generateCacheEntryr@\ss��
�(�+�+�X�-=�-=�
>�F��!�!�'�'�)�I���1���D�!�������A�I�I�t�J�v�4F�/G�H�	I�
�Mrc�"�i}|D]}|||<�	|Srr)�keys�value�dr=s    r�fromkeysrEjs$�����	�A��A�a�D�	��rc��i}t|j�}i}|j�D];}|jj	�}||vrg||<||}|j|��=|j
�D�]*\}}|jd�}	|j�}	|jd�5}
tj|
�}ddd�d}i}
|D]j}|jjd�d}d|
|<|vs|jj�|	k\s�Hd}	|j�}t|�}|||<�lt%j'��D]}||
vs�||=d}�|r%	|j)tj*|��|j5|���-|S#1swY��xYw#t$ri}d}	Y��wxYw#t$rt!j"�Y��wxYw#t,$r6}t!j.d	|j0|j2�
�Yd}~��d}~wt$rt!j"dd�Y��wxYw)a;
    Compute all the possible loadable plugins, while loading as few as
    possible and hitting the filesystem as little as possible.

    @param module: a Python module object.  This represents a package to search
    for plugins.

    @return: a dictionary mapping module names to L{CachedDropin} instances.
    zdropin.cache�rNrFr*���Tz@Unable to write to plugin cache %(path)s: error number %(errno)d)r$�path�errnoz)Unexpected error while writing cache file)rr�iterModules�filePath�parentrr:�child�getModificationTime�open�pickler+�
BaseExceptionr�splitr@r	�errr;rB�
setContent�dumps�OSError�msgrIrJ�update)�module�allCachesCombined�mod�buckets�plugmod�fpp�bucket�pseudoPackagePath�
dropinPath�
lastCached�f�dropinDotCache�
needsWrite�existingKeys�pluginModule�	pluginKeyr<�entry�es                   r�getCacherlqs`����
�F�O�O�
$�C��G��?�?�$������%�%�'���g���G�C�L������
�
�g���&-�]�]�_�.1�!��6�&�,�,�^�<�
�	�#�7�7�9�J�����%�
0��!'���Q���
0��
���"�	6�L�$�)�)�/�/��4�R�8�I�&*�L��#���/��%�%�9�9�;�z�I�!�
�6�+�0�0�2�H�
0��9�E�05�N�9�-�	6� �n�1�1�3�4�	"�I���,�"�9�-�!�
�	"��
K��%�%�f�l�l�>�&B�C�	� � ��0�].1�^��W
0�
0���	��N��J�	��%���G�G�I����
����+�$����'�'�
���!�
K�����I�J�
K�sZ�!F4�2F(�F4�!G�.$G+�(F1	�-F4�4
G�G�G(�'G(�+	I
�4,H%�%"I
�	I
r"c��ddlm}|S)Nr)�twisted.pluginsr)�packages r�_pluginsPackagerp�s
��%��Nr�_TInterface)�boundr.roc#��K�|�
t�}t|�}|j�D]'\}}|jD]}	||d�}|��|����)y#t$rtj�Y�8wxYw�w)ac
    Retrieve all plugins implementing the given interface beneath the given module.

    @param interface: An interface class.  Only plugins which implement this
    interface will be returned.

    @param package: A package beneath which plugins are installed.  For
    most uses, the default value is correct.

    @return: An iterator of plugins.
    N)rprlr:rrRr	rT)r.ro�
allDropins�keyrr?�adapteds       r�
getPluginsrw�s�������!�#���'�"�J�!�'�'�)�"���V��n�n�	"�F�
"�#�F�D�1���&�!�M�	"�"��!�
����	�
�s/�=A8�	A�	A8�	A8�A5�2A8�4A5�5A8c
�b�|jd�}tjD�cgc]�}tjj	tjj
|g|dgz����s=tjj
tjj
|g|�������c}Scc}w)a�
    Return a list of additional directories which should be searched for
    modules to be included as part of the named plugin package.

    @type name: C{str}
    @param name: The fully-qualified Python name of a plugin package, eg
        C{'twisted.plugins'}.

    @rtype: C{list} of C{str}
    @return: The absolute paths to other directories which may contain plugin
        modules for the named plugin package.
    r*z__init__.py)rS�sysrI�os�existsr&�abspath)rro�xs   r�pluginPackagePathsr~�s���j�j��o�G�����
��w�w�~�~�b�g�g�l�l�1�I�w�-��/H�I�J�	����������Q�1��1�2����s�BB,rwr~r)$rrzrQry�types�typingrrrr�zope.interfacerr�twisted.pythonr	�twisted.python.componentsr
�twisted.python.modulesr�twisted.python.reflectrrrr6r@�dictrE�AttributeErrorrl�
ModuleTyperprqrw�
getPlugInsr~�__all__rrr�<module>r�s����
�
�
��4�4�0��7�,�+��i����<��0���}�}�H�I�X��)�)���m�9�5��IM�"��K� �"�+3�E�4D�4D�+E�"�
�k��"�:�
��<�-�
.���y����s�"B4�4	C�?C

Zerion Mini Shell 1.0