Your IP : 3.16.49.213


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/selectors.cpython-312.opt-2.pyc

�

�Q�f�L��r�	ddlmZmZddlmZddlmZddlZddlZddl	Z	dZ
dZd�Zedgd	��Z
d
e
_de
j_de
j _d
e
j"_de
j$_Gd�de�ZGd�de��ZGd�de�ZGd�de�ZGd�de�Zeed�rGd�de�Zeed�rGd�de�Zeed �rGd!�d"e�Zeed#�rGd$�d%e�Zd&�Zed#�reZyed�reZyed �reZyed�reZyeZy)'�)�ABCMeta�abstractmethod)�
namedtuple)�MappingN��c��	t|t�r|}n	t|j��}|dkrtdj
|���|S#ttt
f$rtdj
|��d�wxYw)NzInvalid file object: {!r}rzInvalid file descriptor: {})�
isinstance�int�fileno�AttributeError�	TypeError�
ValueError�format)�fileobj�fds  �0/opt/alt/python312/lib64/python3.12/selectors.py�_fileobj_to_fdrs���
��'�3��
��	?��W�^�^�%�&�B�
�A�v��6�=�=�b�A�B�B�
�I���	�:�6�	?��$�$*�F�7�O�5�:>�
?�	?�s�A�0B�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�&�eZdZ	d�Zd�Zd�Zd�Zy)�_SelectorMappingc��||_y�N)�	_selector)�self�selectors  r�__init__z_SelectorMapping.__init__?s	��!���c�@�t|jj�Sr)�lenr�
_fd_to_key�rs r�__len__z_SelectorMapping.__len__Bs���4�>�>�,�,�-�-r c��	|jj|�}|jj|S#t$rtdj	|��d�wxYw�N�{!r} is not registered)r�_fileobj_lookupr#�KeyErrorr)rrrs   r�__getitem__z_SelectorMapping.__getitem__Es[��	O����/�/��8�B��>�>�,�,�R�0�0���	O��3�:�:�7�C�D�$�N�	O�s	�36�%Ac�@�t|jj�Sr)�iterrr#r$s r�__iter__z_SelectorMapping.__iter__Ls���D�N�N�-�-�.�.r N)�__name__�
__module__�__qualname__rr%r+r.�r rrr<s��3�"�.�O�/r rc�r�eZdZ	edd��Zed��Zdd�Zedd��Zd�Zd�Z	ed��Z
d	�Zd
�Zy)�BaseSelectorNc��	t�r��NotImplementedError�rrrrs    r�registerzBaseSelector.register_s��	�&"�!r c��	t�rr6)rrs  r�
unregisterzBaseSelector.unregisterv���	�"�!r c�L�	|j|�|j|||�Sr)r;r9r8s    r�modifyzBaseSelector.modify�s(��	�	
���� ��}�}�W�f�d�3�3r c��	t�rr6)r�timeouts  r�selectzBaseSelector.select�r<r c��	yrr2r$s r�closezBaseSelector.close�s��	�	
r c��	|j�}|�td��	||S#t$rtdj|��d�wxYw)NzSelector is closedr()�get_map�RuntimeErrorr*r)rr�mappings   r�get_keyzBaseSelector.get_key�s`��	�
�,�,�.���?��3�4�4�	O��7�#�#���	O��3�:�:�7�C�D�$�N�	O�s	�%�%A
c��	t�rr6r$s rrEzBaseSelector.get_map�s��@�!�!r c��|Srr2r$s r�	__enter__zBaseSelector.__enter__�s���r c�$�|j�yr)rC)r�argss  r�__exit__zBaseSelector.__exit__�s���
�
�r r)
r/r0r1rr9r;r>rArCrHrErKrNr2r rr4r4Psq����"��"�,�"��"�$4�"�"��"�$
�O��"��"��r r4)�	metaclassc�B�eZdZ	d�Zd�Zd
d�Zd�Zd
d�Zd�Zd�Z	d	�Z
y)�_BaseSelectorImplc�2�i|_t|�|_yr)r#r�_mapr$s rrz_BaseSelectorImpl.__init__�s�����$�T�*��	r c��		t|�S#t$r?|jj�D] }|j|us�|j
ccYS�wxYwr)rrr#�valuesrr�rr�keys   rr)z!_BaseSelectorImpl._fileobj_lookup�sW��	�	�!�'�*�*���	����-�-�/���;�;�'�)��6�6�M�0�
�
	�s�
�4A�A�ANc�F�|r|ttzzrtdj|���t	||j|�||�}|j|jvr%tdj||j���||j|j<|S)NzInvalid events: {!r}z"{!r} (FD {}) is already registered)	�
EVENT_READ�EVENT_WRITErrrr)rr#r*�rrrrrWs     rr9z_BaseSelectorImpl.register�s����F�z�K�'?�%@�@��3�:�:�6�B�C�C��'�4�#7�#7��#@�&�$�O���6�6�T�_�_�$��?�"�F�7�C�F�F�3�5�
5�#&���������
r c��	|jj|j|��}|S#t$rtdj	|��d�wxYwr')r#�popr)r*rrVs   rr;z_BaseSelectorImpl.unregister�sZ��	O��/�/�%�%�d�&:�&:�7�&C�D�C��
���	O��3�:�:�7�C�D�$�N�	O�s	�*.�%Ac�r�	|j|j|�}||jk7r&|j|�|j
|||�}|S||jk7r+|j|��}||j|j<|S#t$rtdj|��d�wxYw)Nr()r)
r#r)r*rrr;r9r�_replacerr[s     rr>z_BaseSelectorImpl.modify�s���	O��/�/�$�"6�"6�w�"?�@�C��S�Z�Z���O�O�G�$��-�-����6�C�
�
�	�S�X�X�
��,�,�D�,�)�C�&)�D�O�O�C�F�F�#��
���	O��3�:�:�7�C�D�$�N�	O�s�B�%B6c�F�|jj�d|_yr)r#�clearrSr$s rrCz_BaseSelectorImpl.closes����������	r c��|jSr)rSr$s rrEz_BaseSelectorImpl.get_maps���y�y�r c�B�		|j|S#t$rYywxYwr)r#r*)rrs  r�_key_from_fdz_BaseSelectorImpl._key_from_fds-��	�	��?�?�2�&�&���	��	�s��	�r)r/r0r1rr)r9r;r>rCrErdr2r rrQrQ�s-��'�+��&�����r rQc�~��eZdZ	�fd�Zd�fd�	Z�fd�Zejdk(rdd�Zne	jZdd�Z	�xZ
S)�SelectSelectorc�^��t�|��t�|_t�|_yr)�superr�set�_readers�_writers�r�	__class__s �rrzSelectSelector.__init__%s ���
�������
����
r c����t�|�|||�}|tzr%|jj	|j
�|tzr%|jj	|j
�|Sr)rhr9rYrj�addrrZrk)rrrrrWrms     �rr9zSelectSelector.register*sW����g��w���5���J���M�M���c�f�f�%��K���M�M���c�f�f�%��
r c���t�|�|�}|jj|j�|j
j|j�|Sr)rhr;rj�discardrrk�rrrWrms   �rr;zSelectSelector.unregister2sC����g� ��)���
�
���c�f�f�%��
�
���c�f�f�%��
r �win32c�J�tj||||�\}}}|||zgfSr)rA)r�r�w�_r@�xs      r�_selectzSelectSelector._select9s,���m�m�A�q�!�W�5�G�A�q�!��a�!�e�R�<�r c��|�dnt|d�}g}	|j|j|jg|�\}}}t|�}t|�}||zD]R}d}||vr	|tz}||vr	|tz}|j|�}|s�3|j|||jzf��T|S#t$r|cYSwxYw�Nr)�maxryrjrk�InterruptedErrorrirYrZrd�appendr)	rr@�readyrurvrwrrrWs	         rrAzSelectSelector.select?s���!�/�$�s�7�A�����	��l�l�4�=�=�$�-�-��W�M�G�A�q�!�
��F����F���a�%�B��F��Q�w��*�$���Q�w��+�%���#�#�B�'�C�����c�6�C�J�J�#6�7�8����� �	��L�	�s�,B2�2C�?Cr)r/r0r1rr9r;�sys�platformryrA�
__classcell__�rms@rrfrf"s8��� ��
���|�|�w��	 ��-�-��r rfc�V��eZdZ	dZdZdZ�fd�Zd�fd�	Z�fd�Zd�fd�	Z	dd�Z
�xZS)�_PollLikeSelectorNc�L��t�|��|j�|_yr)rhr�
_selector_clsrrls �rrz_PollLikeSelector.__init__[s���
�����+�+�-��r c���t�|�|||�}d}|tzr||jz}|tzr||j
z}	|jj|j|�|S#t�|�!|��xYwr{)	rhr9rY�_EVENT_READrZ�_EVENT_WRITErrr;)rrrrrW�
poller_eventsrms      �rr9z_PollLikeSelector.register_s�����g��w���5���
��J���T�-�-�-�M��K���T�.�.�.�M�	��N�N�#�#�C�F�F�M�:��
��	��G��w�'��s�&A.�.Bc���t�|�|�}	|jj|j�|S#t$rY|SwxYwr)rhr;rr�OSErrorrrs   �rr;z_PollLikeSelector.unregistermsO����g� ��)��	��N�N�%�%�c�f�f�-�
�
��	�	�
��
�		�s�%9�	A�Ac���	|j|j|�}d}||jk7r[d}|tzr||j
z}|tzr||jz}	|jj|j|�d}||jk7rd}|r,|j||��}||j|j<|S#t$rt|�d��d�wxYw#t�|�1|��xYw)Nz is not registeredFrT)rr)r#r)r*rrYr�rZr�rr>rrhr;rr_)rrrrrW�changed�selector_eventsrms       �rr>z_PollLikeSelector.modifyws	���	G��/�/�$�"6�"6�w�"?�@�C����S�Z�Z���O��
�"��4�#3�#3�3����#��4�#4�#4�4��
����%�%�c�f�f�o�>��G��3�8�8���G���,�,�f�4�,�8�C�&)�D�O�O�C�F�F�#��
��-�	G��g�[�(:�;�<�$�F�	G��
���"�7�+��s�C�%&C*�C'�*C<c��|�d}n |dkrd}ntj|dz�}g}	|jj|�}|D]m\}}d}||j
zr	|tz}||jzr	|tz}|j|�}|s�N|j|||jzf��o|S#t$r|cYSwxYw)Nr�@�@)�math�ceilr�pollr}r�rZr�rYrdr~r)rr@r�
fd_event_listr�eventrrWs        rrAz_PollLikeSelector.select�s����?��G�
��\��G��i�i��#�
�.�G���	� �N�N�/�/��8�M�'�I�B���F���(�(�(�(��+�%����)�)�)�)��*�$���#�#�B�'�C�����c�6�C�J�J�#6�7�8�'���� �	��L�	�s�B8�8C�Cr)r/r0r1r�r�r�rr9r;r>rAr�r�s@rr�r�Us.���F��M��K��L�.����6r r�r�c�V�eZdZ	ejZejZejZ	y)�PollSelectorN)
r/r0r1rAr�r��POLLINr��POLLOUTr�r2r rr�r��s ��"����
��m�m���~�~�r r��epollc�v��eZdZ	ejZejZejZ	d�Z
dd�Z�fd�Z�xZS)�
EpollSelectorc�6�|jj�Sr�rrr$s rrzEpollSelector.fileno�����>�>�(�(�*�*r c���|�d}n#|dkrd}ntj|dz�dz}tt|j�d�}g}	|j
j
||�}|D]u\}}d}|tjzr	|tz}|tjzr	|tz}|j|�}|s�V|j|||jzf��w|S#t$r|cYSwxYw)N���rr�g����MbP?r)r�r�r|r"r#rr�r}rA�EPOLLINrZ�EPOLLOUTrYrdr~r)	rr@�max_evrr�rr�rrWs	         rrAzEpollSelector.select�s��������A�����)�)�G�c�M�2�T�9��
��T�_�_�-�q�1�F��E�
� $��� 3� 3�G�V� D�
�+�	��E����F�N�N�?�*��k�)�F��F�O�O�+�+��j�(�F��'�'��+����L�L�#�v��
�
�':�!;�<�+��L��$�
���
�s�C#�#C1�0C1c�V��|jj�t�|��yr�rrCrhrls �rrCzEpollSelector.close������N�N� � �"��G�M�Or r)
r/r0r1rAr�r�r�r�r�r�rrCr�r�s@rr�r��s6���#����
��n�n������	+�	�@	�	r r��devpollc�n��eZdZ	ejZejZejZ	d�Z
�fd�Z�xZS)�DevpollSelectorc�6�|jj�Srr�r$s rrzDevpollSelector.fileno�r�r c�V��|jj�t�|��yrr�rls �rrCzDevpollSelector.close�r�r )
r/r0r1rAr�r�r�r�r�r�rrCr�r�s@rr�r��s0���)����
��m�m���~�~��	+�	�	r r��kqueuec�N��eZdZ	�fd�Zd�Zd�fd�	Z�fd�Zdd�Z�fd�Z�xZ	S)�KqueueSelectorc�b��t�|��tj�|_d|_yr{)rhrrAr�r�_max_eventsrls �rrzKqueueSelector.__init__�s#����G���#�]�]�_�D�N� �D�r c�6�|jj�Srr�r$s rrzKqueueSelector.filenor�r c�:��t�|�|||�}	|tzrptj|j
tjtj�}|jj|gdd�|xjdz
c_
|tzrptj|j
tjtj�}|jj|gdd�|xjdz
c_
|S#t�|�5|��xYw�Nrr)rhr9rYrA�keventr�KQ_FILTER_READ�	KQ_EV_ADDr�controlr�rZ�KQ_FILTER_WRITEr;)rrrrrW�kevrms      �rr9zKqueueSelector.registers�����'�"�7�F�D�9�C�

