o
    Fh                     @   s  d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm	Z	m
Z
 d dlmZmZmZmZmZmZmZ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  eruddl!m"Z" ddl#m$Z$ ddl%m&Z&m'Z' ddl(m)Z) n
d Z& Z' Z"Z)dZ$G dd deZ*G dd deZ+G dd deZ,G dd deZ-G dd deZ.eree
e/  Z0neZ0edge1f Z2G dd dee0Z3G dd deZ4G dd deZ5dS )     N)ABCabstractmethod)Sized)
BaseCookieMorsel)TYPE_CHECKINGAny	AwaitableCallableDict	GeneratorIterableListOptionalSequenceTuple	TypedDictUnion)CIMultiDict)URL   )parse_set_cookie_headers)LooseCookies)Application)HTTPException)BaseRequestRequest)StreamResponsec                   @   sZ   e Zd ZdddZdeddfddZedefdd	Zdd
dZ	e
deddfddZdS )AbstractRouterreturnNc                 C   s
   d| _ d S )NF_frozenself r$   >/var/www/html/venv/lib/python3.10/site-packages/aiohttp/abc.py__init__(      
zAbstractRouter.__init__appc                 C      dS )zPost init stage.

        Not an abstract method for sake of backward compatibility,
        but if the router wants to be aware of the application
        it can override this.
        Nr$   r#   r(   r$   r$   r%   	post_init+       zAbstractRouter.post_initc                 C      | j S Nr    r"   r$   r$   r%   frozen3   s   zAbstractRouter.frozenc                 C   s
   d| _ dS )zFreeze router.TNr    r"   r$   r$   r%   freeze7   s   
zAbstractRouter.freezerequestAbstractMatchInfoc                       dS )z#Return MATCH_INFO for given requestNr$   r#   r1   r$   r$   r%   resolve;       zAbstractRouter.resolver   N)__name__
__module____qualname__r&   r   r+   propertyboolr/   r0   r   r   r5   r$   r$   r$   r%   r   '   s    

r   c                   @   s   e Zd ZdZeedeegee	 f fddZ
eedeegeee	  f fddZeedee fddZedeeef fd	d
Zeedeedf fddZededdfddZedddZdS )r2   r$   r   c                 C   r)   )zExecute matched request handlerNr$   r"   r$   r$   r%   handlerD   r,   zAbstractMatchInfo.handlerc                 C   r)   )z*Expect handler for 100-continue processingNr$   r"   r$   r$   r%   expect_handlerI   r,   z AbstractMatchInfo.expect_handlerc                 C   r)   )z<HTTPException instance raised on router's resolving, or NoneNr$   r"   r$   r$   r%   http_exceptionP   r,   z AbstractMatchInfo.http_exceptionc                 C   r)   )z;Return a dict with additional info useful for introspectionNr$   r"   r$   r$   r%   get_infoU   r,   zAbstractMatchInfo.get_info.c                 C   r)   )z\Stack of nested applications.

        Top level application is left-most element.

        Nr$   r"   r$   r$   r%   appsY   r,   zAbstractMatchInfo.appsr(   Nc                 C   r)   )z)Add application to the nested apps stack.Nr$   r*   r$   r$   r%   add_appb   r,   zAbstractMatchInfo.add_appc                 C   r)   )zFreeze the match info.

        The method is called after route resolution.

        After the call .add_app() is forbidden.

        Nr$   r"   r$   r$   r%   r0   f   r,   zAbstractMatchInfo.freezer7   )r8   r9   r:   	__slots__r;   r   r
   r   r	   r   r=   r   r>   r   r?   r   strr   r@   r   r   rA   rB   r0   r$   r$   r$   r%   r2   @   s,     r2   c                   @   sP   e Zd ZdZdeddfddZedefddZede	e
def fd	d
ZdS )AbstractViewzAbstract class based view.r1   r   Nc                 C   s
   || _ d S r.   _requestr4   r$   r$   r%   r&   t   r'   zAbstractView.__init__c                 C   r-   )zRequest instance.rF   r"   r$   r$   r%   r1   w   s   zAbstractView.requestc                 C   r)   )zExecute the view handler.Nr$   r"   r$   r$   r%   	__await__|   r,   zAbstractView.__await__)r8   r9   r:   __doc__r   r&   r;   r1   r   r   r   r   rH   r$   r$   r$   r%   rE   q   s    rE   c                   @   sB   e Zd ZU dZeed< eed< eed< eed< eed< eed< dS )	ResolveResulta  Resolve result.

    This is the result returned from an AbstractResolver's
    resolve method.

    :param hostname: The hostname that was provided.
    :param host: The IP address that was resolved.
    :param port: The port that was resolved.
    :param family: The address family that was resolved.
    :param proto: The protocol that was resolved.
    :param flags: The flags that were resolved.
    hostnamehostportfamilyprotoflagsN)r8   r9   r:   rI   rD   __annotations__intr$   r$   r$   r%   rJ      s   
 rJ   c                   @   sJ   e Zd ZdZedejfdededej	de
