o
    iw                     @   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 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/m0Z0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9 ddl:Z:ddl;m<Z<m=Z=m>Z> ddl?m@ZA ddlBmCZC ddlDmEZE ddlFmGZG ejHdkrddlZInddlIZIdZJeK dkZLeK dkZMejHdkZNejHdkZOe1dZPe1dZQeRddZSeSjTZTeUe
jVWdZXeYdd geZd!d"R Z[eEj\Z]ej^j_p3ej^j` o3eUe
jVWd#Zad$d% eZdd&D Zbd'd% eZdd(D ecd)hB Zdd*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;ecd<hZeebedA eeA ZfG d=d> d>ZgG d?d@ d@ed@g dAZhdBeCdCe/eCe-eh f fdDdEZidCe-e	j	 fdFdGZje:jkdHdHdHdIG dJdK dKZldLe-e	j	 dMemdCehfdNdOZndCe&emelf fdPdQZodBeCdCe/eCe-eh f fdRdSZpe:jkdHdHdHdIG dTdU dUZqejrdVdWdXemdCeqfdYdZZsG d[d\ d\eZtejrdVdWd]emdCe/eme ememf f fd^d_Zudd`e#dae-em dCe-em fdbdcZvewddZxded% eZd(d)D dfhB ZydgemdCemfdhdiZz	jddkemdleUdmemdnemdCemf
dodpZ{dMe-em dCeUfdqdrZ|da}e-e~ eds< dtadCemfdudvZddydzZ	{dd|ed}emd~edejdedCe-ej fddZ	{dde$g e#f d~edejdedCe-ej f
ddZded~ededCefddZG dd dZG dd de%d ZG dd deZG dd deZ	{dde-e dedCeIjfddZG dd dZdddePdCdfddZe ZG dd de.ZefdddededCdfddZejG dd de(eP ZG dd de,e2emee# f e#f ZdZeweZde dZeweZewd*e dZdZe:jkdHdHdHdIG dd dZdemdCdfddZde-em dCe-ej fddZejrdemde~dCeUfddZdemde~dCeUfddZdS )zVarious helper functions    N)
namedtuple)suppress)EmailMessage)HeaderParser)HTTP)	parsedateceil)Path)MappingProxyType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      h | ]}t |qS  chr.0ir=   r=   I/home/kim/smarthome/.venv/lib/python3.10/site-packages/aiohttp/helpers.py	<setcomp>[       rD      c                 C   r<   r=   r>   r@   r=   r=   rC   rD   \   rE          ()<>@,;:\"/[]?={} 	   c                   @   s   e Zd Zded fddZdS )noopreturn)NNNc                 c   s    d V  d S Nr=   selfr=   r=   rC   	__await__x   s   
znoop.__await__N)__name__
__module____qualname__r   ra   r=   r=   r=   rC   r\   w   s    r\   c                	       s   e Zd ZdZ	ddedededd f fdd	Zedd
ededd fddZedddedede	d  fddZ
defddZ  ZS )r.   z!Http basic authentication helper. latin1loginpasswordencodingr]   c                    sB   |d u rt d|d u rt dd|v rt dt | |||S )Nz"None is not allowed as login valuez%None is not allowed as password valuerP   z5A ":" is not allowed in login (RFC 1945#section-11.1))
ValueErrorsuper__new__)clsrg   rh   ri   	__class__r=   rC   rl      s   zBasicAuth.__new__auth_headerc                 C   s   z
| dd\}}W n ty   tdw | dkr"td| ztj|ddd|}W n tjy=   td	w z
| d
d\}}W n tyS   tdw | |||dS )z<Create a BasicAuth object from an Authorization HTTP header.rZ   r(   z%Could not parse authorization header.basiczUnknown authorization method %sasciiT)validatezInvalid base64 encoding.rP   zInvalid credentials.ri   )	splitrj   lowerbase64	b64decodeencodedecodebinasciiError)rm   rp   ri   Z	auth_typeZencoded_credentialsdecodedusernamerh   r=   r=   rC   rz      s,   
zBasicAuth.decodert   urlc                C   sD   t |ts	td|jdu r|jdu rdS | |jpd|jpd|dS )zCreate BasicAuth from url.zurl should be yarl.URL instanceNre   rt   )
isinstancer'   	TypeErrorraw_userraw_passworduserrh   )rm   r   ri   r=   r=   rC   from_url   s
   
