a
    e	gq                     @   sX  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@ ddlAmBZB ejCdkrddlZDnddlDZDdZEeF dkZGeF dkZHejCdkZIejCdkZJe,dZKe,dZLeMddZNeNjOZOePe
jQRdZSeTddgeUdd R ZVe@jWZXejYjZpLejYj[ oLePe
jQRd!Z\d"d# eUdd$D Z]d%d# eUdd&D e^d'hB Z_d(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9e^d:hZ`e]e_A e`A ZaG d;d< d<ZbG d=d> d>ed>g d?Zce>e*e>e(ec f d@dAdBZde(e	j	 dCdDdEZee5jfdFdFdFdGG dHdI dIZge(e	j	 ehecdJdKdLZie!ehegf dCdMdNZje>e*e>e(ec f d@dOdPZke5jfdFdFdFdGG dQdR dRZlejmdSdTeheldUdVdWZndee(eh e(eh dXdYdZZoepd[Zqd\d# eUd&d'D d]hB Zrehehd^d_d`ZsdehePehehehdbdcddZte(eh ePdedfdgZudave(ew exdh< diayehdCdjdkZzdlddmdndoZ{de|ehe}ej~e}e(ej dqdrdsZdeg ef e}ej~e}e(ej dtdudvZe}e}e}e}dwdxdyZG dzd{ d{ZG d|d} d}e d} ZG d~d deZG dd deZde(e} e}eDjdddZG dd dZdeKddddZe ZG dd de)ZefdeeddddZejG dd de#eK ZG dd de'e-ehee f ef ZdZepeZde dZepeZepd(e dZdZe5jfdFdFdFdGG dd dZehddddZe(eh e(ej dddZejmehewePdddZehewePd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)under_cached_propertyURL   )hdrs)client_logger      )	BasicAuthChainMapProxyETagreifyDarwinWindows)r)   
   _T_S	_SENTINELsentinelZAIOHTTP_NO_EXTENSIONS   i0  d      ZPYTHONASYNCIODEBUGc                 C   s   h | ]}t |qS  chr.0ir9   r9   R/var/www/html/llm_bihealth/app/venv/lib/python3.9/site-packages/aiohttp/helpers.py	<setcomp>Y       r@      c                 C   s   h | ]}t |qS r9   r:   r<   r9   r9   r?   r@   Z   rA          ()<>@,;:\"/[]?={} 	   c                   @   s   e Zd Zed dddZdS )noop)NNNreturnc                 c   s
   d V  d S Nr9   selfr9   r9   r?   	__await__v   s    znoop.__await__N)__name__
__module____qualname__r   r^   r9   r9   r9   r?   rX   u   s   rX   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encodingrZ   c                    sB   |d u rt d|d u r t dd|v r0t dt | |||S )Nz"None is not allowed as login valuez%None is not allowed as password valuerL   z5A ":" is not allowed in login (RFC 1945#section-11.1))
ValueErrorsuper__new__)clsrd   re   rf   	__class__r9   r?   ri   }   s    zBasicAuth.__new__)auth_headerrf   rZ   c                 C   s   z| dd\}}W n ty.   tdY n0 | dkrHtd| ztj|ddd|}W n tjy   td	Y n0 z| d
d\}}W n ty   tdY n0 | |||dS )z<Create a BasicAuth object from an Authorization HTTP header.rV   r%   z%Could not parse authorization header.basiczUnknown authorization method %sasciiT)validatezInvalid base64 encoding.rL   zInvalid credentials.rf   )	splitrg   lowerbase64	b64decodeencodedecodebinasciiError)rj   rm   rf   Z	auth_typeZencoded_credentialsdecodedusernamere   r9   r9   r?   rw      s&    
zBasicAuth.decoderq   )urlrf   rZ   c                C   sD   t |tstd|jdu r*|jdu r*dS | |jp4d|jp<d|dS )zCreate BasicAuth from url.zurl should be yarl.URL instanceNrb   rq   )
isinstancer$   	TypeErrorraw_userraw_passworduserre   )rj   r|   rf   r9   r9   r?   from_url   s
    
