
    yi/v                        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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/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6 ddl7Z7ddl8m9Z9m:Z:m;Z; ddl<m=Z= ddl>m?Z? ddl@mAZAmBZB ej                  dk\  rddlZDnddlDZDdZE ej                         dk(  ZG ej                         dk(  ZHej                  dk\  ZIej                  dk\  ZJ e.d      ZK e.d      ZL ej                  dd      ZNeNj                  ZO ePe
j                  j                  d            ZSej                  j                  xs: ej                  j                   xr!  ePe
j                  j                  d            ZW eXdd      D  ch c]
  }  eY|        c} ZZ eXdd      D  ch c]
  }  eY|        c}  eYd      hz  Z[d d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1 eYd2      hZ\eZe[z  e\z  Z] G d3 d4      Z^ G d5 d6 ed6g d7            Z_d8e=d9e,e=e)e_   f   fd:Z`d9e)e	j                     fd;Za e7j                  d<d<d<=       G d> d?             Zcd@e)e	j                     dAedd9e_fdBZed9e"edecf   fdCZf	 ddDe)ej                     d9dEfdFZh	 ddDe)ej                     d9ej                  fdGZidHed9ePfdIZjd8e=d9e,e=e)e_   f   fdJZk e7j                  d<d<d<=       G dK dL             Zl ej                  dMN      dOedd9elfdP       ZnddHedQe)ed   d9e)ed   fdRZo ej                  dS      Zq eXdd      D  ch c]
  }  eY|        c} dThz  ZrdUedd9edfdVZs	 ddWeddXePdYeddZedd9edf
d[Zt G d\ d]e+e$eK         Zu G d^ d_e$eK         ZvevZw	 dd`lxmvZy eSseyZvdaZ{dbZ| ej                  e{      Z} ej                  e|ej                  c      Z ej                  e{j                  dd            Z ej                  e|j                  dd      ej                  c      Zdee*ed   dfe*e   dAe)e/edef      d9ePfdgZ ej
                  ee}e      Z ej
                  eee      ZdAe)e/edeeef      d9ePfdhZdae)e   edi<   djad9edfdkZddlZ	 ddmedneddoedDej                  dped9e)ej&                     fdqZ	 ddre g ef   doedDej                  dped9e)ej&                     f
dsZ G dt du      Z G dv dwe!dw         Z G dx dye      Z G dz d{e      Z	 dd|e)e   d}ed9eDj4                  fd~Z G d d      ZdddeKd9dfdZddded9dfdZej@                   G d de$eK                Z G d de(e/edee   f   ef         ZdZ ej                  e      Zde dZ ej                  e      Z ej                  d e d      ZdZ e7j                  d<d<d<=       G d d             Zdedd9dfdZde)ed   d9e)ej
                     fdZdedded9ePfdZdedd9ePfdZded9ePfdZdedded9ePfdZyc c} w c c} w c c} w # ez$ r Y w xY w)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internal_logger)      )	BasicAuthChainMapProxyETagDarwinWindows)r(   
   _T_S	_SENTINELsentinelAIOHTTP_NO_EXTENSIONSPYTHONASYNCIODEBUG          ()<>@,;:\"/[]?={} 	   c                       e Zd Zded   fdZy)noopreturn)NNNc              #      K   d  y wN selfs    J/root/polymarket_arb/.venv/lib/python3.12/site-packages/aiohttp/helpers.py	__await__znoop.__await__q   s	     s   N)__name__
