U
    ;g|                     @   s  U d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlZddl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 ddlmZ dd	l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*m+Z+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1 ddl2m3Z3m4Z4 ddl5Z5ddl6m7Z7m8Z8m9Z9 ddl:m;Z; ddl<m=Z= ddl>m?Z? ej@dkrddlZAnddlAZAdZBeC dkZDeC dkZEej@dkZFej@dkZGe,dZHe,dZIeJddZKeKjLZLeMe
jNOdZPejQjRp"ejQjS o"eMe
jNOdZTdd eUddD ZVd d eUdd!D eWd"hB ZXd#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4eWd5hZYeVeXA eYA ZZG d6d7 d7Z[G d8d9 d9ed9d:d;d<gZ\e;e*e;e(e\ f d=d>d?Z]e(e	j	 d@dAdBZ^e5j_dCdCdCdDG dEdF dFZ`e(e	j	 eae\dGdHdIZbe!eae`f d@dJdKZce;e*e;e(e\ f d=dLdMZde5j_dCdCdCdDG dNdO dOZeejfdPdQeaeedRdSdTZgdee(ea e(ea dUdVdWZheidXZjdYd eUd!d"D dZhB Zkeaead[d\d]ZldeaeMeaeaead_d`daZmG dbdc dce)e#eH ZnG ddde dee#eH ZoeoZpzddflqmoZr ePs:erZoW n esk
rR   Y nX e(e-eaetf  eMdgdhdiZue(e-eaetf  eMdgdjdkZve(e-eaetewexf  eMdgdldmZydaze(e{ e|dn< doa}ead@dpdqZ~drddsdtduZdeeaeejee(ej dwdxdyZdeg ef eejee(ej dzd{d|Zeeeed}d~dZG dd dZG dd de d ZG dd deZG dd deZde(e eeAjdddZG dd dZdeHddddZe ZG dd de)ZefdeeddddZejG dd de#eH ZG dd de'e-eaee f ef ZdZeieZde dZeieZeid#e dZdZe5j_dCdCdCdDG dd dZeaddddZe(ea e(ej dddZejfeae{eMdddZeaeMdddZe{eMdddZeae{eMdddZdS )zVarious helper functions    N)
namedtuple)suppress)HeaderParser)	parsedateceil)Path)TracebackType)AnyCallableContextManagerDict	GeneratorGenericIterableIteratorListMappingOptionalProtocolTupleTypeTypeVarUnionget_argsoverload)quote)
getproxiesproxy_bypass)	MultiDictMultiDictProxyMultiMappingURL   )hdrs)client_logger      )	BasicAuthChainMapProxyETagDarwinWindows)r(   
   _T_S	_SENTINELsentinelZAIOHTTP_NO_EXTENSIONSZPYTHONASYNCIODEBUGc                 C   s   h | ]}t |qS  chr.0ir4   r4   O/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/aiohttp/helpers.py	<setcomp>R   s     r;      c                 C   s   h | ]}t |qS r4   r5   r7   r4   r4   r:   r;   S   s            ()<>@,;:\"/[]?={} 	   c                   @   s   e Zd Zed dddZdS )noop)NNNreturnc                 c   s
   d V  d S Nr4   selfr4   r4   r:   	__await__o   s    znoop.__await__N)__name__
__module____qualname__r   rX   r4   r4   r4   r:   rR   n   s   rR   c                       st   e Zd ZdZdeeed d fddZedeed ddd	Zedd
eee	d  dddZ
edddZ  ZS )r*   z!Http basic authentication helper. latin1)loginpasswordencodingrT   c                    sB   |d krt d|d kr t dd|kr0t dt | |||S )Nz"None is not allowed as login valuez%None is not allowed as password valuerF   z5A ":" is not allowed in login (RFC 1945#section-11.1))
ValueErrorsuper__new__)clsr^   r_   r`   	__class__r4   r:   rc   v   s    zBasicAuth.__new__)auth_headerr`   rT   c                 C   s   z| dd\}}W n tk
r0   tdY nX | dkrJtd| ztj|ddd|}W n tjk
r   td	Y nX z| d
d\}}W n tk
r   tdY nX | |||dS )z<Create a BasicAuth object from an Authorization HTTP header.rP   r$   z%Could not parse authorization header.basiczUnknown authorization method %sasciiT)validatezInvalid base64 encoding.rF   zInvalid credentials.r`   )	splitra   lowerbase64	b64decodeencodedecodebinasciiError)rd   rg   r`   Z	auth_typeZencoded_credentialsdecodedusernamer_   r4   r4   r:   rq      s(     zBasicAuth.decoderk   )urlr`   rT   c                C   sD   t |tstd|jdkr*|jdkr*dS | |jp4d|jp<d|dS )zCreate BasicAuth from url.zurl should be yarl.URL instanceNr\   rk   )
isinstancer#   	TypeErrorraw_userraw_passworduserr_   )rd   rv   r`   r4   r4   r:   from_url   s
    
