%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core22/current/usr/lib/python3.10/test/support/__pycache__/
Upload File :
Create Path :
Current File : //snap/core22/current/usr/lib/python3.10/test/support/__pycache__/interpreters.cpython-310.pyc

o

�*�g��@s�dZddlZddlZddlmZmZmZmZgd�Zdd�dd�Z	d	d
�Z
dd�Zd
d�ZGdd�d�Z
dd�Zdd�ZGdd�d�Ze�ZGdd�de�ZGdd�de�ZdS)z"Subinterpreters High Level Module.�N)�ChannelError�ChannelNotFoundError�ChannelEmptyError�is_shareable)
�Interpreter�get_current�get_main�create�list_all�SendChannel�RecvChannel�create_channel�list_all_channelsrrrrT��isolatedcCstj|d�}t||d�S)z'Return a new (idle) Python interpreter.r)�
_interpretersr	r)r�id�r�0/usr/lib/python3.10/test/support/interpreters.pyr	sr	cC�dd�t��D�S)z!Return all existing interpreters.cSsg|]}t|��qSr)r)�.0rrrr�
<listcomp>szlist_all.<locals>.<listcomp>)rr
rrrrr
sr
cC�t��}t|�S)z)Return the currently running interpreter.)rrr�rrrrr!�rcCr)zReturn the main interpreter.)rrrrrrrr'rrc@sleZdZdZdd�dd�Zdd�Zdd	�Zd
d�Zedd
��Z	edd��Z
dd�Zdd�Zdd�dd�Z
dS)rzA single Python interpreter.NrcCs.t|ttjf�std|����||_||_dS�Nzid must be an int, got )�
isinstance�intr�
InterpreterID�	TypeError�_id�	_isolated)�selfrrrrr�__init__0s
zInterpreter.__init__cCsBtt|j�|jd�}dd�|��D�}t|�j�dd�|��d�S)N)rrcss"�|]\}}|�d|��VqdS)�=Nr)r�k�vrrr�	<genexpr>8s� z'Interpreter.__repr__.<locals>.<genexpr>�(z, �))�dictrr r!�items�type�__name__�join)r"�data�kwargsrrr�__repr__6szInterpreter.__repr__cC�
t|j�S�N��hashr �r"rrr�__hash__;�
zInterpreter.__hash__cCst|t�stS|j|jkSr3)rr�NotImplementedr �r"�otherrrr�__eq__>s
zInterpreter.__eq__cC�|jSr3�r r6rrrrD�zInterpreter.idcCs|jdurt�|j�|_|jSr3)r!r�is_isolatedr r6rrrrHs
zInterpreter.isolatedcC�t�|j�S)z<Return whether or not the identified interpreter is running.)r�
is_runningr r6rrrrBPszInterpreter.is_runningcCrA)z�Finalize and destroy the interpreter.

        Attempting to destroy the current interpreter results
        in a RuntimeError.
        )r�destroyr r6rrr�closeTszInterpreter.close)�channelscCst�|j||�dS)zqRun the given source code in the interpreter.

        This blocks the current Python thread until done.
        N)r�
run_stringr )r"�src_strrErrr�run\szInterpreter.run)r-�
__module__�__qualname__�__doc__r#r1r7r<�propertyrrrBrDrHrrrrr-s

rcCs"t��}t|�t|�}}||fS)z�Return (recv, send) for a new cross-interpreter channel.

    The channel may be used to pass data safely between interpreters.
    )r�channel_createrr)�cid�recv�sendrrrr
dsr
cCr)z4Return a list of (recv, send) for all open channels.cSsg|]
}t|�t|�f�qSr)rr)rrNrrrrps�z%list_all_channels.<locals>.<listcomp>)r�channel_list_allrrrrrns�rc@s<eZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dS)
�_ChannelEndz/The base class for RecvChannel and SendChannel.cCs(t|ttjf�std|����||_dSr)rrr�	ChannelIDrr )r"rrrrr#ws
z_ChannelEnd.__init__cCst|�j�dt|j��d�S)Nz(id=r))r,r-rr r6rrrr1|sz_ChannelEnd.__repr__cCr2r3r4r6rrrr7r8z_ChannelEnd.__hash__cCs4t|t�r
t|t�stSnt|t�stS|j|jkSr3)rrr9rr r:rrrr<�s

�
z_ChannelEnd.__eq__cCr=r3r>r6rrrr�r?z_ChannelEnd.idN)
r-rIrJrKr#r1r7r<rLrrrrrrRtsrRc@s.eZdZdZe�dd�dd�Zefdd�ZdS)	rz1The receiving end of a cross-interpreter channel.g{�G�z�?)�	_sentinel�_delaycCs:t�|j|�}||urt�|�t�|j|�}||us|S)z�Return the next object from the channel.

        This blocks until an object has been sent, if none have been
        sent already.
        )r�channel_recvr �time�sleep)r"rTrU�objrrrrO�s
�zRecvChannel.recvcCs"|tur
t�|j�St�|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_SETrrVr )r"�defaultrrr�recv_nowait�szRecvChannel.recv_nowaitN)r-rIrJrK�objectrOrZr\rrrrr�src@s eZdZdZdd�Zdd�ZdS)rz/The sending end of a cross-interpreter channel.cCst�|j|�t�d�dS)z{Send the object (i.e. its data) to the channel's receiving end.

        This blocks until the object is received.
        �N)r�channel_sendr rWrX�r"rYrrrrP�szSendChannel.sendcCst�|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().
        )rr_r r`rrr�send_nowait�s	zSendChannel.send_nowaitN)r-rIrJrKrPrarrrrr�sr)rKrW�_xxsubinterpretersrrrrr�__all__r	r
rrrr
rrRr]rZrrrrrr�<module>s 	7


Zerion Mini Shell 1.0