zBasicAuth.from_urlrY   c                 C   s0   | j  d| j | j}dt|| j S )zEncode credentials.rL   zBasic %s)rd   re   rv   rf   rt   	b64encoderw   )r]   credsr9   r9   r?   rv      s    zBasicAuth.encode)rb   rc   )rc   )r_   r`   ra   __doc__strri   classmethodrw   r$   r   r   rv   __classcell__r9   r9   rk   r?   r+   z   s    
r+   )rd   re   rf   )r|   rZ   c                 C   s<   | j du r| jdu 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.Nrb   )r   r   Z	with_userr+   r   re   )r|   r9   r9   r?   strip_auth_from_url   s    r   rY   c                  C   s(  t jd} | durt| }nPzt }W n2 ty\ } ztd| W Y d}~dS d}~0 0 |trhdnd }zt		t
|W S  t	jy } ztd| W Y d}~n|d}~0  ty" } zZd}tt | }W d   n1 s0    Y  | s|rtd| W Y d}~n
d}~0 0 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_existsr9   r9   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)r_   r`   ra   r$   __annotations__r   r+   r9   r9   r9   r?   r      s   
r   )	netrc_objhostrZ   c                 C   sf   | du rt d| |}|du r2t d|d|\}}}|sH|du rL|n|}|du 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.rb   )LookupErrorauthenticatorsr+   )r   r   Zauth_from_netrcrd   accountre   r{   r9   r9   r?   basicauth_from_netrc   s    

r   c               	   C   s   dd t   D } t }dd |  D }i }| D ]|\}}|\}}|jdv rhtd|j | q8|r|d u r|jd urzt||j}W n t	y   d }Y n0 t
||||< q8|S )Nc                 S   s"   i | ]\}}|d v r|t |qS ))httphttpswswssr#   r=   kvr9   r9   r?   
<dictcomp>  s   z$proxies_from_env.<locals>.<dictcomp>c                 S   s   i | ]\}}|t |qS r9   )r   r   r9   r9   r?   r     rA   )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   authr9   r9   r?   proxies_from_env  s*    


r   c                 C   sn   | j dur&t| j r&td| j dt }z|| j }W n" ty\   td| dY n0 |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   )r|   Zproxies_in_envZ
proxy_infor9   r9   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)r_   r`   ra   r   r   r9   r9   r9   r?   r   8  s   
r   8   )maxsize)mimetyperZ   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'})

    rb   )r   r   r   r   rK   r%   NrS   z "r   *z*/*rO   +)r   r    r   rr   	partitionaddrs   strip)r   partsparamsitemkey_valueZfulltypemtypestyper   r9   r9   r?   parse_mimetype@  s&    
r   )objdefaultrZ   c                 C   s@   t | dd }|r<t|tr<|d dkr<|d dkr<t|jS |S )Nnamer   rG   rH   )getattrr}   r   r   r   )r   r   r   r9   r9   r?   guess_filenameh  s    &
r   z[^\041\043-\133\135-\176]c                 C   s   h | ]}t |qS r9   r:   r<   r9   r9   r?   r@   p  rA   	)contentrZ   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 )NrM   r   )group)xr9   r9   r?   <lambda>}  rA   zquoted_string.<locals>.<lambda>)QCONTENTsetrg   not_qtext_resub)r   r9   r9   r?   quoted_strings  s    r   utf-8)disptypequote_fields_charsetr   rZ   c           
      K   s@  | rt t| kstd| | }|r<g }| D ]\}}|rLt t|ks`td|d||r| dkrt|d|d}||d| f n^zt|}W n> ty   d|dt|d|df}||d	 |f Y n0 ||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 z"bad content disposition parameter rS   filenamerb   rq   z"%s"z''r   rM   z\\rN   z\"z; c                 s   s   | ]}d  |V  qdS )rS   N)join)r=   pairr9   r9   r?   	<genexpr>  rA   z-content_disposition_header.<locals>.<genexpr>)
TOKENr   rg   r   rs   r   appendr   r   replace)
r   r   r   r   r   Zlparamsr   r   ZqvalZsparamsr9   r9   r?   content_disposition_header  s2    r   )r   rZ   c                 C   s    | sdS d| v p|  dd 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.
    FrL   .rb   )r   isdigit)r   r9   r9   r?   is_ip_address  s    r   _cached_current_datetimerb   c                  C   s\   t t } | tkrXd}d}t| ^}}}}}}}	}
d||	 ||| ||||f a| atS )N)MonTueWedThuFriSatSun)rb   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tailr9   r9   r?   rfc822_formatted_time  s     	r  zTuple[weakref.ref[object], str])inforZ   c                 C   sN   | \}}| }|d urJt t t||  W d    n1 s@0    Y  d S r[   )r   	Exceptionr   )r  refr   obr9   r9   r?   _weakref_handle  s
    