zBasicAuth.from_urlrS   c                 C   s0   | j  d| j | j}dt|| j S )zEncode credentials.rF   zBasic %s)r^   r_   rp   r`   rn   	b64encoderq   )rW   credsr4   r4   r:   rp      s    zBasicAuth.encode)r\   r]   )r]   )rY   rZ   r[   __doc__strrc   classmethodrq   r#   r   r|   rp   __classcell__r4   r4   re   r:   r*   s   s        
r*   r^   r_   r`   )rv   rT   c                 C   s<   | j dkr| jdkr| dfS | dt| jp.d| jp6dfS )zIRemove user and password from URL if present and return BasicAuth object.Nr\   )ry   rz   Z	with_userr*   r{   r_   )rv   r4   r4   r:   strip_auth_from_url   s    r   rS   c                  C   s  t jd} | dk	rt| }nRzt }W n4 tk
r^ } ztd| W Y dS d}~X Y nX |trjdnd }zt		t
|W S  t	jk
r } ztd| W 5 d}~X Y n\ tk
r
 } z<d}tt | }W 5 Q R X | s| rtd| W 5 d}~X Y nX dS )	zLoad netrc from file.

    Attempt to load it from the path specified by the env-var
    NETRC or in the default location in the user's home directory.

    Returns None if it couldn't be found or fails to parse.
    NETRCNzHCould not resolve home directory when trying to look for .netrc file: %s_netrcz.netrczCould not parse .netrc file: %sFzCould not read .netrc file: %s)osenvirongetr   homeRuntimeErrorr&   debug
IS_WINDOWSnetrcr   NetrcParseErrorwarningOSError
contextlibr   is_file)Z	netrc_env
netrc_pathZhome_direZnetrc_existsr4   r4   r:   netrc_from_env   s.    

r   T)Zauto_attribsfrozenslotsc                   @   s"   e Zd ZU eed< ee ed< dS )	ProxyInfoproxy
proxy_authN)rY   rZ   r[   r#   __annotations__r   r*   r4   r4   r4   r:   r      s   
r   )	netrc_objhostrT   c                 C   sf   | dkrt d| |}|dkr2t d|d|\}}}|sH|dkrL|n|}|dkr\d}t||S )z
    Return :py:class:`~aiohttp.BasicAuth` credentials for ``host`` from ``netrc_obj``.

    :raises LookupError: if ``netrc_obj`` is :py:data:`None` or if no
            entry is found for the ``host``.
    NzNo .netrc file foundzNo entry for z found in the `.netrc` file.r\   )LookupErrorauthenticatorsr*   )r   r   Zauth_from_netrcr^   accountr_   ru   r4   r4   r:   basicauth_from_netrc   s    

