Your IP : 18.191.44.145


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/web_app.cpython-311.pyc

�

��bg�G�	�:�ddlZddlZddlZddlmZmZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZddlmZddl m!Z!m"Z"m#Z#m$Z$dd	l%m&Z&m'Z'dd
l(m)Z)ddl*m+Z+ddl,m-Z-dd
l.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddl<m=Z=ddl>m?Z?ddl@mAZAmBZBmCZCmDZDmEZEmFZFmGZGdZHerVeedge
dfZIeee9e;ge
dfZJee/ZKeeee/eLfZMedZNneZIeZJeZKeeZMeZNed��ZOed��ZPGd�deeeQe'efef��ZRGd�deS��ZTereeeRge	dfZUneZUGd�deU��ZVdS) �N)�partial�update_wrapper)�
TYPE_CHECKING�Any�
AsyncIterator�	Awaitable�Callable�Dict�Iterable�Iterator�List�Mapping�MutableMapping�Optional�Sequence�Tuple�Type�TypeVar�Union�cast�overload)�Signal)�
FrozenList�)�hdrs)�AbstractAccessLogger�AbstractMatchInfo�AbstractRouter�AbstractStreamWriter)�DEBUG�AppKey)�RawRequestMessage)�
web_logger)�StreamReader)�
Middleware)�NotAppKeyWarning)�AccessLogger)�_fix_request_current_app)�RequestHandler)�Request)�StreamResponse)�AbstractRouteDef)�Server)�AbstractResource�
AbstractRoute�Domain�
MaskDomain�MatchedSubAppResource�PrefixedSubAppResource�
UrlDispatcher)�Application�CleanupErrorr5�_T�_Uc�^��eZdZegd���Zeddddddd�dejdee	d	e
ed
eee
efdedeejd
eddfd�Zdedddfd�Zerde
deddf�fd�Zdedefd�Zedeedefd���Zede
defd���Zdee
eefdefd�ZdWd�Zedeededdfd���Z ede
deddfd���Z dee
eefdeddfd�Z dee
eefddfd �Z!defd!�Z"de#ee
eeffd"�Z$edXdeed#ddeefd$���Z%edeed#e&deee&ffd%���Z%edXde
d#edefd&���Z%dYdee
eefd#edefd'�Z%e'dejfd(���Z(deejddfd)�Z)e'defd*���Z*dWd+�Z+e'defd,���Z,dWd-�Z-e'defd.���Z.dZd0�Z/d1e
d/dde0fd2�Z1d3e2ge0fd/dde0fd4�Z3d5e
d/dde0fd6�Z4d7e
e5de6e7fd8�Z8e'de9fd9���Z:e'de;fd:���Z<e'de;fd;���Z=e'de;fd<���Z>e'd[d>���Z?e'de	fd?���Z@e'deAfd@���ZBdeCdA�deejdBeeDdCedeEfdD�ZFdeCdA�deejdBeeDdCedeEfdE�ZGdWdF�ZHdWdG�ZIdWdH�ZJeKfdIeLdJeMdKeNdLeOdMdNdOeeKdeKfdP�ZPde#eQeeffdQ�ZRdReKdeSfdS�ZTd\dT�ZUde
fdU�ZVdefdV�ZW�xZXS)]r5)�logger�_debug�_router�_loop�
_handler_args�_middlewares�_middlewares_handlers�_run_middlewares�_state�_frozen�_pre_frozen�_subapps�_on_response_prepare�_on_startup�_on_shutdown�_on_cleanup�_client_max_size�_cleanup_ctxN�i.)r:�router�middlewares�handler_args�client_max_size�loop�debugr:rMrNrOrPrQrR�returnc�@�|�t��}ntjdtd���t	|t
��s
J|���|�tjdtd���|durtjdtd���||_||_||_||_	||_
t|��|_d|_
d|_i|_d|_d|_g|_t'|��|_t'|��|_t'|��|_t'|��|_t1��|_|j�|jj��|j�|jj��||_dS)Nzrouter argument is deprecated���
stacklevelzloop argument is deprecated.zdebug argument is deprecatedF)r4�warnings�warn�DeprecationWarning�
isinstancerr;r<r=r>r:rr?r@rArBrCrDrErrFrGrHrI�CleanupContextrK�appendrJ)�selfr:rMrNrOrPrQrRs        �F/opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/web_app.py�__init__zApplication.__init__is����>�"�_�_�F�F��M�/�1C�PQ�
�
�
�
��&�.�1�1�9�9�6�9�9�1����M�-�/A�a�
�
�
�
������M�.�0B�q�
�
�
�
����&,�����
�)������*4�[�*A�*A���<@��"�04���=?������ ���"$��
�8>�t����!�'-�d�|�|���(.�t�����'-�d�|�|���*�,�,�������� 1� =�>�>�>������ 1� =�>�>�>� /������clsc�n�tjd�|j��td���dS)Nz8Inheritance class {} from web.Application is discouraged�rV)rXrY�format�__name__rZ)rbs r_�__init_subclass__zApplication.__init_subclass__�s?���
�
�#�V�C�L�1�1���		
�	
�	
�	
�	
�	
ra�name�valc���||jvr/tjd�|��td���t���||��dS)Nz:Setting custom web.Application.{} attribute is discouragedrUrV)�ATTRSrXrYrerZ�super�__setattr__)r^rhri�	__class__s   �r_rmzApplication.__setattr__�sa����4�:�%�%��
�%�%+�V�D�\�\�&� �	����
�G�G����c�*�*�*�*�*ra�otherc�
�||uS�NrL)r^ros  r_�__eq__zApplication.__eq__�s���u�}�ra�keyc��dSrqrL�r^rss  r_�__getitem__zApplication.__getitem__�����rac��dSrqrLrus  r_rvzApplication.__getitem__�rwrac��|j|Srq)rBrus  r_rvzApplication.__getitem__�s���{�3��rac�P�|jrtjdtd���dSdS)Nz=Changing state of started or joined application is deprecatedrdrV)rCrXrYrZ�r^s r_�
_check_frozenzApplication._check_frozen�sB���<�	��M�R�"��
�
�
�
�
�
�	�	ra�valuec��dSrqrL�r^rsr}s   r_�__setitem__zApplication.__setitem__�rwrac��dSrqrLrs   r_r�zApplication.__setitem__�rwrac��|���t|t��stjdt
d���||j|<dS)Nz�It is recommended to use web.AppKey instances for keys.
https://docs.aiohttp.org/en/stable/web_advanced.html#application-s-configrU)�categoryrW)r|r[r!rXrYr&rBrs   r_r�zApplication.__setitem__�s`���������#�v�&�&�	��M�*�*��
�
�
�
�!���C���rac�>�|���|j|=dSrq)r|rBrus  r_�__delitem__zApplication.__delitem__�s$���������K����rac�*�t|j��Srq)�lenrBr{s r_�__len__zApplication.__len__�s���4�;���rac�*�t|j��Srq)�iterrBr{s r_�__iter__zApplication.__iter__�s���D�K� � � ra�defaultc��dSrqrL�r^rsr�s   r_�getzApplication.get�rwrac��dSrqrLr�s   r_r�zApplication.get�rwrac��dSrqrLr�s   r_r�zApplication.get�rwrac�8�|j�||��Srq)rBr�r�s   r_r�zApplication.get�s���{���s�G�,�,�,rac�x�tjdtd���ttj|j��S)Nzloop property is deprecatedrUrV)rXrYrZr�asyncio�AbstractEventLoopr=r{s r_rQzApplication.loop�s3��
	�
�3�5G�TU�V�V�V�V��G�-�t�z�:�:�:rac��|�tj��}|j�|j|urtd���||_|jdur|���|_|jD]}|�|���dS)Nz8web.Application instance initialized with different loop.)r��get_event_loopr=�RuntimeErrorr;�	get_debugrE�	_set_loop)r^rQ�subapps   r_r�zApplication._set_loops����<��)�+�+�D��:�!�d�j��&<�&<��J���
���
��;�#����.�.�*�*�D�K��m�	#�	#�F����T�"�"�"�"�	#�	#rac��|jSrq)rDr{s r_�
pre_frozenzApplication.pre_frozen�����rac�R�|jrdSd|_|j���|j���|j���|j���|j���|j���|j���t|�
����|_|jrdnd|_
|jD])}|���|j
p|j
|_
�*dS)NTF)rDr?�freezer<rFrKrGrHrI�tuple�_prepare_middlewarer@rNrArE�
pre_freeze�r^r�s  r_r�zApplication.pre_freezes%����	��F������ � �"�"�"���������!�(�(�*�*�*��� � �"�"�"�����!�!�!��� � �"�"�"�����!�!�!�%*�4�+C�+C�+E�+E�%F�%F��"�)-�(8� C���e����m�	U�	U�F�������$(�$9�$T�V�=T�D�!�!�	U�	Urac��|jSrq)rCr{s r_�frozenzApplication.frozen1�
���|�rac��|jrdS|���d|_|jD]}|����dS�NT)rCr�rEr�r�s  r_r�zApplication.freeze5sR���<�	��F�����������m�	�	�F��M�M�O�O�O�O�	�	rac�H�tjdtd���|jS)Nzdebug property is deprecatedrUrV)rXrYrZr;r{s r_rRzApplication.debug>s$���
�4�6H�UV�W�W�W�W��{�rar�c�l���dtddf��fd�}|d��|d��|d��dS)N�signamerSc����t�|���d��fd�}t�|��}|�|��dS)N�appr5rSc��B�K�������d{V��dSrq)�send)r�r��subsigs ��r_�handlerzEApplication._reg_subapp_signals.<locals>.reg_handler.<locals>.handlerGs1������k�k�&�)�)�)�)�)�)�)�)�)�)�)ra)r�r5rSN)�getattrr])r�r��appsigr�r^r�s   @��r_�reg_handlerz4Application._reg_subapp_signals.<locals>.reg_handlerDs_�����V�W�-�-�F�
*�
*�
*�
*�
*�
*�
*��T�7�+�+�F��M�M�'�"�"�"�"�"ra�
on_startup�on_shutdown�
on_cleanup)�str)r^r�r�s`` r_�_reg_subapp_signalszApplication._reg_subapp_signalsCsm����	#��	#��	#�	#�	#�	#�	#�	#�	#�	��L�!�!�!���M�"�"�"���L�!�!�!�!�!ra�prefixc���t|t��std���|�d��}|st	d���tt||��}|�||��S)NzPrefix must be str�/zPrefix cannot be empty)r[r��	TypeError�rstrip�
ValueErrorrr3�_add_subapp)r^r�r��factorys    r_�
add_subappzApplication.add_subappQss���&�#�&�&�	2��0�1�1�1����s�#�#���	7��5�6�6�6��0�&�&�A�A�������0�0�0ra�resource_factoryc�n�|jrtd���|jrtd���|��}|j�|��|�|��|j�|��|���|j�|�	|j��|S)Nz0Cannot add sub application to frozen applicationzCannot add frozen application)
r�r�rM�register_resourcer�rEr]r�r=r�)r^r�r��resources    r_r�zApplication._add_subappZs����;�	S��Q�R�R�R��=�	@��>�?�?�?�#�#�%�%����%�%�h�/�/�/�� � ��(�(�(��
���V�$�$�$��������:�!����T�Z�(�(�(��ra�domainc���t|t��std���d|vrt|��}nt	|��}tt||��}|�||��S)NzDomain must be str�*)r[r�r�r1r0rr2r�)r^r�r��ruler�s     r_�
add_domainzApplication.add_domainjsn���&�#�&�&�	"��0�1�1�1�
�F�]�]�%�f�-�-�D�D��&�>�>�D��/��v�>�>�������0�0�0ra�routesc�6�|j�|��Srq)rM�
add_routes)r^r�s  r_r�zApplication.add_routests���{�%�%�f�-�-�-rac��|jSrq)rFr{s r_�on_response_preparezApplication.on_response_preparews���(�(rac��|jSrq)rGr{s r_r�zApplication.on_startup{r�rac��|jSrq)rHr{s r_r�zApplication.on_shutdown���� � rac��|jSrq)rIr{s r_r�zApplication.on_cleanup�r�rar\c��|jSrq)rKr{s r_�cleanup_ctxzApplication.cleanup_ctx�r�rac��|jSrq)r<r{s r_rMzApplication.router�r�rac��|jSrq)r?r{s r_rNzApplication.middlewares�r�ra�rQ�access_log_classr��kwargsc�t�t|t��s"td�|�����|�|��|���|j|d<||d<|jr$|j���D]
\}}|||<�t|j
f|j|jd�|��S)NzMaccess_log_class must be subclass of aiohttp.abc.AbstractAccessLogger, got {}rRr�)�request_factoryrQ)
�
issubclassrr�rer�r�r;r>�itemsr-�_handle�
_make_requestr=)r^rQr�r��k�vs      r_�
_make_handlerzApplication._make_handler�s����*�,@�A�A�	��;�;A�6�BR�;S�;S���
�
	