��J�&� �-�-�����0E�0E�(.�(8�(8�:�C��N�N�*�*�C�5�!�Q�7��$�$��)�$��K�'� �-�-�����0F�0F�(.�(8�(8�:�C��N�N�*�*�C�5�!�Q�7��$�$��)�$��J��
���"�7�+��s�C2D�Dc�x��t�|�|�}|jtzrqt	j
|jtjtj�}|xjdzc_		|jj|gdd�|jtzrst	j
|jtjtj�}|xjdzc_		|jj|gdd�|S|S#t$rY��wxYw#t$rY|SwxYw)Nrr)rhr;rrYrAr�rr��KQ_EV_DELETEr�rr�r�rZr�)rrrWr�rms    �rr;zKqueueSelector.unregisters����'�$�W�-�C��z�z�J�&��m�m�C�F�F�F�,A�,A�$*�$7�$7�9��� � �A�%� ���N�N�*�*�C�5�!�Q�7�
�z�z�K�'��m�m�C�F�F�F�,B�,B�$*�$7�$7�9��� � �A�%� ���N�N�*�*�C�5�!�Q�7��J�3�J�����������J��s$�7D�;D,�	D)�(D)�,	D9�8D9c���|�dnt|d�}|jxsd}g}	|jjd||�}|D]�}|j
}|j}d}|tjk(r	|tz}|tjk(r	|tz}|j|�}	|	s�i|j|	||	jzf���|S#t$r|cYSwxYwr�)r|r�rr�r}�ident�filterrAr�rYr�rZrdr~r)
rr@r�r�kev_listr�r�flagrrWs
          rrAzKqueueSelector.select.s���%�o�d�3�w��?�G��%�%�*��F��E�
