Your IP : 18.118.28.31


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

�

c��f�L���	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#��reZdSed��reZdSed ��reZdSed��reZdSeZdS)'�)�ABCMeta�abstractmethod)�
namedtuple)�MappingN��c�J�	t|t��r|}na	t|�����}n>#ttt
f$r$td�|����d�wxYw|dkr"td�|�����|S)NzInvalid file object: {!r}rzInvalid 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	�!=�;A8�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�ZdS)�_SelectorMappingc��||_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__rr%r+r.�r rrr<sV������3�"�"�"�.�.�.�O�O�O�/�/�/�/�/r rc��eZdZ	edd���Zed���Zdd�Zedd���Zd�Zd�Z	ed���Z
d	�Zd
�ZdS)�BaseSelectorNc��	t�r��NotImplementedError�rrrrs    r�registerzBaseSelector.register_s��	�&"�!r c��	t�rr6)rrs  r�
unregisterzBaseSelector.unregisterv���	�"�!r c�\�	|�|��|�|||��Sr)r;r9r8s    r�modifyzBaseSelector.modify�s1��	�	
���� � � ��}�}�W�f�d�3�3�3r c��	t�rr6)r�timeouts  r�selectzBaseSelector.select�r<r c��	dSrr2r$s r�closezBaseSelector.close�s��	�	
�r c���	|���}|�td���	||S#t$r$td�|����d�wxYw)NzSelector is closedr()�get_map�RuntimeErrorr*r)rr�mappings   r�get_keyzBaseSelector.get_key�sy��	�
�,�,�.�.���?��3�4�4�4�	O��7�#�#���	O�	O�	O��3�:�:�7�C�C�D�D�$�N�	O���s	�0�.Ac��	t�rr6r$s rrEzBaseSelector.get_map�s��@�!�!r c��|Srr2r$s r�	__enter__zBaseSelector.__enter__�s���r c�.�|���dSr)rC)r�argss  r�__exit__zBaseSelector.__exit__�s���
�
�����r r)
r/r0r1rr9r;r>rArCrHrErKrNr2r rr4r4Ps���������"�"�"��^�"�,�"�"��^�"�$4�4�4�4�"�"�"�"��^�"�$
�
�
�O�O�O��"�"��^�"��������r r4)�	metaclassc�D�eZdZ	d�Zd�Zd
d�Zd�Zd
d�Zd�Zd�Z	d	�Z
dS)�_BaseSelectorImplc�<�i|_t|��|_dSr)r#r�_mapr$s rrz_BaseSelectorImpl.__init__�s�����$�T�*�*��	�	�	r c��		t|��S#t$r2|j���D]}|j|ur|jccYS��wxYwr)rrr#�valuesrr�rr�keys   rr)z!_BaseSelectorImpl._fileobj_lookup�sx��	�	�!�'�*�*�*���	�	�	���-�-�/�/�
"�
"���;�'�)�)��6�M�M�M�M�M�*�
�
	���s��7A�ANc�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*�rrrrrWs     rr9z_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*rrVs   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;r9r�_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#�clearrSr$s rrCz_BaseSelectorImpl.closes!�����������	�	�	r c��|jSr)rSr$s rrEz_BaseSelectorImpl.get_maps
