403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.25
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 :  /usr/lib/python3/dist-packages/zmq/sugar/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

mc�c�/��>�dZddlZddlZddlmZddlmZmZmZm	Z	m
Z
mZmZddl
mZddlmZddlmZddlmZmZmZdd	lmZd
dlmZmZd
dlmZd
add�Z ej!e ��edd���Z"eddd���Z#Gd�deeee#��ZdgZ$dS)zPython bindings for 0MQ.�N)�Lock)�Any�Dict�Generic�List�Optional�Type�TypeVar)�warn)�WeakSet)�Context)�
ContextOption�Errno�SocketOption)�ZMQError�)�AttributeSetter�OptValT)�SocketF�returnc�
�dadS�NT)�_exiting���3/usr/lib/python3/dist-packages/zmq/sugar/context.py�_notice_atexitrs���H�H�Hr�Tr
)�bound�STrT)r�	covariantc	���eZdZUdZeeefed<dZeed<e	��Z
dZeeed<dZ
dZeed<eZeeed<d2d
dded
eddf�fd�
Zd3d�ZdZdefd�Zd
edefd�Zdedededdfd�Zd4d
ededefd�ZeZedeededefd���Zedeededefd���Z ed2deededefd���Z!d3�fd �Z"de#efd!�Z$d"eddfd#�Z%d"eddfd$�Z&d4d%eeddfd&�Z'd
ed'ed
edefd(�Z(d)ed*eddfd+�Z)d)ede*fd,�Z+d-ed)ed*e*ddfd.�Z,d-ed)ede*fd/�Z-d0eddfd1�Z.�xZ/S)5r
auCreate a zmq Context

    A zmq Context creates sockets via its ``ctx.socket`` method.

    .. versionchanged:: 24

        When using a Context as a context manager (``with zmq.Context()``),
        or deleting a context without closing it first,
        ``ctx.destroy()`` is called,
        closing any leftover sockets,
        instead of `ctx.term()` which requires sockets to be closed first.

        This prevents hangs caused by `ctx.term()` if sockets are left open,
        but means that unclean destruction of contexts
        (with sockets left open) is not safe
        if sockets are managed in other threads.
    �sockoptsN�	_instance�
_instance_pidF�_sockets�
_socket_classr�selfzContext[Socket]�
io_threads�kwargsrc���t��jdd|i|��|�dd��rd|_nd|_i|_t��|_dS)Nr)�shadowFTr)�super�__init__�get�_shadowr#rr&)r(r)r*�	__class__s   �rr.zContext.__init__@sa��������9�9�J�9�&�9�9�9��:�:�h��&�&�	!��D�L�L� �D�L���
��	�	��
�
�
rc���t��|js^tsY|jsTd|_t
r,t
|dd���td|��td|���|���dSdSdSdS)a)Deleting a Context without closing it destroys it and all sockets.

        .. versionchanged:: 24
            Switch from threadsafe `term()` which hangs in the event of open sockets
            to less safe `destroy()` which
            warns about any leftover sockets and closes them.
        Tr&NzUnclosed context ���
stacklevel�source)	�localsr0r�closed�_warn_destroy_closer�getattr�ResourceWarning�destroy�r(s r�__del__zContext.__del__Is���	�����|�
	�H�
	�T�[�
	�'+�D�$��
���j�$�7�7�C��.��.�.�#� ��	����
�L�L�N�N�N�N�N�
	�
	�
	�
	�
	�
	rzzmq.Contextc
�D�|j}|j�dd��}|�|j�d|j��}|jrdnd}t
|dd��r&t|j��}|dkrdnd}|�d|��}nd}d	|�d
|�dtt|�����|�d�S)
N�	_repr_cls�.z closed�r&r�sz socket�<�(z) at �>)r1�__dict__r/�
__module__�__name__r8r:�lenr&�hex�id)r(�clsr@r8�	n_socketsrC�socketss       r�__repr__zContext.__repr__cs����n���L�$�$�[�$�7�7�	����>�:�:�C�L�:�:�I�"�k�1���r���4��T�*�*�	��D�M�*�*�I� �1�}�}���"�A�"�.�.�1�.�.�G�G��G�E�9�E�E�w�E�E�S��D���]�]�E�F�E�E�E�Erc��|S�Nrr=s r�	__enter__zContext.__enter__ss���r�exc_type�	exc_value�	tracebackc�<�d|_|���dSr)r9r<)r(rTrUrVs    r�__exit__zContext.__exit__vs��#'�� ��������r�memoc�@�|j�|j��S)z'Copying a Context creates a shadow copy)r1r,�
underlying)r(rYs  r�__copy__zContext.__copy__{s���~�$�$�T�_�5�5�5rrM�addressc�<�ddlm}||��}||���S)z�Shadow an existing libzmq context

        address is the integer address of the libzmq context
        or an FFI pointer to it.

        .. versionadded:: 14.1
        r��
