Current File : //proc/thread-self/root/usr/lib/python3.12/asyncio/__pycache__/unix_events.cpython-312.pyc
�

�(�g�����dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddl
mZddl
mZddl
mZddl
mZdd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddlmZdZe
j6dk(red��d�Zd�ZGd�dej>�Z Gd�dejB�Z"Gd�dejFejH�Z%Gd�dejL�Z'Gd�d�Z(Gd�de(�Z)Gd �d!e(�Z*Gd"�d#e*�Z+Gd$�d%e*�Z,Gd&�d'e(�Z-Gd(�d)e(�Z.d*�Z/Gd+�d,ej`�Z1e Z2e1Z3y)-z2Selector event loop for Unix with signal handling.�N�)�base_events)�base_subprocess)�	constants)�
coroutines)�events)�
exceptions)�futures)�selector_events)�tasks)�
transports)�logger)�SelectorEventLoop�AbstractChildWatcher�SafeChildWatcher�FastChildWatcher�PidfdChildWatcher�MultiLoopChildWatcher�ThreadedChildWatcher�DefaultEventLoopPolicy�win32z+Signals are not really supported on Windowsc��y)zDummy signal handler.N�)�signum�frames  �*/usr/lib/python3.12/asyncio/unix_events.py�_sighandler_noopr*s���c�P�	tj|�S#t$r|cYSwxYw�N)�os�waitstatus_to_exitcode�
ValueError)�statuss rr"r"/s.����(�(��0�0�����
�	�s��%�%c���eZdZdZd�fd�	Z�fd�Zd�Zd�Zd�Zd�Z	d	�Z
		dd
�Z		dd�Z	dd�Z
d
�Z	ddddddd�d�Z	dddddddd�d�Zd�Zd�Zd�Zd�Z�xZS)�_UnixSelectorEventLoopzdUnix event loop.

    Adds signal handling and UNIX Domain Socket support to SelectorEventLoop.
    Nc�2��t�|�|�i|_yr )�super�__init__�_signal_handlers)�self�selector�	__class__s  �rr)z_UnixSelectorEventLoop.__init__?s���
����"� "��rc�0��t�|��tj�s,t	|j
�D]}|j
|��y|j
r;tjd|�d�t|��|j
j�yy)NzClosing the loop z@ on interpreter shutdown stage, skipping signal handlers removal��source)r(�close�sys�
is_finalizing�listr*�remove_signal_handler�warnings�warn�ResourceWarning�clear)r+�sigr-s  �rr1z_UnixSelectorEventLoop.closeCs����
��
��� � �"��D�1�1�2�
0���*�*�3�/�
0��$�$��
�
� 1�$��:H�I�.�%)�	+�
�%�%�+�+�-�
%rc�:�|D]}|s�|j|��yr )�_handle_signal)r+�datars   r�_process_self_dataz)_UnixSelectorEventLoop._process_self_dataQs%���	(�F�������'�		(rc�R�tj|�stj|�rtd��|j	|�|j�	t
j|jj��tj|||d�}||j |<	t
j|t"�t
j$|d�y#ttf$r}tt|���d}~wwxYw#t$r�}|j |=|j sI	t
jd�n2#ttf$r }t'j(d|�Yd}~nd}~wwxYw|j*t*j,k(rtd|�d����d}~wwxYw)z�Add a handler for a signal.  UNIX only.

        Raise ValueError if the signal number is invalid or uncatchable.
        Raise RuntimeError if there is a problem setting up the handler.
        z3coroutines cannot be used with add_signal_handler()NF����set_wakeup_fd(-1) failed: %s�sig � cannot be caught)r�iscoroutine�iscoroutinefunction�	TypeError�
_check_signal�
_check_closed�signal�
set_wakeup_fd�_csock�filenor#�OSError�RuntimeError�strr�Handler*r�siginterruptr�info�errno�EINVAL)r+r:�callback�args�exc�handle�nexcs       r�add_signal_handlerz)_UnixSelectorEventLoop.add_signal_handlerXsq��
�"�"�8�,��.�.�x�8��8�9�
9����3������	)�

� � ����!3�!3�!5�6����x��t�T�:��%+����c�"�	�
�M�M�#�/�0�
����U�+���G�$�	)��s�3�x�(�(��	)���	��%�%�c�*��(�(�F��(�(��,��"�G�,�F��K�K� >��E�E��F���y�y�E�L�L�(�"�T�#��.?�#@�A�A���	�sZ�-C�-0D	�D�-D�D�		F&�F!�,E�F!�E1�E,�'F!�,E1�10F!�!F&c��|jj|�}|�y|jr|j|�y|j	|�y)z2Internal helper that is the actual signal handler.N)r*�get�
_cancelledr5�_add_callback_signalsafe)r+r:rXs   rr<z%_UnixSelectorEventLoop._handle_signal�sE���&�&�*�*�3�/���>������&�&�s�+��)�)�&�1rc��|j|�	|j|=|tjk(rtj
}ntj}	tj||�|js	tjd�yy#t$rYywxYw#t$r2}|jtjk(rtd|�d����d}~wwxYw#ttf$r }tjd|�Yd}~yd}~wwxYw)zwRemove a handler for a signal.  UNIX only.

        Return True if a signal handler was removed, False if not.
        FrBrCNr@rAT)rGr*�KeyErrorrI�SIGINT�default_int_handler�SIG_DFLrMrSrTrNrJr#rrR)r+r:�handlerrWs    rr5z,_UnixSelectorEventLoop.remove_signal_handler�s���
	
