%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/selectors.cpython-311.pyc

�

c��f�L����dZddlmZmZddlmZddlmZddlZddl	Z	ddl
Z
dZdZd�Z
ed	gd
���Zde_dej_d
ej_dej_dej_Gd�de��ZGd�de���ZGd�de��ZGd�de��ZGd�de��Zee	d��rGd�de��Zee	d��rGd�d e��Zee	d!��rGd"�d#e��Zee	d$��rGd%�d&e��Zd'�Zed$��reZdSed��reZdSed!��reZdSed��reZdSeZdS)(z|Selectors module.

This module allows high-level and efficient I/O multiplexing, built upon the
`select` module primitives.
�)�ABCMeta�abstractmethod)�
namedtuple)�MappingN��c�H�t|t��r|}na	t|�����}n>#ttt
f$r$td�|����d�wxYw|dkr"td�|�����|S)z�Return a file descriptor from a file object.

    Parameters:
    fileobj -- file object or file descriptor

    Returns:
    corresponding file descriptor

    Raises:
    ValueError if the object is invalid
    zInvalid file object: {!r}NrzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fds  �0/opt/alt/python311/lib64/python3.11/selectors.py�_fileobj_to_fdrs����'�3���?�
���	?��W�^�^�%�%�&�&�B�B���	�:�6�	?�	?�	?��$�$*�F�7�O�O�5�5�:>�
?�	?����
�A�v�v��6�=�=�b�A�A�B�B�B�
�Is	�!<�;A7�SelectorKey)rr�events�dataz�SelectorKey(fileobj, fd, events, data)

    Object used to associate a file object to its backing
    file descriptor, selected event mask, and attached data.
zFile object registered.zUnderlying file descriptor.z3Events that must be waited for on this file object.zvOptional opaque data associated to this file object.
For example, this could be used to store a per-client session ID.c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�_SelectorMappingz)Mapping of file objects to selector keys.c��||_dS�N)�	_selector)�self�selectors  r�__init__z_SelectorMapping.__init__?s
��!�����c�4�t|jj��Sr)�lenr�
_fd_to_key�rs r�__len__z_SelectorMapping.__len__Bs���4�>�,�-�-�-r c��	|j�|��}|jj|S#t$r$td�|����d�wxYw�N�{!r} is not registered)r�_fileobj_lookupr#�KeyErrorr)rrrs   r�__getitem__z_SelectorMapping.__getitem__Esk��	O���/�/��8�8�B��>�,�R�0�0���	O�	O�	O��3�:�:�7�C�C�D�D�$�N�	O���s	�+.�.Ac�4�t|jj��Sr)�iterrr#r$s r�__iter__z_SelectorMapping.__iter__Ls���D�N�-�.�.�.r N)�__name__�
__module__�__qualname__�__doc__rr%r+r.�r rrr<sY������3�3�"�"�"�.�.�.�O�O�O�/�/�/�/�/r rc��eZdZdZedd���Zed���Zdd�Zedd���Zd�Z	d�Z
ed	���Zd
�Zd�Z
dS)
�BaseSelectora-Selector abstract base class.

    A selector supports registering file objects to be monitored for specific
    I/O events.

    A file object is a file descriptor or any object with a `fileno()` method.
    An arbitrary object can be attached to the file object, which can be used
    for example to store context information, a callback, etc.

    A selector can use various implementations (select(), poll(), epoll()...)
    depending on the platform. The default `Selector` class uses the most
    efficient implementation on the current platform.
    Nc��t�)a3Register a file object.

        Parameters:
        fileobj -- file object or file descriptor
        events  -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
        data    -- attached data

        Returns:
        SelectorKey instance

        Raises:
        ValueError if events is invalid
        KeyError if fileobj is already registered
        OSError if fileobj is closed or otherwise is unacceptable to
                the underlying system call (if a system call is made)

        Note:
        OSError may or may not be raised
        ��NotImplementedError�rrrrs    r�registerzBaseSelector.register_s
��*"�!r c��t�)ajUnregister a file object.

        Parameters:
        fileobj -- file object or file descriptor

        Returns:
        SelectorKey instance

        Raises:
        KeyError if fileobj is not registered

        Note:
        If fileobj is registered but has since been closed this does
        *not* raise OSError (even if the wrapped syscall does)
        r7)rrs  r�
