← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/httpcore/__pycache__/_synchronization.cpython-312.pyc

81 lines

�

c�bj�$��P�ddlmZddlZddlZddlmZmZmZ	ddlZ	ddlZdd�ZGd�d�Z
Gd�d	�ZGd
�d�ZGd�d
�ZGd�d�ZGd�d�ZGd�d�ZGd�d�ZGd�d�ZGd�d�Zy#e	e
f$rdZY�ywxYw#e	$rdZY��wxYw)�)�annotationsN�)�ExceptionMapping�PoolTimeout�map_exceptionsc���	ddl}|j�}|dvrtd��|dk(rt�td��|dk(rt
�td��|S#t$rd}Y�JwxYw)Nr�asyncio)r	�trioz/Running under an unsupported async environment.zBRunning with asyncio requires installation of 'httpcore[asyncio]'.r
z<Running with trio requires installation of 'httpcore[trio]'.)�sniffio�current_async_library�ImportError�RuntimeError�anyior
)r�environments  �p/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/httpcore/_synchronization.pyrrs���6���3�3�5���-�-��L�M�M��i��E�M��P�
�	
��f�����J�
�	
����%� ��� �s�A�A!� A!c�F�eZdZdZdd�Zdd�Zdd�Z			d								d
d�Zy)�	AsyncLock��
    This is a standard lock.

    In the sync case `Lock` provides thread locking.
    In the async case `AsyncLock` provides async locking.
    c��d|_y�N���_backend��selfs r�__init__zAsyncLock.__init__8�	����
�c���t�|_|jdk(rtj�|_y|jdk(rtj�|_yy�z~
        Detect if we're running under 'asyncio' or 'trio' and create
        a lock with the correct implementation.
        r
r	N)rrr
�Lock�
_trio_lockr�_anyio_lockrs r�setupzAsyncLock.setup;sF��
.�/��
��=�=�F�"�"�i�i�k�D�O�
�]�]�i�
'�$�z�z�|�D��(rc��K�|js|j�|jdk(r$|jj��d{���|S|jdk(r"|jj��d{���|S7�97��w�Nr
r	)rr$r"�acquirer#rs r�
__aenter__zAsyncLock.__aenter__Fss�����}�}��J�J�L��=�=�F�"��/�/�)�)�+�+�+����]�]�i�
'��"�"�*�*�,�,�,���	
,��,�s$�A	B	�B�2B	�>B�?B	�B	Nc��K�|jdk(r|jj�y|jdk(r|jj�yy�wr&)rr"�releaser#�r�exc_type�	exc_value�	tracebacks    r�	__aexit__zAsyncLock.__aexit__QsG�����=�=�F�"��O�O�#�#�%�
�]�]�i�
'����$�$�&�(���AA��return�None)r2r�NNN�r,ztype[BaseException] | Noner-zBaseException | Noner.ztypes.TracebackType | Noner2r3)�__name__�
__module__�__qualname__�__doc__rr$r(r/�rrrr0sL����	,�	�04�*.�04�		'�,�	'�(�	'�.�		'�

�	'rrc�6�eZdZdZdd�Z			d							dd�Zy)�AsyncThreadLock��
    This is a threading-only lock for no-I/O contexts.

    In the sync case `ThreadLock` provides thread locking.
    In the async case `AsyncThreadLock` is a no-op.
    c��|S�Nr:rs r�	__enter__zAsyncThreadLock.__enter__e����rNc��yr?r:r+s    r�__exit__zAsyncThreadLock.__exit__h���	
r)r2r<r4r5)r6r7r8r9r@rCr:rrr<r<]sB����
04�*.�04�	
�,�
�(�
�.�	
�

�
rr<c�.�eZdZdd�Zdd�Zdd�Zddd�Zy)	�
AsyncEventc��d|_yrrrs rrzAsyncEvent.__init__rrrc���t�|_|jdk(rtj�|_y|jdk(rtj�|_yyr )rrr
�Event�_trio_eventr�_anyio_eventrs rr$zAsyncEvent.setupusG��
.�/��
��=�=�F�"�#�z�z�|�D��
�]�]�i�
'� %���
�D��(rc���|js|j�|jdk(r|jj�y|jdk(r|jj�yyr&)rr$rJ�setrKrs rrMzAsyncEvent.set�sS���}�}��J�J�L��=�=�F�"���� � �"�
�]�]�i�
'����!�!�#�(rNc��K�|js|j�|jdk(rztjti}|�td�n|}t
|�5tj|�5|jj��d{���ddd�ddd�y|jdk(ratti}t
|�5tj|�5|jj��d{���ddd�ddd�yy7��#1swY��xYw#1swYyxYw7�0#1swY�/xYw#1swYyxYw�w)Nr
�infr	)
rr$r
�TooSlowErrorr�floatr�
fail_afterrJ�wait�TimeoutErrorrrK)r�timeout�trio_exc_map�timeout_or_inf�
anyio_exc_maps     rrSzAsyncEvent.wait�s�����}�}��J�J�L��=�=�F�"�.2�.?�.?��-M�L�-4�_�U�5�\�'�N���-��_�_�^�4��*�*�/�/�1�1�1�5�.�-��]�]�i�
'�/;�[�.I�M��
�.��%�%�g�.��+�+�0�0�2�2�2�/�/�.�(�2��5�4��.�-��3��/�.��/�.�s��AE
�D'�4D�D�D�D'�/E
�E�$D5�D3�D5�E�
E
�D�D$	� D'�'D0�,E
�3D5�5D>	�:E�E
�E
r1r?�rUzfloat | Noner2r3)r6r7r8rr$rMrSr:rrrFrFqs���	.�$�3rrFc�,�eZdZdd�Zdd�Zdd�Zdd�Zy)�AsyncSemaphorec� �||_d|_yr)�_boundr�r�bounds  rrzAsyncSemaphore.__init__�s�������
rc�"�t�|_|jdk(r1tj|j|j��|_y|jdk(r1t
j|j|j��|_yy)z�
        Detect if we're running under 'asyncio' or 'trio' and create
        a semaphore with the correct implementation.
        r
)�
initial_value�	max_valuer	N)rrr
�	Semaphorer]�_trio_semaphorer�_anyio_semaphorers rr$zAsyncSemaphore.setup�si��
.�/��
��=�=�F�"�#'�>�>�"�k�k�T�[�[�$�D� ��]�]�i�
'�$)�O�O�"�k�k�T�[�[�%�D�!�(rc��K�|js|j�|jdk(r#|jj��d{���y|jdk(r#|jj��d{���yy7�87��wr&)rr$rdr'rers rr'zAsyncSemaphore.acquire�sl�����}�}��J�J�L��=�=�F�"��&�&�.�.�0�0�0�
�]�]�i�
'��'�'�/�/�1�1�1�(�
1��1�s$�A	B�B�1B�=B�>B�Bc��K�|jdk(r|jj�y|jdk(r|jj�yy�wr&)rrdr*rers rr*zAsyncSemaphore.release�sG�����=�=�F�"�� � �(�(�*�
�]�]�i�
'��!�!�)�)�+�(�r0N�r_�intr2r3r1)r6r7r8rr$r'r*r:rrr[r[�s���
�2�,rr[c�:�eZdZdd�Zdd�Z			d							dd�Zy)	�AsyncShieldCancellationc���t�|_|jdk(rtjd��|_y|jdk(rtjd��|_yy)z�
        Detect if we're running under 'asyncio' or 'trio' and create
        a shielded scope with the correct implementation.
        r
T)�shieldr	N)rrr
�CancelScope�_trio_shieldr�
_anyio_shieldrs rrz AsyncShieldCancellation.__init__�sQ��
.�/��
��=�=�F�"� $� 0� 0�� =�D��
�]�]�i�
'�!&�!2�!2�$�!?�D��(rc��|jdk(r|jj�|S|jdk(r|jj�|Sr&)rror@rprs rr@z!AsyncShieldCancellation.__enter__�sL���=�=�F�"����'�'�)����]�]�i�
'����(�(�*��rNc��|jdk(r|jj|||�y|jdk(r|jj|||�yyr&)rrorCrpr+s    rrCz AsyncShieldCancellation.__exit__�sQ���=�=�F�"����&�&�x��I�F�
�]�]�i�
'����'�'��)�Y�G�(rr1)r2rkr4r5)r6r7r8rr@rCr:rrrkrk�sH��
@��04�*.�04�		H�,�	H�(�	H�.�		H�

�	Hrrkc�>�eZdZdZdd�Zdd�Z			d							d	d�Zy)
r!rc�6�tj�|_yr?��	threadingr!�_lockrs rrz
Lock.__init__�����^�^�%��
rc�:�|jj�|Sr?�rwr'rs rr@zLock.__enter__�����
�
�����rNc�8�|jj�yr?�rwr*r+s    rrCz
Lock.__exit__����	
�
�
���rr1)r2r!r4r5�r6r7r8r9rr@rCr:rrr!r!��G���&��04�*.�04�	�,��(��.�	�

�rr!c�>�eZdZdZdd�Zdd�Z			d							d	d�Zy)
�
ThreadLockr=c�6�tj�|_yr?rurs rrzThreadLock.__init__rxrc�:�|jj�|Sr?rzrs rr@zThreadLock.__enter__r{rNc�8�|jj�yr?r}r+s    rrCzThreadLock.__exit__r~rr1)r2r�r4r5rr:rrr�r�r�rr�c�&�eZdZdd�Zdd�Zddd�Zy)rIc�6�tj�|_yr?)rvrI�_eventrs rrzEvent.__init__s���o�o�'��rc�8�|jj�yr?)r�rMrs rrMz	Event.sets�������rNc�p�|td�k(rd}|jj|��s
t��y)NrO)rU)rQr�rSr)rrUs  rrSz
Event.waits5���e�E�l�"��G��{�{�����0��-��1rr1r?rY)r6r7r8rrMrSr:rrrIrIs��(�� rrIc�$�eZdZdd�Zdd�Zdd�Zy)rcc�:�tj|��|_y)N)�value)rvrc�
_semaphorer^s  rrzSemaphore.__init__'s��#�-�-�E�:��rc�8�|jj�yr?)r�r'rs rr'zSemaphore.acquire*��������!rc�8�|jj�yr?)r�r*rs rr*zSemaphore.release-r�rNrhr1)r6r7r8rr'r*r:rrrcrc&s��;�"�"rrcc�2�eZdZdd�Z			d							dd�Zy)�ShieldCancellationc��|Sr?r:rs rr@zShieldCancellation.__enter__5rArNc��yr?r:r+s    rrCzShieldCancellation.__exit__8rDr)r2r�r4r5)r6r7r8r@rCr:rrr�r�1s=���
04�*.�04�	
�,�
�(�
�.�	
�

�
rr�)r2�str)�
__future__rrv�types�_exceptionsrrrr
r
�NotImplementedErrorrrrr<rFr[rkr!r�rIrcr�r:rr�<module>r�s���"���F�F�
����
�4*'�*'�Z
�
�(&3�&3�R!,�!,�H$H�$H�T��0��0 � �"�"�

�

��I		�(�)���D���
���E��s"�B�B�	B�B�B%�$B%