���3��	��%�%�c�*��&�-�-���0�0�G��n�n�G�	��M�M�#�w�'��$�$�
A��$�$�R�(���-�	��	���	��y�y�E�L�L�(�"�T�#��.?�#@�A�A���		����(�
A����:�C�@�@���
A�sA�
B�B�8C�	B�B�	C�'-C�C�D�+D�Dc��t|t�std|����|tj�vrtd|����y)z�Internal helper to validate a signal.

        Raise ValueError if the signal number is invalid or uncatchable.
        Raise RuntimeError if there is a problem setting up the handler.
        zsig must be an int, not zinvalid signal number N)�
isinstance�intrFrI�
valid_signalsr#)r+r:s  rrGz$_UnixSelectorEventLoop._check_signal�sJ���#�s�#��6�s�g�>�?�?��f�*�*�,�,��5�c�U�;�<�<�-rc� �t|||||�Sr )�_UnixReadPipeTransport�r+�pipe�protocol�waiter�extras     r�_make_read_pipe_transportz0_UnixSelectorEventLoop._make_read_pipe_transport�s��%�d�D�(�F�E�J�Jrc� �t|||||�Sr )�_UnixWritePipeTransportrks     r�_make_write_pipe_transportz1_UnixSelectorEventLoop._make_write_pipe_transport�s��&�t�T�8�V�U�K�Krc	��lK�tj�5tjdt�t	j
�}
ddd�
5|
j
�std��|j�}t||||||||f||d�|	��}|
j|j�|j|�	|�d{���	ddd�|S#1swY��xYw7�#ttf$r�t$r+|j!�|j#��d{���7�wxYw#1swYSxYw�w)N�ignorezRasyncio.get_child_watcher() is not activated, subprocess support is not installed.)rnro)r6�catch_warnings�simplefilter�DeprecationWarningr�get_child_watcher�	is_activerN�
create_future�_UnixSubprocessTransport�add_child_handler�get_pid�_child_watcher_callback�
SystemExit�KeyboardInterrupt�
BaseExceptionr1�_wait)
r+rmrV�shell�stdin�stdout�stderr�bufsizero�kwargs�watcherrn�transps
             r�_make_subprocess_transportz1_UnixSelectorEventLoop._make_subprocess_transport�s;�����
$�
$�
&�	1��!�!�(�,>�?��.�.�0�G�	1��	��$�$�&�
#�$G�H�H��'�'�)�F�-�d�H�d�E�,1�6�6�7�6�39��6�/5�6�F�
�%�%�f�n�n�&6�$(�$@�$@�&�
J�
����!	�0�
�9	1�	1��(��� 1�2�
�� �
������l�l�n�$�$��
��'	�0�
�se�D4�/C�
D4�A-D'�>C!�C�C!�	
D4�C�D4�C!�!;D$�D�D$�$D'�'D1�,D4c�<�|j|j|�yr )�call_soon_threadsafe�_process_exited)r+�pid�
returncoder�s    rrz._UnixSelectorEventLoop._child_watcher_callback�s���!�!�&�"8�"8�*�Er)�ssl�sock�server_hostname�ssl_handshake_timeout�ssl_shutdown_timeoutc���K�|�t|t�sJ�|r
|�2td��|�td��|�td��|�td��|��|�td��tj|�}tj
t
jt
jd�}	|jd�|j||��d{���nf|�td��|jt
jk7s|jt
jk7rtd	|����|jd�|j||||||�
��d{���\}}	||	fS7��#|j��xYw7�#�w)Nz/you have to pass server_hostname when using sslz+server_hostname is only meaningful with ssl�1ssl_handshake_timeout is only meaningful with ssl�0ssl_shutdown_timeout is only meaningful with ssl�3path and sock can not be specified at the same timerFzno path and sock were specified�.A UNIX Domain Stream Socket was expected, got )r�r�)rfrOr#r!�fspath�socket�AF_UNIX�SOCK_STREAM�setblocking�sock_connectr1�family�type�_create_connection_transport)
r+�protocol_factory�pathr�r�r�r�r��	transportrms
          r�create_unix_connectionz-_UnixSelectorEventLoop.create_unix_connection�s������&�*�_�c�*J�J�J���&� �E�G�G��*� �!N�O�O�$�0� �G�I�I�#�/� �F�H�H����� �I�K�K��9�9�T�?�D��=�=�����1C�1C�Q�G�D�
�� � ��'��'�'��d�3�3�3��|� �!B�C�C����v�~�~�-��I�I��!3�!3�3� �D�T�H�M�O�O����U�#�$(�$E�$E��"�C��"7�!5�%F�%7�7��	�8��(�"�"�%4��
��
�
����7�s=�B"E7�%&E�E�E�BE7�E5�E7�E�E2�2E7�dT)r��backlogr�r�r��
start_servingc	��K�t|t�rtd��|�
|std��|�
|std��|��|�td��t	j
|�}t
jtjtj�}|ddvrH	tjt	j|�j�rt	j|�	|j#|�nU|�td
��|j*tjk7s|j,tjk7rtd|����|j/d�t1j2||g|||||�}|r-|j5�t7j8d��d{���|S#t$rY��t$r!}	tj d||	�Yd}	~	��d}	~	wwxYw#t$rT}
|j%�|
j&t&j(k(r!d|�d	�}tt&j(|�d��d}
~
w|j%��xYw7���w)
Nz*ssl argument must be an SSLContext or Noner�r�r�r)r�z2Unable to check or remove stale UNIX socket %r: %rzAddress z is already in usez-path was not specified, and no sock specifiedr�F)rf�boolrFr#r!r�r�r�r��stat�S_ISSOCK�st_mode�remove�FileNotFoundErrorrMr�error�bindr1rS�
EADDRINUSEr�r�r�r�Server�_start_servingr�sleep)
r+r�r�r�r�r�r�r�r��errrW�msg�servers
             r�create_unix_serverz)_UnixSelectorEventLoop.create_unix_servers7�����c�4� ��H�I�I� �,�S��C�E�
E� �+�C��B�D�
D����� �I�K�K��9�9�T�?�D��=�=�����1C�1C�D�D��A�w�k�)�6��}�}�R�W�W�T�]�%:�%:�;��	�	�$��

