+
    ~j              	        a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHtHt ^ RIHtHtHtHtHtHt ^ RIHtHt ^RIHt ^RI H t  ^R	I!H"t"H#t#H$t$H%t% ^R
I&H't( ^RI)H*t*H+t+H,t,H-t-H.t.H/t/H0t0H1t1H2t2H3t3H4t4H5t5H6t6 ^RI)H7t8 ^RI9H:t: ^RI;H<t<H=t=H>t>H?t? ^RI@HAtA ]'       d   ^ RIBHCtC ^ RIHDtD ^RIH&tE ^RIFHGtGHHtHHItI RtJR]KR&   ]P                  ! 4       tMR]KR&   R^PRR/tNR]KR&   ]! R4      tO]! R4      tPRP                  ]P                  ! R]! R R!7      R",          4      4      tSR]KR#&   ]P                  R$8X  d   R% R& ltUR' R( lt0R) R* ltVR+ R, ltWRR- R. lltXR/ R0 ltYR1 R2 ltZ]P                  R3 R4 l4       t\R5 R6 lt]]R7 R8 l4       t^]R9 R: l4       t^R; R< lt^R= R> lt_R? R@ lt`RRA RB lltaRC RD ltbRE RF ltcRG RH ltdRI RJ lteRK RL ltfRM RN ltg]RO RP l4       th]RQ RR l4       thRS RT lthRU RV lti]j! R4      tkR]KRW&   RX RY ltlRZ R[ ltmR\ R] ltnR^ R_ ltoR` Ra ltpRb Rc ltq]P                  Rd Re l4       trRf Rg ltsRRh Ri llttRj Rk ltuRRl Rm lltvRRn Ro lltwRp Rq ltxRr Rs ltyRtP                  Ru4      t{]{^,          t|]{^,          t}Rv Rw lt~Rx Ry ltRz R{ ltR| R} ltR~ R ltR R ltR R ltR# )z
requests.utils
~~~~~~~~~~~~~~

This module provides utility functions that are used within Requests
that are also useful for external consumption.
)annotationsN)OrderedDict)	GeneratorIterable)TYPE_CHECKINGAnyFinalTypeVarcastoverload)make_headers	parse_url)certs__version__)_HEADER_VALIDATORS_BYTE_HEADER_VALIDATORS_STRHEADER_VALIDATORSto_native_string)SupportsItems)Mappingbytes
getproxiesgetproxies_environmentinteger_typesis_urllib3_1proxy_bypassproxy_bypass_environmentquotestrunquoteurlparse
urlunparse)parse_http_listcookiejar_from_dict)FileModeWarningInvalidHeader
InvalidURLUnrewindableBodyError)CaseInsensitiveDict)	CookieJar)BufferedWriter)_types)PreparedRequestRequestResponser   NETRC_FILESr   DEFAULT_CA_BUNDLE_PATHhttphttpsi  DEFAULT_PORTS_KT_VTz, z,\s*T)accept_encodingzaccept-encodingDEFAULT_ACCEPT_ENCODINGwin32c                    V ^8  d   QhRRRR/#    hostr   returnbool )formats   "c/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/requests/utils.py__annotate__rD   c   s     $ $C $D $    c                n    ^ RI p TP                  TP                  R4      p\	        TP                  TR4      ^ ,          4      pTP                  TR4      ^ ,          pT'       d	   T'       g   R# TP                  R4      p\        RT4      pT Fx  pTR8X  d   RT 9  d    R	# TP                  RR
4      pTP                  RR4      pTP                  RR4      p\        P                  ! YP\        P                  4      '       g   Kw   R	# 	  R#   \         d     R# i ; i  \        \        3 d     R# i ; i)    NFz;Software\Microsoft\Windows\CurrentVersion\Internet SettingsProxyEnableProxyOverride;z<local>.Tz\.*z.*?)winregImportErrorOpenKeyHKEY_CURRENT_USERintQueryValueExOSError
ValueErrorsplitfilterreplacerematchI)r>   rN   internetSettingsproxyEnableproxyOverridetests   &     rC   proxy_bypass_registryr`   c   s!   	
	%~~((N 
 f112BMRSTUVK"//0@/RSTUM -
 &++C0t]3!Dy d?<<U+D<<U+D<<T*DxxBDD)) " C  		 $ 		s#   D AD DDD43D4c                    V ^8  d   QhRRRR/# r<   rA   )rB   s   "rC   rD   rD      s     	/ 	/3 	/4 	/rE   c                N    \        4       '       d   \        V 4      # \        V 4      # )zReturn True, if the host should be bypassed.

Checks proxy settings gathered from the environment, if specified,
or the registry.
)r   r   r`   )r>   s   &rC   r   r      s#     "##+D11(..rE   c                    V ^8  d   QhRRRR/# )r=   dz6_t.SupportsItems[Any, Any] | Iterable[tuple[Any, Any]]r?   zIterable[tuple[Any, Any]]rA   )rB   s   "rC   rD   rD      s      =rE   c                R    \        V \        4      '       d   V P                  4       # V # )z/Returns an internal sequence dictionary update.)
isinstance_SupportsItemsitems)rd   s   &rC   dict_to_sequenceri      s"    
 !^$$wwyHrE   c                    V ^8  d   QhRRRR/# )r=   or   r?   rR   rA   )rB   s   "rC   rD   rD      s     D3 D3 D3 D3rE   c                |   R p^ p\         '       g(   \        V \        4      '       d   V P                  R4      p \	        V R4      '       d   \        V 4      pM\	        V R4      '       d   V P
                  pMo\	        V R4      '       d^    V P                  4       p\        P                  ! V4      P                  pRV P                  9  d   \        P                  ! R\        4       \	        V R4      '       df    V P#                  4       p\	        V R4      '       dC   Vf?    V P%                  ^ ^4       V P#                  4       pT P%                  T;'       g    ^ 4       Vf   ^ p\)        ^ W,
          4      #   \        P                  \         3 d     Li ; i  \&         d    ^ p LHi ; i  \&         d
    Te   Tp L_i ; i)	Nutf-8__len__lenfilenoba%  Requests has determined the content-length for this request using the binary size of the file: however, the file has been opened in text mode (i.e. without the 'b' flag in the mode). This may lead to an incorrect content-length. In Requests 3.0, support will be removed for files in text mode.tellseek)r   rf   r   encodehasattrro   rp   osfstatst_sizemodewarningswarnr&   ioUnsupportedOperationAttributeErrorrr   rs   rT   max)rk   total_lengthcurrent_positionrp   s   &   rC   	super_lenr      s   L<Jq#.. HHWq)1v	E		uu	H			XXZF 88F+33L !&& 2 $
 q&	% vvx q&!!l&:	%FF1aL#$668L FF+00q1 q,122e ''8 	 		X  %#$L%%  	0
 '#/ 	0s<   E3 7F' 5F F 3FFF$#F$'F;:F;c               $    V ^8  d   QhRRRRRR/# )r=   urlz