__module____qualname__r   rU   rQ       rT   rM   rM   p   s    9%56 rY   rM   c            	            e Zd ZdZ	 ddedededd f fdZeddededd fd	       Zedd
dedede	d    fd       Z
defdZ xZS )r*   z!Http basic authentication helper.latin1loginpasswordencodingrN   c                 z    |t        d      |t        d      d|v rt        d      t        | 	  | |||      S )Nz"None is not allowed as login valuez%None is not allowed as password valuer@   z5A ":" is not allowed in login (RFC 1945#section-11.1))
ValueErrorsuper__new__)clsr\   r]   r^   	__class__s       rT   rb   zBasicAuth.__new__x   sP     =ABBDEE%<TUUwsE8X>>rY   auth_headerc                    	 |j                  dd      \  }}|j                         dk7  rt        d|z        	 t        j                  |j                  d      d      j                  |      }	 |j                  d
d      \  }} | |||      S # t        $ r t        d      w xY w# t        j                  $ r t        d	      w xY w# t        $ r t        d      w xY w)z<Create a BasicAuth object from an Authorization HTTP header.rJ   r$   z%Could not parse authorization header.basiczUnknown authorization method %sasciiT)validatezInvalid base64 encoding.r@   zInvalid credentials.r^   )	splitr`   lowerbase64	b64decodeencodedecodebinasciiError)rc   re   r^   	auth_typeencoded_credentialsdecodedusernamer]   s           rT   rp   zBasicAuth.decode   s    	F-8->->sA-F*I* ??'>JKK	9&&#**73dfX 	5
 ")sA!6Hh 8X99-  	FDEE	F ~~ 	9788	9  	5344	5s"   B 5B' /C	 B$'C	Crj   urlc                    t        |t              st        d      |j                  y | |j                  |j                  xs d|      S )zCreate BasicAuth from url.zurl should be yarl.URL instanceN rj   )
isinstancer#   	TypeErroruserr]   )rc   rw   r^   s      rT   from_urlzBasicAuth.from_url   sC     #s#=>>88388S\\/R(CCrY   c                     | j                    d| j                   j                  | j                        }dt	        j
                  |      j                  | j                        z  S )zEncode credentials.r@   zBasic %s)r\   r]   ro   r^   rm   	b64encoderp   )rS   credss     rT   ro   zBasicAuth.encode   sN    JJ<q088GF,,U3::4==IIIrY   )ry   r[   )r[   )rV   rW   rX   __doc__strrb   classmethodrp   r#   r   r}   ro   __classcell__)rd   s   @rT   r*   r*   u   s    + >F??#&?7:?	? : : :; : :8 3; D3 DS D@U D DJ JrY   r*   )r\   r]   r^   rw   rN   c                 ^    t         j                  |       }|| d fS | j                  d       |fS rP   )r*   r}   	with_user)rw   auths     rT   strip_auth_from_urlr      s5    c"D|Dy}}T"D((rY   c                  z   t         j                  j                  d      } | t        |       }n"	 t        j                         }|t        rdndz  }	 t        j                  t        |            S # t
        $ r }t        j                  d|       Y d}~yd}~ww xY w# t        j                  $ r }t        j                  d|       Y d}~yd}~wt        $ re}d}t        j                  t              5  |j!                         }ddd       n# 1 sw Y   nxY w| s|rt        j                  d|       Y d}~yd}~ww xY 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_existss        rT   netrc_from_envr      s    

w'I)_
		yy{H ZXF
G{{3z?++  	5
 	    D?CC   G  ) 	0%--/L	0 	0 	0  !!"BAFGsS   A/ B /	B8BBD:.C		D:D50D
	D5
D	!D55D:T)auto_attribsfrozenslotsc                   (    e Zd ZU eed<   ee   ed<   y)	ProxyInfoproxy
proxy_authN)rV   rW   rX   r#   __annotations__r   r*   rQ   rY   rT   r   r      s    J##rY   r   	netrc_objhostc                     | t        d      | j                  |      }|t        d|d      |\  }}}|s||n|}|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``.
    zNo .netrc file foundzNo entry for z found in the `.netrc` file.ry   )LookupErrorauthenticatorsr*   )r   r   auth_from_netrcr\   accountr]   rv   s          rT   basicauth_from_netrcr      sv     011..t4OM$1MNOO.E7H '/uH Xx((rY   c                  B   t               j                         D  ci c]  \  } }| dv r| t        |       }} }t               }|j                         D  ci c]  \  } }| t	        |       }} }i }|j                         D ]~  \  }}|\  }}	|j
                  dv r0t        j                  d|j
                  j                         |       I|r%|	#|j                  	 t        ||j                        }	t        ||	      ||<    |S c c}} w c c}} w # t        $ r d }	Y ,w xY w)N)httphttpswswss)r   r   z)%s proxies %s are not supported, ignoring)r   itemsr#   r   r   schemer&   r   upperr   r   r   r   )