zBasicAuth.from_urlc                 C   s0   | j  d| j | j}dt|| j S )zEncode credentials.rP   zBasic %s)rg   rh   ry   ri   rw   	b64encoderz   )r`   credsr=   r=   rC   ry      s   zBasicAuth.encode)re   rf   )rf   )rb   rc   rd   __doc__strrl   classmethodrz   r'   r   r   ry   __classcell__r=   r=   rn   rC   r.   |   s"    "
r.   )rg   rh   ri   r   r]   c                 C   s<   | j du r| jdu r| dfS | dt| jpd| jpdfS )zIRemove user and password from URL if present and return BasicAuth object.Nre   )r   r   Z	with_userr.   r   rh   )r   r=   r=   rC   strip_auth_from_url   s    r   c                  C   s0  t jd} | durt| }n(zt }W n ty. } ztd| W Y d}~dS d}~ww |tr4dnd }zt		t
|W S  t	jyY } ztd| W Y d}~dS d}~w ty } z3d}tt | }W d   n1 svw   Y  | s|rtd| W Y d}~dS W Y d}~dS d}~ww )	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_existsr=   r=   rC   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)rb   rc   rd   r'   __annotations__r   r.   r=   r=   r=   rC   r         
 r   	netrc_objhostc                 C   sf   | du rt d| |}|du rt d|d|\}}}|s$|du r&|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.re   )LookupErrorauthenticatorsr.   )r   r   Zauth_from_netrcrg   accountrh   r~   r=   r=   rC   basicauth_from_netrc   s   


r   c               	   C   s   dd t   D } t }dd |  D }i }| D ]>\}}|\}}|jdv r4td|j | q|rS|d u rS|jd urSzt||j}W n t	yR   d }Y nw t
||||< q|S )Nc                 S   s"   i | ]\}}|d v r|t |qS ))httphttpswswssr&   rA   kvr=   r=   rC   
<dictcomp>  s
    z$proxies_from_env.<locals>.<dictcomp>c                 S   s   i | ]	\}}|t |qS r=   )r   r   r=   r=   rC   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   authr=   r=   rC   proxies_from_env  s,   

r   c                 C   sf   | j durt| j rtd| j dt }z|| j }W n ty,   td| dw |j|jf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_infor=   r=   rC   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)rb   rc   rd   r   r   r=   r=   r=   rC   r   :  s
   
 r   8   )maxsizemimetypec                 C   s   | st dddtt dS | d}t }|dd D ]}|s q|d\}}}||  |d q|d   }|d	krDd
}|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'})

    re   )r   r   r   r   rO   r(   NrW   z "r   *z*/*rS   +)r   r#   r"   ru   	partitionaddrv   strip)r   partsparamsitemkey_valueZfulltypemtypestyper   r=   r=   rC   parse_mimetypeB  s&   
r   c                       s,   e Zd Zd fddZdefddZ  ZS )EnsureOctetStreamr]   Nc                    s   t    | d d S Nzapplication/octet-stream)rk   __init__set_default_typer_   rn   r=   rC   r   k  s   
zEnsureOctetStream.__init__c                 C   sB   |  dd }|d\}}}| }|ddkr|  S |S )a  Re-implementation from Message

        Returns application/octet-stream in place of plain/text when
        value is wrong.

        The way this class is used guarantees that content-type will
        be present so simplify the checks wrt to the base implementation.
        zcontent-typere   rO   rS   r(   )r   rv   r   r   countget_default_type)r`   r   ctyper   r=   r=   rC   get_content_typep  s   	z"EnsureOctetStream.get_content_typer]   N)rb   rc   rd   r   r   r   r   r=   r=   rn   rC   r   j  s    r   rawc                 C   sF   t ttdd|  }| }|d}t|dd }|t|fS )zParse Content-Type header.

    Returns a tuple of the parsed content type and a
    MappingProxyType of parameters. The default returned value
    is `application/octet-stream`
    )policyzContent-Type: r=   r(   N)r   r   r   parsestrr   
