o
    4˜Žjp  ã                   @   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mZm	Z	m
Z
mZmZ d dlmZmZmZ d dlmZ d dl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rsd	dlm Z  d	dl!m"Z" d	dl#m$Z$m%Z% d	dl&m'Z' n
e Z$ Z% Z Z'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+G dd„ deƒZ,er®e
ee-  Z.ne
Z.edge/f Z0G dd„ dee.ƒZ1G dd„ deƒZ2G dd „ d eƒZ3dS )!é    N)ÚABCÚabstractmethod)Ú	AwaitableÚCallableÚ	GeneratorÚIterableÚSequenceÚSized)Ú
BaseCookieÚMorselÚSimpleCookie)ÚMappingProxyType)ÚTYPE_CHECKINGÚAnyÚ	TypedDict)Ú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!   úH/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/aiohttp/abc.pyÚ__init__   ó   
zAbstractRouter.__init__Úappc                 C   ó   dS )zºPost 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"   Úfrozen&   s   zAbstractRouter.frozenc                 C   s
   d| _ dS )zFreeze router.TNr   r   r!   r!   r"   Úfreeze*   s   
zAbstractRouter.freezeÚrequestÚAbstractMatchInfoc                 Ã   ó   �dS )z#Return MATCH_INFO for given requestNr!   ©r    r.   r!   r!   r"   Úresolve.   ó    zAbstractRouter.resolve©r   N)Ú__name__Ú
__module__Ú__qualname__r#   r   r(   ÚpropertyÚboolr,   r-   r   r   r2   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	dB  f fdd„ƒƒZeededB 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 )r/   r!   r   c                 C   r&   )zExecute matched request handlerNr!   r   r!   r!   r"   Úhandler7   r)   zAbstractMatchInfo.handlerNc                 C   r&   )z*Expect handler for 100-continue processingNr!   r   r!   r!   r"   Úexpect_handler<   r)   z AbstractMatchInfo.expect_handlerc                 C   r&   )z<HTTPException instance raised on router's resolving, or NoneNr!   r   r!   r!   r"   Úhttp_exceptionC   r)   z AbstractMatchInfo.http_exceptionc                 C   r&   )z;Return a dict with additional info useful for introspectionNr!   r   r!   r!   r"   Úget_infoH   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"   ÚappsL   r)   zAbstractMatchInfo.appsr%   c                 C   r&   )z)Add application to the nested apps stack.Nr!   r'   r!   r!   r"   Úadd_appU   r)   zAbstractMatchInfo.add_appc                 C   r&   )z‡Freeze the match info.

        The method is called after route resolution.

        After the call .add_app() is forbidden.

        Nr!   r   r!   r!   r"   r-   Y   r)   zAbstractMatchInfo.freezer4   )r5   r6   r7   Ú	__slots__r8   r   r   r   r   r   r:   r;   r   r<   ÚdictÚstrr   r=   Útupler   r>   r?   r-   r!   r!   r!   r"   r/   3   s,     þr/   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.r.   r   Nc                 C   s
   || _ d S r+   ©Ú_requestr1   r!   r!   r"   r#   g   r$   zAbstractView.__init__c                 C   r*   )zRequest instance.rE   r   r!   r!   r"   r.   j   s   zAbstractView.requestc                 C   r&   )zExecute the view handler.Nr!   r   r!   r!   r"   Ú	__await__o   r)   zAbstractView.__await__)r5   r6   r7   Ú__doc__r   r#   r8   r.   r   r   r   rG   r!   r!   r!   r"   rD   d   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)r5   r6   r7   rH   rB   Ú__annotations__Úintr!   r!   r!   r"   rI   t   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                 Ã   r0   )z$Return IP address for given hostnameNr!   )r    rK   rL   rM   r!   r!   r"   r2   �   r3   zAbstractResolver.resolveNc                 Ã   r0   )zRelease resolverNr!   r   r!   r!   r"   Úclose“   r3   zAbstractResolver.closer4   )r5   r6   r7   rH   r   ÚsocketÚAF_INETrB   rQ   ÚAddressFamilyÚlistrI   r2   rS   r!   r!   r!   r"   rR   Š   s    ÿÿÿÿþrR   zMorsel[str]c                   @   s$  e Zd ZdZddœdejdB ddfdd„Zeede	fdd	„ƒƒZ
