o
    [+ i                     @   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Z_frozenself r#   W/home/app/PaddleOCR-VL-test/.venv_paddleocr/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"   r0   r#   r#   r$   resolve;       zAbstractRouter.resolver   N)__name__
__module____qualname__r%   r   r*   propertyboolr.   r/   r   r   r4   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 )r1   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$   r/   f   r+   zAbstractMatchInfo.freezer6   )r7   r8   r9   	__slots__r:   r   r
   r   r	   r   r<   r   r=   r   r>   r   strr   r?   r   r   r@   rA   r/   r#   r#   r#   r$   r1   @   s,     r1   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	dde
f fd	d
ZdS )AbstractViewzAbstract class based view.r0   r   Nc                 C   s
   || _ d S r-   _requestr3   r#   r#   r$   r%   t   r&   zAbstractView.__init__c                 C   r,   )zRequest instance.rE   r!   r#   r#   r$   r0   w   s   zAbstractView.requestc                 C   r(   )zExecute the view handler.Nr#   r!   r#   r#   r$   	__await__|   r+   zAbstractView.__await__)r7   r8   r9   __doc__r   r%   r:   r0   r   r   r   rG   r#   r#   r#   r$   rD   q   s    rD   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)r7   r8   r9   rH   rC   __annotations__intr#   r#   r#   r$   rI      s   
 rI   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   rK   rL   rM   r   c                    r2   )z$Return IP address for given hostnameNr#   )r"   rK   rL   rM   r#   r#   r$   r4      r5   zAbstractResolver.resolveNc                    r2   )zRelease resolverNr#   r!   r#   r#   r$   close   r5   zAbstractResolver.closer6   )r7   r8   r9   rH   r   socketAF_INETrC   rQ   AddressFamilyr   rI   r4   rS   r#   r#   r#   r$   rR      s    rR   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)looprX   r   c                C   s   |pt  | _d S r-   )asyncioget_running_loop_loop)r"   rX   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"   ra   rb   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   rc   )r"   rd   rb   Z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"   rf   r#   r#   r$   filter_cookies   r+   z AbstractCookieJar.filter_cookiesr-   )r7   r8   r9   rH   r   rY   AbstractEventLoopr%   r:   r   r;   r\   ClearCookiePredicater^   rC   r`   r   r   rc   r   re   rg   r#   r#   r#   r$   rW      s*    
rW   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                    r2   )zWrite chunk into stream.Nr#   r"   rn   r#   r#   r$   write   r5   zAbstractStreamWriter.write    c                    r2   )zWrite last chunk.Nr#   ro   r#   r#   r$   	write_eof   r5   zAbstractStreamWriter.write_eofc                    r2   )zFlush the write buffer.Nr#   r!   r#   r#   r$   drain   r5   zAbstractStreamWriter.draindeflateencodingstrategyc                 C   r(   )zEnable HTTP body compressionNr#   )r"   ru   rv   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_linerd   zCIMultiDict[str]c                    r2   )zWrite HTTP headersNr#   )r"   ry   rd   r#   r#   r$   write_headers   r5   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)rq   r6   )rt   N)r7   r8   r9   rH   rk   rQ   rP   rl   rm   r   r   r   bytes	bytearray
memoryviewrp   rr   rs   rC   rw   rx   rz   r{   r#   r#   r#   r$   rj      s>   
 rj   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__r0   responsetimec                 C   r(   )zEmit log to logger.Nr#   )r"   r0   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)r7   r8   r9   rH   rB   loggingLoggerrC   r%   r   r   r   floatr   r:   r;   r   r#   r#   r#   r$   r      s    r   )6rY   r   rT   abcr   r   collections.abcr   http.cookiesr   r   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   Z	multidictr   Zyarlr   Z_cookie_helpersr   Ztypedefsr   Zweb_appr   Zweb_exceptionsr   Zweb_requestr   r   Zweb_responser   r   r1   rD   rI   rR   rC   ZIterableBaser;   ri   rW   rj   r   r#   r#   r#   r$   <module>   s<    <1#+