get_paramsdictr   )r   msgcontent_typer   Zcontent_dictr=   r=   rC   parse_content_type  s
   
r   objdefaultc                 C   s@   t | dd }|rt|tr|d dkr|d dkrt|jS |S )Nnamer   rK   rL   )getattrr   r   r
   r   )r   r   r   r=   r=   rC   guess_filename  s   &
r   z[^\041\043-\133\135-\176]c                 C   r<   r=   r>   r@   r=   r=   rC   rD     rE   	contentc                 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 )NrQ   r   )group)xr=   r=   rC   <lambda>  s    zquoted_string.<locals>.<lambda>)QCONTENTsetrj   not_qtext_resub)r   r=   r=   rC   quoted_string  s   r   utf-8disptypequote_fields_charsetr   c           
      K   s>  | rt t| kstd| | }|rg }| D ]r\}}|r%t t|ks/td|d||rx| dkrHt|d|d}||d| f qzt|}W n tym   d|dt|d|df}||d	 |f Y qw ||d| f q|	d
d	dd}||d| f qd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 rW   filenamere   rt   z"%s"z''r   rQ   z\\rR   z\"z; c                 s   s    | ]}d  |V  qdS )rW   N)join)rA   pairr=   r=   rC   	<genexpr>  s    z-content_disposition_header.<locals>.<genexpr>)
TOKENr   rj   r   rv   r   appendr   r   replace)
r   r   r   r   r   Zlparamsr   r   ZqvalZsparamsr=   r=   rC   content_disposition_header  s4   r  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.
    FrP   .re   )r  isdigit)r   r=   r=   rC   is_ip_address  s   r  _cached_current_datetimere   c                  C   s\   t t } | tkr,d}d}t| ^}}}}}}}	}
d||	 ||| ||||f a| atS )N)MonTueWedThuFriSatSun)re   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tailr=   r=   rC   rfc822_formatted_time  s    	r)  infoTuple[weakref.ref[object], str]c                 C   sT   | \}}| }|d ur(t t t||  W d    d S 1 s!w   Y  d S d S r^   )r   	Exceptionr   )r*  refr   obr=   r=   rC   _weakref_handle  s   
"r/     r.  r   timeoutlooptimeout_ceil_thresholdc                 C   sH   |d ur"|dkr"|  | }||krt|}||tt| |fS d S Nr   )r  r	   call_atr/  weakrefr-  )r.  r   r1  r2  r3  whenr=   r=   rC   weakref_handle  s   r8  cbc                 C   s4   |d u s|dkr
d S |  }t|||}||| S r4  )r  calculate_timeout_whenr5  )r9  r1  r2  r3  r  r7  r=   r=   rC   
call_later.  s
   r;  	loop_timetimeout_ceiling_thresholdc                 C   s   | | }||krt |S |S )z$Calculate when to execute a timeout.r   )r<  r1  r=  r7  r=   r=   rC   r:  ;  s   r:  c                	   @   s   e Zd ZdZdZ	ddejdee deddfd	d
Z	de
d dededdfddZdddZdeej fddZdddZdddZdS )TimeoutHandlezTimeout handle_timeout_loop_ceil_threshold
_callbacksr0  r2  r1  ceil_thresholdr]   Nc                 C   s   || _ || _|| _g | _d S r^   r?  )r`   r2  r1  rD  r=   r=   rC   r   L  s
   zTimeoutHandle.__init__callback).Nargskwargsc                 O   s   | j |||f d S r^   )rC  r   )r`   rE  rF  rG  r=   r=   rC   registerY  s   zTimeoutHandle.registerc                 C   s   | j   d S r^   )rC  clearr_   r=   r=   rC   close^     zTimeoutHandle.closec                 C   sJ   | j }|d ur#|dkr#| j | }|| jkrt|}| j|| jS d S r4  )r@  rA  r  rB  r	   r5  __call__)r`   r1  r7  r=   r=   rC   starta  s   