r   c               	   C   s   dd t   D } t }dd |  D }i }| D ]~\}}|\}}|jdkrhtd|j | q8|r|d kr|jd k	rzt||j}W n t	k
r   d }Y nX t
||||< q8|S )Nc                 S   s"   i | ]\}}|d kr|t |qS ))httphttpswswssr"   r8   kvr4   r4   r:   
<dictcomp>
  s    z$proxies_from_env.<locals>.<dictcomp>c                 S   s   i | ]\}}|t |qS r4   )r   r   r4   r4   r:   r     s      )r   r   z)%s proxies %s are not supported, ignoring)r   itemsr   schemer&   r   upperr   r   r   r   )Z
proxy_urlsr   strippedretprotovalr   authr4   r4   r:   proxies_from_env	  s.    
  

r   c                 C   sp   | j dk	r&t| j r&td| j dt }z|| j }W n$ tk
r^   td| dY nX |j|jfS dS )z5Get a permitted proxy for the given URL from the env.NzProxying is disallowed for ``zNo proxies found for `z` in the env)r   r   r   r   r   KeyErrorr   r   )rv   Zproxies_in_envZ
proxy_infor4   r4   r:   get_env_proxy_for_url#  s    r   c                   @   s.   e Zd ZU eed< eed< eed< ded< dS )MimeTypetypesubtypesuffixzMultiDictProxy[str]
parametersN)rY   rZ   r[   r   r   r4   r4   r4   r:   r   1  s   
r   8   )maxsize)mimetyperT   c                 C   s   | st dddtt dS | d}t }|dd D ]4}|s@q6|d\}}}||  |d q6|d   }|d	krd
}|d\}}}	|	d\}	}}
t ||	|
t|dS )a  Parses a MIME type into its components.

    mimetype is a MIME type string.

    Returns a MimeType object.

    Example:

    >>> parse_mimetype('text/html; charset=utf-8')
    MimeType(type='text', subtype='html', suffix='',
             parameters={'charset': 'utf-8'})

    r\   )r   r   r   r   rE   r$   NrM   z "r   *z*/*rI   +)r   r    r   rl   	partitionaddrm   strip)r   partsparamsitemkey_valueZfulltypemtypestyper   r4   r4   r:   parse_mimetype9  s2       
   r   )objdefaultrT   c                 C   s@   t | dd }|r<t|tr<|d dkr<|d dkr<t|jS |S )Nnamer   rA   rB   )getattrrw   r   r   r   )r   r   r   r4   r4   r:   guess_filenamea  s    &