_t.UriTyperaise_errorsr@   r?   ztuple[str, str] | NonerA   )rB   s   "rC   rD   rD      s$     1 1	1#'11rE   c                   \        V \        4      '       d   V P                  R4      p \        P                  P                  R4      pVe   V3pMR \         4       p ^ RIHpHp RpV FK  p\        P                  P                  V4      p\        P                  P                  V4      '       g   KI  Tp M	  Vf   R# \        V 4      p	V	P                  p
V
f   R#  V! V4      P                  V
4      pV'       dL   \        V4      '       d9   V^ ,          '       d   ^ M^pW,          ;'       g    RV^,          ;'       g    R3# R# R#   T\         3 d    T'       d   h  R# i ; i  \"        \$        3 d     R# i ; i)z;Returns the Requests tuple auth for a given url from netrc.rm   NETRCNc              3  ,   "   T F
  pR V 2x  K  	  R# 5i)z~/NrA   ).0fs   & rC   	<genexpr>!get_netrc_auth.<locals>.<genexpr>   s     9[Rs8[s   )NetrcParseErrornetrc )rf   r   decoderv   environgetr1   r   r   path
expanduserexistsr!   hostnameauthenticatorsanyrT   rO   r~   )r   r   
netrc_filenetrc_locationsr   r   
netrc_pathr   locrir>   _netrclogin_is   &&           rC   get_netrc_authr      sH   
 #ujj!(J%-9[9#0
 A''$$Q'Cww~~c"" 
	 ! c]{{<
	:&55d;F#f++%ayy!a--2vayB?? &v  ) 	  	 ( s[   AE% 2
E% >E% E ;E E .E  E E"E"E% !E""E% %E:9E:c                    V ^8  d   QhRRRR/# )r=   objr   r?   
str | NonerA   )rB   s   "rC   rD   rD     s     & & &
 &rE   c                    \        V RR4      pV'       d^   \        V\        \        34      '       d@   V^ ,          R8w  d0   VR,          R8w  d    \        P
                  P                  V4      # R# R# R# R# )z0Tries to guess the filename of the given object.nameN<>)getattrrf   r   r   rv   r   basename)r   r   s   & rC   guess_filenamer     s[    3%D
4#u..47c>d2hRUoww%% GV>.trE   c                    V ^8  d   QhRRRR/# )r=   r   r   r?   rA   )rB   s   "rC   rD   rD   "  s     # #s #s #rE   c                X   \         P                  P                  V 4      '       d   V # \         P                  P                  V 4      w  rV'       dd   \         P                  P                  V4      '       g?   \         P                  P                  V4      w  rV'       g   MRP	                  W2.4      pKk  \
        P                  ! V4      '       g   V # \
        P                  ! V4      pW$P                  4       9  d   V # \         P                  P                  VP                  R4      R,          4      R,          p\        P                  ! VR7      w  rg \         P                  ! WdP                  V4      4       \         P                  ! V4       V#   \         P                  ! T4       i ; i)zReplace nonexistent paths that look like they refer to a member of a zip
archive with the location of an extracted copy of the target, or else
just return the provided path unchanged.
/)suffixr   )rv   r   r   rV   joinzipfile
is_zipfileZipFilenamelistsplitexttempfilemkstempwritereadclose)r   archivememberprefixzip_filer   fdextracted_paths   &       rC   extract_zipped_pathsr   "  s"   
 
