add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
�

�Wc�����dZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZGd	�d
ej�Z
Gd�d�Zdd
�d�Zd�ZdS))�Runner�run�N�)�
coroutines)�events)�
exceptions)�tasks)�	constantsc��eZdZdZdZdZdS)�_State�created�initialized�closedN)�__name__�
__module__�__qualname__�CREATED�INITIALIZED�CLOSED���(/usr/lib64/python3.12/asyncio/runners.pyrrs�������G��K�
�F�F�Frrc�P�eZdZdZddd�d�Zd�Zd�Zd�Zd�Zdd	�d
�Z	d�Z
d�ZdS)
ra5A context manager that controls event loop life cycle.

    The context manager always creates a new event loop,
    allows to run async functions inside it,
    and properly finalizes the loop at the context manager exit.

    If debug is True, the event loop will be run in debug mode.
    If loop_factory is passed, it is used for new event loop creation.

    asyncio.run(main(), debug=True)

    is a shortcut for

    with asyncio.Runner(debug=True) as runner:
        runner.run(main())

    The run() method can be called multiple times within the runner's context.

    This can be useful for interactive console (e.g. IPython),
    unittest runners, console tools, -- everywhere when async code
    is called from existing sync framework and where the preferred single
    asyncio.run() call doesn't work.

    N)�debug�loop_factoryc��tj|_||_||_d|_d|_d|_d|_dS)NrF)	rr�_state�_debug�
_loop_factory�_loop�_context�_interrupt_count�_set_event_loop)�selfrrs   r�__init__zRunner.__init__0s@���n�n������)�����
���
� !���$����rc�(�|j�|S�N)�
_lazy_init�r$s r�	__enter__zRunner.__enter__9s��������rc�(�|j�dSr')�close)r$�exc_type�exc_val�exc_tbs    r�__exit__zRunner.__exit__=s���
�
����rc�j�|jtjurdS	|j}t	|�|j|j
��|j|jtj��|jrtjd�|j�d|_tj|_dS#|jrtjd�j�d|_tj|_wxYw)zShutdown and close event loop.N)rrrr �_cancel_all_tasks�run_until_complete�shutdown_asyncgens�shutdown_default_executorr
�THREAD_JOIN_TIMEOUTr#r�set_event_loopr,r)r$�loops  rr,zRunner.close@s���;�;�f�0�0�0�0��F�	(��:�:�D��d�#�#��#�#�D�$;�$;�$=�>�>��#�#��.�.�y�/L�/L�M�
O�
O��#�#�#��%�%�d�+�+��J�J�L�L��D�J� �-�-�D�K�K�K��	�#�#�#��%�%�d�+�+��J�J�L�L��D�J� �-�-�D�K�'�'�'�'s
�A+C�AD2c�<�|j�|jS)zReturn embedded event loop.)r(r r)s r�get_loopzRunner.get_loopQs��������z�z�r��contextc�*�tj|�stdj|���t	j
��
t
d��|j�|�|j}|jj||��}tj�tj�ur�tjtj �tj"urLt%j&|j(|��}	tjtj |�nd}d|_	|jj-|�|�`tjtj �|ur7tjtj tj"�SSS#t$rd}Y��wxYw#t.j0$r;|j*dkr)t3|dd�}|�|�dkrt5���wxYw#|�^tjtj �|ur6tjtj tj"�wxYw)z/Run a coroutine inside the embedded event loop.z"a coroutine was expected, got {!r}Nz7Runner.run() cannot be called from a running event loopr;)�	main_taskr�uncancel)r�iscoroutine�
ValueError�formatr�_get_running_loop�RuntimeErrorr(r!r �create_task�	threading�current_thread�main_thread�signal�	getsignal�SIGINT�default_int_handler�	functools�partial�
_on_sigintr"r3r�CancelledError�getattr�KeyboardInterrupt)r$�coror<�task�sigint_handlerr?s      rrz
Runner.runVsD���%�%�d�+�+��A�H�H��N�O�O��#�#�%�1��I�K�
K�	
������?��m�m�G��z�z�%�%�d�G�%�<���$�$�&�)�*?�*?�*A�A�A�� � ����/�6�3M�3M�M�M�&�.�.�t���$�O�O�N�
&��
�
�f�m�m�^�<�<�<�"�N� !���	I��:�:�0�0��6��*��$�$�V�]�]�3�~�E�E��
�
�f�m�m�V�-G�-G�H�H�H�F�+��%�
&�
&�
&�"&����	
&������(�(�	�	�	��$�$�q�(�(�"�4��T�:���'�H�H�J�!�O�O�+�-�-��	������*��$�$�V�]�]�3�~�E�E��
�
�f�m�m�V�-G�-G�H�H�
I�
I�
I�
Is,�'G�G�G�G�AH-�-H0�0A"Jc�B�|jtjur
td��|jtjurdS|j
�Pt
j�|_|js?t
j|j�d|_	n|j�|_|j�&|jj|j�tj�|_tj|_dS)NzRunner is closedT)rrrrDrrr�new_event_loopr r#r7r�	set_debug�contextvars�copy_contextr!r)s rr(zRunner._lazy_init�s����;�;�&�-�-�'�'��1�2�2��;�;�&�,�,�,�,��F����%��.�.�0�D�J��'�'�'��%�%�d�j�j�1�1�'+��$�$��+�+�-�D�J��;�;�"��J�J� � ����-�-�#�0�0�2��
��(�(����rc���|xjdz
c_|jdkrA|j�s0|j�|jj	d��dSt��)Nrc��dSr'rrrr�<lambda>z#Runner._on_sigint.<locals>.<lambda>�s��D�r)r"�done�cancelr �call_soon_threadsaferR)r$�signum�framer>s    rrOzRunner._on_sigint�sj�������"���� � �A�%�%�i�n�n�.>�.>�������J�J�+�+�L�L�9�9��F��!�!r)rrr�__doc__r%r*r0r,r:rr(rOrrrrrs���������6!%�4�%�%�%�%�%�������(�(�(�"���
$(�+I�+I�+I�+I�+I�Z)�)�)�&"�"�"�"�"rr�rc��tj��
td��t|��5}|j	|�cddd�S#1swYdSxYw)azExecute the coroutine and return the result.

    This function runs the passed coroutine, taking care of
    managing the asyncio event loop, finalizing asynchronous
    generators and closing the default executor.

    This function cannot be called when another asyncio event loop is
    running in the same thread.

    If debug is True, the event loop will be run in debug mode.

    This function always creates a new event loop and closes it at the end.
    It should be used as a main entry point for asyncio programs, and should
    ideally only be called once.

    The executor is given a timeout duration of 5 minutes to shutdown.
    If the executor hasn't finished within that duration, a warning is
    emitted and the executor is closed.

    Example:

        async def main():
            await asyncio.sleep(1)
            print('hello')

        asyncio.run(main())
    Nz8asyncio.run() cannot be called from a running event looprd)rrCrDrr)�mainr�runners   rrr�s���8���!�-��F�H�	H�
�e�	�	� ���z�z�$�� � � � � � � � � � � � � � � � � ���s�A�Ac�T�tj|�}|sdS|D]}|j��|jtj|ddi��|D]K}|j�r�|j
���'|jd|j
�|d���MdS)N�return_exceptionsTz1unhandled exception during asyncio.run() shutdown)�message�	exceptionrT)r	�	all_tasksr_r3�gather�	cancelledrk�call_exception_handler)r8�	to_cancelrTs   rr2r2�s�������%�I��9����������
�
�
����E�L�L�)�L�t�L�L�M�M������>�>�����>�>��'���'�'�N�!�^�^�-��)�)�
�
�
�	�r)�__all__rY�enumrMrFrI�rrrr	r
�Enumrrrr2rrr�<module>rus&��
������������������
�
�
�
������������������������������������T�Y�Y���I"�I"�I"�I"�I"�I"�I"�X�" �" �" �" �" �J����r