���t�������
�
�
��+��w��%5��!�"���	��*�0�0�2�2�
�
���1���q�	�	���L�
� �.���
�
��	
�
�	
rac�Z�tjdtd���|jd||d�|��S)NzFApplication.make_handler(...) is deprecated, use AppRunner API insteadrUrVr�rL)rXrYrZr�)r^rQr�r�s    r_�make_handlerzApplication.make_handler�sW��	�
�W���	
�	
�	
�	
�"�t�!�
��(8�
�
�<B�
�
�	
rac��JK�|j�|���d{V��dS)zmCauses on_startup signal

        Should be called in the event loop along with the request handler.
        N)r�r�r{s r_�startupzApplication.startup�s6����
�o�"�"�4�(�(�(�(�(�(�(�(�(�(�(rac��JK�|j�|���d{V��dS)zMCauses on_shutdown signal

        Should be called before cleanup()
        N)r�r�r{s r_�shutdownzApplication.shutdown�s7����
��#�#�D�)�)�)�)�)�)�)�)�)�)�)rac��K�|jjr"|j�|���d{V��dS|j�|���d{V��dS)zLCauses on_cleanup signal

        Should be called after shutdown()
        N)r�r�r�rKrIr{s r_�cleanupzApplication.cleanup�st����
�?�!�	6��/�&�&�t�,�,�,�,�,�,�,�,�,�,�,��#�/�/��5�5�5�5�5�5�5�5�5�5�5ra�message�payload�protocol�writer�taskzasyncio.Task[None]�_clsc	�:�|||||||j|j���S)N)rP)r=rJ)r^r�r�r�r�r�r�s       r_r�zApplication._make_request�s7���t�������J� �1�
�
�
�	
rac#�K�t|j��D]S}t|dd��dkr|dfV��tjd�|��td���|dfV��Tt|��dfV�dS)N�__middleware_version__rTz1old-style middleware "{!r}" deprecated, see #2252rUrVF)�reversedr?r�rXrYrerZr()r^�ms  r_r�zApplication._prepare_middleware�s������$�+�,�,�		�		�A��q�2�D�9�9�Q�>�>���g�
�
�
�
��
�J�Q�Q�RS�T�T�&� �����
��h�����&�t�,�,�d�2�2�2�2�2�2ra�requestc��K�tj��}|���}|j�|���d{V��}|r7t|t��s"td�|�����|�	|��|�
��d}||_|j�
tj��}|r:|�|���d{V��}|j����d{V��|�s|j}|jrT|jddd�D]C}|jD]9\}	}
|
r t/t1|	|���|��}�'|	||���d{V��}�:�D||���d{V��}|S)Nz9match_info should be AbstractMatchInfo instance, not {!r}���)r�)r�r�r�r<�resolver[rr�re�add_appr��_match_info�headersr�r�EXPECT�expect_handlerr��drainr�rA�appsr@rr)r^r�rQrR�
match_info�resp�expectr�r�r��	new_styles           r_r�zApplication._handle�s������%�'�'����� � ���<�/�/��8�8�8�8�8�8�8�8�
��	��j�*;�<�<�
��)�)/��
�);�);����	���4� � � ���������(�����$�$�T�[�1�1���	)�#�2�2�7�;�;�;�;�;�;�;�;�D��.�&�&�(�(�(�(�(�(�(�(�(��<� �(�G��$�
<�%�?�4�4�R�4�0�<�<�C�(+�(A�<�<���9�$�<�&4� '��7� ;� ;� ;�W�'�'�G�G�-.�A�c�7�O�O�&;�&;�&;�&;�&;�&;�G�G�
<�!���)�)�)�)�)�)�)�)�D��rac��|S)zgunicorn compatibilityrLr{s r_�__call__zApplication.__call__#s���rac�*�dt|��d�d�S)Nz<Application 0x�x�>)�idr{s r_�__repr__zApplication.__repr__'s��.��D���.�.�.�.�.rac��dSr�rLr{s r_�__bool__zApplication.__bool__*s���tra�rSN).rq)r�r5rSN)rSr\)rSr5)Yrf�
__module__�__qualname__�	frozensetrkr#�logging�Loggerrr4rr%rr�r�intr�r�r`rrgr rm�object�boolrrrr!r7rvrr|r�r�r�rr�r�r8�propertyrQr�r�r�r�r�rRr�r.r�r	r�r�r,r
r/r��_RespPrepareSignalr��
_AppSignalr�r�r�r�rM�_MiddlewaresrNr'rr-r�r�r�r�r�r*r"r$r)rr�rr�r+r�r	rr�
__classcell__�rns@r_r5r5Qs���������I�	
�	
�	
�
�
�E�4",�*.�,.�48�&�48��50�50�50���50���'�	50�
�j�)�50��w�s�C�x�0�1�
50��50��w�0�1�50��50�
�50�50�50�50�n
�t�M�2�
�t�
�
�
�
�
�
+�	+�C�	+�c�	+�d�	+�	+�	+�	+�	+�	+��F��t�������v�b�z��b�����X����s��s�����X�� �u�S�&��*�_�5� �#� � � � �������v�b�z��"�������X����s��3��4�����X��
!�u�S�&��*�_�5�
!�c�
!�d�
!�
!�
!�
!��u�S�&��*�_�5��$����� �� � � � �!�(�5��f�S�k�)9�#:�;�!�!�!�!����v�b�z��D��8�B�<�����X����v�b�z��B��5��R��=�����X�����s��S��3�����X��-�-�u�S�&��*�_�-�-��-�s�-�-�-�-��;�g�/�;�;�;��X�;�#�h�w�'@�A�#�d�#�#�#�#�$� �D� � � ��X� �U�U�U�U�2�������X��������t�����X��"�"�"�"�1��1�m�1�@P�1�1�1�1�� (��-=�)=� >��HU��	����� 1��1�m�1�@P�1�1�1�1�.��*:�!;�.��]�@S�.�.�.�.��)�%7�)�)�)��X�)�� �J� � � ��X� ��!�Z�!�!�!��X�!�� �J� � � ��X� ��!�!�!��X�!���
�����X���!�\�!�!�!��X�!�59�7C�	
�
�
��w�0�1�
��3�4�	
�
�
�
�

�
�
�
�B59�7C�	
�
�
��w�0�1�
��3�4�	
�
�
�
�

�
�
�
�$)�)�)�)�*�*�*�*�	6�	6�	6�	6�$&�
�
�"�
��
�!�	
�
%�
�#�

��7�m�
�
�
�
�
�
�&3�X�e�J��4D�.E�%F�3�3�3�3�$�W�$��$�$�$�$�L����/�#�/�/�/�/��$��������rac�6�eZdZedeefd���ZdS)r6rSc�X�ttt|jd��S)Nr)rr
�
BaseException�argsr{s r_�
exceptionszCleanupError.exceptions/s���D��'���1��6�6�6raN)rfrrrr
r"r$rLrar_r6r6.s>������
�7�D��/�7�7�7��X�7�7�7rar6c�@��eZdZd�fd�Zdeddfd�Zdeddfd�Z�xZS)r\rSNc�V��t�����g|_dSrq)rlr`�_exits)r^rns �r_r`zCleanupContext.__init__;s$���
��������13����rar�c��K�|D]S}||�����}|����d{V��|j�|���TdSrq)�	__aiter__�	__anext__r'r])r^r��cb�its    r_rGzCleanupContext._on_startup?sq�����	#�	#�B���C���"�"�$�$�B��,�,�.�.� � � � � � � ��K���r�"�"�"�"�	#�	#rac��K�g}t|j��D]y}	|����d{V��|�t	|�d������C#t
$rY�Ot$r}|�|��Yd}~�rd}~wwxYw|r+t|��dkr|d�td|���dS)Nz has more than one 'yield'rrz Multiple errors on cleanup stage)	r�r'r*r]r��StopAsyncIteration�	Exceptionr�r6)r^r��errorsr,�excs     r_rIzCleanupContext._on_cleanupEs�������4�;�'�'�	Q�	Q�B�
Q��l�l�n�n�$�$�$�$�$�$�$��
�
�l�b�+N�+N�+N�O�O�P�P�P�P��&�
�
�
����
#�
#�
#��
�
�c�"�"�"�"�"�"�"�"�����
#�����	O��6�{�{�a����Q�i��"�#E�v�N�N�N�		O�	Os�A�
B�(	B�1B�Br)rfrrr`r5rGrIrrs@r_r\r\:s��������4�4�4�4�4�4�#�[�#�T�#�#�#�#�O�[�O�T�O�O�O�O�O�O�O�Orar\)Wr�rrX�	functoolsrr�typingrrrrr	r
rrr
rrrrrrrrrr�	aiosignalr�
frozenlistr�r�abcrrrr�helpersr r!�http_parserr"�logr#�streamsr$�typedefsr%�web_exceptionsr&�web_logr'�web_middlewaresr(�web_protocolr)�web_requestr*�web_responser+�web_routedefr,�
web_serverr-�web_urldispatcherr.r/r0r1r2r3r4�__all__rrrr�_MiddlewaresHandlers�_Subappsr7r8r�r5r�r6�_CleanupContextBaser\rLrar_�<module>rJsb��������������-�-�-�-�-�-�-�-�������������������������������������������,������!�!�!�!�!�!�������������������#�"�"�"�"�"�"�"�*�*�*�*�*�*�������!�!�!�!�!�!� � � � � � �,�,�,�,�,�,�!�!�!�!�!�!�5�5�5�5�5�5�(�(�(�(�(�(� � � � � � �(�(�(�(�(�(�*�*�*�*�*�*�������������������������*������-��)�D�/�!A�B�C�J���'�>�)B�I�d�O�)S� T�U���j�)�L�#�H�U�:�t�3C�-D�$E�F���M�"�H�H��J����L�#�H�-���H��W�T�]�]���W�T�]�]��Z�Z�Z�Z�Z�.��s�F�3�K�'7�!8�#�!=�>�Z�Z�Z�z7�7�7�7�7�<�7�7�7��%�$�X�{�m�]�4�=P�.P�%Q�R���$��O�O�O�O�O�(�O�O�O�O�Ora

?>