��	�	�$���|� �C�E�E����v�~�~�-��I�I��!3�!3�3� �D�T�H�M�O�O�	
������#�#�D�4�&�2B�$'��2G�$8�:����!�!�#��+�+�a�.� � ��
��S)����6��L�L�"*�+/��6�6��6���
��
�
���9�9�� 0� 0�0�%�T�H�,>�?�C�!�%�"2�"2�C�8�d�B���
��
�
����&
!�si�BI�AF'�"G�3B-I� I�!I�'	G�0I�2G�:G�I�G�I�	I�'AH6�6I�Ic
��K�	tj	|j�}	tj|�j}|r|n|}|sy|j�}	|j|	d|||||d�|	�d{���S#t$rtjd��wxYw#ttjf$r}tjd��d}~wwxYw#t$rtjd��wxYw7�~�w)Nzos.sendfile() is not availableznot a regular filer)
r!�sendfile�AttributeErrorr	�SendfileNotAvailableErrorrL�io�UnsupportedOperation�fstat�st_sizerMr{�_sock_sendfile_native_impl)
r+r��file�offset�countrLr��fsize�	blocksize�futs
          r�_sock_sendfile_nativez,_UnixSelectorEventLoop._sock_sendfile_nativebs����	2��K�K�	M��[�[�]�F�	M��H�H�V�$�,�,�E�#�E��	���� � �"���'�'��T�4��(.��y�!�	E��y���%�	2��6�6�0�2�
2�	2��
�� 7� 7�8�	M��6�6�7K�L�L��	M���	M��6�6�7K�L�L�	M���sV�C<�B�B"�C�6C<�;C:�<C<�B�C<�"C�;C�C�C<�C7�7C<c	
��|j�}	|�|j|�|j�r|j|||�y|r/||z
}|dkr%|j|||�|j	|�y	tj|	|||�}
|
dk(r%|j|||�|j	|�y||
z
}||
z
}|�|j||�|j|	|j||	||||||�
y#ttf$r;|�|j||�|j|	|j||	||||||�
Yyt$r�}|�Q|jtjk(r4t|�t ur#t!dtj�}||_|}|dk(r:t%j&d�}
|j|||�|j)|
�n)|j|||�|j)|�Yd}~yYd}~yd}~wt*t,f$r�t.$r.}|j|||�|j)|�Yd}~yd}~wwxYw)Nrzsocket is not connectedzos.sendfile call failed)rL�
remove_writer�	cancelled�_sock_sendfile_update_filepos�
set_resultr!r��_sock_add_cancellation_callback�
add_writerr��BlockingIOError�InterruptedErrorrMrS�ENOTCONNr��ConnectionError�	__cause__r	r��
set_exceptionr�r�r�)r+r��
registered_fdr�rLr�r�r��
total_sent�fd�sentrW�new_excr�s              rr�z1_UnixSelectorEventLoop._sock_sendfile_native_implysT��
�[�[�]���$�

���}�-��=�=�?��.�.�v�v�z�J����
�*�I��A�~��2�2�6�6�:�N����z�*��1	F��;�;�r�6�6�9�=�D�J�q�y��2�2�6�6�:�N����z�*��$����d�"�
� �(��8�8��d�C�����D�$C�$C�S� "�D�&� &��y�*�F��[ �!1�2�	B��$��4�4�S�$�?��O�O�B�� ?� ?����f�"�E�9�j�
B��	'��)��I�I����/���I�_�4�
*�-�u�~�~�?��$'��!����Q��
!�:�:�-�/���2�2�6�6�:�N��!�!�#�&��2�2�6�6�:�N��!�!�#�&�&�'���-�.�	���	#��.�.�v�v�z�J����c�"�"��	#�s,�:C?�?AI�I�B6H�I�+$I�Ic�Z�|dkDr&tj||tj�yy�Nr)r!�lseek�SEEK_SET)r+rLr�r�s    rr�z4_UnixSelectorEventLoop._sock_sendfile_update_filepos�s"����>��H�H�V�V�R�[�[�1�rc�6�����fd�}|j|�y)Nc�v��|j�r(�j�}|dk7r�j|�yyy)Nr@)r�rLr�)r�r�r+r�s  ��r�cbzB_UnixSelectorEventLoop._sock_add_cancellation_callback.<locals>.cb�s6����}�}���[�[�]����8��&�&�r�*��r)�add_done_callback)r+r�r�r�s` ` rr�z6_UnixSelectorEventLoop._sock_add_cancellation_callback�s���	+�
	���b�!rr �NN)�__name__�
__module__�__qualname__�__doc__r)r1r>rZr<r5rGrprsr�rr�r�r�r�r�r��
__classcell__�r-s@rr&r&9s�����
#�.�(�+�Z2��@
=�@D�(,�K�AE�)-�L�04��BF�*.�0#��4� �"&�!%�0#�f*.�G��s��"&�!%��G�R�.DF�L2�"rr&c���eZdZdZd�fd�	Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zej fd
�Zdd�Zd�Zd�Z�xZS)rjic�4��t�|�|�||jd<||_||_|j�|_||_d|_d|_	tj|j�j}tj|�sJtj|�s5tj |�s d|_d|_d|_t#d��tj$|jd�|jj'|jj(|�|jj'|j*|j|j,�|�,|jj't.j0|d�yy)NrlFz)Pipe transport is for pipes/sockets only.)r(r)�_extra�_loop�_piperL�_fileno�	_protocol�_closing�_pausedr!r�r�r��S_ISFIFOr��S_ISCHRr#�set_blocking�	call_soon�connection_made�_add_reader�_read_readyr
�_set_result_unless_cancelled)r+�looprlrmrnro�moder-s       �rr)z_UnixReadPipeTransport.__init__�s.���
�����"����F����
���
��{�{�}���!�����
�����x�x����%�-�-���
�
�d�#��
�
�d�#����T�"��D�J��D�L�!�D�N��H�I�I�
������e�,��
�
���T�^�^�;�;�T�B��
�
���T�-�-�!�\�\�4�+;�+;�	=����J�J� � ��!E�!E�!'��
/�rc�^�|j�sy|jj||�yr )�
is_readingr�r�)r+r�rUs   rr�z"_UnixReadPipeTransport._add_reader�s#����� ���
�
���r�8�,rc�:�|jxr
|jSr )r�r��r+s rrz!_UnixReadPipeTransport.is_reading�s���<�<��5��
�
�$5�5rc�t�|jjg}|j�|jd�n|jr|jd�|jd|j
���t
|jdd�}|j�W|�Utj||j
tj�}|r|jd�nA|jd�n/|j�|jd�n|jd�djd	j|��S)
N�closed�closing�fd=�	_selector�polling�idle�open�<{}>� )r-r�r��appendr�r��getattrr�r�_test_selector_event�	selectors�
EVENT_READ�format�join)r+rRr,rs    r�__repr__z_UnixReadPipeTransport.__repr__�s������'�'�(���:�:���K�K��!�
�]�]��K�K�	�"����c�$�,�,��(�)��4�:�:�{�D�9���:�:�!�h�&:�%�:�:��$�,�,�	�(<�(<�>�G�����I�&����F�#�
�Z�Z�
#��K�K����K�K��!��}�}�S�X�X�d�^�,�,rc�h�	tj|j|j�}|r|jj|�y|jj�rtjd|�d|_
|jj|j�|jj|jj�|jj|jd�y#tt f$rYyt"$r}|j%|d�Yd}~yd}~wwxYw)N�%r was closed by peerTz"Fatal read error on pipe transport)r!�readr��max_sizer��
data_receivedr��	get_debugrrRr��_remove_readerr��eof_received�_call_connection_lostr�r�rM�_fatal_error)r+r=rWs   rr�z"_UnixReadPipeTransport._read_readys���	G��7�7�4�<�<����7�D�����,�,�T�2��:�:�'�'�)��K�K� 7��>� $��
��
�
�)�)�$�,�,�7��
�
�$�$�T�^�^�%@�%@�A��
�
�$�$�T�%?�%?��F�� �!1�2�	���	I����c�#G�H�H��	I�s�*C<�<D1�
D1�D,�,D1c���|j�syd|_|jj|j�|jj�rt
jd|�yy)NTz%r pauses reading)rr�r�rr�rr�debugrs r�
pause_readingz$_UnixReadPipeTransport.pause_readingsP����� ������
�
�!�!�$�,�,�/��:�:���!��L�L�,�d�3�"rc��|js|jsyd|_|jj|j|j
�|jj
�rtjd|�yy)NFz%r resumes reading)	r�r�r�r�r�r�rrr#rs r�resume_readingz%_UnixReadPipeTransport.resume_reading%s[���=�=���������
�
���t�|�|�T�-=�-=�>��:�:���!��L�L�-�t�4�"rc��||_yr �r��r+rms  r�set_protocolz#_UnixReadPipeTransport.set_protocol-�	��!��rc��|jSr r(rs r�get_protocolz#_UnixReadPipeTransport.get_protocol0����~�~�rc��|jSr �r�rs r�
is_closingz!_UnixReadPipeTransport.is_closing3����}�}�rc�@�|js|jd�yyr )r��_closers rr1z_UnixReadPipeTransport.close6s���}�}��K�K���rc�v�|j�-|d|��t|��|jj�yy�Nzunclosed transport r/�r�r8r1�r+�_warns  r�__del__z_UnixReadPipeTransport.__del__:�5���:�:�!��'��x�0�/�$�O��J�J����"rc�<�t|t�rQ|jtjk(r4|jj�rDt
jd||d��n*|jj||||jd��|j|�y�Nz%r: %sT��exc_info)�message�	exceptionr�rm)rfrMrS�EIOr�rrr#�call_exception_handlerr�r4�r+rWr@s   rr!z#_UnixReadPipeTransport._fatal_error?sr���s�G�$����e�i�i�)?��z�z�#�#�%����X�t�W�t�D��J�J�-�-�"� �!� �N�N�	/�
�	
���C�rc��d|_|jj|j�|jj	|j
|�y�NT)r�r�rr�r�r �r+rWs  rr4z_UnixReadPipeTransport._closeMs9����
��
�
�!�!�$�,�,�/��
�
���T�7�7��=rc��	|jj|�|jj�d|_d|_d|_y#|jj�d|_d|_d|_wxYwr �r��connection_lostr�r1r�rGs  rr z,_UnixReadPipeTransport._call_connection_lostR�g��	��N�N�*�*�3�/��J�J�����D�J�!�D�N��D�J��
�J�J�����D�J�!�D�N��D�J���A
�
1A>r��zFatal error on pipe transport)r�r�r�rr)r�rrr�r$r&r*r-r1r1r6r7r:r!r4r r�r�s@rrjrj�s]����H�/�<-�
6�-�*G�$4�5�"����%�M�M��
�>�
rrjc���eZdZd�fd�	Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zej fd
�Zd�Zdd�Zdd�Zd�Z�xZS)rrc���t�
|�||�||jd<||_|j	�|_||_t�|_d|_	d|_
tj|j
�j}tj|�}tj |�}tj"|�}	|s$|s"|	s d|_d|_d|_t%d��tj&|j
d�|j(j+|jj,|�|	s!|rdt.j0j3d�sE|j(j+|j(j4|j
|j6�|�,|j(j+t8j:|d�yy)NrlrFz?Pipe transport is only for pipes, sockets and character devices�aix)r(r)r�r�rLr�r��	bytearray�_buffer�
_conn_lostr�r!r�r�r�r�r�r�r#r�r�r�r�r2�platform�
startswithr�r�r
r�)r+rrlrmrnror�is_char�is_fifo�	is_socketr-s          �rr)z _UnixWritePipeTransport.__init___si���
�����%�"����F����
��{�{�}���!��� �{��������
��x�x����%�-�-���,�,�t�$���-�-��%���M�M�$�'�	��7�i��D�J��D�L�!�D�N��D�E�
E�	������e�,��
�
���T�^�^�;�;�T�B�
�����)@�)@��)G��J�J� � ����!7�!7�!%���t�/?�/?�
A����J�J� � ��!E�!E�!'��
/�rc��|jjg}|j�|jd�n|jr|jd�|jd|j
���t
|jdd�}|j�{|�ytj||j
tj�}|r|jd�n|jd�|j�}|jd|���n/|j�|jd�n|jd�d	jd
j|��S)Nrrr	r
rrzbufsize=r
rr)r-r�r�rr�r�rr�rrr�EVENT_WRITE�get_write_buffer_sizerr)r+rRr,rr�s     rrz _UnixWritePipeTransport.__repr__�s�����'�'�(���:�:���K�K��!�
�]�]��K�K�	�"����c�$�,�,��(�)��4�:�:�{�D�9���:�:�!�h�&:�%�:�:��$�,�,�	�(=�(=�?�G�����I�&����F�#��0�0�2�G��K�K�(�7�)�,�-�
�Z�Z�
#��K�K����K�K��!��}�}�S�X�X�d�^�,�,rc�,�t|j�Sr )�lenrRrs rr[z-_UnixWritePipeTransport.get_write_buffer_size�s���4�<�<� � rc���|jj�rtjd|�|jr|jt
��y|j�y)Nr)r�rrrRrRr4�BrokenPipeErrorrs rr�z#_UnixWritePipeTransport._read_ready�s@���:�:���!��K�K�/��6��<�<��K�K��)�*��K�K�Mrc�Z�t|tttf�sJt	|���t|t�rt|�}|sy|j
s|jrH|j
tjk\rtjd�|xj
dz
c_y|jss	tj|j|�}|t+|�k(ry|dkDrt|�|d}|j,j/|j|j0�|xj|z
c_|j3�y#tt f$rd}Y��t"t$f$r�t&$r1}|xj
dz
c_|j)|d�Yd}~yd}~wwxYw)Nz=pipe closed by peer or os.write(pipe, data) raised exception.rr�#Fatal write error on pipe transport)rf�bytesrQ�
memoryview�reprrSr�r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr�warningrRr!�writer�r�r�r�r�r�r!r]r��_add_writer�_write_ready�_maybe_pause_protocol)r+r=�nrWs    rrgz_UnixWritePipeTransport.write�sW���$��	�:� >�?�K��d��K�?��d�I�&��d�#�D����?�?�d�m�m����)�"M�"M�M���� H�I��O�O�q� �O���|�|�	
��H�H�T�\�\�4�0���C��I�~���Q��!�$�'���+���J�J�"�"�4�<�<��1B�1B�C��������"�"�$��$�%5�6�
���� 1�2�
�� �
����1�$���!�!�#�'L�M���
�s�7 E�F*�"F*�9'F%�%F*c�4�|jsJd��	tj|j|j�}|t	|j�k(r�|jj�|jj|j�|j�|jr6|jj|j�|jd�y|dkDr|jd|�=yy#ttf$rYyttf$r�t $rp}|jj�|xj"dz
c_|jj|j�|j%|d�Yd}~yd}~wwxYw)NzData should not be emptyrrra)rRr!rgr�r]r9r��_remove_writer�_maybe_resume_protocolr�rr r�r�r�r�r�rSr!)r+rkrWs   rriz$_UnixWritePipeTransport._write_ready�s@���|�|�7�7�7�|�	%�������t�|�|�4�A��C����%�%����"�"�$��
�
�)�)�$�,�,�7��+�+�-��=�=��J�J�-�-�d�l�l�;��.�.�t�4���Q���L�L��!��$���) �!1�2�	���-�.�	���	J��L�L��� ��O�O�q� �O�
�J�J�%�%�d�l�l�3����c�#H�I�I��
	J�s�*C?�?F�F�'A&F�Fc��yrFrrs r�
