Your IP : 3.141.32.252


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_runner.cpython-311.pyc

�

��bg�-���ddlZddlZddlZddlZddlmZmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZddlmZ	dd	lmZn
#e$reZYnwxYwd
ZGd�de��Zdd�ZGd�de��ZGd�de��ZGd�de��Z Gd�de��Z!Gd�de��Z"Gd�de��Z#Gd�de#��Z$Gd�de#��Z%dS) �N)�ABC�abstractmethod)�Any�	Awaitable�Callable�List�Optional�Set)�URL�)�PathLike)�Application)�Server)�
SSLContext)	�BaseSite�TCPSite�UnixSite�
NamedPipeSite�SockSite�
BaseRunner�	AppRunner�ServerRunner�GracefulExitc��eZdZdZdS)rrN)�__name__�
__module__�__qualname__�code���I/opt/cloudlinux/venv/lib64/python3.11/site-packages/aiohttp/web_runner.pyrr!s�������D�D�Dr r�returnc��t����N)rrr r!�_raise_graceful_exitr%%s��
�.�.�r c��eZdZdZdddd�ddded	eed
eddf
d�Ze	e
defd
�����Ze
dd���Z
dd�ZdS)r)�_runner�_ssl_context�_backlog�_server�N@N���shutdown_timeout�ssl_context�backlog�runnerrr.r/r0r"c��|j�td���|dkr%d}tj|td���||_||_||_||_d|_	dS)Nz(Call runner.setup() before making a siter+z,shutdown_timeout should be set on BaseRunner�)�
stacklevel)
�server�RuntimeError�warnings�warn�DeprecationWarning�_shutdown_timeoutr'r(r)r*)�selfr1r.r/r0�msgs      r!�__init__zBaseSite.__init__,sl���=� ��I�J�J�J��t�#�#�@�C��M�#�1�a�@�@�@�@�'7�F�$����'�����
�9=����r c��dSr$r�r;s r!�namez
BaseSite.name?s	��	
�r c��>K�|j�|��dSr$)r'�	_reg_siter?s r!�startzBaseSite.startDs"��������t�$�$�$�$�$r c��K�|j�|��|j�|j���|j�|��dSr$)r'�_check_siter*�close�_unreg_siter?s r!�stopz
BaseSite.stopHsT������ � ��&�&�&��<�#��L��� � � ��� � ��&�&�&�&�&r �r"N)rrr�	__slots__�floatr	r�intr=�propertyr�strr@rCrHrr r!rr)s�������B�I�#'�,0��
>�>�>��>� �	>�
�j�)�>��
>�
�>�>�>�>�&��
�c�
�
�
��^��X�
��%�%�%��^�%�'�'�'�'�'�'r rc���eZdZdZ		ddddddd�dddeed	eed
edeeded
ee	dee	ddf�fd�Z
edefd���Zd�fd�Z
�xZS)r)�_host�_port�_reuse_address�_reuse_portNr+r,)r.r/r0�
reuse_address�
reuse_portr1r�host�portr.r/r0rTrUr"c���t���||||���||_|�|jrdnd}||_||_||_dS)Nr-i� i�)�superr=rPr(rQrRrS)
r;r1rVrWr.r/r0rTrU�	__class__s
         �r!r=zTCPSite.__init__Ssn���	������-�#��		�	
�	
�	
���
��<��,�6�4�4�$�D���
�+���%����r c��|jrdnd}|j�dn|j}ttj|||j�����S)N�https�httpz0.0.0.0��schemerVrW)r(rPrNr�buildrQ)r;r_rVs   r!r@zTCPSite.namelsF�� �-�9���6�� �J�.�y�y�D�J���3�9�F��D�J�G�G�G�H�H�Hr c	��(�K�t������d{V��tj��}|jj}|�J�|�||j|j|j	|j
|j|j����d{V��|_
dS)N)�sslr0rTrU)rYrC�asyncio�get_event_loopr'r5�
create_serverrPrQr(r)rRrSr*�r;�loopr5rZs   �r!rCz
TCPSite.startrs�������g�g�m�m�o�o���������%�'�'����$���!�!�!�!�/�/���J��J��!��M��-��'�0�
�
�
�
�
�
�
�
����r )NNrI)rrrrJr	rNrLrKr�boolr=rMr@rC�
__classcell__�rZs@r!rrPs!�������C�I�
#�"�	&�#'�,0��(,�%)�&�&�&��&��s�m�&��s�m�	&� �
&��j�)�&��&� ��~�&��T�N�&�
�&�&�&�&�&�&�2�I�c�I�I�I��X�I�


�

�

�

�

�

�

�

�

�

r rc
�z��eZdZdZdddd�ddded	ed
eededdf�fd
�Z	e
defd���Zd�fd�Z
�xZS)r��_pathr+Nr,r-r1r�pathr.r/r0r"c�`��t���||||���||_dS)Nr-)rYr=rm)r;r1rnr.r/r0rZs      �r!r=zUnixSite.__init__�s?���	������-�#��		�	
�	
�	
���
�
�
r c�2�|jrdnd}|�d|j�d�S)Nr\r]�://unix:�:)r(rm)r;r_s  r!r@z
UnixSite.name�s,�� �-�9���6���/�/�$�*�/�/�/�/r c���K�t������d{V��tj��}|jj}|�J�|�||j|j|j	����d{V��|_
dS)N)rbr0)rYrCrcrdr'r5�create_unix_serverrmr(r)r*rfs   �r!rCzUnixSite.start�s�������g�g�m�m�o�o���������%�'�'����$���!�!�!�!�4�4���J��!��M�	5�
�
�
�
�
�
�
�
����r rI)rrrrJr
rKr	rrLr=rMrNr@rCrirjs@r!rr�s���������I�#'�,0���������
 ���j�)�
���
�������"�0�c�0�0�0��X�0�

�

�

�

�

�

�

�

�

�

r rc	�b��eZdZdZdd�dddededd	f�fd
�Zedefd���Zd
�fd�Z	�xZ
S)rrlr+�r.r1rrnr.r"Nc����tj��}t|tj��st	d���t���||���||_dS)Nz8Named Pipes only available in proactorloop under windowsrv)rcrd�
isinstance�ProactorEventLoopr6rYr=rm)r;r1rnr.rgrZs     �r!r=zNamedPipeSite.__init__�so����%�'�'����'�+�
�
�	��M���
�	������2B��C�C�C���
�
�
r c��|jSr$rlr?s r!r@zNamedPipeSite.name��
���z�r c���K�t������d{V��tj��}|jj}|�J�|�||j���d{V��}|d|_dS)Nr)	rYrCrcrdr'r5�start_serving_pipermr*)r;rgr5r*rZs    �r!rCzNamedPipeSite.start�s�������g�g�m�m�o�o���������%�'�'����$���!�!�!��/�/��D�J�
�
�
�
�
�
�
�
���q�z����r rI)rrrrJrNrKr=rMr@rCrirjs@r!rr�s���������I�MQ����"��*-��DI��	
���������c�����X��"�"�"�"�"�"�"�"�"�"r rc
���eZdZdZdddd�dddejd	ed
eededdf�fd
�Z	e
defd���Zd�fd�Z
�xZS)r)�_sock�_namer+Nr,r-r1r�sockr.r/r0r"c���t���||||���||_|jrdnd}t	t
d��r0|jt
jkr|�d|����d�}nC|���dd�\}}	ttj|||	�����}||_dS)	Nr-r\r]�AF_UNIXrqrrr3r^)
rYr=rr(�hasattr�socket�familyr��getsocknamerNrr`r�)r;r1r�r.r/r0r_r@rVrWrZs          �r!r=zSockSite.__init__�s����	������-�#��		�	
�	
�	
���
� �-�9���6���6�9�%�%�	G�$�+���*G�*G��;�;�d�&6�&6�&8�&8�;�;�;�D�D��)�)�+�+�B�Q�B�/�J�D�$��s�y��T��E�E�E�F�F�D���
�
�
r c��|jSr$)r�r?s r!r@z
SockSite.name�r{r c���K�t������d{V��tj��}|jj}|�J�|�||j|j|j	����d{V��|_
dS)N)r�rbr0)rYrCrcrdr'r5rerr(r)r*rfs   �r!rCzSockSite.start�s�������g�g�m�m�o�o���������%�'�'����$���!�!�!�!�/�/�����):�D�M�0�
�
�
�
�
�
�
�
����r rI)rrrrJr�rKr	rrLr=rMrNr@rCrirjs@r!rr�s��������"�I�#'�,0��������m��
 ���j�)�
���
�������0��c�����X��
�
�
�
�
�
�
�
�
�
r rc	�6�eZdZdZddd�dedededd	fd
�Zede	e
fd���Zedeefd���Z
edeefd
���Zdd�Zedd���Zdd�Zede
fd���Zedd���Zdedd	fd�Zdedd	fd�Zdedd	fd�Zd	S)r��shutdown_callback�_handle_signals�_kwargsr*�_sitesr:Fr+)�handle_signalsr.r�r.�kwargsr"Nc�Z�d|_||_||_d|_g|_||_dSr$r�)r;r�r.r�s    r!r=zBaseRunner.__init__�s9��KO���-������)-���&(���!1����r c��|jSr$)r*r?s r!r5zBaseRunner.servers
���|�r c��g}|jD]@}|j}|�5|j}|�,|D])}|�|������*�A|Sr$)r�r*�sockets�appendr�)r;�ret�siter5r�r�s      r!�	addresseszBaseRunner.addressessh�����K�	7�	7�D��\�F��!� �.���&� '�7�7���
�
�4�#3�#3�#5�#5�6�6�6�6���
r c�*�t|j��Sr$)�setr�r?s r!�siteszBaseRunner.sitess���4�;���r c��4K�tj��}|jr\	|�tjt��|�tjt��n#t$rYnwxYw|�	���d{V��|_
dSr$)rcrdr��add_signal_handler�signal�SIGINTr%�SIGTERM�NotImplementedError�_make_serverr*�r;rgs  r!�setupzBaseRunner.setups������%�'�'����	�
��'�'��
�7K�L�L�L��'�'���8L�M�M�M�M��&�
�
�
���
����"�.�.�0�0�0�0�0�0�0�0����s�A
A)�)
A6�5A6c��
K�dS)z8Call any shutdown hooks to help server close gracefully.Nrr?s r!�shutdownzBaseRunner.shutdown)s
�����r c��K�t|j��D]}|����d{V���|jry|j���|����d{V��|jr|����d{V��|j�|j���d{V��|����d{V��d|_|j	retj��}	|�tj��|�tj��dS#t $rYdSwxYwdSr$)�listr�rHr*�pre_shutdownr�r�r:�_cleanup_serverr�rc�get_running_loop�remove_signal_handlerr�r�r�r�)r;r�rgs   r!�cleanupzBaseRunner.cleanup-s�����
���%�%�	�	�D��)�)�+�+����������<�	@��L�%�%�'�'�'��-�-�/�/�!�!�!�!�!�!�!��%�
/��,�,�.�.�.�.�.�.�.�.�.��,�'�'��(>�?�?�?�?�?�?�?�?�?��"�"�$�$�$�$�$�$�$�$�$������	��+�-�-�D�
��*�*�6�=�9�9�9��*�*�6�>�:�:�:�:�:��&�
�
�
����
����	�	s�0>D0�0
D>�=D>c��
K�dSr$rr?s r!r�zBaseRunner._make_serverI������r c��
K�dSr$rr?s r!r�zBaseRunner._cleanup_serverMr�r r�c�v�||jvrtd|�d|�����|j�|��dS)N�Site z! is already registered in runner )r�r6r��r;r�s  r!rBzBaseRunner._reg_siteQsJ���4�;����T�t�T�T�d�T�T�U�U�U�����4� � � � � r c�B�||jvrtd|�d|�����dS�Nr�z is not registered in runner )r�r6r�s  r!rEzBaseRunner._check_siteVs6���t�{�"�"��P�t�P�P�$�P�P�Q�Q�Q�#�"r c�v�||jvrtd|�d|�����|j�|��dSr�)r�r6�remover�s  r!rGzBaseRunner._unreg_siteZsJ���t�{�"�"��P�t�P�P�$�P�P�Q�Q�Q�����4� � � � � r rI)rrrrJrhrKrr=rMr	rr5rr�r
rr�r�rr�r�r�r�rBrErGrr r!rr�s��������I� %�"&�	2�2�2��2� �	2�
�2�
�
2�2�2�2�����(�����X���	�4��9�	�	�	��X�	�� �s�8�}� � � ��X� �1�1�1�1��G�G�G��^�G�����8�
�F�
�
�
��^�
��
�
�
��^�
�!�h�!�4�!�!�!�!�
R��R�T�R�R�R�R�!��!�T�!�!�!�!�!�!r rc	�Z��eZdZdZdZdd�dedededd	f�fd
�Zdd�Z	defd�Z
dd
�Z�xZS)rzLow-level web server runner��_web_serverF�r��
web_serverr�r�r"Nc�L��t��jdd|i|��||_dS)Nr�r)rYr=r�)r;r�r�r�rZs    �r!r=zServerRunner.__init__es5���	�����A�A��A�&�A�A�A�%����r c��
K�dSr$rr?s r!r�zServerRunner.shutdownk������r c��K�|jSr$r�r?s r!r�zServerRunner._make_serverns������r c��
K�dSr$rr?s r!r�zServerRunner._cleanup_serverqr�r rI)
rrr�__doc__rJrrhrr=r�r�r�rirjs@r!rr`s��������%�%� �I�=B�&�&�&� �&�59�&�MP�&�	
�&�&�&�&�&�&�
�
�
�
� �F� � � � �
�
�
�
�
�
�
�
r rc	�v��eZdZdZdZdd�dedededd	f�fd
�Ze	defd���Z
dd�Zdefd
�Z
dd�Z�xZS)rzWeb Application runner��_appFr��appr�r�r"Nc���t��jdd|i|��t|t��s"t	d�|�����||_dS)Nr�z?The first argument should be web.Application instance, got {!r}r)rYr=rxr�	TypeError�formatr�)r;r�r�r�rZs    �r!r=zAppRunner.__init__zsh���	�����A�A��A�&�A�A�A��#�{�+�+�	��%�%+�V�C�[�[���
���	�	�	r c��|jSr$r�r?s r!r�z
AppRunner.app�s
���y�r c��HK�|j����d{V��dSr$)r�r�r?s r!r�zAppRunner.shutdown�s2�����i� � �"�"�"�"�"�"�"�"�"�"�"r c��>K�tj��}|j�|��|jj���|j����d{V��|j���|jjdd|i|j��S)Nrgr)	rcrdr��	_set_loop�
on_startup�freeze�startup�
_make_handlerr�r�s  r!r�zAppRunner._make_server�s������%�'�'���	���D�!�!�!��	��#�#�%�%�%��i���!�!�!�!�!�!�!�!�!��	������&�t�y�&�A�A�D�A�D�L�A�A�Ar c��HK�|j����d{V��dSr$)r�r�r?s r!r�zAppRunner._cleanup_server�s2�����i���!�!�!�!�!�!�!�!�!�!�!r rI)rrrr�rJrrhrr=rMr�r�rr�r�rirjs@r!rrus�������� � ��I�;@�	�	�	��	�37�	�KN�	�	
�	�	�	�	�	�	���[�����X��#�#�#�#�B�F�B�B�B�B�"�"�"�"�"�"�"�"r rrI)&rcr�r�r7�abcrr�typingrrrrr	r
�yarlr�typedefsr
�web_apprr�rrbr�ImportError�object�__all__�
SystemExitrr%rrrrrrrrrr r!�<module>r�s�������
�
�
�
�
�
�
�
�����#�#�#�#�#�#�#�#�@�@�@�@�@�@�@�@�@�@�@�@�@�@�@�@������������� � � � � � ���������������������J�J�J�����
��
�
�
�
�
�:�
�
�
�����$'�$'�$'�$'�$'�s�$'�$'�$'�N/
�/
�/
�/
�/
�h�/
�/
�/
�d#
�#
�#
�#
�#
�x�#
�#
�#
�L"�"�"�"�"�H�"�"�"�>&
�&
�&
�&
�&
�x�&
�&
�&
�Rm!�m!�m!�m!�m!��m!�m!�m!�`
�
�
�
�
�:�
�
�
�*!"�!"�!"�!"�!"�
�!"�!"�!"�!"�!"s�A	�	A�A

?>