zTimeoutHandle.startBaseTimerContextc                 C   s4   | j d ur| j dkrt| j}| |j |S t S r4  )r@  TimerContextrA  rH  r1  	TimerNoop)r`   timerr=   r=   rC   rQ  k  s
   
zTimeoutHandle.timerc              	   C   sV   | j D ] \}}}tt ||i | W d    n1 sw   Y  q| j   d S r^   )rC  r   r,  rI  )r`   r9  rF  rG  r=   r=   rC   rL  s  s   
zTimeoutHandle.__call__r0  r   )r]   rN  )rb   rc   rd   r   	__slots__asyncioAbstractEventLoopr   floatr   r   r   rH  rJ  TimerHandlerM  rQ  rL  r=   r=   r=   rC   r>  G  s4    




r>  c                   @   s   e Zd ZdZdddZdS )rN  r=   r]   Nc                 C   s   dS )z0Raise TimeoutError if timeout has been exceeded.Nr=   r_   r=   r=   rC   assert_timeout  s    zBaseTimerContext.assert_timeoutr   )rb   rc   rd   rS  rX  r=   r=   r=   rC   rN  {  s    rN  c                   @   sH   e Zd ZdZdefddZdeee  dee dee	 ddfd	d
Z
dS )rP  r=   r]   c                 C   s   | S r^   r=   r_   r=   r=   rC   	__enter__     zTimerNoop.__enter__exc_typeexc_valexc_tbNc                 C      d S r^   r=   )r`   r[  r\  r]  r=   r=   rC   __exit__  s   zTimerNoop.__exit__)rb   rc   rd   rS  rN  rY  r   r   BaseExceptionr   r_  r=   r=   r=   rC   rP    s    
rP  c                	   @   sx   e Zd ZdZdZdejddfddZddd	Zde	fd
dZ
deee  dee dee dee fddZdddZdS )rO  z&Low resolution timeout context managerrA  _tasks
_cancelled_cancellingr2  r]   Nc                 C   s   || _ g | _d| _d| _d S )NFr   ra  )r`   r2  r=   r=   rC   r     s   
zTimerContext.__init__c                 C   s   | j rtjddS )z7Raise TimeoutError if timer has already been cancelled.N)rc  rT  TimeoutErrorr_   r=   r=   rC   rX    s   zTimerContext.assert_timeoutc                 C   sP   t j| jd}|d u rtdtjdkr| | _| jr t j	d | j
| | S )N)r2  z4Timeout context manager should be used inside a taskr+   )rT  Zcurrent_taskrA  r   sysversion_infoZ
cancellingrd  rc  re  rb  r   r`   taskr=   r=   rC   rY    s   

zTimerContext.__enter__r[  r\  r]  c                 C   sX   d }| j r
| j  }|tju r*| jr*|d usJ tjdkr&| | jkr&d S tj	|d S )Nr+   )
rb  poprT  ZCancelledErrorrc  rf  rg  Zuncancelrd  re  )r`   r[  r\  r]  Z
enter_taskr=   r=   rC   r_    s   

zTimerContext.__exit__c                 C   s,   | j st| jD ]}|  qd| _ d S d S NT)rc  r   rb  cancelrh  r=   r=   rC   r1    s
   