can_write_eofz%_UnixWritePipeTransport.can_write_eof����rc��|jry|jsJ�d|_|jsL|jj	|j
�|jj
|jd�yyrF)r�r�rRr�rr�r�r rs r�	write_eofz!_UnixWritePipeTransport.write_eof�s[���=�=���z�z��z���
��|�|��J�J�%�%�d�l�l�3��J�J� � ��!;�!;�T�B�rc��||_yr r(r)s  rr*z$_UnixWritePipeTransport.set_protocol�r+rc��|jSr r(rs rr-z$_UnixWritePipeTransport.get_protocol�r.rc��|jSr r0rs rr1z"_UnixWritePipeTransport.is_closing�r2rc�X�|j�|js|j�yyyr )r�r�rsrs rr1z_UnixWritePipeTransport.close�s$���:�:�!�$�-�-��N�N��+8�!rc�v�|j�-|d|��t|��|jj�yyr6r7r8s  rr:z_UnixWritePipeTransport.__del__r;rc�&�|jd�yr )r4rs r�abortz_UnixWritePipeTransport.aborts�����D�rc��t|t�r4|jj�rDt	j
d||d��n*|jj
||||jd��|j|�yr=)	rfrMr�rrr#rCr�r4rDs   rr!z$_UnixWritePipeTransport._fatal_error	sc���c�7�#��z�z�#�#�%����X�t�W�t�D��J�J�-�-�"� �!� �N�N�	/�
�	
���C�rc�>�d|_|jr%|jj|j�|jj�|jj
|j�|jj|j|�yrF)	r�rRr�rmr�r9rr�r rGs  rr4z_UnixWritePipeTransport._closesf����
��<�<��J�J�%�%�d�l�l�3��������
�
�!�!�$�,�,�/��
�
���T�7�7��=rc��	|jj|�|jj�d|_d|_d|_y#|jj�d|_d|_d|_wxYwr rIrGs  rr z-_UnixWritePipeTransport._call_connection_lostrKrLr�rMr )r�r�r�r)rr[r�rgrirprsr*r-r1r1r6r7r:rzr!r4r r�r�s@rrrrr\sd���#/�J-�0!��!%�F%�8�C�"����
%�M�M��
��>�rrrc��eZdZd�Zy)r|c
���d}|tjk(r6tjj	d�rtj�\}}	tj|f||||d|d�|��|_|�=|j�t|j�d|��|j_d}|�!|j�|j�yy#|�!|j�|j�wwxYw)NrPF)r�r�r�r��universal_newlinesr��wb)�	buffering)
�
subprocess�PIPEr2rTrUr��
socketpair�Popen�_procr1r
�detachr�)	r+rVr�r�r�r�r�r��stdin_ws	         r�_startz_UnixSubprocessTransport._start+s������J�O�O�#����(?�(?��(F�
$�.�.�0�N�E�7�	 �#�)�)��E�!��v�f�#(�'�E�=C�E�D�J��"����
�#'����(8�$�'�#R��
�
� ����"����
��
�
��#��w�"����
��
�
��#�s
�
A!C�%C7N)r�r�r�r�rrrr|r|)s�� rr|c�B�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)raHAbstract base class for monitoring child processes.

    Objects derived from this class monitor a collection of subprocesses and
    report their termination or interruption by a signal.

    New callbacks are registered with .add_child_handler(). Starting a new
    process must be done within a 'with' block to allow the watcher to suspend
    its activity until the new process if fully registered (this is needed to
    prevent a race condition in some implementations).

    Example:
        with watcher:
            proc = subprocess.Popen("sleep 1")
            watcher.add_child_handler(proc.pid, callback)

    Notes:
        Implementations of this class must be thread-safe.

        Since child watcher objects may catch the SIGCHLD signal and call
        waitpid(-1), there should be only one active object per process.
    Nc�\�|jtk7rtjddd��yy)Nr�P{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.����r�)r�r�r6�_deprecated)�clss r�__init_subclass__z&AbstractChildWatcher.__init_subclass__Xs,���>�>�X�%�� � �!7�;�%,�
.�&rc��t��)aRegister a new child handler.

        Arrange for callback(pid, returncode, *args) to be called when
        process 'pid' terminates. Specifying another callback for the same
        process replaces the previous handler.

        Note: callback() must be thread-safe.
        ��NotImplementedError�r+r�rUrVs    rr}z&AbstractChildWatcher.add_child_handler_s
��"�#�#rc��t��)z�Removes the handler for process 'pid'.

        The function returns True if the handler was successfully removed,
        False if there was nothing to remove.r��r+r�s  r�remove_child_handlerz)AbstractChildWatcher.remove_child_handlerjs
��"�#�#rc��t��)z�Attach the watcher to an event loop.

        If the watcher was previously attached to an event loop, then it is
        first detached before attaching to the new loop.

        Note: loop may be None.
        r��r+rs  r�attach_loopz AbstractChildWatcher.attach_looprs
��"�#�#rc��t��)zlClose the watcher.

        This must be called to make sure that any underlying resource is freed.
        r�rs rr1zAbstractChildWatcher.close|s
��
"�#�#rc��t��)z�Return ``True`` if the watcher is active and is used by the event loop.

        Return True if the watcher is installed and ready to handle process exit
        notifications.

        r�rs rrzzAbstractChildWatcher.is_active�s
