o
    çûõj!  ã                   @   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!   ú>/opt/steambot/venv/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   ó   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   rH   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   rI   rB   Ú__annotations__Úintr!   r!   r!   r"   rJ   t   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                 Ã   r0   )z$Return IP address for given hostnameNr!   )r    rL   rM   rN   r!   r!   r"   r2   �   r3   zAbstractResolver.resolveNc                 Ã   r0   )zRelease resolverNr!   r   r!   r!   r"   Úclose“   r3   zAbstractResolver.closer4   )r5   r6   r7   rI   r   ÚsocketÚAF_INETrB   rR   ÚAddressFamilyÚlistrJ   r2   rT   r!   r!   r!   r"   rS   Š   s    ÿÿÿÿþrS   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de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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)ÚlooprZ   r   c                C   s   |pt  ¡ | _d S r+   )ÚasyncioÚget_running_loopÚ_loop)r    rZ   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   s   t ƒ S )zAReturn origins considered secure even over cleartext connections.)Ú	frozensetr   r!   r!   r"   Útreat_as_secure_origin±   rG   z(AbstractCookieJar.treat_as_secure_originc                 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    rd   r!   r!   r"   ÚclearÀ   r)   zAbstractCookieJar.clearÚdomainc                 C   r&   )z0Clear all cookies for domain and all subdomains.Nr!   )r    rf   r!   r!   r"   Úclear_domainÄ   r)   zAbstractCookieJar.clear_domainrb   Úresponse_urlc                 C   r&   )zUpdate cookies.Nr!   )r    rb   rh   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   ri   )r    rj   rh   Ú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    rm   r!   r!   r"   Úfilter_cookiesÓ   r)   z AbstractCookieJar.filter_cookiesr+   )r5   r6   r7   rI   r[   ÚAbstractEventLoopr#   r8   r   r9   r^   r_   r`   r   ra   r   rC   rB   r   rb   rc   ÚClearCookiePredicatere   rg   r   ri   r   rl   rn   r!   r!   r!   r"   rY   ¡   s@    " ÿÿ
þrY   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< dZ	e
eegdf dB ed< edejdB fd	d
„ƒZ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Úon_body_writer   c                 C   r&   )z½The transport this writer writes to, if any.

        Used by upload progress tracking to observe the unsent buffer;
        writers without one report progress only on completion.
        Nr!   r   r!   r!   r"   Ú	transportæ   s   zAbstractStreamWriter.transportÚchunkc                 Ã   r0   )zWrite chunk into stream.Nr!   ©r    rw   r!   r!   r"   Úwriteï   r3   zAbstractStreamWriter.writeó    c                 Ã   r0   )zWrite last chunk.Nr!   rx   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    r~   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_linerj   zCIMultiDict[str]c                 Ã   r0   )zWrite HTTP headersNr!   )r    r‚   rj   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)rz   r4   )r}   N)r5   r6   r7   rI   rr   rR   rQ   rs   rt   ru   r   r8   r[   ÚWriteTransportrv   r   ÚbytesÚ	bytearrayÚ
memoryviewry   r{   r|   rB   r€   r�   rƒ   r„   r!   r!   r!   r"   rq   Ø   sD   
 ÿÿÿþÿÿþrq   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   rI   r@   ÚloggingÚLoggerrB   r#   r   r   r   Úfloatr�   r8   r9   r�   r!   r!   r!   r"   r‰     s    r‰   )4r[   r‘   rU   Ú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   rJ   rS   rB   ÚIterableBaser9   rp   rY   rq   r‰   r!   r!   r!   r"   Ú<module>   s>     17;