o
    RhIv                     @   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/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5 ddl6Z6ddl7m8Z8m9Z9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@ ejAdkrddlZBnddlBZBdZCeD dkZEeD dkZFejAdkZGejAdkZHe-dZIe-dZJeKddZLeLjMZMeNe
jOPdZQejRjSpejRjT oeNe
jOPdZUdd eVddD ZWd d eVdd!D eXd"hB ZYd#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4eXd5hZZeWeYA eZA Z[G d6d7 d7Z\G d8d9 d9ed9g d:Z]d;e<d<e+e<e(e] f fd=d>Z^d<e(e	j	 fd?d@Z_e6j`dAdAdAdBG dCdD dDZadEe(e	j	 dFebd<e]fdGdHZcd<e!ebeaf fdIdJZdd;e<d<e+e<e(e] f fdKdLZee6j`dAdAdAdBG dMdN dNZfejgdOdPdQebd<effdRdSZhddTedUe(eb d<e(eb fdVdWZiejdXZkdYd eVd!d"D dZhB Zld[ebd<ebfd\d]Zm	^dd_ebd`eNdaebdbebd<ebf
dcddZnG dedf dfe*e#eI ZoG dgdh dhe#eI ZpepZqzddilrmpZs eQs*esZpW n
 ety5   Y nw djZudkZvejeuZwejjevejxdlZyejeuzdmZ{ejjevzdmejxdlZ|dne)eb doe)e} dFe(e.ebe}f  d<eNfdpdqZ~ee~ewe{Zee~eye|ZdFe(e.ebe}eef  d<eNfdrdsZdae(e edt< duad<ebfdvdwZddzd{Z	|dd}ed~ebdedejded<e(ej fddZ	|ddeg ef dedejded<e(ej f
ddZdededed<efddZG dd dZG dd de d ZG dd deZG dd deZ	|dde(e ded<eBjfddZG dd dZdddeId<dfddZe ZG dd de*Zefdddeded<dfddZejG dd de#eI ZG dd de'e.ebee f ef ZdZejeZde dZejeZejd#e dZdZe6j`dAdAdAdBG dd dZdebd<dfddZde(eb d<e(ej fddZdebded<eNfddZdebd<eNfddZded<eNfddZdebded<eNf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Pattern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sentinelAIOHTTP_NO_EXTENSIONSPYTHONASYNCIODEBUGc                 C      h | ]}t |qS  chr.0ir7   r7   Q/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/aiohttp/helpers.py	<setcomp>S       r>      c                 C   r6   r7   r8   r:   r7   r7   r=   r>   T   r?          ()<>@,;:\"/[]?={} 	   c                   @   s   e Zd Zded fddZdS )noopreturn)NNNc                 c   s    d V  d S Nr7   selfr7   r7   r=   	__await__p   s   
znoop.__await__N)__name__
__module____qualname__r   r[   r7   r7   r7   r=   rV   o   s    rV   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encodingrW   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 valuerJ   z5A ":" is not allowed in login (RFC 1945#section-11.1))
ValueErrorsuper__new__)clsra   rb   rc   	__class__r7   r=   rf   w   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.rT   r%   z%Could not parse authorization header.basiczUnknown authorization method %sasciiT)validatezInvalid base64 encoding.rJ   zInvalid credentials.rc   )	splitrd   lowerbase64	b64decodeencodedecodebinasciiError)rg   rj   rc   	auth_typeencoded_credentialsdecodedusernamerb   r7   r7   r=   rt      s,   
zBasicAuth.decodern   urlc                C   s6   t |ts	td|jdu rdS | |j|jpd|dS )zCreate BasicAuth from url.zurl should be yarl.URL instanceNr_   rn   )
isinstancer$   	TypeErroruserrb   )rg   r{   rc   r7   r7   r=   from_url   s
   

zBasicAuth.from_urlc                 C   s0   | j  d| j | j}dt|| j S )zEncode credentials.rJ   zBasic %s)ra   rb   rs   rc   rq   	b64encodert   )rZ   credsr7   r7   r=   rs      s   zBasicAuth.encode)r_   r`   )r`   )r\   r]   r^   __doc__strrf   classmethodrt   r$   r   r   rs   __classcell__r7   r7   rh   r=   r*   t   s"    "r*   )ra   rb   rc   r{   rW   c                 C   s(   t | }|d u r| d fS | d |fS rX   )r*   r   	with_user)r{   authr7   r7   r=   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)	netrc_env
netrc_pathhome_direnetrc_existsr7   r7   r=   netrc_from_env   s@   
	