���y�r c�B�		|j|S#t$rYdSwxYwr)r#r*)rrs  r�_key_from_fdz_BaseSelectorImpl._key_from_fds;��	�	��?�2�&�&���	�	�	��4�4�	���s��
�r)r/r0r1rr)r9r;r>rCrErdr2r rrQrQ�s�������'�+�+�+����&���������������������r rQc�l��eZdZ	�fd�Zd�fd�	Z�fd�Zejdkrdd�Zne	j	Zdd�Z	�xZ
S)	�SelectSelectorc���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)rhr9rYrj�addrrZrk)rrrrrWrms     �rr9zSelectSelector.register*sm����g�g���w���5�5���J��	&��M���c�f�%�%�%��K��	&��M���c�f�%�%�%��
r c����t���|��}|j�|j��|j�|j��|Sr)rhr;rj�discardrrk�rrrWrms   �rr;zSelectSelector.unregister2sO����g�g� � ��)�)���
���c�f�%�%�%��
���c�f�%�%�%��
r �win32c�H�tj||||��\}}}|||zgfSr)rA)r�r�w�_r@�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)�maxryrjrk�InterruptedErrorrirYrZrd�appendr)	rr@�readyrurvrwrrrWs	         rrAzSelectSelector.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/r0r1rr9r;�sys�platformryrA�
__classcell__�rms@rrfrf"s�������� ������
������������|�w���	 �	 �	 �	 �	 ��-���������r rfc�V��eZdZ	dZdZdZ�fd�Zd�fd�	Z�fd�Zd�fd�	Z	dd�Z
�xZS)�_PollLikeSelectorNc�z��t�����|���|_dSr)rhr�
_selector_clsrrls �rrz_PollLikeSelector.__init__[s0���
���������+�+�-�-����r c�4��t���|||��}d}|tzr
||jz}|tzr
||jz}	|j�|j|��n'#t���|���xYw|Sr{)	rhr9rY�_EVENT_READrZ�_EVENT_WRITErrr;)rrrrrW�
poller_eventsrms      �rr9z_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)rhr;rr�OSErrorrrs   �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*rrYr�rZr�rr>rrhr;rr_)rrrrrW�changed�selector_eventsrms       �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�rZr�rYrdr~r)rr@r�
fd_event_listr�eventrrWs        rrAz_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/r0r1r�r�r�rr9r;r>rAr�r�s@rr�r�Us��������F��M��K��L�.�.�.�.�.������������������6�������r r�r�c�:�eZdZ	ejZejZejZ	dS)�PollSelectorN)
r/r0r1rAr�r��POLLINr��POLLOUTr�r2r rr�r��s&������"���
��m���~���r r��epollc�X��eZdZ	ejZejZejZ	d�Z
dd�Z�fd�Z�xZS)�
EpollSelectorc�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}rA�EPOLLINrZ�EPOLLOUTrYrdr~r)	rr@�max_evrr�rr�rrWs	         rrAzEpollSelector.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�rrCrhrls �rrCzEpollSelector.close��,����N� � �"�"�"��G�G�M�M�O�O�O�O�Or r)
r/r0r1rAr�r�r�r�r�r�rrCr�r�s@rr�r��st�������#���
��n�����	+�	+�	+�	�	�	�	�@	�	�	�	�	�	�	�	�	r r��devpollc�P��eZdZ	ejZejZejZ	d�Z
�fd�Z�xZS)�DevpollSelectorc�4�|j���Srr�r$s rrzDevpollSelector.fileno�r�r c�z��|j���t�����dSrr�rls �rrCzDevpollSelector.close�r�r )
r/r0r1rAr�r�r�r�r�r�rrCr�r�s@rr�r��s_�������)���
��m���~��	+�	+�	+�	�	�	�	�	�	�	�	�	r r��kqueuec�N��eZdZ	�fd�Zd�Zd�fd�	Z�fd�Zdd�Z�fd�Z�xZ	S)	�KqueueSelectorc���t�����tj��|_d|_dSr{)rhrrAr�r�_max_eventsrls �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)rhr9rYrA�keventr�KQ_FILTER_READ�	KQ_EV_ADDr�controlr�rZ�KQ_FILTER_WRITEr;)rrrrrW�kevrms      �rr9zKqueueSelector.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)rhr;rrYrAr�rr��KQ_EV_DELETEr�rr�r�rZr�)rrrWr�rms    �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�filterrAr�rYr�rZrdr~r)
rr@r�r�kev_listr�r�flagrrWs
          rrAzKqueueSelector.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�rls �rrCzKqueueSelector.closeGr�r r)
r/r0r1rrr9r;rArCr�r�s@rr�r��s��������$�	!�	!�	!�	!�	!�
	+�	+�	+�	�	�	�	�	�	�$	�	�	�	�	�.	�	�	�	�2	�	�	�	�	�	�	�	�	r r�c���	tt|d��}|�dS	|��}|dkr|�d��n|���dS#t$rYdSwxYw)NFr�rT)�getattrrAr�rCr�)�methodr�selector_objs   r�_can_user�Ls�����v�v�t�,�,�H����u�
��x�z�z���V������a� � � � �
��� � � ��t�������u�u����s�:A�
A'�&A')�abcrr�collectionsr�collections.abcrr�rAr�rYrZrr�__doc__rrrrrr4rQrfr��hasattrr�r�r�r�r��DefaultSelectorr2r r�<module>r�s]���(�'�'�'�'�'�'�'�"�"�"�"�"�"�#�#�#�#�#�#�����
�
�
�
�
�
�
�
��
������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 

?>