cast_int_addr�r,)�zmq.utils.interopr`)rMr]r`s   rr,zContext.shadow�s8��	4�3�3�3�3�3��-��(�(���s�'�"�"�"�"r�ctxc�r�ddlm}ddlm}|�|��}||��}||���S)zuShadow an existing pyczmq context

        ctx is the FFI `zctx_t *` pointer

        .. versionadded:: 14.1
        r)�zctxr_ra)�pyczmqrerbr`r[)rMrcrer`r[r]s      r�
shadow_pyczmqzContext.shadow_pyczmq�s[��	 ������3�3�3�3�3�3��_�_�S�)�)�
��-�
�+�+���s�'�"�"�"�"rc�\�|j�(|jtj��ks|jjrw|j5|j�(|jtj��ks|jjr)||���|_tj��|_ddd��n#1swxYwY|jS)aReturns a global Context instance.

        Most single-threaded applications have a single, global Context.
        Use this method instead of passing around Context instances
        throughout your code.

        A common pattern for classes that depend on Contexts is to use
        a default argument to enable programs with multiple Contexts
        but not require the argument for simpler applications::

            class MyClass(object):
                def __init__(self, context=None):
                    self.context = context or Context.instance()

        .. versionchanged:: 18.1

            When called in a subprocess after forking,
            a new global instance is created instead of inheriting
            a Context that won't work from the parent process.
        N)r))r$r%�os�getpidr8�_instance_lock)rMr)s  r�instancezContext.instance�s���.