r     )r  r   timeoutlooptimeout_ceil_thresholdrZ   c                 C   sH   |d urD|dkrD|  | }||kr,t|}||tt| |fS d S Nr   )r  r   call_atr  weakrefr  )r  r   r  r  r  whenr9   r9   r?   weakref_handle  s    r"  )cbr  r  r  rZ   c                 C   s4   |d u s|dkrd S |  }t|||}||| S r  )r  calculate_timeout_whenr  )r#  r  r  r  r	  r!  r9   r9   r?   
call_later  s
    r%  )	loop_timer  timeout_ceiling_thresholdrZ   c                 C   s   | | }||krt |S |S )z$Calculate when to execute a timeout.r   )r&  r  r'  r!  r9   r9   r?   r$    s    r$  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_thresholdrZ   c                 C   s   || _ || _|| _g | _d S r[   r)  )r]   r  r  r.  r9   r9   r?   __init__"  s
    zTimeoutHandle.__init__).N)callbackargskwargsrZ   c                 O   s   | j |||f d S r[   )r-  r   )r]   r0  r1  r2  r9   r9   r?   register/  s    zTimeoutHandle.registerrY   c                 C   s   | j   d S r[   )r-  clearr\   r9   r9   r?   close4  s    zTimeoutHandle.closec                 C   sN   | j }|d urF|dkrF| j | }|| jkr6t|}| j|| jS d S d S r  )r*  r+  r  r,  r   r  __call__)r]   r  r!  r9   r9   r?   start7  s    
zTimeoutHandle.startBaseTimerContextc                 C   s8   | j d ur.| j dkr.t| j}| |j |S t S d S r  )r*  TimerContextr+  r3  r  	TimerNoop)r]   timerr9   r9   r?   r;  A  s
    
zTimeoutHandle.timerc              	   C   sV   | j D ]@\}}}tt ||i | W d    q1 s<0    Y  q| j   d S r[   )r-  r   r  r4  )r]   r#  r1  r2  r9   r9   r?   r6  I  s    
.zTimeoutHandle.__call__)r  )r_   r`   ra   r   	__slots__asyncioAbstractEventLoopr   floatr/  r   r
   r3  r5  TimerHandler7  r;  r6  r9   r9   r9   r?   r(    s     

r(  c                   @   s   e Zd ZdZddddZdS )r8  r9   NrY   c                 C   s   dS )z0Raise TimeoutError if timeout has been exceeded.Nr9   r\   r9   r9   r?   assert_timeoutU  s    zBaseTimerContext.assert_timeout)r_   r`   ra   r<  rA  r9   r9   r9   r?   r8  Q  s   r8  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 )	r:  r9   rY   c                 C   s   | S r[   r9   r\   r9   r9   r?   	__enter__]  s    zTimerNoop.__enter__Nexc_typeexc_valexc_tbrZ   c                 C   s   d S r[   r9   )r]   rD  rE  rF  r9   r9   r?   __exit__`  s    zTimerNoop.__exit__)r_   r`   ra   r<  r8  rB  r   r   BaseExceptionr	   rG  r9   r9   r9   r?   r:  Y  s   
r:  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 )r9  z&Low resolution timeout context managerr+  _tasks
_cancelled_cancellingN)r  rZ   c                 C   s   || _ g | _d| _d| _d S )NFr   rI  )r]   r  r9   r9   r?   r/  n  s    zTimerContext.__init__rY   c                 C   s   | j rtjddS )z7Raise TimeoutError if timer has already been cancelled.N)rK  r=  TimeoutErrorr\   r9   r9   r?   rA  t  s    zTimerContext.assert_timeoutc                 C   sP   t j| jd}|d u 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(   )r=  Zcurrent_taskr+  r   sysversion_infoZ
cancellingrL  rK  rM  rJ  r   r]   Ztaskr9   r9   r?   rB  y  s    

zTimerContext.__enter__rC  c                 C   sX   d }| j r| j  }|tju rT| jrT|d us0J tjdkrL| | jkrLd S tj	|d S )Nr(   )
rJ  popr=  ZCancelledErrorrK  rN  rO  ZuncancelrL  rM  )r]   rD  rE  rF  Z
enter_taskr9   r9   r?   rG    s    