unregisterzBaseSelector.unregisterv�
��""�!r c�Z�|�|��|�|||��S)ayChange a registered file object monitored events or attached data.

        Parameters:
        fileobj -- file object or file descriptor
        events  -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
        data    -- attached data

        Returns:
        SelectorKey instance

        Raises:
        Anything that unregister() or register() raises
        )r<r:r9s    r�modifyzBaseSelector.modify�s,��	
���� � � ��}�}�W�f�d�3�3�3r c��t�)aqPerform the actual selection, until some monitored file objects are
        ready or a timeout expires.

        Parameters:
        timeout -- if timeout > 0, this specifies the maximum wait time, in
                   seconds
                   if timeout <= 0, the select() call won't block, and will
                   report the currently ready file objects
                   if timeout is None, select() will block until a monitored
                   file object becomes ready

        Returns:
        list of (key, events) for ready file objects
        `events` is a bitwise mask of EVENT_READ|EVENT_WRITE
        r7)r�timeouts  r�selectzBaseSelector.select�r=r c��dS)zmClose the selector.

        This must be called to make sure that any underlying resource is freed.
        Nr3r$s r�closezBaseSelector.close�s	��
	
�r c��|���}|�td���	||S#t$r$td�|����d�wxYw)zzReturn the key associated to a registered file object.

        Returns:
        SelectorKey for this file object
        NzSelector is closedr()�get_map�RuntimeErrorr*r)rr�mappings   r�get_keyzBaseSelector.get_key�st���,�,�.�.���?��3�4�4�4�	O��7�#�#���	O�	O�	O��3�:�:�7�C�C�D�D�$�N�	O���s	�/�.Ac��t�)z2Return a mapping of file objects to selector keys.r7r$s rrFzBaseSelector.get_map�s
��"�!r c��|Srr3r$s r�	__enter__zBaseSelector.__enter__�s���r c�.�|���dSr)rD)r�argss  r�__exit__zBaseSelector.__exit__�s���
�
�����r r)r/r0r1r2rr:r<r?rBrDrIrFrLrOr3r rr5r5Ps����������"�"�"��^�"�,�"�"��^�"�$4�4�4�4�"�"�"�"��^�"�$
�
�
�O�O�O��"�"��^�"��������r r5)�	metaclassc�F�eZdZdZd�Zd�Zdd�Zd�Zdd�Zd�Z	d	�Z
d
�ZdS)�_BaseSelectorImplzBase selector implementation.c�<�i|_t|��|_dSr)r#r�_mapr$s rrz_BaseSelectorImpl.__init__�s�����$�T�*�*��	�	�	r c��	t|��S#t$r2|j���D]}|j|ur|jccYS��wxYw)alReturn a file descriptor from a file object.

        This wraps _fileobj_to_fd() to do an exhaustive search in case
        the object is invalid but we still have it in our map.  This
        is used by unregister() so we can unregister an object that
        was previously registered even if it is closed.  It is also
        used by _SelectorMapping.
        )rrr#�valuesrr�rr�keys   rr)z!_BaseSelectorImpl._fileobj_lookup�ss��	�!�'�*�*�*���	�	�	���-�-�/�/�
"�
"���;�'�)�)��6�M�M�M�M�M�*�
�
	���s��7A
�
A
Nc�H�|r|ttzzr"td�|�����t	||�|��||��}|j|jvr(td�||j�����||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITErrrr)rr#r*�rrrrrXs     rr:z_BaseSelectorImpl.register�s����	D�F�z�K�'?�%@�@�	D��3�:�:�6�B�B�C�C�C��'�4�#7�#7��#@�#@�&�$�O�O���6�T�_�$�$��?�"�F�7�C�F�3�3�5�5�
5�#&�������
r c���	|j�|�|����}n1#t$r$td�|����d�wxYw|Sr')r#�popr)r*rrWs   rr<z_BaseSelectorImpl.unregister�sp��	O��/�%�%�d�&:�&:�7�&C�&C�D�D�C�C���	O�	O�	O��3�:�:�7�C�C�D�D�$�N�	O�����
s	�-0�.Ac�|�	|j|�|��}n1#t$r$td�|����d�wxYw||jkr-|�|��|�|||��}n0||jkr%|�|���}||j|j	<|S)Nr()r)
r#r)r*rrr<r:r�_replacerr\s     rr?z_BaseSelectorImpl.modify�s���	O��/�$�"6�"6�w�"?�"?�@�C�C���	O�	O�	O��3�:�:�7�C�C�D�D�$�N�	O�����S�Z����O�O�G�$�$�$��-�-����6�6�C�C�
�S�X�
�
��,�,�D�,�)�)�C�&)�D�O�C�F�#��
s	� #�.Ac�F�|j���d|_dSr)r#�clearrTr$s rrDz_BaseSelectorImpl.closes!�����������	�	�	r c��|jSr)rTr$s rrFz_BaseSelectorImpl.get_maps
���y�r c�@�	|j|S#t$rYdSwxYw)z�Return the key associated to a given file descriptor.

        Parameters:
        fd -- file descriptor

        Returns:
        corresponding key, or None if not found
        N)r#r*)rrs  r�_key_from_fdz_BaseSelectorImpl._key_from_fds6��	��?�2�&�&���	�	�	��4�4�	���s��
�r)r/r0r1r2rr)r:r<r?rDrFrer3r rrRrR�s�������'�'�+�+�+����&���������������������r rRc�n��eZdZdZ�fd�Zd	�fd�	Z�fd�Zejdkrd	d�Z	ne
j
Z	d	d�Z
�xZS)
�SelectSelectorzSelect-based selector.c���t�����t��|_t��|_dSr)�superr�set�_readers�_writers�r�	__class__s �rrzSelectSelector.__init__%s3���
������������
�����
�
�
r Nc����t���|||��}|tzr|j�|j��|tzr|j�|j��|Sr)rir:rZrk�addrr[rl)rrrrrXrns     �rr:zSelectSelector.register*sm����g�g���w���5�5���J��	&��M���c�f�%�%�%��K��	&��M���c�f�%�%�%��
r c����t���|��}|j�|j��|j�|j��|Sr)rir<rk�discardrrl�rrrXrns   �rr<zSelectSelector.unregister2sO����g�g� � ��)�)���
���c�f�%�%�%��
���c�f�%�%�%��
r �win32c�H�tj||||��\}}}|||zgfSr)rB)r�r�w�_rA�xs      r�_selectzSelectSelector._select9s-���m�A�q�!�W�5�5�G�A�q�!��a�!�e�R�<�r c��|�dnt|d��}g}	|�|j|jg|��\}}}n#t$r|cYSwxYwt|��}t|��}||zD]V}d}||vr
|tz}||vr
|tz}|�|��}|r|�	|||j
zf���W|S�Nr)�maxrzrkrl�InterruptedErrorrjrZr[re�appendr)	rrA�readyrvrwrxrrrXs	         rrBzSelectSelector.select?s���!�/�$�$�s�7�A������	��l�l�4�=�$�-��W�M�M�G�A�q�!�!���	�	�	��L�L�L�	������F�F����F�F���a�%�		9�		9�B��F��Q�w�w��*�$���Q�w�w��+�%���#�#�B�'�'�C��
9����c�6�C�J�#6�7�8�8�8���s�&?�A�
Ar)r/r0r1r2rr:r<�sys�platformrzrB�
__classcell__�rns@rrgrg"s�������� � ������
������������|�w���	 �	 �	 �	 �	 ��-���������r rgc�X��eZdZdZdZdZdZ�fd�Zd�fd�	Z�fd�Z	d�fd�	Z
dd�Z�xZS)	�_PollLikeSelectorz<Base class shared between poll, epoll and devpoll selectors.Nc�z��t�����|���|_dSr)rir�
_selector_clsrrms �rrz_PollLikeSelector.__init__[s0���
���������+�+�-�-����r c�4��t���|||��}d}|tzr
||jz}|tzr
||jz}	|j�|j|��n'#t���|���xYw|Sr|)	rir:rZ�_EVENT_READr[�_EVENT_WRITErrr<)rrrrrX�
poller_eventsrns      �rr:z_PollLikeSelector.register_s�����g�g���w���5�5���
��J��	.��T�-�-�M��K��	/��T�.�.�M�	��N�#�#�C�F�M�:�:�:�:��	��G�G���w�'�'�'������
s� A1�1$Bc���t���|��}	|j�|j��n#t$rYnwxYw|Sr)rir<rr�OSErrorrss   �rr<z_PollLikeSelector.unregistermsc����g�g� � ��)�)��	��N�%�%�c�f�-�-�-�-���	�	�	�
�D�	�����
s�A�
A�Ac���	|j|�|��}n!#t$rt|�d���d�wxYwd}||jkrud}|tzr
||jz}|tzr
||jz}	|j�	|j
|��n'#t���|���xYwd}||j
krd}|r&|�||���}||j|j
<|S)Nz is not registeredFrT)rr)r#r)r*rrZr�r[r�rr?rrir<rr`)rrrrrX�changed�selector_eventsrns       �rr?z_PollLikeSelector.modifyws7���	G��/�$�"6�"6�w�"?�"?�@�C�C���	G�	G�	G��g�;�;�;�<�<�$�F�	G�������S�Z����O��
�"�
4��4�#3�3����#�
5��4�#4�4��
���%�%�c�f�o�>�>�>�>��
����"�"�7�+�+�+������G��3�8����G��	*��,�,�f�4�,�8�8�C�&)�D�O�C�F�#��
s� $�A�= B�$Cc��|�d}n |dkrd}ntj|dz��}g}	|j�|��}n#t$r|cYSwxYw|D]g\}}d}||jzr
|tz}||jzr
|tz}|�	|��}|r|�
|||jzf���h|S)Nr�@�@)�math�ceilr�pollr~r�r[r�rZrerr)rrAr��
fd_event_listr�eventrrXs        rrBz_PollLikeSelector.select�s���?��G�G�
��\�\��G�G��i��#�
�.�.�G���	� �N�/�/��8�8�M�M���	�	�	��L�L�L�	����&�		9�		9�I�B���F���(�(�(�
&��+�%����)�)�)�
%��*�$���#�#�B�'�'�C��
9����c�6�C�J�#6�7�8�8�8���s�A�A�Ar)
r/r0r1r2r�r�r�rr:r<r?rBr�r�s@rr�r�Us��������F�F��M��K��L�.�.�.�.�.������������������6�������r r�r�c�<�eZdZdZejZejZej	Z
dS)�PollSelectorzPoll-based selector.N)r/r0r1r2rBr�r��POLLINr��POLLOUTr�r3r rr�r��s)������"�"���
��m���~���r r��epollc�Z��eZdZdZejZejZej	Z
d�Zdd�Z�fd�Z�xZ
S)�
EpollSelectorzEpoll-based selector.c�4�|j���Sr�rrr$s rrzEpollSelector.fileno�����>�(�(�*�*�*r Nc���|�d}n#|dkrd}ntj|dz��dz}tt|j��d��}g}	|j�||��}n#t$r|cYSwxYw|D]q\}}d}|tj	zr
|tz}|tjzr
|tz}|�
|��}|r|�|||jzf���r|S)N���rr�g����MbP?r)r�r�r}r"r#rr�r~rB�EPOLLINr[�EPOLLOUTrZrerr)	rrA�max_evr�r�rr�rrXs	         rrBzEpollSelector.select�s(��������A�������)�G�c�M�2�2�T�9��
��T�_�-�-�q�1�1�F��E�
� $�� 3� 3�G�V� D� D�
�
��#�
�
�
�����
����*�	
=�	
=�	��E����F�N�?�*�*��k�)�F��F�O�+�+�)��j�(�F��'�'��+�+���=��L�L�#�v��
�':�!;�<�<�<���Ls�A*�*A9�8A9c�z��|j���t�����dSr�rrDrirms �rrDzEpollSelector.close��,����N� � �"�"�"��G�G�M�M�O�O�O�O�Or r)r/r0r1r2rBr�r�r�r�r�r�rrDr�r�s@rr�r��sw�������#�#���
��n�����	+�	+�	+�	�	�	�	�@	�	�	�	�	�	�	�	�	r r��devpollc�R��eZdZdZejZejZej	Z
d�Z�fd�Z�xZ
S)�DevpollSelectorzSolaris /dev/poll selector.c�4�|j���Srr�r$s rrzDevpollSelector.fileno�r�r c�z��|j���t�����dSrr�rms �rrDzDevpollSelector.close�r�r )r/r0r1r2rBr�r�r�r�r�r�rrDr�r�s@rr�r��sb�������)�)���
��m���~��	+�	+�	+�	�	�	�	�	�	�	�	�	r r��kqueuec�P��eZdZdZ�fd�Zd�Zd	�fd�	Z�fd�Zd	d�Z�fd�Z	�xZ
S)
�KqueueSelectorzKqueue-based selector.c���t�����tj��|_d|_dSr|)rirrBr�r�_max_eventsrms �rrzKqueueSelector.__init__�s4����G�G������#�]�_�_�D�N� �D���r c�4�|j���Srr�r$s rrzKqueueSelector.filenor�r Nc�8��t���|||��}	|tzr\tj|jtjtj��}|j�	|gdd��|xj
dz
c_
|tzr\tj|jtjtj��}|j�	|gdd��|xj
dz
c_
n'#t���
|���xYw|S�Nrr)rir:rZrB�keventr�KQ_FILTER_READ�	KQ_EV_ADDr�controlr�r[�KQ_FILTER_WRITEr<)rrrrrX�kevrns      �rr:zKqueueSelector.registers����'�'�"�"�7�F�D�9�9�C�

