Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j}��X�SSKJr SSKrSSKJrJr SSKJr SSKJ	r	 \R(a-SSKrSSKr\R\R\R4r\R\\R"4r\R&/\R(\4r\R&\R\\R"4/\R(S4r\R&\R\\R"4\\/\R(S4rS/rSS	jrSS3jr"SS\5r"S
S\	5rg)�)�annotationsN�)�Request�Response)�AsyncByteStream�)�AsyncBaseTransport�
ASGITransportc�Z�SSKnUR5S:Xagg![a gf=f)Nr�trioTF)�sniffio�current_async_library�ImportError)r
s �HD:\code\apps\devtools\python\Lib\site-packages\httpx/_transports/asgi.py�is_running_triorsA��	
�	��(�(�*�f�4��5�4���
���
�s��5*�*c�t�[5(aSSKnUR"5$SSKnUR"5$)Nr)rr�Event�asyncio)rrs  r�create_eventr,s)�������z�z�|����=�=�?��c�(�\rSrSrSSjrSSjrSrg)�ASGIResponseStream�7c��Xlg�N��_body)�self�bodys  r�__init__�ASGIResponseStream.__init__8s���6rc�H# �SRUR57v� g7f)Nr)�joinr)rs r�	__aiter__�ASGIResponseStream.__aiter__;s����h�h�t�z�z�"�"�s� "rN)rzlist[bytes]�return�None)r&ztyping.AsyncIterator[bytes])�__name__�7__module__�__qualname__�__firstlineno__r r$�__static_attributes__�rrrr7s���#rrc�P�\rSrSrSrSSSjjrS	SjrSrg)8r9�?a�10A custom AsyncTransport that handles sending requests directly to an ASGI app.11 12```python13transport = httpx.ASGITransport(14    app=app,15    root_path="/submount",16    client=("1.2.3.4", 123)17)18client = httpx.AsyncClient(transport=transport)19```20 21Arguments:22 23* `app` - The ASGI application.24* `raise_app_exceptions` - Boolean indicating if exceptions in the application25   should be raised. Default to `True`. Can be set to `False` for use cases26   such as testing the content of a client 500 response.27* `root_path` - The root path on which the ASGI application should be mounted.28* `client` - A two-tuple indicating the client IP and port of incoming requests.29```30c�4�XlX lX0lX@lgr)�app�raise_app_exceptions�	root_path�client)rr1r2r3r4s     rr �ASGITransport.__init__Ws����$8�!�"���rc
���^^^	^31^^^
^# �[TR[5(deSSS0STRTRR32VVs/sHup#UR
5U4PM snnTRRTRRTRRRS5STRRTRRTRR4URUR S.nTRR#5m	Sm33SmSm/mSm
[%5mS
U	U34U4S	jjnSUUUUU
U4S35jjnUR'XEU5IShv�N TR/5(deTceTce[1T5n[3TTUS9$s snnfNA![(a/ UR*(aeTR-5 TcSmTc0mNwf=f7f)N�http�versionz3.0z1.1�?r)�type�asgi�http_version�method�headers�scheme�path�raw_path�query_string�serverr4r3Fc���># �T(aTR5IShv�N SS0$TR5IShv�NnSUSS.$N'N![a SmSSSS.s$f=f7f)Nr:zhttp.disconnectTzhttp.requestrF)r:r�	more_body)�wait�	__anext__�StopAsyncIteration)r�request_body_chunks�request_complete�response_completes ���r�receive�3ASGITransport.handle_async_request.<locals>.receive�s|���� �'�,�,�.�.�.�� 1�2�2�
Q�0�:�:�<�<��+�D�t�L�L�/�=��%�
Q�#'� � .��%�P�P�
Q�sB�A"�A�A"�A36�A�A37�A"�A38�39A�A"�A�A"c��p># �USS:Xa#T(aeUSmURS/5mSmgUSS:Xa|TR5(aeURSS5nURS	S405nU(a!TRS:waTRU5 U(dTR	5 ggg7f)Nr:zhttp.response.start�statusr>Tzhttp.response.bodyrrrEF�HEAD)�get�is_setr=�append�set)	�messagerrE�41body_parts�requestrK�response_headers�response_started�status_codes	   ������r�send�0ASGITransport.handle_async_request.<locals>.send�s������v��"7�7�+�+�+�%�h�/��#*�;�;�y�"�#=� �#'� ����$8�8�,�3�3�5�5�5�5��{�{�6�3�/��#�K�K��U�;�	��G�N�N�f�4��%�%�d�+� �%�)�)�+�!�9�s�B3B6i�)r>�stream)r&zdict[str, typing.Any])rUz&typing.MutableMapping[str, typing.Any]r&r')�42isinstancer]rr=r>�raw�lower�urlr?r@rA�split�query�host�portr4r3r$rr1�	Exceptionr2rTrRrr)rrW�k�v�scoperLr[r]rVrIrJrKrXrYrZs `      @@@@@@@r�handle_async_request�"ASGITransport.handle_async_requestcs������'�.�.�/�:�:�:�:����&�!��n�n�5<�_�_�5H�5H�I�5H�6�A�����A��5H�I��k�k�(�(��K�K�$�$����,�,�2�2�4�8��;�#�K�K�-�-��{�{�'�'����)9�)9�:��k�k����
43�� &�n�n�6�6�8�� �������44� ��(�N��	M�	M�	,�	,�*45	&��(�(�5�4�0�0�0�!�'�'�)�)�)�)��&�&�&��+�+�+�#�J�/����-=�f�M�M��YJ�v
1���	&��(�(���!�!�#��"�!���'�#%� ��	&�sI�AG;�F7�3C2G;�&F?�;F=�<F?�=G;�=F?�?6G8�5G;�7G8�8G;)r1r4r2r3N)T�)z	127.0.0.1�{)46r1�_ASGIAppr2�boolr3�strr4ztuple[str, int]r&r')rWrr&r)r(r)r*r+�__doc__r rjr,r-rrr47r48?sd���4&*��"4�49�
�50�#�51��	52�53 �54�55�
56�XN��XN�57�XNr)r&ro)r&r)�58__future__r�typing�_modelsrr�_typesr�baser	�
TYPE_CHECKINGrr�Unionr�MutableMappingrp�Any�_Message�Callable�	Awaitable�_Receive�_Sendrn�__all__rrrr59r-rr�<module>r�s��"�
�'�$�$�	������L�L�����60�61�2�3�E�� � ��f�j�j��1���?�?�2�v�/�/��9�9�:��������3��62�63�?�+�,�f�.>�.>�t�.D�D�	���?�?����3��64�65�?�+�X�u�=�v�?O�?O�PT�?U�U����66����#��#�|N�&�|Nr
codekingpro/portable-devtools · Team Ai