kv
proxy_urlsr   strippedretprotovalr   r   s
             rT   proxies_from_envr     s3    L&&(Aq.. 	
3q6	J 
  I6@6F6F6HIda&q))IHI
Cnn& ,
st<<++!!;U\\=O=O=QSX zz% /	5::FD ud+E
, J- J #  D s   DD
DDDloopzOptional[asyncio.Task[Any]]c                 .    t        j                  |       S )Nr   )asynciocurrent_taskr   s    rT   r   r   "  s     T**rY   c                     | t        j                         } | j                         sCt        j                  dt
        d       | j                         rt        j                  dd       | S )Nz5The object should be created within an async functionr(   )
stacklevelT)
stack_info)	r   get_event_loop
is_runningwarningswarnDeprecationWarning	get_debugr'   r   r   s    rT   get_running_loopr   (  s]     |%%'??C	

 >>##GTX KrY   objc                 :    t        t        dd       }| ||       S y)NisasyncgenfunctionF)getattrinspect)r   funcs     rT   r   r   :  s$    70$7DCyrY   c                    | j                   .t        | j                         rt        d| j                   d      t               }	 || j                     }|j
                  |j                  fS # t        $ r t        d| d      w xY w)z5Get a permitted proxy for the given URL from the env.zProxying is disallowed for ``zNo proxies found for `z` in the env)r   r   r   r   r   r   r   KeyError)rw   proxies_in_env
proxy_infos      rT   get_env_proxy_for_urlr   B  s    
xxSXX 68AFGG%'N7#CJJ/
 !6!666  H23'FGGHs   A- -Bc                   6    e Zd ZU eed<   eed<   eed<   ded<   y)MimeTypetypesubtypesuffixzMultiDictProxy[str]
parametersN)rV   rW   rX   r   r   rQ   rY   rT   r   r   P  s    
ILK%%rY   r   8   )maxsizemimetypec           	         | s t        dddt        t                           S | j                  d      }t               }|dd D ]W  }|s|j	                  d      \  }}}|j                  |j                         j                         |j                  d             Y |d   j                         j                         }|d	k(  rd
}|j	                  d      \  }}}	|	j	                  d      \  }	}}
t        ||	|
t        |            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'})

    ry   )r   r   r   r   r?   r$   NrG   z "r   *z*/*rC   +)r   r!   r    rk   	partitionaddrl   strip)r   partsparamsitemkey_valuefulltypemtypestyper   s              rT   parse_mimetyper   X  s     R~ik7R
 	
 NN3E&[Fab	 ;s+Q

399;$$&D(9:	; Qx~~%%'H3((-OE1es+E1fE&^F=S rY   defaultc                     t        | dd       }|r5t        |t              r%|d   dk7  r|d   dk7  rt        |      j                  S |S )Nnamer   r;   r<   )r   rz   r   r   r   )r   r   r   s      rT   guess_filenamer     sC    3%D
4%$q'S.T"X_DzNrY   z[^\041\043-\133\135-\176]	contentc                 p    t         t        |       kD  st        d|       t        j	                  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                 *    d| j                  d      z   S )NrA   r   )group)xs    rT   <lambda>zquoted_string.<locals>.<lambda>  s    dQWWQZ&7 rY   )QCONTENTsetr`   not_qtext_resub)r   s    rT   quoted_stringr    s7     s7|#9'EFF7AArY   disptypequote_fields_charsetr   c                 
   | rt         t        |       kD  st        dj                  |             | }|r	g }|j	                         D ]  \  }}|rt         t        |      kD  st        dj                  ||            |r[|j                         dk(  r%t        |d|      }|j                  |d|z  f       o	 t        |      }|j                  |d|z  f       |j                  d	d
      j                  dd      }|j                  |d|z  f        dj                  d |D              }	dj                  ||	f      }|S # t        $ r: dj                  |dt        |d|      f      }|j                  |dz   |f       Y ;w xY w)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}filenamery   rj   z"%s"z''r   rA   z\\rB   z\"z; c              3   >   K   | ]  }d j                  |        yw)rG   N)join).0pairs     rT   	<genexpr>z-content_disposition_header.<locals>.<genexpr>  s     ?tCHHTN?s   )TOKENr   r`   formatr   rl   r   appendr  r
  replace)