zTimerContext.timeoutr   )rb   rc   rd   r   rS  rT  rU  r   rX  rN  rY  r   r   r`  r   boolr_  r1  r=   r=   r=   rC   rO    s     


rO  delayrD  c                 C   sL   | d u s| dkrt d S t }| }||  }| |kr!t|}t |S r4  )async_timeoutr1  rT  Zget_running_loopr  r	   Z
timeout_at)rn  rD  r2  r  r7  r=   r=   rC   ceil_timeout  s   

rp  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< de
e d	dfd
dZed	efddZed	e
e fddZed	e
e fddZdS )HeadersMixinzMixin for handling headers.)_content_type_content_dict_stored_content_type_headersNrr  rs  rt  r   r]   c                 C   s>   || _ |d u rd| _i | _d S t|\}}|| _| | _d S r   )rt  rr  rs  r   copy)r`   r   r   Zcontent_mapping_proxyr=   r=   rC   _parse_content_type  s   
z HeadersMixin._parse_content_typec                 C   s6   | j tj}| j|kr| | | jdusJ | jS )z7The value of content part for Content-Type HTTP header.N)ru  r   r)   CONTENT_TYPErt  rw  rr  r`   r   r=   r=   rC   r     s
   

zHeadersMixin.content_typec                 C   s<   | j tj}| j|kr| | | jdusJ | jdS )z7The value of charset part for Content-Type HTTP header.Ncharset)ru  r   r)   rx  rt  rw  rs  ry  r=   r=   rC   rz    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)ru  r   r)   ZCONTENT_LENGTHr  )r`   content_lengthr=   r=   rC   r{  
  s   zHeadersMixin.content_length)rb   rc   rd   r   	frozensetATTRSr$   r   r   rr  r   rs  r   r8   rt  r   r7   rw  propertyr   rz  r  r{  r=   r=   r=   rC   rq    s   
 rq  futzasyncio.Future[_T]resultc                 C   s   |   s| | d S d S r^   )done
set_result)r  r  r=   r=   rC   r    s   r  c                   @   s&   e Zd Z	ddededdfddZdS )	ErrorableProtocol.exc	exc_causer]   Nc                 C   r^  r^   r=   )r`   r  r  r=   r=   rC   set_exception  s   zErrorableProtocol.set_exception.)rb   rc   rd   r`  r  r=   r=   r=   rC   r    s    r  z&asyncio.Future[_T] | ErrorableProtocolr  r  c                 C   sB   t | r|  rdS |tu }||u }|s|s||_| | 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)rT  Zisfuturer  _EXC_SENTINEL	__cause__r  )r  r  r  Zexc_is_sentinelZexc_causes_itselfr=   r=   rC   r  !  s   r  c                   @   s^   e Zd ZU dZdZee ed< ddede	ee
  fddZd	ed
efddZd
efddZdS )AppKeyz.Keys for static typing support in Application.)_name_t__orig_class__r  Nr   tc                 C   sF   t  }|r|jjdkr|jd }n|j}|s|d | | _|| _d S )Nz<module>rb   r  )inspectcurrentframef_codeco_name	f_globalsf_backr  r  )r`   r   r  framemoduler=   r=   rC   r   C  s   

zAppKey.__init__otherr]   c                 C   s   t |tr| j|jk S dS rk  )r   r  r  )r`   r  r=   r=   rC   __lt__O  s   
zAppKey.__lt__c                 C   s   | j }|d u r"tt t| jd }W d    n1 sw   Y  |d u r)d}nt|trA|jdkr7|j}n|j d|j }nt	|}d| j
 d| dS )Nr   z<<Unknown>>builtinsr  z<AppKey(z, type=z)>)r  r   AttributeErrorr   r  r   r   rc   rd   reprr  )r`   r  Zt_reprr=   r=   rC   __repr__T  s   


zAppKey.__repr__r^   )rb   rc   rd   r   rS  r   objectr   r   r   r5   r   rm  r  r  r=   r=   r=   rC   r  8  s   
 r  c                	   @   sv  e Zd ZdZdeeeeee	 f e	f  ddfddZ
dddZed	ee defd
dZed	ede	fddZd	eeee f de	fddZed	ee dedeeef fddZed d	ee dddee fddZed d	ede	de	fddZd!d	eeee f de	de	fddZdefddZdeeeee	 f  fddZd	edefddZdefddZdefddZdS )"r/   )_mapsmapsr]   Nc                 C   s   t || _d S r^   )tupler  )r`   r  r=   r=   rC   r   j  rK  zChainMapProxy.__init__c                 C   s   t d| j)Nz4Inheritance class {} from ChainMapProxy is forbidden)r   formatrb   )rm   r=   r=   rC   __init_subclass__m  s   zChainMapProxy.__init_subclass__r   c                 C   r^  r^   r=   r`   r   r=   r=   rC   __getitem__s  rZ  zChainMapProxy.__getitem__c                 C   r^  r^   r=   r  r=   r=   rC   r  v  rZ  c              	   C   s4   | j D ]}z|| W   S  ty   Y qw t|r^   )r  r   )r`   r   mappingr=   r=   rC   r  y  s   
r   c                 C   r^  r^   r=   r`   r   r   r=   r=   rC   r     rZ  zChainMapProxy.get.c                 C   r^  r^   r=   r  r=   r=   rC   r     rZ  c                 C   r^  r^   r=   r  r=   r=   rC   r     rZ  c                 C   s"   z| | W S  t y   | Y S w r^   )r   r  r=   r=   rC   r     s
   
c                 C   s   t t j| j S r^   )lenr   unionr  r_   r=   r=   rC   __len__  s   zChainMapProxy.__len__c                 C   s&   i }t | jD ]}|| qt|S r^   )reversedr  updateiter)r`   dr  r=   r=   rC   __iter__  s   zChainMapProxy.__iter__c                    s   t  fdd| jD S )Nc                 3   s    | ]} |v V  qd S r^   r=   )rA   mr   r=   rC   r     s    z-ChainMapProxy.__contains__.<locals>.<genexpr>anyr  r  r=   r  rC   __contains__  s   zChainMapProxy.__contains__c                 C   s
   t | jS r^   r  r_   r=   r=   rC   __bool__  s   