r   z[^\041\043-\133\135-\176]c                 C   s   h | ]}t |qS r4   r5   r7   r4   r4   r:   r;   i  s     	)contentrT   c                 C   s*   t t| kstd| tdd | S )a  Return 7-bit content as quoted-string.

    Format content into a quoted-string as defined in RFC5322 for
    Internet Message Format. Notice that this is not the 8-bit HTTP
    format, but the 7-bit email format. Content must be in usascii or
    a ValueError is raised.
    zbad content for quoted-string c                 S   s   d|  d S )NrG   r   )group)xr4   r4   r:   <lambda>v      zquoted_string.<locals>.<lambda>)QCONTENTsetra   not_qtext_resub)r   r4   r4   r:   quoted_stringl  s    r   utf-8)disptypequote_fields_charsetr   rT   c           
      K   s>  | rt t| kstd| | }|r:g }| D ]\}}|rLt t|ks\td|||r| dkrt|d|d}||d| f n`zt|}W n@ tk
r   d	|dt|d|df}||d |f Y nX ||d| f q4|
d	d

dd}||d| f q4d	dd |D }	d	||	f}|S )ak  Sets ``Content-Disposition`` header for MIME.

    This is the MIME payload Content-Disposition header from RFC 2183
    and RFC 7579 section 4.2, not the HTTP Content-Disposition from
    RFC 6266.

    disptype is a disposition type: inline, attachment, form-data.
    Should be valid extension token (see RFC 2183)

    quote_fields performs value quoting to 7-bit MIME headers
    according to RFC 7578. Set to quote_fields to False if recipient
    can take 8-bit file names and field values.

    _charset specifies the charset to use when quote_fields is True.

    params is a dict with disposition params.
    z!bad content disposition type {!r}z+bad content disposition parameter {!r}={!r}filenamer\   rk   z"%s"z''r   rG   z\\rH   z\"z; c                 s   s   | ]}d  |V  qdS )rM   N)join)r8   pairr4   r4   r:   	<genexpr>  s     z-content_disposition_header.<locals>.<genexpr>)TOKENr   ra   formatr   rm   r   appendr   r   replace)
r   r   r   r   r   Zlparamsr   r   ZqvalZsparamsr4   r4   r:   content_disposition_headery  s6    
r   c                   @   s   e Zd ZU eeef ed< dS )_TSelf_cacheN)rY   rZ   r[   r   r   r0   r   r4   r4   r4   r:   r     s   
r   c                   @   s^   e Zd ZdZedef ddddZdee ee	e
  eddd	Zee edd
ddZdS )reifyaU  Use as a class method decorator.

    It operates almost exactly like
    the Python `@property` decorator, but it puts the result of the
    method it decorates into the instance dict after the first call,
    effectively replacing the function it decorates with an instance
    variable.  It is, in Python parlance, a data descriptor.
    .N)wrappedrT   c                 C   s   || _ |j| _|j| _d S rU   )r   r   rY   r   )rW   r   r4   r4   r:   __init__  s    zreify.__init__)instownerrT   c                 C   sr   zFz|j | j W W S  tk
rB   | |}||j | j< | Y W S X W n& tk
rl   |d krf|  Y S  Y nX d S rU   )r   r   r   r   AttributeError)rW   r   r   r   r4   r4   r:   __get__  s    
zreify.__get__)r   r   rT   c                 C   s   t dd S )Nzreified property is read-only)r   )rW   r   r   r4   r4   r:   __set__  s    zreify.__set__)N)rY   rZ   r[   r   r   r0   r   r   r   r   r
   r   r   r4   r4   r4   r:   r     s   	 r   )r   )r   rT   c                 C   sd   | sdS t | tr"| dd S t | tttfrH| ddd S t|  dt	|  ddS )a  Check if host looks like an IPv4 address.

    This function does not validate that the format is correct, only that
    the host is a str or bytes, and its all numeric.

    This check is only meant as a heuristic to ensure that
    a host is not a domain name.
    F.r\   ri    [] is not a str or bytesN)
rw   r   r   isdigitbytes	bytearray
memoryviewrq   rx   r   r   r4   r4   r:   is_ipv4_address  s    	
r   c                 C   sN   | sdS t | trd| kS t | tttfr2d| kS t|  dt|  ddS )a  Check if host looks like an IPv6 address.

    This function does not validate that the format is correct, only that
    the host contains a colon and that it is a str or bytes.

    This check is only meant as a heuristic to ensure that
    a host is not a domain name.
    FrF      :r   r   N)rw   r   r   r   r   rx   r   r   r4   r4   r:   is_ipv6_address  s    	
r   c                 C   s   t | pt| S )zCheck if host looks like an IP Address.

    This check is only meant as a heuristic to ensure that
    a host is not a domain name.
    )r   r   r   r4   r4   r:   is_ip_address  s    r   _cached_current_datetimer\   c                  C   s\   t t } | tkrXd}d}t| ^}}}}}}}	}
d||	 ||| ||||f a| atS )N)MonTueWedThuFriSatSun)r\   JanFebMarAprMayJunJulAugSepOctNovDecz#%s, %02d %3s %4d %02d:%02d:%02d GMT)inttimer   gmtime_cached_formatted_datetime)now_weekdayname
_monthnameyearmonthdayhhmmsswdtailr4   r4   r:   rfc822_formatted_time  s     	r#  zTuple[weakref.ref[object], str])inforT   c              	   C   s:   | \}}| }|d k	r6t t t||  W 5 Q R X d S rU   )r   	Exceptionr   )r$  refr   obr4   r4   r:   _weakref_handle8  s
    
r(     )r'  r   timeoutlooptimeout_ceil_thresholdrT   c                 C   sH   |d k	rD|dkrD|  | }||kr,t|}||tt| |fS d S Nr   )r  r   call_atr(  weakrefr&  )r'  r   r*  r+  r,  whenr4   r4   r:   weakref_handle@  s    r1  )cbr*  r+  r,  rT   c                 C   s4   |d ks|dkrd S |  }t|||}||| S r-  )r  calculate_timeout_whenr.  )r2  r*  r+  r,  r  r0  r4   r4   r:   
call_laterP  s
    r4  )	loop_timer*  timeout_ceiling_thresholdrT   c                 C   s   | | }||krt |S |S )z$Calculate when to execute a timeout.r   )r5  r*  r6  r0  r4   r4   r:   r3  ]  s    r3  c                   @   s   e Zd ZdZdZdejee eddddZ	e
d eedd	d
dZddddZeej dddZddddZddddZdS )TimeoutHandlezTimeout handle_timeout_loop_ceil_threshold
_callbacksr)  N)r+  r*  ceil_thresholdrT   c                 C   s   || _ || _|| _g | _d S rU   r8  )rW   r+  r*  r=  r4   r4   r:   r   n  s
    zTimeoutHandle.__init__).N)callbackargskwargsrT   c                 O   s   | j |||f d S rU   )r<  r   )rW   r>  r?  r@  r4   r4   r:   register{  s    zTimeoutHandle.registerrS   c                 C   s   | j   d S rU   )r<  clearrV   r4   r4   r:   close  s    zTimeoutHandle.closec                 C   sN   | j }|d k	rF|dkrF| j | }|| jkr6t|}| j|| jS d S d S r-  )r9  r:  r  r;  r   r.  __call__)rW   r*  r0  r4   r4   r:   start  s    
zTimeoutHandle.startBaseTimerContextc                 C   s8   | j d k	r.| j dkr.t| j}| |j |S t S d S r-  )r9  TimerContextr:  rA  r*  	TimerNoop)rW   timerr4   r4   r:   rI    s
    
zTimeoutHandle.timerc              
   C   s>   | j D ](\}}}tt ||| W 5 Q R X q| j   d S rU   )r<  r   r%  rB  )rW   r2  r?  r@  r4   r4   r:   rD    s    
zTimeoutHandle.__call__)r)  )rY   rZ   r[   r   	__slots__asyncioAbstractEventLoopr   floatr   r   r
   rA  rC  TimerHandlerE  rI  rD  r4   r4   r4   r:   r7  i  s$      
r7  c                   @   s   e Zd ZdZddddZdS )rF  r4   NrS   c                 C   s   dS )z0Raise TimeoutError if timeout has been exceeded.Nr4   rV   r4   r4   r:   assert_timeout  s    zBaseTimerContext.assert_timeout)rY   rZ   r[   rJ  rO  r4   r4   r4   r:   rF    s   rF  c                   @   sB   e Zd ZdZedddZeee  ee ee	 ddddZ
dS )	rH  r4   rS   c                 C   s   | S rU   r4   rV   r4   r4   r:   	__enter__  s    zTimerNoop.__enter__Nexc_typeexc_valexc_tbrT   c                 C   s   d S rU   r4   )rW   rR  rS  rT  r4   r4   r:   __exit__  s    zTimerNoop.__exit__)rY   rZ   r[   rJ  rF  rP  r   r   BaseExceptionr	   rU  r4   r4   r4   r:   rH    s   
rH  c                   @   sx   e Zd ZdZdZejddddZdddd	Ze	dd
dZ
eee  ee ee ee dddZddddZdS )rG  z&Low resolution timeout context managerr:  _tasks
_cancelled_cancellingN)r+  rT   c                 C   s   || _ g | _d| _d| _d S )NFr   rW  )rW   r+  r4   r4   r:   r     s    zTimerContext.__init__rS   c                 C   s   | j rtjddS )z7Raise TimeoutError if timer has already been cancelled.N)rY  rK  TimeoutErrorrV   r4   r4   r:   rO    s    zTimerContext.assert_timeoutc                 C   sP   t j| jd}|d krtdtjdkr2| | _| jr@t j	d | j
| | S )N)r+  z4Timeout context manager should be used inside a taskr'   )rK  Zcurrent_taskr:  r   sysversion_infoZ
cancellingrZ  rY  r[  rX  r   rW   taskr4   r4   r:   rP    s    

zTimerContext.__enter__rQ  c                 C   sX   d }| j r| j  }|tjkrT| jrT|d k	s0ttjdkrL| | j	krLd S tj
|d S )Nr'   )rX  poprK  ZCancelledErrorrY  AssertionErrorr\  r]  ZuncancelrZ  r[  )rW   rR  rS  rT  Z
enter_taskr4   r4   r:   rU    s    

zTimerContext.__exit__c                 C   s(   | j s$t| jD ]}|  qd| _ d S NT)rY  r   rX  cancelr^  r4   r4   r:   r*    s    
zTimerContext.timeout)rY   rZ   r[   r   rJ  rK  rL  r   rO  rF  rP  r   r   rV  r	   boolrU  r*  r4   r4   r4   r:   rG    s   
rG  )delayr=  rT   c                 C   sL   | d ks| dkrt d S t }| }||  }| |krBt|}t |S r-  )async_timeoutr*  rK  Zget_running_loopr  r   Z
timeout_at)re  r=  r+  r  r0  r4   r4   r:   ceil_timeout  s    
rg  c                   @   s   e Zd ZU edddgZee ed< dZe	e ed< dZ
e	eeef  ed< eZeedef ed< e	e ddddZeed	d
dZee	e d	ddZee	e d	ddZdS )HeadersMixin_content_type_content_dict_stored_content_type_headersN)rawrT   c                 C   sV   || _ |d krd| _i | _n6t d| }| | _|d}t|dd  | _d S )Nzapplication/octet-streamzContent-Type: r4   r$   )rk  ri  rj  r   parsestrget_content_type
get_paramsdict)rW   rm  msgr   r4   r4   r:   _parse_content_type  s    

z HeadersMixin._parse_content_typerS   c                 C   s6   | j tj}| j|kr"| | | jdk	s0t| jS )z7The value of content part for Content-Type HTTP header.N)rl  r   r%   CONTENT_TYPErk  rs  ri  ra  rW   rm  r4   r4   r:   content_type  s
    

zHeadersMixin.content_typec                 C   s<   | j tj}| j|kr"| | | jdk	s0t| jdS )z7The value of charset part for Content-Type HTTP header.Ncharset)rl  r   r%   rt  rk  rs  rj  ra  ru  r4   r4   r:   rw  $  s
    

zHeadersMixin.charsetc                 C   s"   | j tj}|dkrdS t|S )z(The value of Content-Length HTTP header.N)rl  r   r%   ZCONTENT_LENGTHr  )rW   content_lengthr4   r4   r:   rx  -  s    zHeadersMixin.content_length)rY   rZ   r[   	frozensetATTRSr!   r   r   ri  r   rj  r   r3   rk  r   r2   rs  propertyrv  rw  r  rx  r4   r4   r4   r:   rh    s   
rh  zasyncio.Future[_T])futresultrT   c                 C   s   |   s| | d S rU   )done
set_result)r|  r}  r4   r4   r:   r  4  s    r  c                   @   s    e Zd ZdeeddddZdS )ErrorableProtocol.N)exc	exc_causerT   c                 C   s   d S rU   r4   )rW   r  r  r4   r4   r:   set_exception=  s    zErrorableProtocol.set_exception).)rY   rZ   r[   rV  r  r4   r4   r4   r:   r  <  s    r  z&asyncio.Future[_T] | ErrorableProtocol)r|  r  r  rT   c                 C   sB   t | r|  rdS |tk}||k}|s4|s4||_| | dS )zSet future exception.

    If the future is marked as complete, this function is a no-op.

    :param exc_cause: An exception that is a direct cause of ``exc``.
                      Only set if provided.
    N)rK  Zisfuturer~  _EXC_SENTINEL	__cause__r  )r|  r  r  Zexc_is_sentinelZexc_causes_itselfr4   r4   r:   r  D  s    r  c                   @   sZ   e Zd ZU dZdZee ed< dee	ee
  dddZeedd	d
ZedddZdS )AppKeyz.Keys for static typing support in Application.)_name_t__orig_class__r  N)r   tc                 C   sD   t  }|r,|jjdkr$|jd }q,|j}q|d | | _|| _d S )Nz<module>rY   r   )inspectcurrentframef_codeco_name	f_globalsf_backr  r  )rW   r   r  framemoduler4   r4   r:   r   f  s    
zAppKey.__init__)otherrT   c                 C   s   t |tr| j|jk S dS rb  )rw   r  r  )rW   r  r4   r4   r:   __lt__r  s    
zAppKey.__lt__rS   c              	   C   s   | j }|d kr0tt t| jd }W 5 Q R X |d kr>d}n8t|trn|jdkrZ|j}qv|j d|j }nt	|}d| j
 d| dS )Nr   z<<Unknown>>builtinsr   z<AppKey(z, type=z)>)r  r   r   r   r  rw   r   rZ   r[   reprr  )rW   r  Zt_reprr4   r4   r:   __repr__w  s    


zAppKey.__repr__)N)rY   rZ   r[   r   rJ  r   objectr   r   r   r0   r   rd  r  r  r4   r4   r4   r:   r  [  s   
r  c                   @   s`  e Zd ZdZeeeeee	 f e	f  ddddZ
ddddZeee ed	d
dZeee	d	ddZeeee f e	d	ddZeee eeeef dddZedee dee dddZed ee	e	dddZd!eeee f e	e	dddZedddZeeeee	 f  dddZeed	ddZedddZedddZdS )"r+   )_mapsN)mapsrT   c                 C   s   t || _d S rU   )tupler  )rW   r  r4   r4   r:   r     s    zChainMapProxy.__init__rS   c                 C   s   t d| jd S )Nz4Inheritance class {} from ChainMapProxy is forbidden)rx   r   rY   )rd   r4   r4   r:   __init_subclass__  s
    zChainMapProxy.__init_subclass__)r   rT   c                 C   s   d S rU   r4   rW   r   r4   r4   r:   __getitem__  s    zChainMapProxy.__getitem__c                 C   s   d S rU   r4   r  r4   r4   r:   r    s    c              	   C   s<   | j D ](}z|| W   S  tk