r  r  r  r   r   lparamsr   r   qvalsparamss
             rT   content_disposition_headerr    s   ( ECM1?FFxPQQE 	5HCus3x/ DKKCQTU  99;*, b8<DNNC$#78=,S1  Vd]';<{{4088eDVd]34+	5, ))?w??		5'*+L & :!ww%tU3X-NO   c	4'89	:s   6D???FFc                   "    e Zd ZU eeef   ed<   y)_TSelf_cacheN)rV   rW   rX   r   r   r0   r   rQ   rY   rT   r  r    s    bMrY   r  c                   l    e Zd ZdZdedef   ddfdZddee   dee	e
      defd	Zdee   d
eddfdZy)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.rN   Nc                 V    || _         |j                  | _        |j                  | _        y rP   )r  r   rV   r   )rS   r  s     rT   __init__zreify.__init__  s!    $$	rY   instownerc                     	 	 |j                   | j                     S # t        $ r/ | j                  |      }||j                   | j                  <   |cY S w xY w# t        $ r || cY S  w xY wrP   )r  r   r   r  AttributeError)rS   r  r  r   s       rT   __get__zreify.__get__  sp    
	{{499-- ll4(),DII&
  	|	s'    5AA AA A(&A(r   c                     t        d      )Nzreified property is read-only)r!  )rS   r  r   s      rT   __set__zreify.__set__  s    <==rY   rP   )rV   rW   rX   r   r   r0   r  r  r   r   r
   r"  r$  rQ   rY   rT   r  r    sh    %b 1 %d %
F2J xS	/B b >F2J >r >d >rY   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})$)flagsrh   regexregexbc                     |yt        |t              rt        | j                  |            S t        |t        t
        t        f      rt        |j                  |            S t        | dt        |       d      )NFz [z] is not a str or bytes)	rz   r   boolmatchbytes	bytearray
memoryviewr{   r   )r&  r'  r   s      rT   _is_ip_addressr.    sl     |$EKK%&&	D5)Z8	9FLL&''4&4:,.EFGGrY   c                 2    t        |       xs t        |       S rP   )is_ipv4_addressis_ipv6_address)r   s    rT   is_ip_addressr2     s    4 9OD$99rY   _cached_current_datetimery   c                      t        t        j                               } | t        k7  r5d}d}t        j                  |       ^}}}}}}}	}
d||	   |||   ||||fz  a| at        S )N)MonTueWedThuFriSatSun)ry   JanFebMarAprMayJunJulAugSepOctNovDecz#%s, %02d %3s %4d %02d:%02d:%02d GMT)inttimer3  gmtime_cached_formatted_datetime)now_weekdayname
_monthnameyearmonthdayhhmmsswdtails              rT   rfc822_formatted_timerW  (  s     diik
C
&& I

  37++c2B/eS"b"b4%JuN
 &
" $' %%rY   c                     | \  }} |       }|*t        t              5   t        ||              d d d        y y # 1 sw Y   y xY wrP   )r   	Exceptionr   )inforefr   obs       rT   _weakref_handler]  P  sM    IC	B	~i  	 GB	  	  	  	 s	   :Ar\  r   timeouttimeout_ceil_thresholdc                     |T|dkD  rO|j                         |z   }||k\  rt        |      }|j                  |t        t	        j
                  |       |f      S y Nr   )rI  r   call_atr]  weakrefr[  )r\  r   r^  r   r_  whens         rT   weakref_handlere  X  sU     w{yy{W$,,:D||D/GKKOT3JKKrY   cbc                 |    |:|dkD  r5|j                         |z   }||kD  rt        |      }|j                  ||       S y ra  )rI  r   rb  )rf  r^  r   r_  rd  s        rT   