zChainMapProxy.__bool__c                 C   s   d tt| j}d| dS )Nz, zChainMapProxy(rJ   )r   mapr  r  )r`   r   r=   r=   rC   r    s   zChainMapProxy.__repr__r   r  r^   )rb   rc   rd   rS  r   r   r   r   r  r   r   r  r   r5   r  r6   r   r   r  r  r   r  r  rm  r  r  r  r=   r=   r=   rC   r/   g  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 )r0   r   Fis_weakN)rb   rc   rd   r   r   r  rm  r=   r=   r=   rC   r0     r   r0   r   c                 C   s*   | t krt| std| dd S d S )NzValue z, is not a valid etag. Maybe it contains '"'?)ETAG_ANY	_ETAGC_RE	fullmatchrj   )r   r=   r=   rC   validate_etag_value  s
   
r  date_strc                 C   s`   | dur.t | }|dur.tt tj|dd dtjjiW  d   S 1 s)w   Y  dS )z/Process a date string, return a datetime objectN   tzinfo)r   r   rj   datetimetimezoneutc)r  	timetupler=   r=   rC   parse_http_date  s   
 r  methodcodec                 C   s2   |t v p| tv pd|  kodk n  o| tjv S )z-Check if a request must return an empty body.r;   ,  )EMPTY_BODY_STATUS_CODESEMPTY_BODY_METHODSr)   METH_CONNECT_ALLr  r  r=   r=   rC   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
    r;   r  )r  r)   r  r  r=   r=   rC   should_remove_content_length  s    r  r^   )Tr   )r*  r+  r]   NrR  )r   rT  rw   r{   r   r  enum	functoolsr  r   r   platformrerf  r  r6  collectionsr   r   email.messager   email.parserr   email.policyr   email.utilsr   mathr	   pathlibr
   typesr   r   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%   r1   Zyarlr'   re   r)   logr*   rg  ro  __all__systemZIS_MACOSr   ZPY_310ZPY_311r5   r6   Enumr7   r8   rm  r   r   ZNO_EXTENSIONSr|  ranger  ZMETH_HEAD_ALLr  flagsdev_modeignore_environmentDEBUGZCHARr?   ZCTLZ
SEPARATORSr   r\   r.   r   r   sr   r   r   r   r   r   	lru_cacher   r   r   r   compiler   r   r   r  r  r  r  r   r  r)  r/  r  rV  rU  rW  r8  r;  r:  r>  rN  rP  rO  Timeoutrp  rq  r  r`  r  r  r  total_orderingr  r/   Z_ETAGCr  Z_QUOTED_ETAGZQUOTED_ETAG_REZLIST_QUOTED_ETAG_REr  r0   r  r  r  r  r=   r=   r=   rC   <module>   s~   P




?	+
'
$ 

3
(



4B
/
$.@


	