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 :  /lib/python3/dist-packages/prompt_toolkit/eventloop/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/prompt_toolkit/eventloop/__pycache__/inputhook.cpython-311.pyc
�

�Ïc����dZddlZddlZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZmZm
Z
mZmZmZmZddlmZgd�Zerdd	lmZeZd
e
dgdfdefd
�Zd
e
dgdfdefd�ZGd�de��ZGd�d��ZdS)a8
Similar to `PyOS_InputHook` of the Python API, we can plug in an input hook in
the asyncio event loop.

The way this works is by using a custom 'selector' that runs the other event
loop until the real selector is ready.

It's the responsibility of this event hook to return when there is input ready.
There are two ways to detect when input is ready:

The inputhook itself is a callable that receives an `InputHookContext`. This
callable should run the other event loop, and return when the main loop has
stuff to do. There are two ways to detect when to return:

- Call the `input_is_ready` method periodically. Quit when this returns `True`.

- Add the `fileno` as a watch to the external eventloop. Quit when file descriptor
  becomes readable. (But don't read from it.)

  Note that this is not the same as checking for `sys.stdin.fileno()`. The
  eventloop of prompt-toolkit allows thread-based executors, for example for
  asynchronous autocompletion. When the completion for instance is ready, we
  also want prompt-toolkit to gain control again in order to display that.
�N)�AbstractEventLoop)�BaseSelector�SelectorKey)�
TYPE_CHECKING�Any�Callable�List�Mapping�Optional�Tuple�)�get_event_loop)�new_eventloop_with_inputhook�set_eventloop_with_inputhook�InputHookSelector�InputHookContext)�FileDescriptorLike�	inputhookr�returnc�p�ttj��|��}tj|��}|S)z;
    Create a new event loop with the given inputhook.
    )r�	selectors�DefaultSelector�asyncio�SelectorEventLoop)r�selector�loops   �D/usr/lib/python3/dist-packages/prompt_toolkit/eventloop/inputhook.pyrr2s1��!��!:�!<�!<�i�H�H�H��$�X�.�.�D��K�c�L�t|��}tj|��|S)zL
    Create a new event loop with the given inputhook, and activate it.
    )rr�set_event_loop)rrs  rrr=s'��(�	�2�2�D���4� � � ��Krc	���eZdZdZdededgdfddfd�Z	ddd	d
ddedd
fd�Zdd�Z		ddd	d
ddedd
fd�Z
	ddeede
edfd�Zdd�Zdedfd�ZdS)rz�
    Usage:

        selector = selectors.SelectSelector()
        loop = asyncio.SelectorEventLoop(InputHookSelector(selector, inputhook))
        asyncio.set_event_loop(loop)
    rrrNrc�b�||_||_tj��\|_|_dS�N)rr�os�pipe�_r�_w)�selfrrs   r�__init__zInputHookSelector.__init__Qs*��!��
�"����7�9�9�������r�fileobjr�events�
_EventMask�datarc�<�|j�|||���S�N)r-)r�register�r(r*r+r-s    rr0zInputHookSelector.registerXs!���}�%�%�g�v�D�%�A�A�Arc�6�|j�|��Sr#)r�
unregister)r(r*s  rr3zInputHookSelector.unregister]s���}�'�'��0�0�0rc�<�|j�||d���Sr/)r�modifyr1s    rr5zInputHookSelector.modify`s!���}�#�#�G�V�$�#�?�?�?r�timeout)rr,c�X�����ttt��dg����dkr�j�����Sd�d�d����fd�}tj|���}|���dtf�fd�}��	t�j|����	tj
d	krt	j�jgggd��tj�jd
��n#t $rYnwxYw|�����J��S)N�_readyr�r6Frc�v���j������tj�jd��d�dS)Nr9�xT)r�selectr$�writer')�ready�resultr(r6s����r�run_selectorz.InputHookSelector.select.<locals>.run_selectorqs8����]�)�)�'�)�:�:�F��H�T�W�d�#�#�#��E�E�Er)�targetc����Sr#�)r>s�r�input_is_readyz0InputHookSelector.select.<locals>.input_is_readyzs����Lr�win32i�rN)�len�getattrrrr<�	threading�Thread�start�boolrrr&�sys�platformr$�read�OSError�join)r(r6r@�thrDr>r?s``   @@rr<zInputHookSelector.selectesl������
�w�~�'�'��2�6�6�7�7�!�;�;��=�'�'��'�8�8�8�����	�	�	�	�	�	�	�	�	��
�\�
2�
2�
2��
���
�
�
�	��	�	�	�	�	�	�	
���'����@�@�A�A�A�	��|�w�&�&��
�t�w�i��R��6�6�6��G�D�G�T�"�"�"�"���	�	�	�
�D�		����	���	�	�	��!�!�!��
s�:AD�
D�Dc���|jr2tj|j��tj|j��dx|_|_|j���dS)z%
        Clean up resources.
        ���N)r&r$�closer'r�r(s rrUzInputHookSelector.close�sZ���7�	��H�T�W�����H�T�W��������$�'��
�������r)rrc�4�|j���Sr#)r�get_maprVs rrXzInputHookSelector.get_map�s���}�$�$�&�&�&rr#)r*rrrrF)�__name__�
__module__�__qualname__�__doc__rrr)rr0r3r5r�floatr	rr<rUr
rXrCrrrrHsr��������%�$�%�19�;M�:N�PT�:T�1U�%�	
�%�%�%�%�PT�B�B�+�B�5A�B�IL�B�	�B�B�B�B�
1�1�1�1�PT�@�@�+�@�5A�@�IL�@�	�@�@�@�@�*.�7�7����7�	
�e�/�0�	1�7�7�7�7�r	�	�	�	�'��!D�E�'�'�'�'�'�'rrc�B�eZdZdZdedegefddfd�Zdefd�ZdS)rz0
    Given as a parameter to the inputhook.
    �filenorDrNc�"�||_||_dSr#)�_filenorD)r(r_rDs   rr)zInputHookContext.__init__�s�����,����rc��|jSr#)rarVs rr_zInputHookContext.fileno�s
���|�r)	rYrZr[r\�intrrLr)r_rCrrrr�sk��������-�s�-�H�R��X�4F�-�4�-�-�-�-��������r)r\rr$r<rrMrIrrr�typingrrrr	r
rr�utilsr�__all__�	_typeshedrrcr,rrrrrCrr�<module>rhs�����0����	�	�	�	�
�
�
�
�����
�
�
�
�����%�%�%�%�%�%�/�/�/�/�/�/�/�/�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�!�!�!�!�!�!�������,�,�,�,�,�,��J���+�,�d�2�3���������+�,�d�2�3�������b'�b'�b'�b'�b'��b'�b'�b'�J
�
�
�
�
�
�
�
�
�
r

Youez - 2016 - github.com/yon3zu
LinuXploit