ww~~d ggmmD)OG
"''..11''--0 6*+g&&w'H&&(( WWfll3/34R8F!))8B
]]6*+
 	s   %F F)c                    V ^8  d   QhRRRR/# )r=   filenamer   r?   z%Generator[BufferedWriter, None, None]rA   )rB   s   "rC   rD   rD   I  s     	 	# 	"G 	rE   c              #  r  "   \         P                  ! \        P                  P	                  V 4      R7      w  r \        P
                  ! VR4      ;_uu_ 4       pVx  RRR4       \        P                  ! W 4       R#   + '       g   i     L(; i  \         d    \        P                  ! T4       h i ; i5i)z-Write a file to the disk in an atomic fashion)dirwbN)	r   r   rv   r   dirnamefdopenrX   BaseExceptionremove)r   tmp_descriptortmp_nametmp_handlers   &   rC   atomic_openr   H  s}       (//BGGOOH4MNNYY~t,, -


8& -,  
		(s4   7B7B A>B <B7>B		B #B44B7c                    V ^8  d   QhRRRR/# )r=   valuez4Mapping[Any, Any] | Iterable[tuple[Any, Any]] | Noner?   zdict[Any, Any] | NonerA   )rB   s   "rC   rD   rD   U  s      ?rE   c                    V f   R# \        V \        \        \        \        34      '       d   \        R4      h\        V 4      # )a  Take an object and test to see if it can be represented as a
dictionary. Unless it can not be represented as such, return an
OrderedDict, e.g.,

::

    >>> from_key_val_list([('key', 'val')])
    OrderedDict([('key', 'val')])
    >>> from_key_val_list('string')
    Traceback (most recent call last):
    ...
    ValueError: cannot encode objects that are not 2-tuples
    >>> from_key_val_list({'key': 'val'})
    OrderedDict([('key', 'val')])

:rtype: OrderedDict
N+cannot encode objects that are not 2-tuples)rf   r   r   r@   rR   rU   r   r   s   &rC   from_key_val_listr   U  s9    ( }%#udC011FGGurE   c                    V ^8  d   QhRRRR/# )r=   r   Noner?   rA   )rB   s   "rC   rD   rD   s  s     - -4 -D -rE   c                    R # NrA   r   s   &rC   to_key_val_listr   r  s    *-rE   c                    V ^8  d   QhRRRR/# )r=   r   z6_t.SupportsItems[_KT, _VT] | Iterable[tuple[_KT, _VT]]r?   zlist[tuple[_KT, _VT]]rA   )rB   s   "rC   rD   rD   u  s        A  rE   c                    R # r   rA   r   s   &rC   r   r   t  s      rE   c                    V ^8  d   QhRRRR/# )r=   r   z=_t.SupportsItems[_KT, _VT] | Iterable[tuple[_KT, _VT]] | Noner?   zlist[tuple[_KT, _VT]] | NonerA   )rB   s   "rC   rD   rD   x  s      H!rE   c                    V f   R# \        V \        \        \        \        34      '       d   \        R4      h\        V \        4      '       d   \        V P                  4       4      # \        V 4      # )a  Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,

::

    >>> to_key_val_list([('key', 'val')])
    [('key', 'val')]
    >>> to_key_val_list({'key': 'val'})
    [('key', 'val')]
    >>> to_key_val_list('string')
    Traceback (most recent call last):
    ...
    ValueError: cannot encode objects that are not 2-tuples

:rtype: list
Nr   )	rf   r   r   r@   rR   rU   rg   listrh   r   s   &rC   r   r   x  sV    & }%#udC011FGG%((EKKM"";rE   c                    V ^8  d   QhRRRR/# )r=   r   r   r?   	list[str]rA   )rB   s   "rC   rD   rD     s      S Y rE   c                    . p\        V 4       F>  pVR,          VRR u;8X  d   R8X  d   M M\        V^R 4      pVP                  V4       K@  	  V# )a  Parse lists as described by RFC 2068 Section 2.

In particular, parse comma-separated lists where the elements of
the list may include quoted-strings.  A quoted-string could
contain a comma.  A non-quoted string could have quotes in the
middle.  Quotes are removed automatically after parsing.

It basically works like :func:`parse_set_header` just that items
may appear multiple times and case sensitivity is preserved.

The return value is a standard :class:`list`:

>>> parse_list_header('token, "quoted value"')
['token', 'quoted value']

To create a header from the :class:`list` again, use the
:func:`dump_header` function.

:param value: a string with a list header.
:return: :class:`list`
:rtype: list
N   NN"r   )_parse_list_headerunquote_header_valueappend)r   resultitems   &  rC   parse_list_headerr     sR    . F"5)8tBCy'C''Qr
3Dd * MrE   c                    V ^8  d   QhRRRR/# )r=   r   r   r?   dict[str, str | None]rA   )rB   s   "rC   rD   rD     s      S %: rE   c                    / p\        V 4       FR  pRV9  d   RW&   K  VP                  R^4      w  r0V R,          V RR u;8X  d   R8X  d   M M\        V ^R 4      p WV&   KT  	  V# )a"  Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict:

