Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
memory.cpython-313.pyc116 linesDownload Raw Back to __pycache__
1�

2�j�)���SSKJr SrSSKrSSKJrJr SSKJrJ	r	 SSK3Jr SSKJ
r
JrJr SS	KJrJrJrJr SS4KJrJr SSKJrJrJr SSKJr \"S
5r\"SSS9r\"SSS9r "SS\5r!\"SS9"SS\
\55r"\"SS9"SS\
\55r#\"SS9"SS\
\\\55r$\"SS9"SS\
\ \\ 55r%g)�)�annotations)�MemoryObjectReceiveStream�MemoryObjectSendStream�MemoryObjectStreamStatisticsN)�OrderedDict�deque)�	dataclass�field)�
TracebackType)�Generic�5NamedTuple�TypeVar�)�BrokenResourceError�ClosedResourceError�EndOfStream�6WouldBlock)�TaskInfo�get_current_task)�Event�ObjectReceiveStream�ObjectSendStream)�7checkpoint�T_Item�T_coT)�	covariant�T_contra)�
contravariantc�R�\rSrSr%S\S'S\S'S\S'S\S'S\S'S\S	'S8rg)r��int�current_buffer_used�float�max_buffer_size�open_send_streams�open_receive_streams�tasks_waiting_send�tasks_waiting_receive�N)�__name__�9__module__�__qualname__�__firstlineno__�__annotations__�__static_attributes__r)��ZD:\code\apps\devtools\python\user_packages\Python313\site-packages\anyio/streams/memory.pyrrs&�������������r0rF)�eqc�N�\rSrSr%\"S\S9rS\S'\"SS9rS\S'SS	jr	S10r11g)
�_MemoryObjectItemReceiver�*F��init�default_factoryr�	task_info)r7r�itemc�p�[USS5nURRSURSU<S3$)Nr:z(task_info=z, item=�))�getattr�	__class__r*r9)�selfr:s  r1�__repr__�"_MemoryObjectItemReceiver.__repr__/s<���t�V�T�*���.�.�)�)�*�+�d�n�n�5E�W�T�H�TU�V�Vr0r)N)�return�str)r*r+r,r-r12rr9r.r:r@r/r)r0r1r4r4*s)���U�<L�M�I�x�M��e�$�D�&�$�Wr0r4c��\rSrSr%\"5rS\S'\"S\S9rS\S'\"SSS	9r	S13\S'\"SSS	9r14S15\S'\"S\S9rS
\S'\"S\S9r
S\S'SSjrSrg)�_MemoryObjectStreamState�6r#r$Fr6z
deque[T_Item]�bufferr�r7�defaultr!�open_send_channels�open_receive_channelsz5OrderedDict[Event, _MemoryObjectItemReceiver[T_Item]]�waiting_receiverszOrderedDict[Event, T_Item]�waiting_sendersc16���[[UR5URURUR17[UR5[UR55$�N)r�lenrGr$rJrKrMrL�r?s r1�18statistics�#_MemoryObjectStreamState.statisticsCsR��+������� � ��#�#��&�&���$�$�%���&�&�'�
19�	20r0r)N�rBr)r*r+r,r-r21r$r.rrGrJrKrrLrMrRr/r)r0r1rErE6sz��"�W�O�U�$�!�u�e�D�F�M�D�#���:���:�!&�E�1�!=��3�=�OT�
�K�P��L��38�
�K�3�O�/��22r0rEc��\rSrSr%S\S'\"SSS9rS\S'SSjrSS	jrSS23jr	SSjr24SSjrSS
jrSSjr
SSjrSSjrSSjrSrg)r�Nz_MemoryObjectStreamState[T_co]�_stateFrH�bool�_closedc�B�UR=RS-
slg�N�)rWrKrQs r1�
__post_init__�'MemoryObjectReceiveStream.__post_init__Ss�����)�)�Q�.�)r0c���UR(a[eURR(aZURRR	SS9upURR25R
U5 UR5 URR26(a$URR27R5$URR(d[e[e)ak28Receive the next item if it can be done without waiting.29 30:return: the received item31:raises ~anyio.ClosedResourceError: if this send stream has been closed32:raises ~anyio.EndOfStream: if the buffer is empty and this stream has been33    closed from the sending end34:raises ~anyio.WouldBlock: if there are no items in the buffer and no tasks35    waiting to send36 37F��last)rYrrWrM�popitemrG�append�set�popleftrJrr)r?�38send_eventr:s   r1�receive_nowait�(MemoryObjectReceiveStream.receive_nowaitVs����<�<�%�%��;�;�&�&�#�{�{�:�:�B�B��B�N��J��K�K���%�%�d�+��N�N���;�;����;�;�%�%�-�-�/�/����/�/����r0c���# �[5IShv�N UR5$N![a� [5n[[39"5nX RRU'UR5IShv�N URRRUS5 O+!URRRUS5 f=fURs$![a [Sef=ff=f7frO)
rrgrrr4rrWrL�wait�popr:�AttributeErrorr)r?�
receive_event�receivers   r1�receive�!MemoryObjectReceiveStream.receivers�����l���	,��&�&�(�(�	���	,�!�G�M�0��6�8�H�;C�K�K�)�)�-�8�
G�#�(�(�*�*�*����-�-�1�1�-��F�����-�-�1�1�-��F��
,��}�}�$��!�
,�!�t�+�
,��	,�sd�C:�&�C:�(�C:�>C7�'B'�:A=�;B'�'C7�'(C�C7�C!�C7�C:�!C3�3C7�7C:c�V�UR(a[e[URS9$)z�40Create a clone of this receive stream.41 42Each clone can be closed separately. Only when all clones have been closed will43the receiving end of the memory stream be considered closed by the sending ends.44 45:return: the cloned stream46 47�rW)rYrrrWrQs r1�clone�MemoryObjectReceiveStream.clone�s ���<�<�%�%�(����<�<r0c�6�UR(d�SUlUR=RS-slURRS:XaG[URRR55nUHnUR
5 M ggg�z�48Close the stream.49 50This works the exact same way as :meth:`aclose`, but is provided as a special51case for the benefit of synchronous callbacks.52 53Tr\rN)rYrWrK�listrM�keysrd)r?�send_events�events   r1�close�MemoryObjectReceiveStream.close�ss���|�|��D�L��K�K�-�-��2�-��{�{�0�0�A�5�"�4�;�;�#>�#>�#C�#C�#E�F��(�E��I�I�K�)�6�r0c��,# �UR5 g7frO�r{rQs r1�aclose� MemoryObjectReceiveStream.aclose������54�55����c�6�URR5$�zR56Return statistics about the current state of this stream.57 58.. versionadded:: 3.059�rWrRrQs r1rR�$MemoryObjectReceiveStream.statistics�����{�{�%�%�'�'r0c��U$rOr)rQs r1�	__enter__�#MemoryObjectReceiveStream.__enter__�����r0c�$�UR5 grOr~�r?�exc_type�exc_val�exc_tbs    r1�__exit__�"MemoryObjectReceiveStream.__exit__��
��	
�60�61�r0c��UR(dA[R"SURRS[U5SS3[SUS9 gg�Nz62Unclosed <z at �x�>r\)�63stacklevel�source�rY�warnings�warnr>r*�id�ResourceWarningrQs r1�__del__�!MemoryObjectReceiveStream.__del__��F���|�|��M�M��T�^�^�4�4�5�T�"�T�(�1��Q�G����	
�r0�rYN�rB�None)rBr)rBzMemoryObjectReceiveStream[T_co]rT�r�ztype[BaseException] | Noner�zBaseException | Noner�zTracebackType | NonerBr�)r*r+r,r-r.r64rYr]rgrorsr{rrRr�r�r�r/r)r0r1rrNsq��*�*��u�e�4�G�T�4�/��8,�(
=� � �(���,��&��%�	�6566��r0rc��\rSrSr%S\S'\"SSS9rS\S'SSjrSS	jrSS67jr	SSjr68SSjrSS
jrSSjr
SSjrSSjrSSjrSrg)r��z"_MemoryObjectStreamState[T_contra]rWFrHrXrYc�B�UR=RS-
slgr[)rWrJrQs r1r]�$MemoryObjectSendStream.__post_init__�s�����&�&�!�+�&r0c�^�UR(a[eURR(d[eURR69(axURR70R
SS9up#URR5(dXl	UR5 gURR71(aMx[URR5URR:a&URRRU5 g[e)aa72Send an item immediately if it can be done without waiting.73 74:param item: the item to send75:raises ~anyio.ClosedResourceError: if this send stream has been closed76:raises ~anyio.BrokenResourceError: if the stream has been closed from the77    receiving end78:raises ~anyio.WouldBlock: if the buffer is full and there are no tasks waiting79    to receive80 81Fr`N)rYrrWrKrrLrbr9�has_pending_cancellationr:rdrPrGr$rcr)r?r:rmrns    r1�send_nowait�"MemoryObjectSendStream.send_nowait�s����<�<�%�%��{�{�0�0�%�%��k�k�+�+�&*�k�k�&C�&C�&K�&K�QV�&K�&W�#�M��%�%�>�>�@�@� $�
��!�!�#���k�k�+�+�+��t�{�{�!�!�"�T�[�[�%@�%@�@��K�K���%�%�d�+��r0c���# �[5IShv�N URU5 gN![a� [5nXRR82U'UR
5IShv�N O5![a( URR83RUS5 ef=fX RR84;aURR85U	[Segf=f7f)ae86Send an item to the stream.87 88If the buffer is full, this method blocks until there is again room in the89buffer or the item can be sent directly to a receiver.90 91:param item: the item to send92:raises ~anyio.ClosedResourceError: if this send stream has been closed93:raises ~anyio.BrokenResourceError: if the stream has been closed from the94    receiving end95 96N)97rr�rrrWrMrj�
BaseExceptionrkr)r?r:rfs   r1�send�MemoryObjectSendStream.send�s�����l���	4����T�"�	���	4���J�6:�K�K�'�'�98�3�
� �o�o�'�'�'�� �
����+�+�/�/�99�D�A��
���[�[�8�8�8��K�K�/�/�100�;�)�t�3�9�	4�sR�C#�(�C#�*�C#�,C �A1�*A-�+A1�0C �12B#�#:C �C#�C � C#c�V�UR(a[e[URS9$)z�101Create a clone of this send stream.102 103Each clone can be closed separately. Only when all clones have been closed will104the sending end of the memory stream be considered closed by the receiving ends.105 106:return: the cloned stream107 108rr)rYrrrWrQs r1rs�MemoryObjectSendStream.clones ���<�<�%�%�%�T�[�[�9�9r0c�~�UR(d�SUlUR=RS-slURRS:Xak[URRR55nURRR
5 UHnUR5 M gggrv)rYrWrJrwrLrx�clearrd)r?�receive_eventsrzs   r1r{�MemoryObjectSendStream.closes����|�|��D�L��K�K�*�*�a�/�*��{�{�-�-��2�!%�d�k�k�&C�&C�&H�&H�&J�!K�����-�-�3�3�5�+�E��I�I�K�,�3�r0c��,# �UR5 g7frOr~rQs r1r�MemoryObjectSendStream.aclose(r�r�c�6�URR5$r�r�rQs r1rR�!MemoryObjectSendStream.statistics+r�r0c��U$rOr)rQs r1r�� MemoryObjectSendStream.__enter__3r�r0c�$�UR5 grOr~r�s    r1r��MemoryObjectSendStream.__exit__6r�r0c��UR(dA[R"SURRS[U5SS3[SUS9 ggr�r�rQs r1r��MemoryObjectSendStream.__del__>r�r0r�Nr�)r:rrBr�)rBz MemoryObjectSendStream[T_contra]rTr�)r*r+r,r-r.r109rYr]r�r�rsr{rrRr�r�r�r/r)r0r1rr�sq��.�.��u�e�4�G�T�4�,��:4�<
:� �"�(���,��&��%�	�110111��r0r)&�112__future__r�__all__r��collectionsrr�dataclassesr	r113�typesr�typingrr
r�rrrr�_core._testingrr�abcrrr�lowlevelrrrrrr4rErrr)r0r1�<module>r�s��"����*�(��/�/���8�>�>�!�	��	���v��&���:�T�2��	�:�	��e��W����W��W��e��114�w�v��115��116�.�e��s���
�/B�4�/H�s��s�l�e���W�X�.�0@��0J���r0
codekingpro/portable-devtools · Team Ai