403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/zmq/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/zmq/__pycache__/decorators.cpython-311.pyc
�

mc�c����dZdZddlmZddlZGd�d��ZGd�de��ZGd	�d
e��Zd�Zd�Z	dS)
aiDecorators for running functions with context/sockets.

.. versionadded:: 15.3

Like using Contexts and Sockets as context managers, but with decorator syntax.
Context and sockets are closed at the end of the function.

For example::

    from zmq.decorators import context, socket
    
    @context()
    @socket(zmq.PUSH)
    def work(ctx, push):
        ...
)�context�socket���wrapsNc�,�eZdZdZdd�Zd�Zd�Zd�ZdS)�
_DecoratorzThe mini decorator factoryNc��||_dS�N��_target)�self�targets  �0/usr/lib/python3/dist-packages/zmq/decorators.py�__init__z_Decorator.__init__"s
�������c�@������j�i���\�������fd�}|S)a�
        The main logic of decorator

        Here is how those arguments works::

            @out_decorator(*dec_args, *dec_kwargs)
            def func(*wrap_args, **wrap_kwargs):
                ...

        And in the ``wrapper``, we simply create ``self.target`` instance via
        ``with``::

            target = self.get_target(*args, **kwargs)
            with target(*dec_args, **dec_kwargs) as obj:
                ...

        c�F���t��������fd���}|S)Nc�����j|i|��}|�i���5}�r
�|vr||�<n4�r,�|vr(td��j������||fz}�|i|��cddd��S#1swxYwYdS)Nz*{}() got multiple values for argument '{}')�
get_target�	TypeError�format�__name__)	�args�kwargsr�obj�dec_args�
dec_kwargs�func�kw_namer
s	    �����r�wrapperz7_Decorator.__call__.<locals>.decorator.<locals>.wrapper<s���(���$�9�&�9�9���V�X�4��4�4�1���-�7�&�#8�#8�*-��w��� �-�W��%6�%6�'�-�-3�V�D�M�7�-K�-K����
 $�s�f�}���4��0��0�0�1�1�1�1�1�1�1�1�1�1�1�1����1�1�1�1�1�1s�AA,�,A0�3A0r)rr rrrr
s` ����r�	decoratorz&_Decorator.__call__.<locals>.decorator;sH����
�4�[�[�
1�
1�
1�
1�
1�
1�
1�
1��[�
1�"�Nr)�process_decorator_args)r
rrr!rs``` @r�__call__z_Decorator.__call__%s_������$)D��(C�
�)
�#�)
�)
�%���:�	�	�	�	�	�	�	�	�*�rc��|jS)zWReturn the target function

        Allows modifying args/kwargs to be passed.
        r)r
rrs   rrz_Decorator.get_targetRs��
�|�rc��d}t|�d��t��r|�d��}n@t	|��dkr-t|dt��r|d}|dd�}|||fS)z�Process args passed to the decorator.

        args not consumed by the decorator will be passed to the target factory
        (Context/Socket constructor).
        N�name�r)�
isinstance�get�str�pop�len)r
rrrs    rr"z!_Decorator.process_decorator_argsYs~�����f�j�j��(�(�#�.�.�	��j�j��(�(�G�G�
��Y�Y�!�^�^�
�4��7�C� 8� 8�^��1�g�G�����8�D���f�$�$rr
)r�
__module__�__qualname__�__doc__rr#rr"�rrrrs\������$�$�����+�+�+�Z���%�%�%�%�%rrc�"��eZdZdZ�fd�Z�xZS)�_ContextDecoratorzDecorator subclass for Contextsc�^��t���tj��dSr
)�superr�zmq�Context)r
�	__class__s �rrz_ContextDecorator.__init__ms#���
�������%�%�%�%�%r)rr-r.r/r�
__classcell__�r7s@rr2r2js>�������)�)�&�&�&�&�&�&�&�&�&rr2c�.��eZdZdZ�fd�Zd�Zd�Z�xZS)�_SocketDecoratorzJDecorator subclass for sockets

    Gets the context from other args.
    c�~��t��j|i|��\}}}|�dd��|_|||fS)z$Also grab context_name out of kwargs�context_namer)r4r"r+r=)r
rrrr7s    �rr"z'_SocketDecorator.process_decorator_argswsH��� >���� >�� O�� O� O����v�"�J�J�~�y�A�A�����f�$�$rc�*�|j|i|��}|jS)z$Get context, based on call-time args)�_get_contextr)r
rrrs    rrz_SocketDecorator.get_target}s!��#�$�#�T�4�V�4�4���~�rc���|j|vr)||j}t|tj��r|S|D] }t|tj��r|cS�!tj���S)a�
        Find the ``zmq.Context`` from ``args`` and ``kwargs`` at call time.

        First, if there is an keyword argument named ``context`` and it is a
        ``zmq.Context`` instance , we will take it.

        Second, we check all the ``args``, take the first ``zmq.Context``
        instance.

        Finally, we will provide default Context -- ``zmq.Context.instance``

        :return: a ``zmq.Context`` instance
        )r=r(r5r6�instance)r
rr�ctx�args     rr?z_SocketDecorator._get_context�s�����&�&���*�+�C��#�s�{�+�+�
��
��	�	�C��#�s�{�+�+�
��
�
�
�
��{�#�#�%�%�%r)rr-r.r/r"rr?r8r9s@rr;r;qs`���������
%�%�%�%�%����
&�&�&�&�&�&�&rr;c�*�t��|i|��S)z�Decorator for adding a Context to a function.

    Usage::

        @context()
        def foo(ctx):
            ...

    .. versionadded:: 15.3

    :param str name: the keyword argument passed to decorated function
    )r2�rrs  rrr�s �������/��/�/�/rc�*�t��|i|��S)aSDecorator for adding a socket to a function.

    Usage::

        @socket(zmq.PUSH)
        def foo(push):
            ...

    .. versionadded:: 15.3

    :param str name: the keyword argument passed to decorated function
    :param str context_name: the keyword only argument to identify context
                             object
    )r;rEs  rrr�s ������t�.�v�.�.�.r)
r/�__all__�	functoolsrr5rr2r;rrr0rr�<module>rIs�����(��
������
�
�
�
�H%�H%�H%�H%�H%�H%�H%�H%�V&�&�&�&�&�
�&�&�&�)&�)&�)&�)&�)&�z�)&�)&�)&�X
0�
0�
0� /�/�/�/�/r

Youez - 2016 - github.com/yon3zu
LinuXploit