��"�#�#rc��t��)zdEnter the watcher's context and allow starting new processes

        This function must return selfr�rs r�	__enter__zAbstractChildWatcher.__enter__�s
��"�#�#rc��t��)zExit the watcher's contextr��r+�a�b�cs    r�__exit__zAbstractChildWatcher.__exit__�s��!�#�#r)�returnN)r�r�r�r�r�r}r�r�r1rzr�r�rrrrrAs/���,.�	$�$�$�$�$�$�$rrc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)ra6Child watcher implementation using Linux's pid file descriptors.

    This child watcher polls process file descriptors (pidfds) to await child
    process termination. In some respects, PidfdChildWatcher is a "Goldilocks"
    child watcher implementation. It doesn't require signals or threads, doesn't
    interfere with any processes launched outside the event loop, and scales
    linearly with the number of subprocesses launched by the event loop. The
    main disadvantage is that pidfds are specific to Linux, and only work on
    recent (5.3+) kernels.
    c��|Sr rrs rr�zPidfdChildWatcher.__enter__�����rc��yr r)r+�exc_type�	exc_value�
exc_tracebacks    rr�zPidfdChildWatcher.__exit__����rc��yrFrrs rrzzPidfdChildWatcher.is_active�rqrc��yr rrs rr1zPidfdChildWatcher.close�r�rc��yr rr�s  rr�zPidfdChildWatcher.attach_loop�r�rc��tj�}tj|�}|j	||j
||||�yr )r�get_running_loopr!�
pidfd_openr��_do_wait)r+r�rUrVr�pidfds      rr}z#PidfdChildWatcher.add_child_handler�s:���&�&�(���
�
�c�"�������
�
�s�E�8�T�Jrc�$�tj�}|j|�	tj|d�\}}t|�}tj|�|||g|���y#t$rd}tjd|�Y�CwxYw)Nr�zJchild process pid %d exit status already read:  will report returncode 255)
rr�rr!�waitpidr"�ChildProcessErrorrrfr1)	r+r�r�rUrVr�_r$r�s	         rr�zPidfdChildWatcher._do_wait�s����&�&�(�����E�"�	8��
�
�3��*�I�A�v�0��7�J�
�������j�(�4�(��!�	��J��N�N�.��
�		�s�A+�+!B�Bc��yrFrr�s  rr�z&PidfdChildWatcher.remove_child_handler����rN)r�r�r�r�r�r�rzr1r�r}r�r�rrrrr�s0��	��
��
�
�K�
)�&rrc�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�BaseChildWatcherc� �d|_i|_yr )r��
_callbacksrs rr)zBaseChildWatcher.__init__�s����
���rc�&�|jd�yr )r�rs rr1zBaseChildWatcher.close�s������rc�V�|jduxr|jj�Sr )r��
is_runningrs rrzzBaseChildWatcher.is_active�s#���z�z��%�A�$�*�*�*?�*?�*A�Arc��t��r r�)r+�expected_pids  r�_do_waitpidzBaseChildWatcher._do_waitpid����!�#�#rc��t��r r�rs r�_do_waitpid_allz BaseChildWatcher._do_waitpid_all�r�rc��|�t|tj�sJ�|j�(|�&|jrtjdt�|j�)|jjtj�||_|�;|jtj|j�|j�yy)NzCA loop is being detached from a child watcher with pending handlers)rfr�AbstractEventLoopr�r�r6r7�RuntimeWarningr5rI�SIGCHLDrZ�	_sig_chldr�r�s  rr�zBaseChildWatcher.attach_loop�s����|�z�$��0H�0H�I�I�I��:�:�!�d�l�t����M�M�=��
 �
�:�:�!��J�J�,�,�V�^�^�<���
����#�#�F�N�N�D�N�N�C�
� � �"�rc��	|j�y#ttf$r�t$r(}|jjd|d��Yd}~yd}~wwxYw)N�$Unknown exception in SIGCHLD handler)r@rA)r�r�r�r�r�rCrGs  rr�zBaseChildWatcher._sig_chld�sX��	�� � �"���-�.�	���	�
�J�J�-�-�A� �/�
�
��		�s��A�A�AN)
r�r�r�r)r1rzr�r�r�r�rrrr�r��s&����B�$�$�#�(rr�c�P��eZdZdZ�fd�Z�fd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Z�xZS)
rad'Safe' child watcher implementation.

    This implementation avoids disrupting other code spawning processes by
    polling explicitly each process in the SIGCHLD handler instead of calling
    os.waitpid(-1).

    This is a safe solution but it has a significant overhead when handling a
    big number of children (O(n) each time SIGCHLD is raised)
    c�R��t�|��tjddd��y)Nrr�r�r�)r(r)r6r��r+r-s �rr)zSafeChildWatcher.__init__s'���
�������/�;�%,�	.rc�V��|jj�t�|�
�yr )r�r9r(r1r�s �rr1zSafeChildWatcher.closes���������
��
�rc��|Sr rrs rr�zSafeChildWatcher.__enter__r�rc��yr rr�s    rr�zSafeChildWatcher.__exit__r�rc�H�||f|j|<|j|�yr )r�r�r�s    rr}z"SafeChildWatcher.add_child_handler"s%�� (�$�/������	
����rc�>�	|j|=y#t$rYywxYw�NTF�r�r`r�s  rr�z%SafeChildWatcher.remove_child_handler(�(��	�����$����	��	���
�	�c�Z�t|j�D]}|j|��yr �r4r�r�r�s  rr�z SafeChildWatcher._do_waitpid_all/s(������(�	"�C����S�!�	"rc��|dkDsJ�	tj|tj�\}}|dk(ryt|�}|jj�rt
jd||�		|jj|�\}}|||g|���y#t$r|}d}t
jd|�Y�OwxYw#t$r7|jj�rt
jd|d��YyYywxYw)Nr�$process %s exited with returncode %sr��8Unknown child process pid %d, will report returncode 255�'Child watcher got an unexpected pid: %rTr>)
r!r��WNOHANGr"r�rrr#r�rfr��popr`)r+r�r�r$r�rUrVs       rr�zSafeChildWatcher._do_waitpid4s����a����	7��*�*�\�2�:�:�>�K�C���a�x��/��7�J��z�z�#�#�%����C�)�:�7�		-�!�_�_�0�0��5�N�H�d�
�S�*�,�t�,��7!�	��C��J��N�N�J��
�	��(�	3��z�z�#�#�%����H�"�T�3�&�	3�s#�'B�4C�#C�C�;D�D)
r�r�r�r�r)r1r�r�r}r�r�r�r�r�s@rrrs0����.���
���"�
 -rrc�J��eZdZdZ�fd�Z�fd�Zd�Zd�Zd�Zd�Z	d�Z