�M�!�� �B�I�K�K�/�/��}�#�0��#�
4�
4��M�)��(�B�I�K�K�7�7��}�+�8�%(�C�:�$>�$>�$>�C�M�(*�	���C�%�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4�
4����
4�
4�
4�
4��}�s�AB�B �#B c�H��t�����dS)aLClose or terminate the context.

        Context termination is performed in the following steps:

        - Any blocking operations currently in progress on sockets open within context shall
          raise :class:`zmq.ContextTerminated`.
          With the exception of socket.close(), any further operations on sockets open within this context
          shall raise :class:`zmq.ContextTerminated`.
        - After interrupting all blocking calls, term shall block until the following conditions are satisfied:
            - All sockets open within context have been closed.
            - For each socket within context, all messages sent on the socket have either been
              physically transferred to a network peer,
              or the socket's linger period set with the zmq.LINGER socket option has expired.

        For further details regarding socket linger behaviour refer to libzmq documentation for ZMQ_LINGER.

        This can be called to close the context by hand. If this is not called,
        the context will automatically be closed when it is garbage collected.
        N)r-�term)r(r1s �rrnzContext.term�s���(	���������rc�l�t|j��}|�tj��|SrR)�dirr1�extendr�__members__)r(�keyss  r�__dir__zContext.__dir__�s+���4�>�"�"�����M�-�.�.�.��r�socketc�:�|j�|��dS)zBAdd a weakref to a socket for Context.destroy / reference countingN)r&�add�r(rus  r�_add_socketzContext._add_socket�s���
���&�!�!�!�!�!rc�`�t|dd���|j�|��dSdS)z8Remove a socket for Context.destroy / reference countingr&N)r:r&�discardrxs  r�
_rm_socketzContext._rm_socket�s:���4��T�*�*�6��M�!�!�&�)�)�)�)�)�7�6r�lingerc�Z�|jrdStt|dd��pg��}|D]j}|rf|js_|jr"trt	d|��t
d|���|� |�tj|��|�	���k|�
��dS)a�Close all sockets associated with this context and then terminate
        the context.

        .. warning::

            destroy involves calling ``zmq_close()``, which is **NOT** threadsafe.
            If there are active sockets in other threads, this must not be called.

        Parameters
        ----------

        linger : int, optional
            If specified, set LINGER on sockets prior to closing them.
        Nr&z(Destroying context with unclosed socket �r4)r8�listr:r9rr;�
setsockoptr�LINGER�closern)r(r}rOrCs    rr<zContext.destroy�s����;�	��F� ���z�4�!@�!@�!F�B�G�G���	�	�A��
���
��+�����F�1�F�F�'�#$� �	�����%��L�L��!4�f�=�=�=����	�	�	���	�	�����r�socket_typec��|jrttj���|j||fi|��}|j���D],\}}	|�||���#t$rY�)wxYw|�|��|S)a]Create a Socket associated with this Context.

        Parameters
        ----------
        socket_type : int
            The socket type, which can be any of the 0MQ socket types:
            REQ, REP, PUB, SUB, PAIR, DEALER, ROUTER, PULL, PUSH, etc.

        kwargs:
            will be passed to the __init__ method of the socket class.
        )	r8rr�ENOTSUPr'r#�itemsr�ry)r(r�r*rC�opt�values      rruzContext.sockets����;�	*��5�=�)�)�)�"��"��+�
�
�!'�
�
���-�-�-�/�/�	�	�J�C��
����S�%�(�(�(�(���
�
�
���	
����
	
��������s�A&�&
A3�2A3r�r�c��||j|<dS)zkset default socket options for new sockets created by this Context

        .. versionadded:: 13.0
        N�r#)r(r�r�s   rr�zContext.setsockopt1s��
#��
�c���rc��|j|S)zkget default socket options for new sockets created by this Context

        .. versionadded:: 13.0
        r�)r(r�s  r�
getsockoptzContext.getsockopt8s��
�}�S�!�!r�namec��|tjvr|�||��S|tjvr||j|<dStd|�����)z"set default sockopts as attributesz"No such context or socket option: N)rrr�setrr#�AttributeError)r(r�r�r�s    r�
_set_attr_optzContext._set_attr_opt?s[���=�,�,�,��8�8�C��'�'�'�
�\�-�
-�
-�!&�D�M�#���� �!L�d�!L�!L�M�M�Mrc��|tjvr|�|��S||jvrt	|���|j|S)z"get default sockopts as attributes)rrrr/r#r�)r(r�r�s   r�
_get_attr_optzContext._get_attr_optHsH���=�,�,�,��8�8�C�=�=� ��$�-�'�'�$�T�*�*�*��}�S�)�)r�keyc���|���}	tt|��}||jvrt	|���|j|=dS#t$rt	d|�����wxYw)z%delete default sockopts as attributeszNo such socket option: N)�upperr:rr#r�)r(r�r�s   r�__delattr__zContext.__delattr__Rs����i�i�k�k��	'��,��,�,�C��$�-�'�'�$�S�)�)�)��M�#�&�&�&��
�	D�	D�	D� �!B�3�!B�!B�C�C�C�	D���s�A
�
A*)r�rNrR)0rIrH�__qualname__�__doc__r�intr�__annotations__r$rrkr%rr0r9rrr'r	r r.r>r@�strrPrrSrXr\�__deepcopy__�classmethodr,rgrlrnrrtryr|r<rur�rr�r�r�r��
__classcell__)r1s@rr
r
#s�����������$�3��8�n�����I�s�����T�V�V�N�#'�M�8�C�=�'�'�'��G�������$�M�4��8�$�$�$�"�"�(�"�c�"��"�QU�"�"�"�"�"�"�����0�I�F�#�F�F�F�F� ���a�����������������
6�6�q�6��6�q�6�6�6�6��L��#�D��G�#�c�#�a�#�#�#��[�#��
#�4��7�
#��
#��
#�
#�
#��[�
#� �"�"�d�1�g�"�3�"�q�"�"�"��[�"�H������4��c������"�#�"�$�"�"�"�"�*��*��*�*�*�*�!�!�h�s�m�!�t�!�!�!�!�F�Q��S��C��B�����8#�c�#�#�#�$�#�#�#�#�"�c�"�g�"�"�"�"�N�#�N�C�N��N�D�N�N�N�N�*�#�*�C�*�G�*�*�*�*�'�s�'�t�'�'�'�'�'�'�'�'rr�)%r��atexitri�	threadingr�typingrrrrrr	r
�warningsr�weakrefr�zmq.backendr
�ContextBase�
zmq.constantsrrr�	zmq.errorr�	attrsettrrrrurrr�registerrr �__all__rrr�<module>r�s�����
�
�
�
�	�	�	�	�������D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�������������.�.�.�.�.�.�<�<�<�<�<�<�<�<�<�<�������/�/�/�/�/�/�/�/�������������
��������G�C�y�!�!�!���W�T��T�2�2�2��z'�z'�z'�z'�z'�k�?�G�B�K�z'�z'�z'�z	�+���r

Youez - 2016 - github.com/yon3zu
LinuXploit