r,   Y qX qt|d S rU   )r  r   )rW   r   mappingr4   r4   r:   r    s    
)r   r   rT   c                 C   s   d S rU   r4   rW   r   r   r4   r4   r:   r     s    zChainMapProxy.get.c                 C   s   d S rU   r4   r  r4   r4   r:   r     s    c                 C   s   d S rU   r4   r  r4   r4   r:   r     s    c                 C   s(   z
| | W S  t k
r"   | Y S X d S rU   )r   r  r4   r4   r:   r     s    
c                 C   s   t t j| j S rU   )lenr   unionr  rV   r4   r4   r:   __len__  s    zChainMapProxy.__len__c                 C   s&   i }t | jD ]}|| qt|S rU   )reversedr  updateiter)rW   dr  r4   r4   r:   __iter__  s    zChainMapProxy.__iter__c                    s   t  fdd| jD S )Nc                 3   s   | ]} |kV  qd S rU   r4   )r8   mr   r4   r:   r     s     z-ChainMapProxy.__contains__.<locals>.<genexpr>anyr  r  r4   r  r:   __contains__  s    zChainMapProxy.__contains__c                 C   s
   t | jS rU   r  rV   r4   r4   r:   __bool__  s    zChainMapProxy.__bool__c                 C   s   d tt| j}d| dS )Nz, zChainMapProxy(r@   )r   mapr  r  )rW   r   r4   r4   r:   r    s    zChainMapProxy.__repr__).).)N)rY   rZ   r[   rJ  r   r   r   r   r  r
   r   r  r   r0   r  r1   r   r   r  r  r   r  r  rd  r  r  r  r4   r4   r4   r:   r+     s(   (  r+   z[!\x23-\x7E\x80-\xff]+z(W/)?"(z)"z)(?:\s*,\s*|$)|(.)r   c                   @   s"   e Zd ZU eed< dZeed< dS )r,   r   Fis_weakN)rY   rZ   r[   r   r   r  rd  r4   r4   r4   r:   r,     s   
r,   )r   rT   c                 C   s&   | t kr"t| s"td| dd S )NzValue z, is not a valid etag. Maybe it contains '"'?)ETAG_ANY	_ETAGC_RE	fullmatchra   )r   r4   r4   r:   validate_etag_value  s    
r  )date_strrT   c              
   C   sT   | dk	rPt | }|dk	rPtt* tj|dd dtjjiW  5 Q R  S Q R X dS )z/Process a date string, return a datetime objectN   tzinfo)r   r   ra   datetimetimezoneutc)r  	timetupler4   r4   r:   parse_http_date  s    