r   T)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]   r^   r$   __annotations__r   r*   r7   r7   r7   r=   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.r_   )LookupErrorauthenticatorsr*   )r   r   auth_from_netrcra   accountrb   rz   r7   r7   r=   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#   r;   kvr7   r7   r=   
<dictcomp>  s
    z$proxies_from_env.<locals>.<dictcomp>c                 S   s   i | ]	\}}|t |qS r7   )r   r   r7   r7   r=   r     s    )r   r   z)%s proxies %s are not supported, ignoring)r   itemsr   schemer'   r   upperr   r   r   r   )
proxy_urlsr   strippedretprotovalr   r   r7   r7   r=   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{   proxies_in_env
proxy_infor7   r7   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]   r^   r   r   r7   r7   r7   r=   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'})

    r_   )r   r   r   r   rI   r%   NrQ   z "r   *z*/*rM   +)r   r!   r    ro   	partitionaddrp   strip)r   partsparamsitemkey_valuefulltypemtypestyper   r7   r7   r=   parse_mimetype7  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   rE   rF   )getattrr|   r   r   r   )r   r   r   r7   r7   r=   guess_filename_  s   &
r   z[^\041\043-\133\135-\176]c                 C   r6   r7   r8   r:   r7   r7   r=   r>   g  r?   	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 )NrK   r   )group)xr7   r7   r=   <lambda>t  s    zquoted_string.<locals>.<lambda>)QCONTENTsetrd   not_qtext_resub)r   r7   r7   r=   quoted_stringj  s   r   utf-8disptypequote_fields_charsetr   c           
      K   s:  | rt t| kstd| | }|rg }| D ]p\}}|r%t t|ks-td|||rv| dkrFt|d|d}||d| f qzt|}W n tyk   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 {!r}z+bad content disposition parameter {!r}={!r}filenamer_   rn   z"%s"z''r   rK   z\\rL   z\"z; c                 s   s    | ]}d  |V  qdS )rQ   N)join)r;   pairr7   r7   r=   	<genexpr>  s    z-content_disposition_header.<locals>.<genexpr>)TOKENr   rd   formatr   rp   r   appendr   r   replace)
r   r   r   r   r   lparamsr   r   qvalsparamsr7   r7   r=   content_disposition_headerw  s8   
r   c                   @   s   e Zd ZU eeef ed< dS )_TSelf_cacheN)r\   r]   r^   r   r   r0   r   r7   r7   r7   r=   r     s   
 r   c                   @   sh   e Zd ZdZdedef ddfddZddee d	ee	e
  defd
dZdee deddf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.
    wrapped.rW   Nc                 C   s   || _ |j| _|j| _d S rX   )r   r   r\   r   )rZ   r   r7   r7   r=   __init__  s   zreify.__init__instownerc                 C   sb   z z|j | j W W S  ty    | |}||j | j< | Y W S w  ty0   |d u r/|  Y S  w rX   )r   r   r   r   AttributeError)rZ   r   r   r   r7   r7   r=   __get__  s   

zreify.__get__r   c                 C   s   t d)Nzreified property is read-only)r  )rZ   r   r   r7   r7   r=   __set__  s   zreify.__set__rX   )r\   r]   r^   r   r   r0   r   r   r   r   r
   r  r  r7   r7   r7   r=   r     s
    	$r   )r   z[^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$a  ^(?:(?:(?:[A-F0-9]{1,4}:){6}|(?=(?:[A-F0-9]{0,4}:){0,6}(?:[0-9]{1,3}\.){3}[0-9]{1,3}$)(([0-9A-F]{1,4}:){0,5}|:)((:[0-9A-F]{1,4}){1,5}:|:)|::(?:[A-F0-9]{1,4}:){5})(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])|(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}|(?=(?:[A-F0-9]{0,4}:){0,7}[A-F0-9]{0,4}$)(([0-9A-F]{1,4}:){1,7}|:)((:[0-9A-F]{1,4}){1,7}|:)|(?:[A-F0-9]{1,4}:){7}:|:(:[A-F0-9]{1,4}){7})$)flagsrl   regexregexbc                 C   sZ   |d u rdS t |trt| |S t |tttfr!t||S t| dt| d)NFz [z] is not a str or bytes)	r|   r   boolmatchbytes	bytearray