call_laterrh  h  sF     w{yy{W$++:D||D"%%rY   c            	           e Zd ZdZ	 ddej
                  dee   deddfdZde	d	   d
e
de
ddfdZddZdeej                     fdZddZddZy)TimeoutHandlezTimeout handler   r^  ceil_thresholdrN   Nc                 <    || _         || _        || _        g | _        y rP   )_timeout_loop_ceil_threshold
_callbacks)rS   r   r^  rk  s       rT   r  zTimeoutHandle.__init__y  s&      
-  	rY   callback).Nargskwargsc                 @    | j                   j                  |||f       y rP   )rp  r  )rS   rq  rr  rs  s       rT   registerzTimeoutHandle.register  s     	$78rY   c                 8    | j                   j                          y rP   )rp  clearrR   s    rT   closezTimeoutHandle.close  s    rY   c                     | j                   }|b|dkD  r]| j                  j                         |z   }|| j                  k\  rt	        |      }| j                  j                  || j                        S y ra  )rm  rn  rI  ro  r   rb  __call__)rS   r^  rd  s      rT   startzTimeoutHandle.start  sa    --7Q;::??$w.D$...Dz::%%dDMM::rY   c                     | j                   A| j                   dkD  r2t        | j                        }| j                  |j                         |S t               S ra  )rm  TimerContextrn  ru  r^  	TimerNoop)rS   timers     rT   r  zTimeoutHandle.timer  sB    ==$): ,EMM%--(L;rY   c                     | j                   D ]&  \  }}}t        t              5   ||i | d d d        ( | j                   j                          y # 1 sw Y   MxY wrP   )rp  r   rY  rw  )rS   rf  rr  rs  s       rT   rz  zTimeoutHandle.__call__  s]     $ 	$Bf)$ $D#F#$ $	$ 	$ $s   	AA	   rN   N)rN   BaseTimerContext)rV   rW   rX   r   r   AbstractEventLoopr   floatr  r   r
   ru  rx  Handler{  r  rz  rQ   rY   rT   rj  rj  v  s     !"	'' % 	
 
9 +9479CF9	9
 x/  rY   rj  c                       e Zd ZddZy)r  Nc                      y)z0Raise TimeoutError if timeout has been exceeded.NrQ   rR   s    rT   assert_timeoutzBaseTimerContext.assert_timeout  s    rY   r  )rV   rW   rX   r  rQ   rY   rT   r  r    s    ?rY   r  c                   H    e Zd ZdefdZdeee      dee   dee   ddfdZ	y)r~  rN   c                     | S rP   rQ   rR   s    rT   	__enter__zTimerNoop.__enter__  s    rY   exc_typeexc_valexc_tbNc                      y rP   rQ   rS   r  r  r  s       rT   __exit__zTimerNoop.__exit__  s     	rY   )
rV   rW   rX   r  r  r   r   BaseExceptionr	   r  rQ   rY   rT   r~  r~    sN    + 4./ -( '	
 
rY   r~  c            	           e Zd ZdZdej
                  ddfdZddZdefdZ	de
ee      d	e
e   d
e
e   de
e   fdZddZy)r}  z&Low resolution timeout context managerr   rN   Nc                 .    || _         g | _        d| _        y )NF)rn  _tasks
_cancelled)rS   r   s     rT   r  zTimerContext.__init__  s    
/1rY   c                 >    | j                   rt        j                  dy)z7Raise TimeoutError if timer has already been cancelled.N)r  r   TimeoutErrorrR   s    rT   r  zTimerContext.assert_timeout  s    ??&&D0 rY   c                     t        | j                        }|t        d      | j                  rt        j
                  d | j                  j                  |       | S )Nr   z4Timeout context manager should be used inside a task)r   rn  r   r  r   r  r  r  rS   tasks     rT   r  zTimerContext.__enter__  sS    ,<I  ??&&D04 rY   r  r  r  c                     | j                   r| j                   j                          |t        j                  u r| j                  rt        j
                  d y rP   )r  popr   CancelledErrorr  r  r  s       rT   r  zTimerContext.__exit__  s>     ;;KKOOw---$//&&D0rY   c                     | j                   s2t        | j                        D ]  }|j                           d| _         y y NT)r  r   r  cancelr  s     rT   r^  zTimerContext.timeout  s8    DKK(  #DO	 rY   r  )rV   rW   rX   r   r   r  r  r  r  r  r   r   r  r	   r)  r  r^  rQ   rY   rT   r}  r}    sx    0 W66  4  