�xZS)	raW'Fast' child watcher implementation.

    This implementation reaps every terminated processes by calling
    os.waitpid(-1) directly, possibly breaking other code spawning processes
    and waiting for their termination.

    There is no noticeable overhead when handling a big number of children
    (O(1) each time a child terminates).
    c���t�|��tj�|_i|_d|_tjddd��y)Nrrr�r�r�)	r(r)�	threading�Lock�_lock�_zombies�_forksr6r�r�s �rr)zFastChildWatcher.__init__asC���
�����^�^�%��
���
�������/�;�%,�	.rc���|jj�|jj�t�|��yr )r�r9r�r(r1r�s �rr1zFastChildWatcher.closeks,����������
�
����
��
�rc�t�|j5|xjdz
c_|cddd�S#1swYyxYw)Nr)r�r�rs rr�zFastChildWatcher.__enter__ps/��
�Z�Z�	��K�K�1��K��	�	�	�s�.�7c�>�|j5|xjdzc_|js|js
	ddd�yt|j�}|jj	�ddd�tjd�y#1swY� xYw)Nrz5Caught subprocesses termination from unknown pids: %s)r�r�r�rOr9rrf)r+r�r�r��collateral_victimss     rr�zFastChildWatcher.__exit__vs{��
�Z�Z�	"��K�K�1��K��{�{�$�-�-��		"�	"�"%�T�]�]�!3���M�M���!�	"�	���C��	 �	"�	"�s�/B�/B�Bc�
�|jsJd��|j5	|jj|�}	ddd�||g|���y#t$r||f|j
|<Yddd�ywxYw#1swY�<xYw)NzMust use the context manager)r�r�r�r�r`r�)r+r�rUrVr�s     rr}z"FastChildWatcher.add_child_handler�s����{�{�:�:�:�{�
�Z�Z�	�
�!�]�]�.�.�s�3�
�	�	��j�(�4�(��
�
�'/��~�����$��
	�	�
��	�	�s(�A9�A�A6�+A9�5A6�6A9�9Bc�>�	|j|=y#t$rYywxYwr�r�r�s  rr�z%FastChildWatcher.remove_child_handler�r�r�c��		tjdtj�\}}|dk(ryt|�}|j
5	|jj|�\}}|jj�rtjd||�	ddd��tjd||�n
|||g�����#t$rYywxYw#t$r\|jrK||j|<|jj�rtjd||�Yddd���4d}Y��wxYw#1swY��xYw)Nr@rr�z,unknown process %s exited with returncode %sz8Caught subprocess termination from unknown pid: %d -> %d)r!r�r�r"r�r�r�r�r�rrr#r`r�r�rf)r+r�r$r�rUrVs      rr�z FastChildWatcher._do_waitpid_all�sC���

<� �j�j��R�Z�Z�8���V�
�!�8��3�F�;�
����
6�6�%)�_�_�%8�%8��%=�N�H�d��z�z�+�+�-����%K�%(�*�6�!
6�&������ #�Z�1���j�0�4�0�K��%�
��
�� �
$��{�{�-7��
�
�c�*��:�:�/�/�1�"�L�L�*>�),�j�:�!�
6�
6� $�H�
$��
6�
6�sN�'C�D=�	C�'2D=�	C�C�AD:�*D=�5D:�7D=�9D:�:D=�=E)r�r�r�r�r)r1r�r�r}r�r�r�r�s@rrrWs+����.��
� �)��(1rrc�R�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)ra~A watcher that doesn't require running loop in the main thread.

    This implementation registers a SIGCHLD signal handler on
    instantiation (which may conflict with other code that
    install own handler for this signal).

    The solution is safe but it has a significant overhead when
    handling a big number of processes (*O(n)* each time a
    SIGCHLD is received).
    c�P�i|_d|_tjddd��y)Nrr�r�r�)r��_saved_sighandlerr6r�rs rr)zMultiLoopChildWatcher.__init__�s*�����!%������4�;�%,�	.rc��|jduSr )r�rs rrzzMultiLoopChildWatcher.is_active�s���%�%�T�1�1rc�Z�|jj�|j�ytjtj
�}||jk7rtjd�d|_ytjtj
|j�d|_y)Nz+SIGCHLD handler was changed by outside code)	r�r9r�rI�	getsignalr�r�rrf)r+rds  rr1zMultiLoopChildWatcher.close�sz���������!�!�)���"�"�6�>�>�2���d�n�n�$��N�N�H�I�"&���
�M�M�&�.�.�$�*@�*@�A�!%��rc��|Sr rrs rr�zMultiLoopChildWatcher.__enter__�r�rc��yr r�r+r��exc_val�exc_tbs    rr�zMultiLoopChildWatcher.__exit__�r�rc�r�tj�}|||f|j|<|j|�yr )rr�r�r�)r+r�rUrVrs     rr}z'MultiLoopChildWatcher.add_child_handler�s5���&�&�(�� $�h��5������	
����rc�>�	|j|=y#t$rYywxYwr�r�r�s  rr�z*MultiLoopChildWatcher.remove_child_handler�r�r�c�8�|j�ytjtj|j�|_|j�*t	j
d�tj|_tjtjd�y)NzaPrevious SIGCHLD handler was set by non-Python code, restore to default handler on watcher close.F)r�rIr�r�rrfrcrQr�s  rr�z!MultiLoopChildWatcher.attach_loopso��
�!�!�-��!'���v�~�~�t�~�~�!N����!�!�)��N�N�J�
K�%+�^�^�D�"�	���F�N�N�E�2rc�Z�t|j�D]}|j|��yr r�r�s  rr�z%MultiLoopChildWatcher._do_waitpid_alls(������(�	"�C����S�!�	"rc�8�|dkDsJ�	tj|tj�\}}|dk(ryt|�}d}	|jj|�\}}}|j�rtjd||�y|r'|j�rtjd||�|j|||g|���y#t$r|}d}tjd|�d}Y��wxYw#t$rtjd|d�	�YywxYw)
NrTr�r�F�%Loop %r that handles pid %r is closedr�r�r>)r!r�r�r"r�rrfr�r��	is_closedrr#r�r`)	r+r�r�r$r��	debug_logrrUrVs	         rr�z!MultiLoopChildWatcher._do_waitpids���a����	��*�*�\�2�:�:�>�K�C���a�x��/��7�J��I�	L�#'�?�?�#6�#6�s�#;� �D�(�D��~�~�����F��c�R�����!1��L�L�!G�!-�z�;�)��)�)�(�C��K�d�K��=!�	��C��J��N�N�J��
��I�	��$�	/�
�N�N�D���
/�	/�s#�'C
�C5�
%C2�1C2�5!D�Dc��	|j�y#ttf$r�t$rt	j
dd��YywxYw)Nr�Tr>)r�r�r�r�rrf)r+rrs   rr�zMultiLoopChildWatcher._sig_chld<sE��	R�� � �"���-�.�	���	R��N�N�A�D�Q�	R�s��/A�AN)r�r�r�r�r)rzr1r�r�r}r�r�r�r�r�rrrrr�sA��	�$.�2�
&��
���3�""�#L�JRrrc�d�eZdZdZd�Zd�Zd�Zd�Zd�Ze	jfd�Zd�Zd	�Z
d
�Zd�Zy)
raAThreaded child watcher implementation.

    The watcher uses a thread per process
    for waiting for the process finish.

    It doesn't require subscription on POSIX signal
    but a thread creation is not free.

    The watcher has O(1) complexity, its performance doesn't depend
    on amount of spawn processes.
    c�F�tjd�|_i|_yr�)�	itertoolsr��_pid_counter�_threadsrs rr)zThreadedChildWatcher.__init__Rs��%�O�O�A�.�����
rc��yrFrrs rrzzThreadedChildWatcher.is_activeVrqrc��yr rrs rr1zThreadedChildWatcher.closeYr�rc��|Sr rrs rr�zThreadedChildWatcher.__enter__\r�rc��yr rr�s    rr�zThreadedChildWatcher.__exit___r�rc���t|jj��D�cgc]}|j�r|��}}|r||j�d�t
|��yycc}w)Nz0 has registered but not finished child processesr/)r4r�values�is_aliver-r8)r+r9�thread�threadss    rr:zThreadedChildWatcher.__del__bsd��(,�T�]�]�-A�-A�-C�(D�)�f��o�o�'��)��)���T�^�^�$�$T�U�!��
���)s�A!c���tj�}tj|jdt|j���||||fd��}||j|<|j�y)Nzasyncio-waitpid-T)�target�namerV�daemon)	rr�r��Threadr��nextrr�start)r+r�rUrVrrs      rr}z&ThreadedChildWatcher.add_child_handlerjsf���&�&�(���!�!��)9�)9�)9�$�t�?P�?P�:Q�9R�'S�(,�c�8�T�'B�)-�/��$��
�
�c�����rc��yrFrr�s  rr�z)ThreadedChildWatcher.remove_child_handlersr�rc��yr rr�s  rr�z ThreadedChildWatcher.attach_loopyr�rc��|dkDsJ�	tj|d�\}}t|�}|j�rt	j
d||�	|j�rt	jd||�n|j|||g|���|jj|�y#t$r|}d}t	jd|�Y�~wxYw)Nrr�r�r�r)r!r�r"rrr#r�rfrr�rr�)r+rr�rUrVr�r$r�s        rr�z ThreadedChildWatcher._do_waitpid|s����a����	7��*�*�\�1�5�K�C��0��7�J��~�~�����C�)�:�7��>�>���N�N�B�D�#�N�%�D�%�%�h��Z�G�$�G��
�
���,�'��'!�	��C��J��N�N�J��
�	�s�B.�.#C�CN)r�r�r�r�r)rzr1r�r�r6r7r:r}r�r�r�rrrrrEsB��
���
��
�%�M�M����
�(rrc��ttd�sy	tj�}tjtj|d��y#t
$rYywxYw)Nr�FrT)�hasattrr!�getpidr1r�rM)r�s r�
can_use_pidfdr&�sO���2�|�$����i�i�k��
������s�A�&�'�������s�=A�	A�Ac�B��eZdZdZeZ�fd�Zd�Z�fd�Zd�Z	d�Z
�xZS)�_UnixDefaultEventLoopPolicyz:UNIX event loop policy with a watcher for child processes.c�0��t�|��d|_yr )r(r)�_watcherr�s �rr)z$_UnixDefaultEventLoopPolicy.__init__�s���
������
rc��tj5|j�)t�rt	�|_nt�|_ddd�y#1swYyxYwr )rr�r*r&rrrs r�
_init_watcherz)_UnixDefaultEventLoopPolicy._init_watcher�sA��
�\�\�	;��}�}�$� �?�$5�$7�D�M�$8�$:�D�M�	;�	;�	;�s�6A�Ac����t�|�|�|j�Etj�tj
�ur|jj
|�yyy)z�Set the event loop.

        As a side effect, if a child watcher was set before, then calling
        .set_event_loop() from the main thread will call .attach_loop(loop) on
        the child watcher.
        N)r(�set_event_loopr*r��current_thread�main_threadr�)r+rr-s  �rr.z*_UnixDefaultEventLoopPolicy.set_event_loop�sS���	���t�$��M�M�%��(�(�*�i�.C�.C�.E�E��M�M�%�%�d�+�F�
&rc��|j�|j�tjddd��|jS)z~Get the watcher for child processes.

        If not yet set, a ThreadedChildWatcher object is automatically created.
        ryr�r�r�)r*r,r6r�rs rryz-_UnixDefaultEventLoopPolicy.get_child_watcher�s@��
�=�=� ���� ����0�:�BI�	K��}�}�rc��|�t|t�sJ�|j�|jj�||_t	j
ddd��y)z$Set the watcher for child processes.N�set_child_watcherr�r�r�)rfrr*r1r6r�)r+r�s  rr3z-_UnixDefaultEventLoopPolicy.set_child_watcher�sT����*�W�6J�"K�K�K��=�=�$��M�M���!���
����0�:�BI�	Kr)r�r�r�r�r&�
_loop_factoryr)r,r.ryr3r�r�s@rr(r(�s%���D�*�M��;�,��Krr()4r�rSr�r
r!rrIr�r�r�r2r�r6�rrrrrr	r
rrr
�logr�__all__rT�ImportErrorrr"�BaseSelectorEventLoopr&�
ReadTransportrj�_FlowControlMixin�WriteTransportrr�BaseSubprocessTransportr|rrr�rrrrr&�BaseDefaultEventLoopPolicyr(rrrrr�<module>r?se��8��	��	��
�
���
�����������������<�<�7��
�C�
D�D�	�
�P"�_�B�B�P"�fM�Z�5�5�M�`J�j�:�:�(�7�7�J�Z ��F�F� �0S$�S$�l7�,�7�t2�+�2�jN-�'�N-�bj1�'�j1�Z~R�0�~R�BO(�/�O(�b	�6K�&�"C�"C�6K�r+��4�r
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!