��>�>�1�1�$���H�� ���Y�Y���z�z�����6�0�0�0��j�(�F��6�1�1�1��k�)�F��'�'��+����L�L�#�v��
�
�':�!;�<� ��L��$�
���
�s�C�C�Cc�V��|jj�t�|��yrr�rls �rrCzKqueueSelector.closeGr�r r)
r/r0r1rrr9r;rArCr�r�s@rr�r��s)���$�	!�
	+�	�$	�.	�2	�	r r�c��	tt|d�}|�y	|�}|dk(r|jd�y|j�y#t$rYywxYw)NFr�rT)�getattrrAr�rCr�)�methodr�selector_objs   r�_can_user�Lsj����v�v�t�,�H����
��z���V�����a� ��
��� �������s�A�A�	A�A)�abcrr�collectionsr�collections.abcrr�rAr�rYrZrr�__doc__rrrrrr4rQrfr��hasattrr�r�r�r�r��DefaultSelectorr2r r�<module>r�ss���(�"�#��
�
��
����2��(K�L�����
8�����6�����R�����E�����/�w�/�({�W�{�|Q��Q�h0�&�0�fW�)�W�t�6�6��&�(�&��6�7��+�)�+�\�6�9���+���6�8��O�*�O�d�4�H��$�O�
�g��#�O�
�i��%�O�
�f��"�O�$�Or 

?>