.r  )methodcoderT   c                 C   s6   t |p4t| p4d|  ko"dk n  o4|  tjkS )z-Check if a request must return an empty body.   ,  )status_code_must_be_empty_bodymethod_must_be_empty_bodyr   r%   METH_CONNECTr  r  r4   r4   r:   must_be_empty_body  s
    $r  )r  rT   c                 C   s   |   tjkS )z,Check if a method must return an empty body.)r   r%   Z	METH_HEAD)r  r4   r4   r:   r    s    r  )r  rT   c                 C   s    | dkpd|   kodk S   S )z1Check if a status code must return an empty body.   0     d   r  r4   )r  r4   r4   r:   r    s    r  c                 C   sF   |dkpDd|  kodk n  pDd|  ko2dk n  oD|   tjkS )zrCheck if a Content-Length header should be removed.

    This should always be a subset of must_be_empty_body
    r  r  r  r  )r   r%   r  r  r4   r4   r:   should_remove_content_length  s
    $r  )N)Tr   )r)  )r)  )r)  )r   rK  rn   rr   r   r  enum	functoolsr  r   r   platformrer\  r  r/  collectionsr   r   email.parserr   email.utilsr   mathr   pathlibr   typesr	   typingr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   urllib.parser   urllib.requestr   r   attrZ	multidictr   r    r!   Zyarlr#   r\   r%   logr&   r]  rf  __all__systemZIS_MACOSr   ZPY_310ZPY_311r0   r1   Enumr2   r3   rd  r   r   ZNO_EXTENSIONSflagsdev_modeignore_environmentDEBUGrangeZCHARr6   ZCTLZ
SEPARATORSr   rR   r*   r   r   sr   r   r   r   r   r   	lru_cacher   r   compiler   r   r   r   r   r   Zreify_pyZ_helpersZreify_cImportErrorr   r   r   r   r   r   r   r  r   r  r#  r(  r  rM  rL  rN  r1  r4  r3  r7  rF  rH  rG  Timeoutrg  rh  r  rV  r  r  r  total_orderingr  r+   Z_ETAGCr  Z_QUOTED_ETAGZQUOTED_ETAG_REZLIST_QUOTED_ETAG_REr  r,   r  r  r  r  r  r  r4   r4   r4   r:   <module>   s\  P



?	+
'
      5  	(  
4D  ..$@


	