1
+ 4./ -( '	
 
$#rY   r}  delayrk  c                     | | dk  rt        j                  d       S t               }|j                         }|| z   }| |kD  rt	        |      }t        j
                  |      S ra  )async_timeoutr^  r   rI  r   
timeout_at)r  rk  r   rL  rd  s        rT   ceil_timeoutr    s^     }
$$T**D
))+C;D~Dz##D))rY   c                       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	Zedefd
       Zede	e   fd       Zede	e   fd       Zy)HeadersMixin)_content_type_content_dict_stored_content_type_headersNr  r  r  rawrN   c                     || _         |d| _        i | _        y t               j	                  d|z         }|j                         | _        |j                  d      }t        |dd        | _        y )Nzapplication/octet-streamzContent-Type: rQ   r$   )r  r  r  r   parsestrget_content_type
get_paramsdict)rS   r  msgr   s       rT   _parse_content_typez HeadersMixin._parse_content_type  si    $'!;!;D!#D.))*:S*@AC!$!5!5!7D^^B'F!%fQRj!1DrY   c                     | j                   j                  t        j                        }| j                  |k7  r| j                  |       | j                  S )z7The value of content part for Content-Type HTTP header.)r  r   r%   CONTENT_TYPEr  r  r  rS   r  s     rT   content_typezHeadersMixin.content_type  sF     mm 1 12$$+$$S)!!!rY   c                     | j                   j                  t        j                        }| j                  |k7  r| j                  |       | j                  j                  d      S )z7The value of charset part for Content-Type HTTP header.charset)r  r   r%   r  r  r  r  r  s     rT   r  zHeadersMixin.charset  sQ     mm 1 12$$+$$S)!!%%i00rY   c                 p    | j                   j                  t        j                        }|t	        |      S y)z(The value of Content-Length HTTP header.N)r  r   r%   CONTENT_LENGTHrH  )rS   content_lengths     rT   r  zHeadersMixin.content_length  s2     **4+>+>?%~&&rY   )rV   rW   rX   	frozensetATTRSr"   r   r   r  r   r  r   r3   r  r   r2   r  propertyr  r  rH  r  rQ   rY   rT   r  r    s    PQE3#'M8C='.2M8DcN+28@%T9 45@
2x} 
2 
2 "c " " 1# 1 1   rY   r  futzasyncio.Future[_T]resultc                 H    | j                         s| j                  |       y y rP   )done
set_result)r  r  s     rT   r  r  (  s    88:v rY   excc                 H    | j                         s| j                  |       y y rP   )r  set_exception)r  r  s     rT   r  r  -  s    88:# rY   c                   `    e Zd ZU dZdZee   ed<   ddede	ee
      fdZded	efd
Zd	efdZy)AppKeyz.Keys for static typing support in Application.)_name_t__orig_class__r  Nr   tc                     t        j                         }|r8|j                  j                  dk(  r|j                  d   }n|j
                  }|r8dz   |z   | _        || _        y )Nz<module>rV   .)r   currentframef_codeco_name	f_globalsf_backr  r  )rS   r   r  framemodules        rT   r  zAppKey.__init__=  s]    $$&||##z1#ooj9LLE	  c\D(
rY   otherrN   c                 V    t        |t              r| j                  |j                  k  S yr  )rz   r  r  )rS   r  s     rT   __lt__zAppKey.__lt__I  s"    eV$::++rY   c                 l   | j                   }|0t        t              5  t        | j                        d   }d d d        |d}nSt        |t              r8|j                  dk(  r|j                  }n'|j                   d|j                   }nt        |      }d| j                   d| dS # 1 sw Y   txY w)Nr   z<<Unknown>>builtinsr  z<AppKey(z, type=z)>)r  r   r!  r   r  rz   r   rW   rX   reprr  )rS   r  t_reprs      rT   __repr__zAppKey.__repr__N  s    GG9.) 5T001!45 9"F4 ||z)LL>1>>*:;!WF$**WVHB775 5s   B**B3rP   )rV   rW   rX   r   	__slots__r   objectr   r   r   r0   r  r)  r  r  rQ   rY   rT   r  r  2  sQ    81I
 L 
