add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
f

��_�c@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.iN)�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
)�
_interpretersrr)r�id�r�2/usr/lib64/python3.10/test/support/interpreters.pyrsrcC�dd�t��D�S)z!Return all existing interpreters.cSsg|]}t|��qSr)r)�.0rrrr�
<listcomp>�zlist_all.<locals>.<listcomp>)rrrrrrr�rcC�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.Nr
cCs.t|ttjf�std|����||_||_dS�Nzid must be an int, got )�
isinstance�intrZ
InterpreterID�	TypeError�_id�	_isolated)�selfrrrrr�__init__0szInterpreter.__init__cCsBtt|j�|jd�}dd�|��D�}t|�j�dd�|��d�S)N)rrcss |]\}}|�d|��VqdS)z=Nr)rZkZvrrrZ	<genexpr>8rz'Interpreter.__repr__.<locals>.<genexpr>z(z, �))Zdictrrr Zitems�type�__name__Zjoin)r!ZdataZkwargsrrr�__repr__6szInterpreter.__repr__cC�
t|j�S�N�Zhashr�r!rrr�__hash__;�zInterpreter.__hash__cCst|t�stS|j|jkSr()rr�NotImplementedr�r!Zotherrrr�__eq__>s
zInterpreter.__eq__cC�|jSr(�rr*rrrrDrzInterpreter.idcCs|jdurt�|j�|_|jSr()r rZis_isolatedrr*rrrrHs
zInterpreter.isolatedcC�t�|j�S)z<Return whether or not the identified interpreter is running.)r�
is_runningrr*rrrr3PrzInterpreter.is_runningcCr2)z�Finalize and destroy the interpreter.

        Attempting to destroy the current interpreter results
        in a RuntimeError.
        )rZdestroyrr*rrr�closeTszInterpreter.close)�channelscCst�|j||�dS)zqRun the given source code in the interpreter.

        This blocks the current Python thread until done.
        N)rZ
run_stringr)r!Zsrc_strr5rrr�run\szInterpreter.run)r%�
__module__�__qualname__�__doc__r"r&r+r/�propertyrrr3r4r6rrrrr-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.
    )rZchannel_creater
r	)�cid�recv�sendrrrrdsrcCr)z4Return a list of (recv, send) for all open channels.cSsg|]}t|�t|�f�qSr)r
r	)rr;rrrrps�z%list_all_channels.<locals>.<listcomp>)rZchannel_list_allrrrrrns�rc@s<eZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dS)
�_ChannelEndz/The base class for RecvChannel and SendChannel.cCs(t|ttjf�std|����||_dSr)rrrZ	ChannelIDrr)r!rrrrr"wsz_ChannelEnd.__init__cCst|�j�dt|j��d�S)Nz(id=r#)r$r%rrr*rrrr&|r,z_ChannelEnd.__repr__cCr'r(r)r*rrrr+r,z_ChannelEnd.__hash__cCs2t|t�rt|t�s&tSt|t�s&tS|j|jkSr()rr
r-r	rr.rrrr/�s


z_ChannelEnd.__eq__cCr0r(r1r*rrrr�rz_ChannelEnd.idN)
r%r7r8r9r"r&r+r/r:rrrrrr>tsr>c@s.eZdZdZe�dd�dd�Zefdd�ZdS)	r
z1The receiving end of a cross-interpreter channel.g{�G�z�?)�	_sentinel�_delaycCs4t�|j|�}||ur0t�|�t�|j|�}q|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!r?r@�objrrrr<�s

zRecvChannel.recvcCs"|turt�|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().
        N)�_NOT_SETrrAr)r!Zdefaultrrr�recv_nowait�szRecvChannel.recv_nowaitN)r%r7r8r9�objectr<rErFrrrrr
�sr
c@s eZdZdZdd�Zdd�ZdS)r	z/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.
        iN)r�channel_sendrrBrC�r!rDrrrr=�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().
        )rrHrrIrrr�send_nowait�s	zSendChannel.send_nowaitN)r%r7r8r9r=rJrrrrr	�sr	)r9rBZ_xxsubinterpretersrrrrrZ__all__rrrrrrrr>rGrEr
r	rrrrZ<module>s	7