>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
>>> sorted(d.items())
[('bar', 'as well'), ('foo', 'is a fish')]

If there is no value for a key it will be `None`:

>>> parse_dict_header('key_without_value')
{'key_without_value': None}

To create a header from the :class:`dict` again, use the
:func:`dump_header` function.

:param value: a string with a dict header.
:return: :class:`dict`
:rtype: dict
=Nr   r   r   )r   rV   r   )r   r   r   r   s   &   rC   parse_dict_headerr     sp    , %'F"5)d?FLjja(9bc
)c)(q5Et * MrE   c               $    V ^8  d   QhRRRRRR/# )r=   r   r   is_filenamer@   r?   rA   )rB   s   "rC   rD   rD     s!       $ 3 rE   c                    V '       d_   V ^ ,          V R,          u;8X  d   R8X  dB   M V # V ^R p V'       d   V R,          R8w  d#   V P                  RR4      P                  RR4      # V # )zUnquotes a header value.  (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.

:param value: the header value to unquote.
:rtype: str
r   Nr=   Nz\\\z\"r   )rX   )r   r   s   &&rC   r   r     sb     qU2Y-#- L a eBi61==.66ucBBLrE   c                    V ^8  d   QhRRRR/# )r=   cjr+   r?   r   rA   )rB   s   "rC   rD   rD     s      I *? rE   c                Z    V  Uu/ uF  qP                   VP                  bK  	  ppV# u upi )ztReturns a key/value dictionary from a CookieJar.

:param cj: CookieJar object to extract cookies from.
:rtype: dict
)r   r   )r   cookiecookie_dicts   &  rC   dict_from_cookiejarr     s.     <>>2;;,2K> ?s   (c               $    V ^8  d   QhRRRRRR/# )r=   r   r+   r   dict[str, str]r?   rA   )rB   s   "rC   rD   rD     s!     0 0i 0n 0 0rE   c                    \        W4      # )zReturns a CookieJar from a key/value dictionary.

:param cj: CookieJar to insert cookies into.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:rtype: CookieJar
r$   )r   r   s   &&rC   add_dict_to_cookiejarr     s     {//rE   c                    V ^8  d   QhRRRR/# )r=   contentr   r?   r   rA   )rB   s   "rC   rD   rD   
  s       	 rE   c                v   \         P                  ! R\        4       \        P                  ! R\        P
                  R7      p\        P                  ! R\        P
                  R7      p\        P                  ! R4      pVP                  V 4      VP                  V 4      ,           VP                  V 4      ,           # )zdReturns encodings from given content string.

:param content: bytestring to extract encodings from.
zIn requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)z!<meta.*?charset=["\']*(.+?)["\'>])flagsz+<meta.*?content=["\']*;?charset=(.+?)["\'>]z$^<\?xml.*?encoding=["\']*(.+?)["\'>])rz   r{   DeprecationWarningrY   compiler[   findall)r   
charset_re	pragma_rexml_res   &   rC   get_encodings_from_contentr	  
  s    
 MM1 	 @MJ

IQSQUQUVIZZ?@F 	7#


G
$	%
..
!	"rE   c                    V ^8  d   QhRRRR/# )r=   headerr   r?   ztuple[str, dict[str, Any]]rA   )rB   s   "rC   rD   rD   #  s     % %s %/I %rE   c                j   V P                  R4      pV^ ,          P                  4       VR,          r2/ pRpV Fw  pVP                  4       pV'       g   K  VP                  R4      ;pR8w  g   K7  VRV P                  V4      pWg^,           R P                  V4      p	WVP                  4       &   Ky  	  W$3# )zReturns content type and parameters from given header.

:param header: string
:return: tuple containing content type and dictionary of
     parameters.
rJ   r   NNz"' r   Nr   )rV   stripfindlower)
r  tokenscontent_typeparamsparams_dictstrip_charsparamidxkeyr   s
   &         rC   _parse_content_type_headerr  #  s     \\#F!!9??,fRj&)+KK5UZZ_,c3+##K0C')$**;7E',		$  $$rE   c                    V ^8  d   QhRRRR/# )r=   headersCaseInsensitiveDict[str]r?   r   rA   )rB   s   "rC   rD   rD   9  s      '? J rE   c                    V P                  R4      pV'       g   R# \        V4      w  rRV9   d   VR,          P                  R4      # RV9   d   R# RV9   d   R# R# )	zqReturns encodings from given HTTP Header Dict.

:param headers: dictionary to extract encoding from.
:rtype: str
zcontent-typeNcharsetz'"textz
ISO-8859-1zapplication/jsonrm   )r   r  r  )r  r  r  s   &  rC   get_encoding_from_headersr   9  s^     ;;~.L5lCLFi &&u--\) *rE   c               $    V ^8  d   QhRRRRRR/# )r=   iteratorzIterable[bytes]rr0   r?   z"Generator[str | bytes, None, None]rA   )rB   s   "rC   rD   rD   R  s$      "*'rE   c              #  &  "   VP                   f   T  Rj  xL
  R# \        P                  ! VP                   4      ! RR7      pV  F"  pVP                  V4      pV'       g   K  Vx  K$  	  VP                  RRR7      pV'       d   Vx  R# R#  Lx5i)zStream decodes an iterator.NrX   errorsrE   T)final)encodingcodecsgetincrementaldecoderr   )r"  r#  decoderchunkrvs   &&   rC   stream_decode_response_unicoder.  R  s~     
 	zz**1::6iHG^^E"2H  
