%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/test/support/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/test/support/__pycache__/interpreters.cpython-312.pyc

�

���f�����dZddlZddlZddlZddlmZmZddlmZm	Z	m
Z
gd�Zdd�d�Zd	�Z
d
�Zd�ZGd�d
�Zd�Zd�ZGd�d�Ze�ZGd�de�ZGd�de�Zy)z"Subinterpreters High Level Module.�N)�is_shareable�RunFailedError)�ChannelError�ChannelNotFoundError�ChannelEmptyError)
�Interpreter�get_current�get_main�create�list_all�SendChannel�RecvChannel�create_channel�list_all_channelsrrrrT��isolatedc�H�tj|��}t||��S)z'Return a new (idle) Python interpreter.r)�
_interpretersrr)r�ids  �0/usr/lib/python3.12/test/support/interpreters.pyrrs��	�	�	�x�	0�B��r�H�-�-�c�b�tj�D�cgc]
}t|���c}Scc}w)z!Return all existing interpreters.)rrr�rs rrrs#��&3�&<�&<�&>�?��K��O�?�?��?s�,c�@�tj�}t|�S)z)Return the currently running interpreter.)rr	rrs rr	r	"s��	�	"�	"�	$�B��r�?�rc�@�tj�}t|�S)zReturn the main interpreter.)rr
rrs rr
r
(s��	�	�	�	!�B��r�?�rc�f�eZdZdZdd�d�Zd�Zd�Zd�Zed��Z	ed	��Z
d
�Zd�Zdd�d
�Z
y)rzA single Python interpreter.Nrc�|�t|ttjf�st	d|����||_||_y�Nzid must be an int, got )�
isinstance�intr�
InterpreterID�	TypeError�_id�	_isolated)�selfrrs   r�__init__zInterpreter.__init__1s8���"�s�M�$?�$?�@�A��5�b�V�<�=�=����!��rc���tt|j�|j��}d�|j	�D�}t|�j�ddj|��d�S)N)rrc3�0K�|]\}}|�d|�����y�w)�=N�)�.0�k�vs   r�	<genexpr>z'Interpreter.__repr__.<locals>.<genexpr>9s����8�4�1�a�Q�C�q���,�8�s��(z, �))�dictr r#r$�items�type�__name__�join)r%�data�kwargss   r�__repr__zInterpreter.__repr__7sR���s�4�8�8�}�t�~�~�>��8�4�:�:�<�8���t�*�%�%�&�a��	�	�&�(9�':�!�<�<rc�,�t|j�S�N��hashr#�r%s r�__hash__zInterpreter.__hash__<����D�H�H�~�rc�`�t|t�stS|j|jk(Sr:)rr�NotImplementedr#�r%�others  r�__eq__zInterpreter.__eq__?s%���%��-�!�!��9�9����(�(rc��|jSr:�r#r=s rrzInterpreter.idE����x�x�rc�z�|j�$tj|j�|_|jSr:)r$r�is_isolatedr#r=s rrzInterpreter.isolatedIs.���>�>�!�+�6�6�t�x�x�@�D�N��~�~�rc�@�tj|j�S)z<Return whether or not the identified interpreter is running.)r�
is_runningr#r=s rrKzInterpreter.is_runningQs���'�'����1�1rc�@�tj|j�S)z�Finalize and destroy the interpreter.

        Attempting to destroy the current interpreter results
        in a RuntimeError.
        )r�destroyr#r=s r�closezInterpreter.closeUs���$�$�T�X�X�.�.r)�channelsc�F�tj|j||�y)zqRun the given source code in the interpreter.

        This blocks the current Python thread until done.
        N)r�
run_stringr#)r%�src_strrOs   r�runzInterpreter.run]s��
	� � ����7�H�=r)r4�
__module__�__qualname__�__doc__r&r8r>rD�propertyrrrKrNrSr*rrrr.sX��&�'+�"�=�
�)���������2�/�+/�>rrc�^�tj�}t|�t|�}}||fS)z�Return (recv, send) for a new cross-interpreter channel.

    The channel may be used to pass data safely between interpreters.
    )�	_channelsrrr
)�cid�recv�sends   rrres/��
�
�
�
�C��S�!�;�s�#3�$�D���:�rc�x�tj�D�cgc]}t|�t|�f��c}Scc}w)z4Return a list of (recv, send) for all open channels.)rYrrr
)rZs rrros<��!�)�)�+�-����
�{�3�/�0�-�-��-s�7c�8�eZdZdZd�Zd�Zd�Zd�Zed��Z	y)�_ChannelEndz/The base class for RecvChannel and SendChannel.c�n�t|ttjf�st	d|����||_yr)rr rY�	ChannelIDr"r#)r%rs  rr&z_ChannelEnd.__init__xs1���"�s�I�$7�$7�8�9��5�b�V�<�=�=���rc�^�t|�j�dt|j��d�S)Nz(id=r0)r3r4r r#r=s rr8z_ChannelEnd.__repr__}s(���t�*�%�%�&�d�3�t�x�x�=�/��;�;rc�,�t|j�Sr:r;r=s rr>z_ChannelEnd.__hash__�r?rc��t|t�rt|t�stSt|t�stS|j|jk(Sr:)rrrAr
r#rBs  rrDz_ChannelEnd.__eq__�s?���d�K�(��e�[�1�%�%��E�;�/�!�!��y�y�D�H�H�$�$rc��|jSr:rFr=s rrz_ChannelEnd.id�rGrN)
r4rTrUrVr&r8r>rDrWrr*rrr_r_us-��9��
<��%����rr_c�2�eZdZdZe�dd�d�Zefd�Zy)rz1The receiving end of a cross-interpreter channel.g{�G�z�?)�	_sentinel�_delayc���tj|j|�}||ur:tj|�tj|j|�}||ur�:|S)z�Return the next object from the channel.

        This blocks until an object has been sent, if none have been
        sent already.
        )rYr[r#�time�sleep)r%rgrh�objs    rr[zRecvChannel.recv�sQ���n�n�T�X�X�y�1���Y���J�J�v���.�.����9�5�C��Y���
rc��|turtj|j�Stj|j|�S)z�Return the next object from the channel.

        If none have been sent then return the default if one
        is provided or fail with ChannelEmptyError.  Otherwise this
        is the same as recv().
        )�_NOT_SETrYr[r#)r%�defaults  r�recv_nowaitzRecvChannel.recv_nowait�s4���h���>�>�$�(�(�+�+��>�>�$�(�(�G�4�4rN)r4rTrUrV�objectr[rnrpr*rrrr�s��;� &���
�#+�
5rrc��eZdZdZd�Zd�Zy)r
z/The sending end of a cross-interpreter channel.c�n�tj|j|�tjd�y)z{Send the object (i.e. its data) to the channel's receiving end.

        This blocks until the object is received.
        �N)rYr\r#rjrk�r%rls  rr\zSendChannel.send�s#��
	���t�x�x��%�	
�
�
�1�
rc�B�tj|j|�S)z�Send the object to the channel's receiving end.

        If the object is immediately received then return True
        (else False).  Otherwise this is the same as send().
        )rYr\r#rus  r�send_nowaitzSendChannel.send_nowait�s���~�~�d�h�h��,�,rN)r4rTrUrVr\rwr*rrr
r
�s��9�	�	-rr
)rVrj�_xxsubinterpretersr�_xxinterpchannelsrYrrrrr�__all__rrr	r
rrrr_rqrnrr
r*rr�<module>r{s���(��*�%�<���
���.�@�
��4>�4>�n�-���6�8��5�+�5�8-�+�-r

Zerion Mini Shell 1.0