S 
Xd2h%7 
F t 
8# 8rY   r  c            	          e Zd ZdZdeeeeee	   f   e	f      ddfdZ
ddZedee   defd       Zedede	fd	       Zdeeee   f   de	fd
Zedee   dedeeef   fd       Zeddee   dddee   fd       Zeddede	de	fd       Zddeeee   f   de	de	fdZdefdZdeeeee	   f      fdZdedefdZdefdZdefdZy)r+   )_mapsmapsrN   Nc                 $    t        |      | _        y rP   )tupler  )rS   r  s     rT   r  zChainMapProxy.__init__d  s    4[
rY   c                 J    t        dj                  | j                              )Nz4Inheritance class {} from ChainMapProxy is forbidden)r{   r  rV   )rc   s    rT   __init_subclass__zChainMapProxy.__init_subclass__g  s"    !6#,,/
 	
rY   r   c                      y rP   rQ   rS   r   s     rT   __getitem__zChainMapProxy.__getitem__m      rY   c                      y rP   rQ   r  s     rT   r  zChainMapProxy.__getitem__q  r  rY   c                 f    | j                   D ]	  }	 ||   c S  t        |      # t        $ r Y "w xY wrP   )r  r   )rS   r   mappings      rT   r  zChainMapProxy.__getitem__u  sD    zz 	Gs|#	
 sm  s   $	00r   c                      y rP   rQ   rS   r   r   s      rT   r   zChainMapProxy.get}  r  rY   c                      y rP   rQ   r  s      rT   r   zChainMapProxy.get  r  rY   c                      y rP   rQ   r  s      rT   r   zChainMapProxy.get  r  rY   c                 0    	 | |   S # t         $ r |cY S w xY wrP   )r   r  s      rT   r   zChainMapProxy.get  s%    	9 	N	s    c                 V    t         t               j                  | j                         S rP   )lenr   unionr  rR   s    rT   __len__zChainMapProxy.__len__  s    ;35;;

+,,rY   c                 r    i }t        | j                        D ]  }|j                  |        t        |      S rP   )reversedr  updateiter)rS   dr  s      rT   __iter__zChainMapProxy.__iter__  s6    02