zTimerContext.__exit__c                 C   s(   | j s$t| jD ]}|  qd| _ d S NT)rK  r   rJ  cancelrP  r9   r9   r?   r    s    
zTimerContext.timeout)r_   r`   ra   r   r<  r=  r>  r/  rA  r8  rB  r   r   rH  r	   boolrG  r  r9   r9   r9   r?   r9  i  s   
r9  )delayr.  rZ   c                 C   sL   | d u s| dkrt d S t }| }||  }| |krBt|}t |S r  )async_timeoutr  r=  Zget_running_loopr  r   Z
timeout_at)rU  r.  r  r	  r!  r9   r9   r?   ceil_timeout  s    
rW  c                   @   s   e Zd ZU dZeg d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 )HeadersMixinzMixin for handling headers.)_content_type_content_dict_stored_content_type_headersNrY  rZ  r[  )rawrZ   c                 C   sV   || _ |d u rd| _i | _n6t d| }| | _|d}t|dd  | _d S )Nzapplication/octet-streamzContent-Type: r9   r%   )r[  rY  rZ  r   parsestrget_content_type
get_paramsdict)r]   r]  msgr   r9   r9   r?   _parse_content_type  s    

z HeadersMixin._parse_content_typerY   c                 C   s6   | j tj}| j|kr"| | | jdus0J | jS )z7The value of content part for Content-Type HTTP header.N)r\  r   r&   CONTENT_TYPEr[  rc  rY  r]   r]  r9   r9   r?   content_type  s
    

zHeadersMixin.content_typec                 C   s<   | j tj}| j|kr"| | | jdus0J | jdS )z7The value of charset part for Content-Type HTTP header.Ncharset)r\  r   r&   rd  r[  rc  rZ  re  r9   r9   r?   rg    s
    

zHeadersMixin.charsetc                 C   s"   | j tj}|du rdS t|S )z(The value of Content-Length HTTP header.N)r\  r   r&   CONTENT_LENGTHr  )r]   content_lengthr9   r9   r?   ri    s    zHeadersMixin.content_length)r_   r`   ra   r   	frozensetATTRSr!   r   r   rY  r   rZ  r   r5   r[  r   r4   rc  propertyrf  rg  r  ri  r9   r9   r9   r?   rX    s   
rX  zasyncio.Future[_T])futresultrZ   c                 C   s   |   s| | d S r[   )done
set_result)rm  rn  r9   r9   r?   rp    s    rp  c                   @   s    e Zd ZdeeddddZdS )ErrorableProtocol.N)exc	exc_causerZ   c                 C   s   d S r[   r9   )r]   rr  rs  r9   r9   r?   set_exception  s    zErrorableProtocol.set_exception).)r_   r`   ra   rH  rt  r9   r9   r9   r?   rq    s    rq  z&asyncio.Future[_T] | ErrorableProtocol)rm  rr  rs  rZ   c                 C   sB   t | r|  rdS |tu }||u }|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)r=  Zisfuturero  _EXC_SENTINEL	__cause__rt  )rm  rr  rs  Zexc_is_sentinelZexc_causes_itselfr9   r9   r?   rt    s    rt  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__rz  N)r   tc                 C   sD   t  }|r,|jjdkr$|jd }q,|j}q|d | | _|| _d S )Nz<module>r_   r   )inspectcurrentframef_codeco_name	f_globalsf_backrx  ry  )r]   r   r{  framemoduler9   r9   r?   r/    s    
zAppKey.__init__)otherrZ   c                 C   s   t |tr| j|jk S dS rR  )r}   rw  rx  )r]   r  r9   r9   r?   __lt__%  s    
zAppKey.__lt__rY   c                 C   s   | j }|d u rDtt t| jd }W d    n1 s:0    Y  |d u rRd}n8t|tr|jdkrn|j}q|j d|j }nt	|}d| j
 d| dS )Nr   z<<Unknown>>builtinsr   z<AppKey(z, type=z)>)ry  r   AttributeErrorr   rz  r}   r   r`   ra   reprrx  )r]   r{  Zt_reprr9   r9   r?   __repr__*  s    
,

zAppKey.__repr__)N)r_   r`   ra   r   r<  r   objectr   r   r   r2   r/  rT  r  r  r9   r9   r9   r?   rw    s   
rw  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)mapsrZ   c                 C   s   t || _d S r[   )tupler  )r]   r  r9   r9   r?   r/  @  s    zChainMapProxy.__init__rY   c                 C   s   t d| jd S )Nz4Inheritance class {} from ChainMapProxy is forbidden)r~   formatr_   )rj   r9   r9   r?   __init_subclass__C  s
    zChainMapProxy.__init_subclass__)r   rZ   c                 C   s   d S r[   r9   r]   r   r9   r9   r?   __getitem__I  s    zChainMapProxy.__getitem__c                 C   s   d S r[   r9   r  r9   r9   r?   r  L  s    c              	   C   s:   | j D ]&}z|| W   S  ty*   Y q0 qt|d S r[   )r  r   )r]   r   mappingr9   r9   r?   r  O  s    
)r   r   rZ   c                 C   s   d S r[   r9   r]   r   r   r9   r9   r?   r   W  s    zChainMapProxy.get.c                 C   s   d S r[   r9   r  r9   r9   r?   r   Z  s    c                 C   s   d S r[   r9   r  r9   r9   r?   r   ]  s    c                 C   s&   z
| | W S  t y    | Y S 0 d S r[   )r   r  r9   r9   r?   r   `  s    
c                 C   s   t t j| j S r[   )lenr   unionr  r\   r9   r9   r?   __len__f  s    zChainMapProxy.__len__c                 C   s&   i }t | jD ]}|| qt|S r[   )reversedr  updateiter)r]   dr  r9   r9   r?   __iter__j  s    zChainMapProxy.__iter__c                    s   t  fdd| jD S )Nc                 3   s   | ]} |v V  qd S r[   r9   )r=   mr   r9   r?   r   r  rA   z-ChainMapProxy.__contains__.<locals>.<genexpr>anyr  r  r9   r  r?   __contains__q  s    zChainMapProxy.__contains__c                 C   s
   t | jS r[   r  r\   r9   r9   r?   __bool__t  s    zChainMapProxy.__bool__c                 C   s   d tt| j}d| dS )Nz, zChainMapProxy(rF   )r   mapr  r  )r]   r   r9   r9   r?   r  w  s    zChainMapProxy.__repr__).).)N)r_   r`   ra   r<  r   r   r   r   rw  r
   r/  r  r   r2   r  r3   r   r   r  r  r   r  r  rT  r  r  r  r9   r9   r9   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)r_   r`   ra   r   r   r  rT  r9   r9   r9   r?   r-     s   