4	(B	 
 	s   BBAB$"B	Bc               $    V ^8  d   QhRRRRRR/# )r=   stringr   slice_length
int | Noner?   zGenerator[bytes, None, None]rA   )rB   s   "rC   rD   rD   f  s$     ' ''!+'!'rE   c                    R # r   rA   r0  r1  s   &&rC   iter_slicesr5  e  s     $'rE   c               $    V ^8  d   QhRRRRRR/# )r=   r0  r   r1  r2  r?   zGenerator[str, None, None]rA   )rB   s   "rC   rD   rD   j  s$     % %%)%%rE   c                    R # r   rA   r4  s   &&rC   r5  r5  i  s     "%rE   c               $    V ^8  d   QhRRRRRR/# )r=   r0  zbytes | strr1  r2  r?   z"Generator[bytes | str, None, None]rA   )rB   s   "rC   rD   rD   m  s$     	 		'1	'	rE   c              #     "   ^ pVe   V^ 8:  d   \        V 4      pV\        V 4      8  d   WW!,            x  W!,          pK&  R# 5i)z Iterate over slices of a string.N)ro   )r0  r1  poss   && rC   r5  r5  m  sI      C|q06{
F
3-.. s   AAc                    V ^8  d   QhRRRR/# )r=   r#  r0   r?   zstr | bytes | NonerA   )rB   s   "rC   rD   rD   y  s     & & &.@ &rE   c                   \         P                  ! R\        4       V P                  f   R# . p\	        V P
                  4      pV'       d    \        V P                  V4      #  \        V P                  T;'       g    RRR7      #   \         d    TP                  T4        LAi ; i  \         d    T P                  u # i ; i)zReturns the requested content back in unicode.

:param r: Response object to get unicode content from.

Tried:

1. charset from content-type
2. fall back and replace all unicode characters

:rtype: str
zIn requests 3.0, get_unicode_from_response will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)Nrm   rX   r%  )
rz   r{   r  r   r   r  r   UnicodeErrorr   	TypeError)r#  tried_encodingsr(  s   &  rC   get_unicode_from_responser@  y  s     MM1 	 	yy!#O )3H	-qyy(++
199h11')DD  	-""8,	-  yys*   B #B' <B' B$#B$'C CUNRESERVED_SETc                    V ^8  d   QhRRRR/# r=   urir   r?   rA   )rB   s   "rC   rD   rD     s      C C rE   c                   V P                  R4      p\        ^\        V4      4       F  pW,          R,          p\        V4      ^8X  da   VP                  4       '       dK    \	        \        V^4      4      pT\        9   d   YAT,          R,          ,           Y&   Ks  RY,           2Y&   K  RW,           2W&   K  	  RP                  V4      #   \         d    \        RT R24      hi ; i)zUn-escape any percent-escape sequences in a URI that are unreserved
characters. This leaves all reserved, illegal and non-ASCII bytes encoded.

:rtype: str
%:rG   r=   Nz"Invalid percent-escape sequence: '':r=   NNr   )
rV   rangero   isalnumchrrR   rU   r(   rA  r   )rD  partsihcs   &    rC   unquote_unreservedrO    s     IIcNE1c%j!HSMq6Q;199;;LAr
O N"Qx|+uxj>58*~EH " 775>  L #EaS!JKKLs    CC&c                    V ^8  d   QhRRRR/# rC  rA   )rB   s   "rC   rD   rD     s     5 5S 5S 5rE   c                r    RpRp \        \        V 4      VR7      #   \         d    \        YR7      u # i ; i)zRe-quote the given URI.

This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.

:rtype: str
z!#$%&'()*+,/:;=?@[]~z!#$&'()*+,/:;=?@[]~)safe)r   rO  r(   )rD  safe_with_percentsafe_without_percents   &  rC   requote_urirU    sG     /0	5 ',3DEE 5 S44	5s    66c               $    V ^8  d   QhRRRRRR/# )r=   ipr   netr?   r@   rA   )rB   s   "rC   rD   rD     s!     5 53 5S 5T 5rE   c           
        \         P                  ! R\        P                  ! V 4      4      ^ ,          pVP	                  R4      w  r4\         P                  ! R\        P                  ! \        \        V4      4      4      4      ^ ,          p\         P                  ! R\        P                  ! V4      4      ^ ,          V,          pW%,          We,          8H  # )zThis function allows you to check if an IP belongs to a network subnet

Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
         returns False if ip = 192.168.1.1 and net = 192.168.100.0/24

