Your IP : 18.224.15.154
�
��bgP��V�dZddlmZddlZddlZddlZddlmZddlm Z ddlm
Z
ddlmZddlmZdd lm
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZerddlmZddlmZed��Zededef���ZeeefZeZ ee!edee!efe"geee
effZ#edeeedeedfffZ$erGd�de��Z%Gd�de��Z&Gd�d ��Z'Gd!�d"��Z(d5d&�Z)e*ed'��Z+d6d+�Z,Gd,�d-��Z-e
eee!efeee
gdffZ.Gd.�d/��Z/Gd0�d1e/��Z0Gd2�d��Z1Gd3�d4��Z2dS)7zA
Internal hook annotation, representation and calling machinery.
�)�annotationsN)�
ModuleType)�AbstractSet)�Any)�Callable)� Generator)�List)�Mapping)�Optional)�overload)�Sequence)�Tuple)�
TYPE_CHECKING)�TypeVar)�Union�)�_Result)� TypedDict)�Final�_T�_F.)�bound�HookImplc�.�eZdZUded<ded<ded<dS)�
_HookSpecOpts�bool�firstresult�historic�Warning | None�warn_on_implN��__name__�
__module__�__qualname__�__annotations__���^/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pluggy/_hooks.pyrr*s3���������������$�$�$�$�$�$r'rc�L�eZdZUded<ded<ded<ded<ded<ded<d S)
�
_HookImplOptsr�wrapper�hookwrapper�optionalhook�tryfirst�trylast�
str | None�specnameNr!r&r'r(r*r*/sQ��������
�
�
��������������
�
�
������r'r*c�r�eZdZdZdZdd�Ze ddd���Ze ddd���Z ddd�Zd S)�HookspecMarkeraDecorator for marking functions as hook specifications.
Instantiate it with a project_name to get a decorator.
Calling :meth:`PluginManager.add_hookspecs` later will discover all marked
functions if the :class:`PluginManager` uses the same project_name.
��project_namer5�str�return�Nonec��||_dS�Nr4��selfr5s r(�__init__zHookspecMarker.__init__B���#/����r'FN�functionrrrrr rc��dSr:r&�r<r?rrr s r(�__call__zHookspecMarker.__call__E� �� �r'.�Callable[[_F], _F]c��dSr:r&rAs r(rBzHookspecMarker.__call__OrCr'� _F | None�_F | Callable[[_F], _F]c�:�����d����fd�}|�||��S|S)a�If passed a function, directly sets attributes on the function
which will make it discoverable to :meth:`PluginManager.add_hookspecs`.
If passed no function, returns a decorator which can be applied to a
function later using the attributes supplied.
If ``firstresult`` is ``True``, the 1:N hook call (N being the number of
registered hook implementation functions) will stop at I<=N when the
I'th function returns a non-``None`` result.
If ``historic`` is ``True``, every call to the hook will be memorized
and replayed on plugins registered after the call was made.
�funcrr7c�l���r�rtd������d�}t|�jdz|��|S)Nz'cannot have a historic firstresult hook)rrr �_spec)�
ValueError�setattrr5)rI�optsrrr<r s ����r(�setattr_hookspec_optsz6HookspecMarker.__call__.<locals>.setattr_hookspec_optsnsY����
L�K�
L� �!J�K�K�K�*�$� ,�#�#�D�
�D�$�+�g�5�t�<�<�<��Kr'N�rIrr7rr&)r<r?rrr rOs` ``` r(rBzHookspecMarker.__call__YsR������* � � � � � � � � ���(�(��2�2�2�(�(r'�r5r6r7r8)FFN)
r?rrrrrr rr7r)....)
r?r8rrrrr rr7rD)NFFN)
r?rFrrrrr rr7rG�r"r#r$�__doc__� __slots__r=rrBr&r'r(r3r38s���������"�I�0�0�0�0��"��'+������X������'*������X��#�!��'+�#)�#)�#)�#)�#)�#)�#)r'r3c��eZdZdZdZdd�Ze ddd���Ze ddd���Z d d!d�ZdS)"�HookimplMarkeraDecorator for marking functions as hook implementations.
Instantiate it with a ``project_name`` to get a decorator.
Calling :meth:`PluginManager.register` later will discover all marked
functions if the :class:`PluginManager` uses the same project_name.
r4r5r6r7r8c��||_dSr:r4r;s r(r=zHookimplMarker.__init__�r>r'.r?rr,rr-r.r/r1r0r+c��dSr:r&�r<r?r,r-r.r/r1r+s r(rBzHookimplMarker.__call__�� �� �r'rDc��dSr:r&rYs r(rBzHookimplMarker.__call__�rZr'NFrFrGc�F��������d�������fd�}|�|S||��S)a�If passed a function, directly sets attributes on the function
which will make it discoverable to :meth:`PluginManager.register`.
If passed no function, returns a decorator which can be applied to a
function later using the attributes supplied.
If ``optionalhook`` is ``True``, a missing matching hook specification
will not result in an error (by default it is an error if no matching
spec is found).
If ``tryfirst`` is ``True``, this hook implementation will run as early
as possible in the chain of N hook implementations for a specification.
If ``trylast`` is ``True``, this hook implementation will run as late as
possible in the chain of N hook implementations.
If ``wrapper`` is ``True``("new-style hook wrapper"), the hook
implementation needs to execute exactly one ``yield``. The code before
the ``yield`` is run early before any non-hook-wrapper function is run.
The code after the ``yield`` is run after all non-hook-wrapper functions
have run. The ``yield`` receives the result value of the inner calls, or
raises the exception of inner calls (including earlier hook wrapper
calls). The return value of the function becomes the return value of the
hook, and a raised exception becomes the exception of the hook.
If ``hookwrapper`` is ``True`` ("old-style hook wrapper"), the hook
implementation needs to execute exactly one ``yield``. The code before
the ``yield`` is run early before any non-hook-wrapper function is run.
The code after the ``yield`` is run after all non-hook-wrapper function
have run The ``yield`` receives a :class:`_Result` object representing
the exception or result outcome of the inner calls (including earlier
hook wrapper calls). This option is mutually exclusive with ``wrapper``.
If ``specname`` is provided, it will be used instead of the function
name when matching this hook implementation to a hook specification
during registration.
.. versionadded:: 1.2.0
The ``wrapper`` parameter.
rIrr7c�L��������d�}t|�jdz|��|S)N)r+r,r-r.r/r1�_impl)rMr5) rIrNr,r-r<r1r.r/r+s �������r(�setattr_hookimpl_optsz6HookimplMarker.__call__.<locals>.setattr_hookimpl_opts�sB���"�*� ,�$�"�$�
#�#�D�
�D�$�+�g�5�t�<�<�<��Kr'NrPr&) r<r?r,r-r.r/r1r+r_s ` `````` r(rBzHookimplMarker.__call__�se���������f
�
�
�
�
�
�
�
�
�
�
�
���(�(�(�(��2�2�2r'rQ)......)r?rr,rr-rr.rr/rr1r0r+rr7r).......)r?r8r,rr-rr.rr/rr1r0r+rr7rD)NFFFFNF)r?rFr,rr-rr.rr/rr1r0r+rr7rGrRr&r'r(rVrVs���������"�I�0�0�0�0�� � ���"��
�
�
�
��X�
���� ���"��
�
�
�
��X�
�#�!�"���#��B3�B3�B3�B3�B3�B3�B3r'rVrNr7r8c��|�dd��|�dd��|�dd��|�dd��|�dd��|�dd��dS)Nr.Fr/r+r,r-r1)�
setdefault)rNs r(�normalize_hookimpl_optsrb�s����O�O�J��&�&�&��O�O�I�u�%�%�%��O�O�I�u�%�%�%��O�O�M�5�)�)�)��O�O�N�E�*�*�*��O�O�J��%�%�%�%�%r'�pypy_version_inforI�object�'tuple[tuple[str, ...], tuple[str, ...]]c�d� �tj|��r |j}nI#t$rYdSwxYwtj|��s$ t|d|��}n#t$rYdSwxYw tjtj|��r|j n|��}n#t$rYdSwxYwtjjtjj
f� � fd�|j���D��}t!|��}t!d�|���D����pd}|r2t%|��}|d|�t!||d���}}nd}t&sd}nd}|r=t|d d
��}tj|��sd|vr|d|vr
|d
d�}||fS)z�Return tuple of positional and keywrord argument names for a function,
method, class or callable.
In case of a class, its ``__init__`` method is considered.
For methods the ``self`` parameter is not included.
)r&r&rBc�.��i|]\}}|j�v�||��Sr&)�kind)�.0�name�param�_valid_param_kindss �r(�
<dictcomp>zvarnames.<locals>.<dictcomp>s7�������D�%��:�+�+�+�
�e�+�+�+r'c3�@K�|]}|j|ju�|jV��dSr:)�default�empty)rirks r(� <genexpr>zvarnames.<locals>.<genexpr>s?����
�
���}�E�K�/�/�
�M�/�/�/�/�
�
r'Nr&�r<)r<�objr$��.rr)�inspect�isclassr=�AttributeError� isroutine�getattr� Exception� signature�ismethod�__func__� TypeError� Parameter�POSITIONAL_ONLY�POSITIONAL_OR_KEYWORD�
parameters�items�tuple�values�len�_PYPY)
rI�sig�
_valid_params�args�defaults�index�kwargs�implicit_names�qualnamerls
@r(�varnamesr��s=�����t��� � ��=�D�D��� � � ��6�6� ����
�
�t�
$�
$�� ��4��T�2�2�D�D��� � � ��6�6� �������$�-�d�3�3�=�D�M�M��
�
���������v�v����� ��)���/��������>�/�/�1�1����M�
����D�
�
�
�&�-�-�/�/�
�
�
�
�
� �
�
����X������F�U�F�|�U�4����<�%8�%8�f������)�*3���(������n�b�9�9����D�!�!� �c�X�o�o�$�q�'�^�:S�:S�����8�D���<�s0��
-�-�A�
A%�$A%�)/B�
B'�&B'c�&�eZdZdZdZerd d�ZdSdS)
�
_HookRelayzaHook holder object for performing 1:N hook calls where N is the number
of registered plugins.)�__dict__rjr6r7�_HookCallerc��dSr:r&)r<rjs r(�__getattr__z_HookRelay.__getattr__@s���Cr'N)rjr6r7r�)r"r#r$rSrTrr�r&r'r(r�r�8sK���������I��� � � � � � ��r'r�c��eZdZdZ d,d-d
�Zd.d�Zd/d�Zd.d�Zd0d�Zd1d�Z d2d�Z
d3d�Zd4d�Zd5d"�Z
d,d6d&�Zd7d)�Zd8d+�ZdS)9r�)rj�spec� _hookexec�
_hookimpls�
_call_historyNrjr6�hook_execute� _HookExec�specmodule_or_class�_Namespace | None� spec_opts�_HookSpecOpts | Noner7r8c��||_||_g|_d|_d|_|�|�J�|�||��dSdSr:)rjr�r�r�r��set_specification)r<rjr�r�r�s r(r=z_HookCaller.__init__Ps_�� �� � ,���13���26���%)�� ��*��(�(�(��"�"�#6� �B�B�B�B�B�+�*r'rc��|jduSr:)r�rrs r(�has_specz_HookCaller.has_spec`s���y��$�$r'�
_Namespacerc���|j�)td|jj�d|jj�����t ||j|��|_|�d��r g|_dSdS)NzHook z( is already registered within namespace r)r�rLrj� namespace�HookSpec�getr�)r<r�r�s r(r�z_HookCaller.set_specificationcs���
�9� ��:�� ��:�:�$(�I�$7�:�:���
��0�$�)�Y�G�G�� ��=�=��$�$� $�!#�D���� $� $r'c��|jduSr:)r�rrs r(�is_historicz_HookCaller.is_historicqs���!��-�-r'�plugin�_Pluginc��t|j��D]\}}|j|kr|j|=dS�td|�d����)Nzplugin z
not found)� enumerater�r�rL)r<r��i�methods r(�_remove_pluginz_HookCaller._remove_plugints^��"�4�?�3�3� � �I�A�v��}��&�&��O�A�&����'��7�6�7�7�7�8�8�8r'�list[HookImpl]c�4�|j���Sr:)r��copyrrs r(�
get_hookimplsz_HookCaller.get_hookimpls{s����#�#�%�%�%r'�hookimplrc��t|j��D]\}}|js|jr|}n�t |j��}|js|jr|t |j��}}nd|}}|jr|j�||��dS|jr|j�||��dS|dz
}||kr/|j|jr|dz}||kr|j|j�|j�|dz|��dS)z,Add an implementation to the callback chain.rrN)r�r�r,r+r�r/�insertr.)r<r�r�r��
splitpoint�start�ends r(�
_add_hookimplz_HookCaller._add_hookimpl~s>��"�4�?�3�3� .� .�I�A�v��!�
�V�^�
��
���
��T�_�-�-�J��� '�8�#3� '�#�S���%9�%9�3�E�E��J�3�E��� 4��O�"�"�5�(�3�3�3�3�3�
�
� 4��O�"�"�3��1�1�1�1�1��a��A��u�*�*����!3�!<�*��Q����u�*�*����!3�!<�*��O�"�"�1�q�5�(�3�3�3�3�3r'c��d|j�d�S)Nz
<_HookCaller �>�rjrrs r(�__repr__z_HookCaller.__repr__�s��-�t�y�-�-�-�-r'r��Mapping[str, object]c����|jrj|jjD]_}|�vrWd��fd�|jjD����}tjd�|��d���dS�^dSdS)Nz, c3�b�K�|])}|����v�t|��V��*dSr:)�keys�repr)ri�argnamer�s �r(rqz<_HookCaller._verify_all_args_are_provided.<locals>.<genexpr>�sJ�����*�*�#�"�&�+�+�-�-�7�7��W�
�
�8�7�7�7� *�*r'zSArgument(s) {} which are declared in the hookspec cannot be found in this hook call�)�
stacklevel)r��argnames�join�warnings�warn�format)r<r�r�� notincalls ` r(�_verify_all_args_are_providedz)_HookCaller._verify_all_args_are_provided�s�����9� ��9�-�
�
���&�(�(� $� � �*�*�*�*�'+�y�'9�*�*�*�!�!�I��M�<�<B�F�9�<M�<M�#$�����
�E�E�)� � �
�
r'rdrc��|���r
Jd���|�|��|jr |jj�dd��nd}|�|j|j||��S)N�ACannot directly call a historic hook - use call_historic instead.rF)r�r�r�rNr�r�rjr�)r<r�rs r(rBz_HookCaller.__call__�s���� � �"�"� O� O�N� O� O�"��*�*�6�2�2�2�BF�)�V�d�i�n�(�(���>�>�>�QV���~�~�d�i���&�+�N�N�Nr'�result_callback�Callable[[Any], None] | None�Mapping[str, object] | Nonec��|j�J�|pi}|�|��|j�||f��|�|j|j|d��}|�dSt
|t��r|D]}||���dSdS)aCall the hook with given ``kwargs`` for all registered plugins and
for all plugins which will be registered afterwards.
If ``result_callback`` is provided, it will be called for each
non-``None`` result obtained from a hook implementation.
NF)r�r��appendr�rjr��
isinstance�list)r<r�r��res�xs r(�
call_historicz_HookCaller.call_historic�s����!�-�-�-���2���*�*�6�2�2�2���!�!�6�?�";�<�<�<��n�n�T�Y�����G�G���"��F��c�4� � � #��
#�
#�����"�"�"�"� #� #�
#�
#r'�methods�Sequence[Callable[..., object]]c�z�|���r
Jd���|�|��ddddddd�}|j���}|D]�}t dd||��}t|��dz
}|dkrY||jrL||js?||js2|dz}|dkr'||jr||js
||j�2|� |dz|����|j
r |j
j�dd��nd}|�
|j|||��S) zCall the hook with some additional temporarily participating
methods using the specified ``kwargs`` as call parameters.r�FN)r+r,r-r/r.r1z<temp>rrr)r�r�r�r�rr�r.r,r+r�r�rNr�r�rj) r<r�r�rN� hookimplsr�r�r�rs r(�
call_extraz_HookCaller.call_extra�s���� � �"�"� O� O�N� O� O�"��*�*�6�2�2�2�� �!����
�
���O�(�(�*�*� ��
.�
.�F���h���=�=�H��I����"�A��Q����a�L�)��"�1��1��5>�q�\�5I���Q��� �Q����a�L�)��"�1��1��5>�q�\�5I��
���Q��U�H�-�-�-�-�BF�)�V�d�i�n�(�(���>�>�>�QV���~�~�d�i��F�K�H�H�Hr'r�c���|���r`|j�J�|jD]Q\}}|�|j|g|d��}|r*|�(t |t
��sJ�||d���PdSdS)zAApply call history to a new hookimpl if it is marked as historic.NFr)r�r�r�rjr�r�)r<r�r�r�r�s r(�_maybe_apply_historyz _HookCaller._maybe_apply_history�s�������� ,��%�1�1�1�+/�+=�
,�
,�'����n�n�T�Y���&�%�H�H���,�?�6�%�c�4�0�0�0�0�0�#�O�C��F�+�+�+�� ,� ,�
,�
,r')NN)
rjr6r�r�r�r�r�r�r7r8)r7r)r�r�r�rr7r8)r�r�r7r8�r7r�)r�rr7r8�r7r6)r�r�r7r8)r�rdr7r)r�r�r�r�r7r8)r�r�r�r�r7r)r�rr7r8)r"r#r$rTr=r�r�r�r�r�r�r�r�rBr�r�r�r&r'r(r�r�GsG�������I�26�*.�C�C�C�C�C� %�%�%�%�$�$�$�$�.�.�.�.�9�9�9�9�&�&�&�&�4�4�4�4�0.�.�.�.�����$O�O�O�O�9=�.2�#�#�#�#�#�0I�I�I�I�@ ,� ,� ,� ,� ,� ,r'r�c�n�eZdZdZdZdd �Zedd���Zedd
���Zedd���Z dd�Z
dS)�_SubsetHookCallerztA proxy to another HookCaller which manages calls to all registered
plugins except the ones from remove_plugins.)�_orig�_remove_plugins�origr��remove_plugins�AbstractSet[_Plugin]r7r8c�R�||_||_|j|_|j|_dSr:)r�r�rjr�)r<r�r�s r(r=z_SubsetHookCaller.__init__
s'����
�-����I�� ������r'r�c�4���fd��jjD��S)Nc�0��g|]}|j�jv�|��Sr&)r�r�)ri�implr<s �r(�
<listcomp>z0_SubsetHookCaller._hookimpls.<locals>.<listcomp>s3���
�
�
���{�$�"6�6�6�
�6�6�6r')r�r�rrs`r(r�z_SubsetHookCaller._hookimplss3���
�
�
�
��
�-�
�
�
�
r'�HookSpec | Nonec��|jjSr:)r�r�rrs r(r�z_SubsetHookCaller.specs���z��r'�_CallHistory | Nonec��|jjSr:)r�r�rrs r(r�z_SubsetHookCaller._call_historys
���z�'�'r'r6c��d|j�d�S)Nz<_SubsetHookCaller r�r�rrs r(r�z_SubsetHookCaller.__repr__ s��3�T�Y�3�3�3�3r'N)r�r�r�r�r7r8r�)r7r�)r7r�r�)r"r#r$rSrTr=�propertyr�r�r�r�r&r'r(r�r��s�������4�4��I�
(�(�(�(��
�
�
��X�
������X���(�(�(��X�(�4�4�4�4�4�4r'r�c�"�eZdZdZdd�Zdd
�ZdS)r)r?r��
kwargnamesr�rN�plugin_namer+r,r-r.r/r�r�r�r6r?�_HookImplFunction[object]�hook_impl_optsr*r7r8c��||_t|j��\|_|_||_||_||_|d|_|d|_|d|_ |d|_
|d|_dS)Nr+r,r-r.r/)r?r�r�r�r�rNr�r+r,r-r.r/)r<r�r�r?r�s r(r=zHookImpl.__init__3s{�� (��
�)1�$�-�)@�)@�&��
�t�����"�� �&���%�i�0���)�-�8���*�>�:���&�z�2��
�%�i�0����r'c�(�d|j�d|j�d�S)Nz<HookImpl plugin_name=z , plugin=r�)r�r�rrs r(r�zHookImpl.__repr__Es ��U��(8�U�U�T�[�U�U�U�Ur'N)
r�r�r�r6r?r�r�r*r7r8r�)r"r#r$rTr=r�r&r'r(rr$sI�������I�1�1�1�1�$V�V�V�V�V�Vr'c��eZdZdZdd
�ZdS)
r�)r�r?rjr�r�rNr r�r�rjr6rNrr7r8c���||_t||��|_||_t |j��\|_|_||_|�d��|_ dS)Nr )
r�rzr?rjr�r�r�rNr�r )r<r�rjrNs r(r=zHookSpec.__init__TsZ��"���/6�y�$�/G�/G��
��� �)1�$�-�)@�)@�&��
�t���� � �H�H�^�4�4����r'N)r�r�rjr6rNrr7r8)r"r#r$rTr=r&r'r(r�r�Is/�������I�5�5�5�5�5�5r'r�)rNr*r7r8)rIrdr7re)3rS�
__future__rrv�sysr��typesr�typingrrrrr r
rrr
rrrr�_resultr�typing_extensionsrrrrdr�typer�r�r6rr��_HookImplFunctionrr*r3rVrb�hasattrr�r�r��_CallHistoryr�r�rr�r&r'r(�<module>r
s/����#�"�"�"�"�"�����
�
�
�
����������������������������������������������������������������������� � � � � � ��������������������(�+�+�+�+�+�+�'�'�'�'�'�'�
�W�T�]�]���W�T��#�v�+�.�/�/�/��
�:�t�#�
$�
�
����(�:�
���V�� 4�d�;� �&�$�v�,�
��!�
� ��S�%��I�d�G�B�K��6M�,N�(N�"O�O�P���
�%�%�%�%�%� �%�%�%�
����� ����D)�D)�D)�D)�D)�D)�D)�D)�Ni3�i3�i3�i3�i3�i3�i3�i3�X&�&�&�&� ���(�)�)��>�>�>�>�B � � � � � � � ��E�'�#�v�+�.���3�%��+�9N�0O�O�P�Q��m,�m,�m,�m,�m,�m,�m,�m,�`*4�*4�*4�*4�*4��*4�*4�*4�Z"V�"V�"V�"V�"V�"V�"V�"V�J5�5�5�5�5�5�5�5�5�5r'
?>