eede	fd
d„ƒƒZeedeeeef ef fdd„ƒƒZeedeeeef  fdd„ƒƒZed!dedB 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&   )z5Return True if cookies can be used with IP addresses.Nr!   r   r!   r!   r"   Úunsafe§   r)   zAbstractCookieJar.unsafec                 C   r&   )z(Return True if cookies should be quoted.Nr!   r   r!   r!   r"   Úquote_cookie¬   r)   zAbstractCookieJar.quote_cookiec                 C   r&   )z&Return the cookies stored in this jar.Nr!   r   r!   r!   r"   Úcookies±   r)   zAbstractCookieJar.cookiesc                 C   r&   )z0Return the host-only cookies stored in this jar.Nr!   r   r!   r!   r"   Úhost_only_cookies¶   r)   z#AbstractCookieJar.host_only_cookiesÚ	predicatec                 C   r&   )z,Clear all cookies if no predicate is passed.Nr!   )r    ra   r!   r!   r"   Úclear»   r)   zAbstractCookieJar.clearÚdomainc                 C   r&   )z0Clear all cookies for domain and all subdomains.Nr!   )r    rc   r!   r!   r"   Úclear_domain¿   r)   zAbstractCookieJar.clear_domainr_   Úresponse_urlc                 C   r&   )zUpdate cookies.Nr!   )r    r_   re   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   rf   )r    rg   re   Ú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    rj   r!   r!   r"   Úfilter_cookiesÎ   r)   z AbstractCookieJar.filter_cookiesr+   )r5   r6   r7   rH   rZ   ÚAbstractEventLoopr#   r8   r   r9   r]   r^   r   rC   rB   r   r_   Ú	frozensetr`   ÚClearCookiePredicaterb   rd   r   r   rf   r   ri   rk   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dB ed< e	de
eB eB 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dB 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_sizeNÚlengthÚchunkr   c                 Ã   r0   )zWrite chunk into stream.Nr!   ©r    rs   r!   r!   r"   ÚwriteÚ   r3   zAbstractStreamWriter.writeó    c                 Ã   r0   )zWrite last chunk.Nr!   rt   r!   r!   r"   Ú	write_eofÞ   r3   zAbstractStreamWriter.write_eofc                 Ã   r0   )zFlush the write buffer.Nr!   r   r!   r!   r"   Údrainâ   r3   zAbstractStreamWriter.drainÚdeflateÚencodingÚstrategyc                 C   r&   )zEnable HTTP body compressionNr!   )r    rz   r{   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_linerg   zCIMultiDict[str]c                 Ã   r0   )zWrite HTTP headersNr!   )r    r~   rg   r!   r!   r"   Úwrite_headersð   r3   z"AbstractStreamWriter.write_headersc                 C   r&   )zàForce 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)rv   r4   )ry   N)r5   r6   r7   rH   rp   rQ   rP   rq   rr   r   ÚbytesÚ	bytearrayÚ
memoryviewru   rw   rx   rB   r|   r}   r   r€   r!   r!   r!   r"   ro   Ó   s>   
 ÿÿÿþÿÿþro   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__r.   ÚresponseÚtimec                 C   r&   )zEmit log to logger.Nr!   )r    r.   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)r5   r6   r7   rH   r@   ÚloggingÚLoggerrB   r#   r   r   r   ÚfloatrŠ   r8   r9   r‹   r!   r!   r!   r"   r„   þ   s    r„   )4rZ   rŒ   rT   Úabcr   r   Úcollections.abcr   r   r   r   r   r	   Úhttp.cookiesr
   r   r   Útypesr   Útypingr   r   r   Ú	multidictr   Úyarlr   Ú_cookie_helpersr   Útypedefsr   Úweb_appr   Úweb_exceptionsr   Úweb_requestr   r   Úweb_responser   r   r/   rD   rI   rR   rB   ÚIterableBaser9   rn   rX   ro   r„   r!   r!   r!   r"   Ú<module>   s>     12+