+ 	GHHW	 AwrY   c                 @    t        fd| j                  D              S )Nc              3   &   K   | ]  }|v  
 y wrP   rQ   )r  mr   s     rT   r  z-ChainMapProxy.__contains__.<locals>.<genexpr>  s     03!80s   anyr  r  s    `rT   __contains__zChainMapProxy.__contains__  s    0TZZ000rY   c                 ,    t        | j                        S rP   r  rR   s    rT   __bool__zChainMapProxy.__bool__  s    4::rY   c                 `    dj                  t        t        | j                              }d| dS )Nz, zChainMapProxy(r:   )r
  mapr  r  )rS   r   s     rT   r  zChainMapProxy.__repr__  s*    ))Cdjj12y**rY   r  ).rP   )rV   rW   rX   r  r   r   r   r   r  r
   r  r  r   r0   r  r1   r   r   rH  r  r   r   r  r)  r  r  r  rQ   rY   rT   r+   r+   a  s   I!XgeC4D.Es.J&KL !QU !
 vbz b   s s  uS&*_5 #  vbz B 5R=   vbz D 8B<   s S 3  uS&*_-  s - -(5fSk)9#:; 1 14 1$ +# +rY   r+   z[!\x23-\x7E\x80-\xff]+z(W/)?"(z)"z)(?:\s*,\s*|$)|(.)r   c                   &    e Zd ZU eed<   dZeed<   y)r,   r   Fis_weakN)rV   rW   rX   r   r   r  r)  rQ   rY   rT   r,   r,     s    JGTrY   r,   r   c                 `    | t         k7  r%t        j                  |       st        d| d      y y )NzValue z, is not a valid etag. Maybe it contains '"'?)ETAG_ANY	_ETAGC_RE	fullmatchr`   )r   s    rT   validate_etag_valuer    s9    !4!4U!;UIJK
 	
 "<rY   date_strc                     | Vt        |       }|It        t              5  t        j                  |dd dt        j                  j
                  icddd       S y# 1 sw Y   yxY w)z/Process a date string, return a datetime objectN   tzinfo)r   r   r`   datetimetimezoneutc)r  	timetuples     rT   parse_http_dater    sd    h'	 *% W(()BQ-V@Q@Q@U@UVW WWs   0AA#methodcodec                     t        |      xs@ t        |       xs3 d|cxk  xr dk  nc xr! | j                         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  s     rT   must_be_empty_bodyr$    sH     	't, 	G$V,	G4#E&,,.D4E4E"ErY   c                 D    | j                         t        j                  k(  S )z,Check if a method must return an empty body.)r   r%   	METH_HEAD)r  s    rT   r!  r!    s     <<>T^^++rY   c                 .    | dv xs d| cxk  xr dk  S c S )z1Check if a status code must return an empty body.   0     d   r  rQ   )r  s    rT   r   r     s$     :2!2s!22!22rY   c                     |dv xsE d|cxk  xr dk  nc xs3 d|cxk  xr dk  nc xr! | j                         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#  s     rT   should_remove_content_lengthr-    sM     	
 	G$	G4#E&,,.D4E4E"ErY   rP   )Tzutf-8)rZ  zTuple[weakref.ref[object], str]rN   Nr  )r   r   rm   rq   r   r  enum	functoolsr   r   r   platformresysrI  r   rc  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#   ry   r%   logr&   r'   version_infor  __all__systemIS_MACOSr   PY_310PY_311r0   r1   Enumr2   r3   r)  r   r   NO_EXTENSIONSr%  dev_modeignore_environmentDEBUGrangechrCHARCTL
SEPARATORSr  rM   r*   r   r   sr   r   r   r   r  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_regexro   _ipv4_regexb_ipv6_regexbr+  r.  partialr0  r1  r,  r-  r2  r3  rH  r   rK  rW  r]  r  r  TimerHandlere  rh  rj  r  r~  r}  Timeoutr  r  r  r  r  total_orderingr  r+   _ETAGCr  _QUOTED_ETAGQUOTED_ETAG_RELIST_QUOTED_ETAG_REr  r,   r  r  r$  r!  r   r-  )is   0rT   <module>rg     sv             	  	 
    "  % !        *  3  = =   /w#
08??(X__)+
			W	$			W	$ T]T]DIIk:.	RZZ^^$;<=		 			$$$Sbjjnn=Q.R)S 
 a&1A&Q|$!s1v$H(  F'
* 	s
Z 
:J
;(IJ :Jz)S )U30C+C%D )(- (V T$d3$ $ 4$
)HU[[$9 ) ) ):$sI~. 6 15+
7,,
-+"+ 15
7,,
-$C D 7s 7uS(92E-E'F 7 T$d3& & 4& R $S $X $ !$N hsm x}  rzz67!$-.qCF.$7
B3 
B3 
B ?F22!%28;2QT22jXwr{ >GBK >@ 	*
1 
   bjj'bjjbmm<rzz-..w78rzz-..w7r}}M
H3<
H!(
H7?c5j@Q7R
H	
H $)##NKN#)##NKN:sE9j'H!IJ :t : +/ (3- . %&s %&P  %&
  
#
#	
 " g!!"( %&	S 
#
# "	
 g!!"/  / d?~&89 ?

  
-## -#b 56*E?*,1**- -`( "  
+ - D 
 +8WR[ +8 +8\A+GE#vc{"23S89 A+J 
#BJJv	&$L) bjjAl^3E!FG  T$d3  4

s 
t 
hsm 9J9J0K s # $ ,c ,d ,3 3 3 C D Q '$f	 /`  		s$   Y2Y4Y$
Y) )Y21Y2