r-   )r   rZ   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	fullmatchrg   )r   r9   r9   r?   validate_etag_value  s    
r  )date_strrZ   c                 C   s`   | dur\t | }|dur\tt, tj|dd dtjjiW  d   S 1 sR0    Y  dS )z/Process a date string, return a datetime objectN   tzinfo)r   r   rg   datetimetimezoneutc)r  	timetupler9   r9   r?   parse_http_date  s    
:r  )methodcoderZ   c                 C   s2   |t v p0| tv p0d|  ko"dk n  o0| tjv S )z-Check if a request must return an empty body.r8   ,  )EMPTY_BODY_STATUS_CODESEMPTY_BODY_METHODSr&   METH_CONNECT_ALLr  r  r9   r9   r?   must_be_empty_body  s
     r  c                 C   s*   |t v p(d|  kodk n  o(| tjv S )zrCheck if a Content-Length header should be removed.

    This should always be a subset of must_be_empty_body
    r8   r  )r  r&   r  r  r9   r9   r?   should_remove_content_length  s     r  )N)Tr   )r  )r  )r  )r   r=  rt   rx   r   r  enum	functoolsr|  r   r   platformrerN  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propcache.apir"   r.   Zyarlr$   rb   r&   logr'   rO  rV  __all__systemZIS_MACOSr   ZPY_310ZPY_311r2   r3   Enumr4   r5   rT  r   r   ZNO_EXTENSIONSrj  ranger  ZMETH_HEAD_ALLr  flagsdev_modeignore_environmentDEBUGZCHARr;   ZCTLZ
SEPARATORSr   rX   r+   r   r   sr   r   r   r   r   r   	lru_cacher   r   compiler   r   r   r   r   r   r  r   r  r  r  r  r?  r>  r@  r"  r%  r$  r(  r8  r:  r9  TimeoutrW  rX  rp  rH  ru  rq  rt  total_orderingrw  r,   Z_ETAGCr  Z_QUOTED_ETAGZQUOTED_ETAG_REZLIST_QUOTED_ETAG_REr  r-   r  r  r  r  r9   r9   r9   r?   <module>   s>  P



?	+
'
 3(  
4B /.$@


	