:rtype: bool
z=Lr   )structunpacksocket	inet_atonrV   dotted_netmaskrR   )rW  rX  ipaddrnetaddrbitsnetmasknetworks   &&     rC   address_in_networkrd    s     ]]4!1!1"!56q9FIIcNMGmmD&"2"2>#d)3L"MNqQGmmD&"2"27";<Q?'IG'"344rE   c                    V ^8  d   QhRRRR/# )r=   maskrR   r?   r   rA   )rB   s   "rC   rD   rD     s     5 5 5 5rE   c                    R^^ V ,
          ,          ^,
          ,          p\         P                  ! \        P                  ! RV4      4      # )zuConverts mask from /xx format to xxx.xxx.xxx.xxx

Example: if mask is 24 function returns 255.255.255.0

:rtype: str
l    z>I)r\  	inet_ntoarZ  pack)rf  ra  s   & rC   r^  r^    s7     b4i1,,DFKKd344rE   c                    V ^8  d   QhRRRR/# )r=   	string_ipr   r?   r@   rA   )rB   s   "rC   rD   rD     s      s t rE   c                X     \         P                  ! V 4       R#   \         d     R# i ; i)z
:rtype: bool
FT)r\  r]  rT   )rk  s   &rC   is_ipv4_addressrm    s.    #   s    ))c                    V ^8  d   QhRRRR/# )r=   string_networkr   r?   r@   rA   )rB   s   "rC   rD   rD     s      # $ rE   c                <   V P                  R4      ^8X  db    \        V P                  R4      ^,          4      pT^8  g   T^ 8  d   R#  \        P
                  ! T P                  R4      ^ ,          4       R# R#   \         d     R# i ; i  \         d     R# i ; i)zJ
Very simple check of the cidr format in no_proxy variable.

:rtype: bool
r   FT)countrR   rV   rU   r\  r]  rT   )ro  rf  s   & rC   is_valid_cidrrr    s     C A%	~++C034D !8tby	^11#6q9:
    		  		s#   !A: 
,B :B	B	BBc               $    V ^8  d   QhRRRRRR/# )r=   env_namer   r   r   r?   zGenerator[None, None, None]rA   )rB   s   "rC   rD   rD     s"     1 1# 1j 15P 1rE   c              #  n  "   VRJpRpV'       d3   \         P                  P                  V 4      pV\         P                  V &    Rx  V'       d-   Vf   \         P                  V  R# V\         P                  V &   R# R#   T'       d+   Tf   \         P                  T  i T\         P                  T &   i i ; i5i)zSet the environment variable 'env_name' to 'value'

Save previous value, yield, and then restore the previous value stored in
the environment variable 'env_name'.

If 'value' is None, do nothingN)rv   r   r   )rt  r   value_changed	old_values   &&  rC   set_environrx    s      %M IJJNN8,	$

81 JJx('0

8$	 = JJx('0

8$	 s   AB5A> 6B5>4B22B5c               $    V ^8  d   QhRRRRRR/# )r=   r   r   no_proxyr   r?   r@   rA   )rB   s   "rC   rD   rD   *  s!     < <s <j <T <rE   c                L   R R lpTpVf	   V! R4      p\        V 4      pVP                  pVf   R# V'       Ed   R VP                  RR4      P                  R	4       4       p\	        V4      '       d;   V F3  p\        V4      '       d   \        WW4      '       d    R# K*  WW8X  g   K2   R# 	  MTpVP                  '       d   VR
VP                   2,          pV F]  p	V	P                  R4      p	WY8X  g   W8X  d    R# RV	,           p	VP                  V	4      '       g   VP                  V	4      '       g   K\   R# 	  \        RV4      ;_uu_ 4         \        V4      p
RRR4       X
'       d   R# R#   \        \        P                  3 d    Rp
 L3i ; i  + '       g   i     L?; i)z@
Returns whether we should bypass proxies or not.

:rtype: bool
c                    V ^8  d   QhRRRR/# )r=   r  r   r?   r   rA   )rB   s   "rC   rD   +should_bypass_proxies.<locals>.__annotate__3  s     B Bs Bz BrE   c                    \         P                  P                  V 4      ;'       g.    \         P                  P                  V P                  4       4      # r   )rv   r   r   upper)r  s   &rC   	get_proxy(should_bypass_proxies.<locals>.get_proxy3  s0    zz~~c"AAbjjnnSYY[&AArE   Nrz  Tc              3  8   "   T F  q'       g   K  Vx  K  	  R # 5ir   rA   )r   r>   s   & rC   r   (should_bypass_proxies.<locals>.<genexpr>E  s     X+O4SW$$+Os   	
 r   ,:rK   F)r!   r   rX   rV   rm  rr  rd  portlstripendswithrx  r   r>  r\  gaierror)r   rz  r  no_proxy_argparsedr   no_proxy_hostsproxy_iphost_with_portr>   bypasss   &&         rC   should_bypass_proxiesr  *  sp   B
 LZ(c]FHx Y8+;+;C+D+J+J3+OX8$$* **)(==# >)   + &N{{{Afkk]"33&{{3'#~'=Tz$$T**n.E.Ed.K.K ' 
Z	.	.	!(+F 
/  6??+ 	F	 
/	.s*   FE00FFFFF#	c               $    V ^8  d   QhRRRRRR/# )r=   r   r   rz  r   r?   r   rA   )rB   s   "rC   rD   rD   i  s!     	 	S 	J 	. 	rE   c                >    \        WR7      '       d   / # \        4       # )z5
Return a dict of environment proxies.

:rtype: dict
rz  )r  r   )r   rz  s   &&rC   get_environ_proxiesr  i  s     S44	|rE   c               $    V ^8  d   QhRRRRRR/# )r=   r   r   proxiesdict[str, str] | Noner?   r   rA   )rB   s   "rC   rD   rD   u  s"      c $9 j rE   c                d   T;'       g    / p\        V 4      pVP                  f,   VP                  VP                  VP                  R4      4      # VP                  R,           VP                  ,           VP                  RVP                  ,           R.pRpV F  pWQ9   g   K  W,          p V# 	  V# )zSelect a proxy for the url, if applicable.