e fddZedd
dZd	S )AbstractResolverzAbstract DNS resolver.r   rL   rM   rN   r   c                    r3   )z$Return IP address for given hostnameNr$   )r#   rL   rM   rN   r$   r$   r%   r5      r6   zAbstractResolver.resolveNc                    r3   )zRelease resolverNr$   r"   r$   r$   r%   close   r6   zAbstractResolver.closer7   )r8   r9   r:   rI   r   socketAF_INETrD   rR   AddressFamilyr   rJ   r5   rT   r$   r$   r$   r%   rS      s    rS   zMorsel[str]c                   @   s   e Zd ZdZdddeej ddfddZee	de
fdd	Ze	dd
ee ddfddZe	deddfddZe	e fdededdfddZdee deddfddZe	deddfddZdS )AbstractCookieJarzAbstract Cookie Jar.N)looprY   r   c                C   s   |pt  | _d S r.   )asyncioget_running_loop_loop)r#   rY   r$   r$   r%   r&      s   zAbstractCookieJar.__init__c                 C   r)   )z(Return True if cookies should be quoted.Nr$   r"   r$   r$   r%   quote_cookie   r,   zAbstractCookieJar.quote_cookie	predicatec                 C   r)   )z,Clear all cookies if no predicate is passed.Nr$   )r#   r^   r$   r$   r%   clear   r,   zAbstractCookieJar.cleardomainc                 C   r)   )z0Clear all cookies for domain and all subdomains.Nr$   )r#   r`   r$   r$   r%   clear_domain   r,   zAbstractCookieJar.clear_domaincookiesresponse_urlc                 C   r)   )zUpdate cookies.Nr$   )r#   rb   rc   r$   r$   r%   update_cookies   r,   z AbstractCookieJar.update_cookiesheadersc                 C   s(   |rt | }r| || dS dS dS )z+Update cookies from raw Set-Cookie headers.N)r   rd   )r#   re   rc   cookies_to_updater$   r$   r%   update_cookies_from_headers   s   z-AbstractCookieJar.update_cookies_from_headersrequest_urlzBaseCookie[str]c                 C   r)   )z6Return the jar's cookies filtered by their attributes.Nr$   )r#   rh   r$   r$   r%   filter_cookies   r,   z AbstractCookieJar.filter_cookiesr.   )r8   r9   r:   rI   r   rZ   AbstractEventLoopr&   r;   r   r<   r]   ClearCookiePredicater_   rD   ra   r   r   rd   r   rg   ri   r$   r$   r$   r%   rX      s*    
rX   c                   @   s   e Zd ZU dZdZeed< dZeed< dZe	e ed< e
deeeef ddfd	d
Ze
ddeddfddZe
dddZe
	d dede	e ddfddZe
dddZe
deddddfddZdddZdS )!AbstractStreamWriterzAbstract stream writer.r   buffer_sizeoutput_sizelengthchunkr   Nc                    r3   )zWrite chunk into stream.Nr$   r#   rp   r$   r$   r%   write   r6   zAbstractStreamWriter.write    c                    r3   )zWrite last chunk.Nr$   rq   r$   r$   r%   	write_eof   r6   zAbstractStreamWriter.write_eofc                    r3   )zFlush the write buffer.Nr$   r"   r$   r$   r%   drain   r6   zAbstractStreamWriter.draindeflateencodingstrategyc                 C   r)   )zEnable HTTP body compressionNr$   )r#   rw   rx   r$   r$   r%   enable_compression   r,   z'AbstractStreamWriter.enable_compressionc                 C   r)   )zEnable HTTP chunked modeNr$   r"   r$   r$   r%   enable_chunking   r,   z$AbstractStreamWriter.enable_chunkingstatus_linere   zCIMultiDict[str]c                    r3   )zWrite HTTP headersNr$   )r#   r{   re   r$   r$   r%   write_headers   r6   z"AbstractStreamWriter.write_headersc                 C   r)   )zForce sending buffered headers if not already sent.

        Required only if write_headers() buffers headers instead of sending immediately.
        For backwards compatibility, this method does nothing by default.
        Nr$   r"   r$   r$   r%   send_headers   r,   z!AbstractStreamWriter.send_headers)rs   r7   )rv   N)r8   r9   r:   rI   rm   rR   rQ   rn   ro   r   r   r   bytes	bytearray
memoryviewrr   rt   ru   rD   ry   rz   r|   r}   r$   r$   r$   r%   rl      s>   
 rl   c                	   @   s\   e Zd ZdZdZdejdeddfddZe	d	e
d
ededdfddZedefddZdS )AbstractAccessLoggerzAbstract writer to access log.logger
log_formatr   r   r   Nc                 C   s   || _ || _d S r.   r   )r#   r   r   r$   r$   r%   r&     s   
zAbstractAccessLogger.__init__r1   responsetimec                 C   r)   )zEmit log to logger.Nr$   )r#   r1   r   r   r$   r$   r%   log  r,   zAbstractAccessLogger.logc                 C   r)   )zCheck if logger is enabled.Tr$   r"   r$   r$   r%   enabled	  s   zAbstractAccessLogger.enabled)r8   r9   r:   rI   rC   loggingLoggerrD   r&   r   r   r   floatr   r;   r<   r   r$   r$   r$   r%   r      s    r   )6rZ   r   rU   abcr   r   collections.abcr   http.cookiesr   r   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   	multidictr   yarlr   _cookie_helpersr   typedefsr   web_appr   web_exceptionsr   web_requestr   r   web_responser   r   r2   rE   rJ   rS   rD   IterableBaser<   rk   rX   rl   r   r$   r$   r$   r%   <module>   s<    <1#+