
    3Cf
                         d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZ dZ G d d      Zy)zLow level HTTP server.    N)Any	AwaitableCallableDictListOptional   )AbstractStreamWriter)get_running_loop)RawRequestMessage)StreamReader)RequestHandler_RequestFactory_RequestHandler)BaseRequest)Serverc                      e Zd Zdddddedee   dedeej                     de	d	dfd
Z
ed	ee   fd       Zdedej                  d	dfdZ	 ddedee   d	dfdZdededededdd	efdZddZddee   d	dfdZd	efdZy)r   NF)request_factoryhandler_cancellationloophandlerr   r   r   kwargsreturnc                    t        |      | _        i | _        || _        d| _        || _        |xs | j                  | _        || _        y )Nr   )	r   _loop_connections_kwargsrequests_countrequest_handler_make_requestr   r   )selfr   r   r   r   r   s         R/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/aiohttp/web_server.py__init__zServer.__init__   sJ     &d+
EG&.D$2D2D$8!    c                 H    t        | j                  j                               S N)listr   keys)r!   s    r"   connectionszServer.connections!   s    D%%**,--r$   	transportc                 "    || j                   |<   y r&   r   )r!   r   r*   s      r"   connection_madezServer.connection_made%   s     &/'"r$   excc                 <    || j                   v r| j                   |= y y r&   r,   )r!   r   r.   s      r"   connection_lostzServer.connection_lost*   s%     d'''!!'* (r$   messagepayloadprotocolwritertaskzasyncio.Task[None]c                 6    t        |||||| j                        S r&   )r   r   )r!   r1   r2   r3   r4   r5   s         r"   r    zServer._make_request0   s     7GXvtTZZPPr$   c                 F    | j                   D ]  }|j                           y r&   )r   close)r!   conns     r"   pre_shutdownzServer.pre_shutdown:   s     %% 	DJJL	r$   timeoutc                    K   fd| j                   D        }t        j                  |  d {    | j                   j                          y 7 w)Nc              3   @   K   | ]  }|j                          y wr&   )shutdown).0r9   r;   s     r"   	<genexpr>z"Server.shutdown.<locals>.<genexpr>?   s     FDw'Fs   )r   asynciogatherclear)r!   r;   coross    ` r"   r>   zServer.shutdown>   s@     FD4E4EFnne$$$! 	%s   +AA Ac                    	 t        | fd| j                  i| j                  S # t        $ rS | j                  j	                         D ci c]  \  }}|dv r|| nc c}}w }}}t        | fd| j                  i|cY S w xY w)Nr   )debugaccess_log_class)r   r   r   	TypeErroritems)r!   kvr   s       r"   __call__zServer.__call__C   s    		C!$HTZZH4<<HH 	C !LL..0Aq55 1 F 
 "$BTZZB6BB	Cs   !$ &B 
A"B ?B r&   )r   N)__name__
__module____qualname__r   r   r   boolrA   AbstractEventLoopr   r#   propertyr   r   r)   	Transportr-   BaseExceptionr0   r   r   r
   r   r    r:   floatr>   rL    r$   r"   r   r      s8   
 6:%*489 9 "/2	9
 #9 w0019 9 
9" .T.1 . ./%/292C2C/	/ GK+%+,4],C+	+Q"Q Q !	Q
 %Q #Q 
Q"huo " "

C. 
Cr$   r   )__doc__rA   typingr   r   r   r   r   r   abcr
   helpersr   http_parserr   streamsr   web_protocolr   r   r   web_requestr   __all__r   rV   r$   r"   <module>r`      s7      A A % % * ! J J $
>C >Cr$   