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/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

mc�c ��@�dZddlZddlmZmZmZGd�d��ZdS)zWin32 compatibility utilities.�N)�Any�Callable�Optionalc�R�eZdZdZd	deegefddfd�Zd�Zd�Z	d�Z
dS)
�allow_interruptaDUtility for fixing CTRL-C events on Windows.

    On Windows, the Python interpreter intercepts CTRL-C events in order to
    translate them into ``KeyboardInterrupt`` exceptions.  It (presumably)
    does this by setting a flag in its "console control handler" and
    checking it later at a convenient location in the interpreter.

    However, when the Python interpreter is blocked waiting for the ZMQ
    poll operation to complete, it must wait for ZMQ's ``select()``
    operation to complete before translating the CTRL-C event into the
    ``KeyboardInterrupt`` exception.

    The only way to fix this seems to be to add our own "console control
    handler" and perform some application-defined operation that will
    unblock the ZMQ polling operation in order to force ZMQ to pass control
    back to the Python interpreter.

    This context manager performs all that Windows-y stuff, providing you
    with a hook that is called when a CTRL-C event is intercepted.  This
    hook allows you to unblock your ZMQ poll operation immediately, which
    will then result in the expected ``KeyboardInterrupt`` exception.

    Without this context manager, your ZMQ-based application will not
    respond normally to CTRL-C events on Windows.  If a CTRL-C event occurs
    while blocked on ZMQ socket polling, the translation to a
    ``KeyboardInterrupt`` exception will be delayed until the I/O completes
    and control returns to the Python interpreter (this may never happen if
    you use an infinite timeout).

    A no-op implementation is provided on non-Win32 systems to avoid the
    application from having to conditionally use it.

    Example usage:

    .. sourcecode:: python

       def stop_my_application():
           # ...

       with allow_interrupt(stop_my_application):
           # main polling loop.

    In a typical ZMQ application, you would use the "self pipe trick" to
    send message to a ``PAIR`` socket in order to interrupt your blocking
    socket polling operation.

    In a Tornado event loop, you can use the ``IOLoop.stop`` method to
    unblock your I/O loop.
    N�action�returnc�T�tjdkrdS|�|��dS)aTranslate ``action`` into a CTRL-C handler.

        ``action`` is a callable that takes no arguments and returns no
        value (returned value is ignored).  It must *NEVER* raise an
        exception.

        If unspecified, a no-op will be used.
        �ntN)�os�name�_init_action)�selfrs  �1/usr/lib/python3/dist-packages/zmq/utils/win32.py�__init__zallow_interrupt.__init__?s.���7�d�?�?��F����&�!�!�!�!�!�c����ddlm}m}ddlm}m}|�d��}|||��}|jx}|_||f|_	||_
��d���|_|�fd���}	|	|_dS)Nr)�WINFUNCTYPE�windll)�BOOL�DWORD�kernel32c��dS�N�rrr�<lambda>z.allow_interrupt._init_action.<locals>.<lambda>[s��T�rc�(��|dkr
���dS)Nrr)�eventrs �r�handlez,allow_interrupt._init_action.<locals>.handle^s�����z�z�������1r)
�ctypesrr�ctypes.wintypesrr�LoadLibrary�SetConsoleCtrlHandler�_SetConsoleCtrlHandler�argtypes�restyperr)
rrrrrrr�PHANDLER_ROUTINEr#rs
 `        rrzallow_interrupt._init_actionLs����.�.�.�.�.�.�.�.�/�/�/�/�/�/�/�/��%�%�j�1�1��'�;�t�U�3�3��
�*�	+���'�*:�D�)A��&�(,��%��>�!�\�F����	�		�		�		�		�
�	�		�����rc��tjdkrdS|�|jd��}|dkrt	���dS)z"Install the custom CTRL-C handler.rN�r�rr
r$r�OSError)r�results  r�	__enter__zallow_interrupt.__enter__l�D��
�7�d�?�?��F��,�,�T�[�!�<�<���Q�;�;��)�)�O��;rc��tjdkrdS|�|jd��}|dkrt	���dS)z!Remove the custom CTRL-C handler.rNrr*)r�argsr,s   r�__exit__zallow_interrupt.__exit__vr.rr)�__name__�
__module__�__qualname__�__doc__rrrrrr-r1rrrrrs�������0�0�d"�"�x���S��(9�:�"�d�"�"�"�"����@�������rr)r5r�typingrrrrrrr�<module>r7sp��$�$�
�	�	�	�*�*�*�*�*�*�*�*�*�*�r�r�r�r�r�r�r�r�r�rr

Youez - 2016 - github.com/yon3zu
LinuXploit