memoryviewr}   r   )r  r  r   r7   r7   r=   _is_ip_address  s   
r  c                 C   s   t | pt| S rX   )is_ipv4_addressis_ipv6_address)r   r7   r7   r=   is_ip_address  s   r  _cached_current_datetimer_   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)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tailr7   r7   r=   rfc822_formatted_time  s    	r3  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 rX   )r   	Exceptionr   )r4  refr   obr7   r7   r=   _weakref_handle/  s   
"r9     r8  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_atr9  weakrefr7  )r8  r   r;  r<  r=  whenr7   r7   r=   weakref_handle7  s   rB  cbc                 C   s4   |d u s|dkr
d S |  }t|||}||| S r>  )r%  calculate_timeout_whenr?  )rC  r;  r<  r=  r(  rA  r7   r7   r=   
call_laterG  s
   rE  	loop_timetimeout_ceiling_thresholdc                 C   s   | | }||krt |S |S )z$Calculate when to execute a timeout.r   )rF  r;  rG  rA  r7   r7   r=   rD  T  s   rD  c                	   @   s   e 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 handler:  r<  r;  ceil_thresholdrW   Nc                 C   s   || _ || _|| _g | _d S rX   )_timeout_loop_ceil_threshold
_callbacks)rZ   r<  r;  rI  r7   r7   r=   r   c  s
   zTimeoutHandle.__init__callback).Nargskwargsc                 O   s   | j |||f d S rX   )rM  r   )rZ   rN  rO  rP  r7   r7   r=   registerp  s   zTimeoutHandle.registerc                 C   s   | j   d S rX   )rM  clearrY   r7   r7   r=   closeu     zTimeoutHandle.closec                 C   sJ   | j }|d ur#|dkr#| j | }|| jkrt|}| j|| jS d S r>  )rJ  rK  r%  rL  r   r?  __call__)rZ   r;  rA  r7   r7   r=   startx  s   
zTimeoutHandle.startBaseTimerContextc                 C   s4   | j d ur| j dkrt| j}| |j |S t S r>  )rJ  TimerContextrK  rQ  r;  	TimerNoop)rZ   timerr7   r7   r=   rZ    s
   