:param url: The url being for the request
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
Nallz://zall://)r!   r   r   scheme)r   r  urlparts
proxy_keysproxy	proxy_keys   &&    rC   select_proxyr  u  s     mmG}H {{8??GKK,>?? 	%("3"338$$$	J E	&EL  
 LrE   c               (    V ^8  d   QhRRRRRRRR/# )	r=   requestzRequest | PreparedRequestr  r  	trust_envr@   r?   r   rA   )rB   s   "rC   rD   rD     s0      &"  	rE   c                t   Ve   TM/ p\        \        V P                  4      p\        V4      P                  pVP                  R4      pVP                  4       pV'       dX   \        W5R7      '       gF   \        W5R7      pVP                  WGP                  R4      4      pV'       d   VP                  WH4       V# )a  This method takes proxy information from a request and configuration
input to resolve a mapping of target proxies. This will consider settings
such as NO_PROXY to strip proxy configurations.

:param request: Request or PreparedRequest
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
:param trust_env: Boolean declaring whether to trust environment configs

:rtype: dict
rz  r  r  )
r
   r   r   r!   r  r   copyr  r  
setdefault)	r  r  r  r   r  rz  new_proxiesenviron_proxiesr  s	   &&&      rC   resolve_proxiesr    s     !,g"G
sGKK
 Cc]!!F{{:&H,,.K.sFF-cE##F,?,?,FG""61rE   c                    V ^8  d   QhRRRR/# )r=   r   r   r?   rA   )rB   s   "rC   rD   rD     s     # #S # #rE   c                    V  R\          2# )zC
Return a string representing the default user agent.

:rtype: str
r   r   )r   s   &rC   default_user_agentr    s     V1[M""rE   c                   V ^8  d   QhRR/# )r=   r?   r  rA   )rB   s   "rC   rD   rD     s      1 rE   c            
     @    \        R\        4       R\        RRRR/4      # )z1
:rtype: requests.structures.CaseInsensitiveDict
z
User-AgentzAccept-EncodingAcceptz*/*
Connectionz
keep-alive)r*   r  r9   rA   rE   rC   default_headersr    s/     ,.6e,		
 rE   c                    V ^8  d   QhRRRR/# )r=   r   r   r?   zlist[dict[str, str]]rA   )rB   s   "rC   rD   rD     s     " "c "&: "rE   c                   . pRpV P                  V4      p V '       g   V# \        P                  ! RV 4       F  p VP                  R^4      w  rERVP                  R4      /pVP                  R4       F9  p VP                  R4      w  rT P                  T4      YhP                  T4      &   K;  	  VP	                  V4       K  	  V#   \         d    TRrT Li ; i  \         d      K:  i ; i)zReturn a list of parsed link headers proxies.

i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"

:rtype: list
z '"z, *<rJ   r   r   z<> '"r   )r  rY   rV   rU   r   )	r   linksreplace_charsvalr   r  linkr  r  s	   &        rC   parse_header_linksr    s     #%EMKK&Exx&	"))C+KC !&syy':;\\#&E"[[-
 .3[[-GD=)* ' 	T! '$ L  	"r	"  s#   C7CCCC+*C+ asciic                    V ^8  d   QhRRRR/# )r=   datar   r?   r   rA   )rB   s   "rC   rD   rD     s       : rE   c                   V R,          pV\         P                  \         P                  39   d   R# VR,          \         P                  8X  d   R# VR,          \         P                  \         P
                  39   d   R# VP                  \        4      pV^ 8X  d   R# V^8X  d)   VR,          \        8X  d   R	# VR
,          \        8X  d   R# V^8X  d)   VR,          \        8X  d   R# VR,          \        8X  d   R# R# )z
:rtype: str
:N   Nzutf-32:N   Nz	utf-8-sigr   zutf-16rm   :NNr=   z	utf-16-be:r   Nr=   z	utf-16-lez	utf-32-ber  z	utf-32-leN)
r)  BOM_UTF32_LEBOM_UTF32_BEBOM_UTF8BOM_UTF16_LEBOM_UTF16_BErq  _null_null2_null3)r  sample	nullcounts   &  rC   guess_json_utfr    s     "XF&%%v':':;;bzV__$bzf))6+>+>??U#IA~A~#;& $<6!A~":":rE   c               $    V ^8  d   QhRRRRRR/# )r=   r   r   
new_schemer?   rA   )rB   s   "rC   rD   rD     s&     C C# C3 C3 CrE   c                    \        V 4      pVw  r4rVrxp	VP                  p
V
'       g   YzrzV'       d#   \        \        V
4      p
RP	                  WJ.4      p
Vf   TpVf   Rp\        W:VRW34      # )zGiven a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.

:rtype: str
@r   )r   netlocr
   r   r   r"   )r   r  r  r  auth_host_portr   queryfragmentr  s   &&         rC   prepend_scheme_if_neededr    sw     s^F8>5F%X ]]F c6"4.)~|vtRABBrE   c                    V ^8  d   QhRRRR/# )r=   r   r   r?   ztuple[str, str]rA   )rB   s   "rC   rD   rD   .  s      3 ? rE   c                    \        V 4      p \        VP                  4      \        VP                  4      3pV#   \        \
        3 d    Rp T# i ; i)zoGiven a url with authentication components, extract them into a tuple of
username,password.

:rtype: (str,str)
)r   r   )r!   r    usernamepasswordr~   r>  )r   r  r  s   &  rC   get_auth_from_urlr  .  sU     c]F('&//*BC K I& Ks   *9 AAc                    V ^8  d   QhRRRR/# )r=   r  tuple[str | bytes, str | bytes]r?   r   rA   )rB   s   "rC   rD   rD   ?  s     , ,"A ,d ,rE   c                >    V w  r\        W^ 4       \        W^4       R# )zVerifies that header parts don't contain leading whitespace
reserved characters, or return characters.

:param header: tuple, in the format (name, value).
N)_validate_header_part)r  r   r   s   &  rC   check_header_validityr  ?  s     KD&*&+rE   c               (    V ^8  d   QhRRRRRRRR/# )	r=   r  r  header_partzstr | bytesheader_validator_indexrR   r?   r   rA   )rB   s   "rC   rD   rD   J  s0     
 
+

  
 
	
rE   c           
     :   \        V\        4      '       d   \        V,          pMB\        V\        4      '       d   \        V,          pM\        R V: RV  R\        V4       24      hVP                  V4      '       g   V^ 8X  d   RMRp\        RV RV: 24      hR# )zHeader part (z) from z# must be of type str or bytes, not r   r   zTInvalid leading whitespace, reserved character(s), or return character(s) in header z: N)rf   r   r   r   r   r'   typerZ   )r  r  r  	validatorheader_kinds   &&&  rC   r  r  J  s    
 +s##*+AB		K	'	'+,BC	K?'& :115k1B0CE
 	

 ??;'' 6! ;f&&1]"[OE
 	
 (rE   c                    V ^8  d   QhRRRR/# )r=   r   r   r?   rA   )rB   s   "rC   rD   rD   b  s     A As As ArE   c                    \        V 4      w  rr4rVV'       g   Y2r2VP                  R^4      R,          p\        WW4VR34      # )zK
Given a url remove the fragment and the authentication part.

:rtype: str
r  r   r   )r!   rsplitr"   )r   r  r  r   r  r  	_fragments   &      rC   urldefragauthr  b  sG     6>c]2FD% ]]3"2&FvtUB?@@rE   c                    V ^8  d   QhRRRR/# )r=   prepared_requestr.   r?   r   rA   )rB   s   "rC   rD   rD   s  s     S S/ Sd SrE   c                    \        V P                  RR4      pVe6   \        V P                  \        4      '       d    V! V P                  4       R# \        R4      h  \
         d    \        R4      hi ; i)z^Move file pointer back to its recorded starting position
so it can be read again on redirect.
rs   Nz;An error occurred when rewinding request body for redirect.z+Unable to rewind request body for redirect.)r   bodyrf   _body_positionr   rT   r)   )r  	body_seeks   & rC   rewind_bodyr  s  sz     (--vt<I''" "	&556 $$QRR  	'M 	s   A A3)z.netrcr   )FzBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~r   )T)zpython-requests)__conditional_annotations____doc__
__future__r   r)  
contextlibr|   rv   rY   r\  rZ  sysr   rz   r   collectionsr   collections.abcr   r   typingr   r   r   r	   r
   r   urllib3.utilr   r   r   r   r   _internal_utilsr   r   r   r   r-   r   rg   compatr   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r   cookiesr%   
exceptionsr&   r'   r(   r)   
structuresr*   http.cookiejarr+   r,   _tmodelsr.   r/   r0   r1   __annotations__wherer2   r5   r6   r7   r   rV   r9   platformr`   ri   r   r   r   r   contextmanagerr   r   r   r   r   r   r   r   r	  r  r   r.  r5  r@  	frozensetrA  rO  rU  rd  r^  rm  rr  rx  r  r  r  r  r  r  r  rt   r  r  r  r  r  r  r  r  r  r  )r  s   @rC   <module>r	     s   #   	 	 	   
    # /  1  $  4    : (  ,(!::)U ) $kkm  + GS1u 1enen "&HHWl489JKL"  
 <<7$L	/D3N1h&#L 	 	: 
 - 
 -	  
 @@F202%,2& 
' 
' 
% 
%	&T "M 
05,550 1 1,<~	4>#"L 	g		@C<",
0A"SrE   