��J�&�*� �-����0E�(.�(8�:�:�C��N�*�*�C�5�!�Q�7�7�7��$�$��)�$�$��K�'�*� �-����0F�(.�(8�:�:�C��N�*�*�C�5�!�Q�7�7�7��$�$��)�$�$���
����"�"�7�+�+�+������Js�CC3�3$Dc�>��t���|��}|jtzrnt	j|jtjtj��}|xj	dzc_		|j
�|gdd��n#t$rYnwxYw|jtzrnt	j|jtjtj��}|xj	dzc_		|j
�|gdd��n#t$rYnwxYw|S)Nrr)rir<rrZrBr�rr��KQ_EV_DELETEr�rr�r�r[r�)rrrXr�rns    �rr<zKqueueSelector.unregisters3����'�'�$�$�W�-�-�C��z�J�&�	
��m�C�F�F�,A�$*�$7�9�9��� � �A�%� � ���N�*�*�C�5�!�Q�7�7�7�7�������D������z�K�'�
��m�C�F�F�,B�$*�$7�9�9��� � �A�%� � ���N�*�*�C�5�!�Q�7�7�7�7�������D������Js$�2B�
B�B�/D
�
D�Dc��|�dnt|d��}|jpd}g}	|j�d||��}n#t$r|cYSwxYw|D]|}|j}|j}d}|tjkr
|tz}|tj
kr
|tz}|�|��}	|	r|�
|	||	jzf���}|Sr�)r}r�rr�r~�ident�filterrBr�rZr�r[rerr)
rrAr�r��kev_listr�r�flagrrXs
          rrBzKqueueSelector.select.s��%�o�d�d�3�w��?�?�G��%�*��F��E�
��>�1�1�$���H�H����#�
�
�
�����
�����
=�
=���Y���z�����6�0�0�0��j�(�F��6�1�1�1��k�)�F��'�'��+�+���=��L�L�#�v��
�':�!;�<�<�<���Ls�>�A
�A
c�z��|j���t�����dSrr�rms �rrDzKqueueSelector.closeGr�r r)r/r0r1r2rrr:r<rBrDr�r�s@rr�r��s��������$�$�	!�	!�	!�	!�	!�
	+�	+�	+�	�	�	�	�	�	�$	�	�	�	�	�.	�	�	�	�2	�	�	�	�	�	�	�	�	r r�c���tt|d��}|�dS	|��}|dkr|�d��n|���dS#t$rYdSwxYw)zJCheck if we can use the selector depending upon the
    operating system. NFr�rT)�getattrrBr�rDr�)�methodr�selector_objs   r�_can_user�Ls����v�v�t�,�,�H����u�
��x�z�z���V������a� � � � �
��� � � ��t�������u�u����s�:A�
A&�%A&)r2�abcrr�collectionsr�collections.abcrr�rBr�rZr[rrrrrrrr5rRrgr��hasattrr�r�r�r�r��DefaultSelectorr3r r�<module>r�sb����(�'�'�'�'�'�'�'�"�"�"�"�"�"�#�#�#�#�#�#�����
�
�
�
�
�
�
�
��
������2�j��(K�(K�(K�L�L�����
8����6����R����E����/�/�/�/�/�w�/�/�/�({�{�{�{�{�W�{�{�{�{�|Q�Q�Q�Q�Q��Q�Q�Q�h0�0�0�0�0�&�0�0�0�fW�W�W�W�W�)�W�W�W�t�7�6�6���&�&�&�&�&�&�(�&�&�&��7�6�7���-�+�+�+�+�+�)�+�+�+�\�7�6�9���
������+�����7�6�8���Q�O�O�O�O�O�*�O�O�O�d���4�8�H���	%�$�O�O�O�
�X�g���%�#�O�O�O�
�X�i���%�%�O�O�O�
�X�f���%�"�O�O�O�$�O�O�Or 

Zerion Mini Shell 1.0