zTimeoutHandle.timerc              	   C   sV   | j D ] \}}}tt ||i | W d    n1 sw   Y  q| j   d S rX   )rM  r   r6  rR  )rZ   rC  rO  rP  r7   r7   r=   rU    s   
zTimeoutHandle.__call__r:  rW   N)rW   rW  )r\   r]   r^   r   asyncioAbstractEventLoopr   floatr   r   r
   rQ  rS  TimerHandlerV  rZ  rU  r7   r7   r7   r=   rH  `  s2    




rH  c                   @   s   e Zd ZdddZdS )rW  rW   Nc                 C   s   dS )z0Raise TimeoutError if timeout has been exceeded.Nr7   rY   r7   r7   r=   assert_timeout  s    zBaseTimerContext.assert_timeoutr\  )r\   r]   r^   ra  r7   r7   r7   r=   rW    s    rW  c                   @   sD   e 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 )
rY  rW   c                 C   s   | S rX   r7   rY   r7   r7   r=   	__enter__     zTimerNoop.__enter__exc_typeexc_valexc_tbNc                 C      d S rX   r7   rZ   rd  re  rf  r7   r7   r=   __exit__  s   zTimerNoop.__exit__)
r\   r]   r^   rW  rb  r   r   BaseExceptionr	   ri  r7   r7   r7   r=   rY    s    
rY  c                	   @   st   e 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 )rX  z&Low resolution timeout context managerr<  rW   Nc                 C   s   || _ g | _d| _d S )NF)rK  _tasks
_cancelled)rZ   r<  r7   r7   r=   r     s   
zTimerContext.__init__c                 C   s   | j rtjddS )z7Raise TimeoutError if timer has already been cancelled.N)rl  r]  TimeoutErrorrY   r7   r7   r=   ra    s   zTimerContext.assert_timeoutc                 C   s<   t j| jd}|d u rtd| jrt jd | j| | S )N)r<  z4Timeout context manager should be used inside a task)r]  current_taskrK  r   rl  rm  rk  r   rZ   taskr7   r7   r=   rb    s   zTimerContext.__enter__rd  re  rf  c                 C   s,   | j r| j   |tju r| jrtjd d S rX   )rk  popr]  CancelledErrorrl  rm  rh  r7   r7   r=   ri    s
   
zTimerContext.__exit__c                 C   s,   | j st| jD ]}|  qd| _ d S d S NT)rl  r   rk  cancelro  r7   r7   r=   r;    s
   

zTimerContext.timeoutr\  )r\   r]   r^   r   r]  r^  r   ra  rW  rb  r   r   rj  r	   r  ri  r;  r7   r7   r7   r=   rX    s    


rX  delayrI  c                 C   sL   | d u s| dkrt d S t }| }||  }| |kr!t|}t |S r>  )async_timeoutr;  r]  get_running_loopr%  r   
timeout_at)ru  rI  r<  r(  rA  r7   r7   r=   ceil_timeout  s   

ry  c                   @   s   e Zd ZU 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 )HeadersMixin)_content_type_content_dict_stored_content_type_headersNr{  r|  r}  rawrW   c                 C   sX   || _ |d u rd| _i | _d S t d| }| | _|d}t|dd  | _d S )Nzapplication/octet-streamzContent-Type: r7   r%   )r}  r{  r|  r   parsestrget_content_type
get_paramsdict)rZ   r  msgr   r7   r7   r=   _parse_content_type  s   


z HeadersMixin._parse_content_typec                 C   s(   | j tj}| j|kr| | | jS )z7The value of content part for Content-Type HTTP header.)r~  r   r&   CONTENT_TYPEr}  r  r{  rZ   r  r7   r7   r=   content_type  s   

zHeadersMixin.content_typec                 C   s.   | j tj}| j|kr| | | jdS )z7The value of charset part for Content-Type HTTP header.charset)r~  r   r&   r  r}  r  r|  r  r7   r7   r=   r    s   

zHeadersMixin.charsetc                 C   s"   | j tj}|durt|S dS )z(The value of Content-Length HTTP header.N)r~  r   r&   CONTENT_LENGTHr$  )rZ   content_lengthr7   r7   r=   r    s   zHeadersMixin.content_length)r\   r]   r^   	frozensetATTRSr"   r   r   r{  r   r|  r   r3   r}  r   r2   r  propertyr  r  r$  r  r7   r7   r7   r=   rz    s   
 rz  futzasyncio.Future[_T]resultc                 C   s   |   s| | d S d S rX   )done
set_result)r  r  r7   r7   r=   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_causerW   Nc                 C   rg  rX   r7   )rZ   r  r  r7   r7   r=   set_exception  s   zErrorableProtocol.set_exception.)r\   r]   r^   rj  r  r7   r7   r7   r=   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)r]  isfuturer  _EXC_SENTINEL	__cause__r  )r  r  r  exc_is_sentinelexc_causes_itselfr7   r7   r=   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>r\   .)inspectcurrentframef_codeco_name	f_globalsf_backr  r  )rZ   r   r  framemoduler7   r7   r=   r   D  s   

zAppKey.__init__otherrW   c                 C   s   t |tr| j|jk S dS rs  )r|   r  r  )rZ   r  r7   r7   r=   __lt__P  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   r  r   r  r|   r   r]   r^   reprr  )rZ   r  t_reprr7   r7   r=   __repr__U  s   


zAppKey.__repr__rX   )r\   r]   r^   r   	__slots__r   objectr   r   r   r0   r   r  r  r  r7   r7   r7   r=   r  9  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mapsrW   Nc                 C   s   t || _d S rX   )tupler  )rZ   r  r7   r7   r=   r   k  rT  zChainMapProxy.__init__c                 C   s   t d| j)Nz4Inheritance class {} from ChainMapProxy is forbidden)r}   r   r\   )rg   r7   r7   r=   __init_subclass__n  s   zChainMapProxy.__init_subclass__r   c                 C   rg  rX   r7   rZ   r   r7   r7   r=   __getitem__t  rc  zChainMapProxy.__getitem__c                 C   rg  rX   r7   r  r7   r7   r=   r  w  rc  c              	   C   s4   | j D ]}z|| W   S  ty   Y qw t|rX   )r  r   )rZ   r   mappingr7   r7   r=   r  z  s   
r   c                 C   rg  rX   r7   rZ   r   r   r7   r7   r=   r     rc  zChainMapProxy.get.c                 C   rg  rX   r7   r  r7   r7   r=   r     rc  c                 C   rg  rX   r7   r  r7   r7   r=   r     rc  c                 C   s"   z| | W S  t y   | Y S w rX   )r   r  r7   r7   r=   r     s
   
c                 C   s   t t j| j S rX   )lenr   unionr  rY   r7   r7   r=   __len__  s   zChainMapProxy.__len__c                 C   s&   i }t | jD ]}|| qt|S rX   )reversedr  updateiter)rZ   dr  r7   r7   r=   __iter__  s   zChainMapProxy.__iter__c                    s   t  fdd| jD S )Nc                 3   s    | ]} |v V  qd S rX   r7   )r;   mr   r7   r=   r     s    z-ChainMapProxy.__contains__.<locals>.<genexpr>anyr  r  r7   r  r=   __contains__  s   zChainMapProxy.__contains__c                 C   s
   t | jS rX   r  rY   r7   r7   r=   __bool__  s   
zChainMapProxy.__bool__c                 C   s   d tt| j}d| dS )Nz, zChainMapProxy(rD   )r   mapr  r  )rZ   r   r7   r7   r=   r    s   zChainMapProxy.__repr__r\  r  rX   )r\   r]   r^   r  r   r   r   r   r  r
   r   r  r   r0   r  r1   r   r   r$  r  r   r  r  r  r  r  r  r7   r7   r7   r=   r+   h  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]   r^   r   r   r  r  r7   r7   r7   r=   r,     r   r,   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	fullmatchrd   )r   r7   r7   r=   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   rd   datetimetimezoneutc)r  	timetupler7   r7   r=   parse_http_date  s   
 r  methodcodec                 C   s6   t |pt| pd|  kodk n  o|  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  r7   r7   r=   must_be_empty_body  s
   $r  c                 C   s   |   tjkS )z,Check if a method must return an empty body.)r   r&   	METH_HEAD)r  r7   r7   r=   r    s   r  c                 C   s    | dv pd|   kodk S   S )z1Check if a status code must return an empty body.   0     d   r  r7   )r  r7   r7   r=   r    s    r  c                 C   sF   |dv p"d|  kodk n  p"d|  kodk n  o"|   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  r7   r7   r=   should_remove_content_length  s
   $r  rX   )Tr   )r4  r5  rW   Nr[  )r   r]  rq   ru   r   r  enum	functoolsr  r   r   platformresysr%  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   r   urllib.parser   urllib.requestr   r   attr	multidictr    r!   r"   yarlr$   r_   r&   logr'   version_inforv  __all__systemIS_MACOSr   PY_310PY_311r0   r1   Enumr2   r3   r  r   r   NO_EXTENSIONSr  dev_modeignore_environmentDEBUGrangeCHARr9   CTL
SEPARATORSr   rV   r*   r   r   sr   r   r   r   r   r   	lru_cacher   r   compiler   r   r   r   r   r   reify_py_helpersreify_cImportError_ipv4_pattern_ipv6_pattern_ipv4_regex
IGNORECASE_ipv6_regexrs   _ipv4_regexb_ipv6_regexbr	  r  partialr  r  r
  r  r  r  r$  r   r'  r3  r9  r  r_  r^  r`  rB  rE  rD  rH  rW  rY  rX  Timeoutry  rz  r  rj  r  r  r  total_orderingr  r+   _ETAGCr  _QUOTED_ETAGQUOTED_ETAG_RELIST_QUOTED_ETAG_REr  r,   r  r  r  r  r  r  r7   r7   r7   r=   <module>   s   T




=+
 '

5 


"
(



21
0
$.@


	