
    Ii6              
       r   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	J
r
  S SKJr  S SKrSSKJr  \R                   (       a  SSKJr  SSS	.r\R)                  \" S
5       V s0 s H"  o S:w  d  M
  \" U 5      SR/                  U 5      _M$     sn 5        \R0                  " SR3                  \R5                  5        V s/ s H  n \R7                  U 5      PM     sn 5      5      r S9S\R:                  \\4   S\ S\RB                  \   S\4S jjr" S9S\R:                  \\4   S\RB                  \   S\4S jjr#SSS\4S jr$S\S\ 4S jr%S\S\S\4S jr&S\RB                  \   4S jr'S\S\RP                  \RR                  \\4      4S jr*S\S\RB                  \   4S jr+SS1r,S\RZ                  \R\                  \R^                  \R^                  4      S\R`                  \R\                  \R^                  \R^                  4      4S  jr1S!S"S\RB                  \2   4S# jr3S!S"S$S"S\ 4S% jr4S!S"S&S"S\ 4S' jr5S\RR                  \\RB                  \   4   4S( jr6S:S\R:                  \\4   S\S\4S) jjr7S:S\R:                  \\4   S\S\4S* jjr8S\S+\R^                  S\R^                  4S, jr9S\S\4S- jr:S.\RB                  \   S\RB                  \   4S/ jr;S0\Rx                  S\RB                  \2   4S1 jr= " S2 S35      r> " S4 S55      r?S6\S\ 4S7 jr@S6\S\ 4S8 jrAgs  sn f s  sn f );    N)Path)
getproxies   )PrimitiveDataURLz%22z\\)"\       z%{:02X}|valuelowerencodingreturnc                     [        U [        5      (       a  U nOU R                  U=(       d    S5      nU(       a  UR                  5       $ U$ )z=
Coerce str/bytes into a strictly byte-wise HTTP header key.
ascii)
isinstancebytesencoder   )r   r   r   bytes_values       2/venv/lib/python3.13/site-packages/httpx/_utils.pynormalize_header_keyr      s?     %ll8#6w7"';8[8    c                 d    [        U [        5      (       a  U $ U R                  U=(       d    S5      $ )z?
Coerce str/bytes into a strictly byte-wise HTTP header value.
r   )r   r   r   r   r   s     r   normalize_header_valuer   -   s*     %<<+G,,r   r   c                 8    U SL a  gU SL a  gU c  g[        U 5      $ )z{
Coerce a primitive data type into a string value.

Note that we prefer JSON-style 'true'/'false' for boolean values here.
TtrueFfalse )strr   s    r   primitive_value_to_strr$   8   s*     }	%	u:r   c                 R     [         R                  " U 5        g! [         a     gf = f)z/
Return `True` if `encoding` is a known codec.
FT)codecslookupLookupError)r   s    r   is_known_encodingr)   G   s,    h   s    
&&namec                     S[         R                  [           S[        4S jn[        R	                  X!5      nU  SU S3R                  5       $ )z3
Encode a name/value pair within a multipart form.
matchr   c                 2    [         U R                  S5         $ )Nr   )!_HTML5_FORM_ENCODING_REPLACEMENTSgroup)r,   s    r   replacer#format_form_param.<locals>.replacerW   s    0Q@@r   z="r	   )typingMatchr"   _HTML5_FORM_ENCODING_REsubr   )r*   r   r0   s      r   format_form_paramr6   R   sO    
AS) Ac A $''8EV2eWA%%''r   c                  D   S[         R                  ;   a<  [        [         R                  S   5      n U R                  5       (       a  [	        U 5      $ S[         R                  ;   a<  [        [         R                  S   5      nUR                  5       (       a  [	        U5      $ g )NSSL_CERT_FILESSL_CERT_DIR)osenvironr   is_filer"   is_dir)ssl_filessl_paths     r   get_ca_bundle_from_envr@   ^   ss    "**$

?34x= #

>23??x= r   c                    / nSnU R                  U5      n U (       d  U$ [        R                  " SU 5       H  n UR                  SS5      u  pESUR                  S5      0nUR                  S5       H9  n UR                  S5      u  pU R                  U5      XhR                  U5      '   M;     UR	                  U5        M     U$ ! [         a    USpT Nf = f! [         a       M8  f = f)	a  
Returns a list of parsed link headers, for more info see:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
The generic syntax of those is:
Link: < uri-reference >; param1=value1; param2="value2"
So for instance:
Link; '<http:/.../front.jpeg>; type="image/jpeg",<http://.../back.jpeg>;'
would return
    [
        {"url": "http:/.../front.jpeg", "type": "image/jpeg"},
        {"url": "http://.../back.jpeg"},
    ]
:param value: HTTP Link entity-header field
:return: list of parsed link headers
z '"z, *<;r   r!   urlz<> '"=)stripresplit
ValueErrorappend)	r   linksreplace_charsvalrC   paramslinkparamkeys	            r   parse_header_linksrQ   j   s      13EMKK&Exx&	"))C+KC syy*+\\#&E"[[-
 .3[[-GD=)* ' 	T ' L  	"r	"  s#   C6CCC
C('C(content_typec                 d    [         R                  R                  5       nXS'   UR                  S S9$ )Nzcontent-type)failobj)emailmessageMessageget_content_charset)rR   msgs     r   parse_content_type_charsetrZ      s2     --


!C&""4"00r   authorizationzproxy-authorizationitemsc              #      #    U  H5  u  p[        UR                  5       5      [        ;   a
  [        SUS9nX4v   M7     g 7f)Nz[secure])match_type_of)to_strr   SENSITIVE_HEADERSto_bytes_or_str)r\   kvs      r   obfuscate_sensitive_headersrd      s:      !'') 11
!<Ad
 s   =?rC   r   c                 p    U R                   b  U R                   $ SSS.R                  U R                  5      $ )NP     )httphttps)portgetscheme)rC   s    r   port_or_defaultrm      s/    
xxxx%))#**55r   otherc                     U R                   UR                   :H  =(       a7    U R                  UR                  :H  =(       a    [        U 5      [        U5      :H  $ )z8
Return 'True' if the given URLs share the same origin.
)rl   hostrm   )rC   rn   s     r   same_originrq      sE    
 	

ell" 	;HH

"	;C OE$::r   locationc                     U R                   UR                   :w  a  gU R                  S:H  =(       a9    [        U 5      S:H  =(       a$    UR                  S:H  =(       a    [        U5      S:H  $ )z9
Return 'True' if 'location' is a HTTPS upgrade of 'url'
Frh   rf   ri   rg   )rp   rl   rm   )rC   rr   s     r   is_https_redirectrt      sa     xx8==  	

f 	-C B&	-OOw&	- H%,	r   c                     [        5       n 0 nS H1  nU R                  U5      (       d  M  X   nSU;   a  UOSU 3X S3'   M3     U R                  SS5      R                  S5       Vs/ s H  oDR                  5       PM     nnU H}  nUS:X  a  0 s  $ U(       d  M  SU;   a  SX'   M"  [	        U5      (       a
  SUS	U 3'   M<  [        U5      (       a  SUS
U S3'   MW  UR                  5       S:X  a
  SUS	U 3'   Mu  SUSU 3'   M     U$ s  snf )z+Gets proxy information from the environment)rh   ri   allz://zhttp://nor!   ,*Nzall://zall://[]	localhostzall://*)r   rk   rG   rE   is_ipv4_hostnameis_ipv6_hostnamer   )
proxy_infomountsrl   hostnamerp   no_proxy_hostss         r   get_environment_proxiesr      s-    J57F*>>&!!!)H!X-WXJ3G XS>" + 0:~~dB/G/M/Mc/RS/Rtjjl/RNS" s?
 IX  #' !(++.2z*+!(++04
!,-![0.2z*+/3
+,5 #8 M; Ts   'Dc                 R    [        U [        5      (       a  U R                  U5      $ U $ Nr   r"   r   r   s     r   to_bytesr      s"    %/s%;%;5<<!FFr   c                 R    [        U [        5      (       a  U $ U R                  U5      $ r   )r   r"   decoder   s     r   r_   r_      s"    uc**5FX0FFr   r^   c                 P    [        U[        5      (       a  U $ U R                  5       $ r   r   )r   r^   s     r   ra   ra      s    }c225FFr   c                 <    U S   U S   s=:X  a  S:X  a  O  OU SS $ U $ )Nr   r	   r    r#   s    r   unquoter      s'    (eBi63652;AEAr   filenamec                 V    U (       a"  [         R                  " U 5      S   =(       d    S$ g )Nr   zapplication/octet-stream)	mimetypes
guess_type)r   s    r   guess_content_typer     s$    ##H-a0N4NNr   streamc                 H    U R                  5       n[        R                  " U5      R                  nU$ ! [        [
        4 a]     U R                  5       nU R                  S[        R                  5      nU R                  U5         U$ ! [        [
        4 a      gf = ff = f)zg
Given a file-like stream object, return its length in number of bytes
without reading it into memory.
r   N)	filenor:   fstatst_sizeAttributeErrorOSErrortellseekSEEK_END)r   fdlengthoffsets       r   peek_filelike_lengthr   
  s    
]]_"%% M G$ 
	 [[]F[[BKK0FKK
 M	 ( 		
s(   04 B!AB		BB!BB!c                   R    \ rS rSrS\4S jrS
S jrS
S jrS\4S jrS\4S jr	S	r
g)Timeri#  r   c                    #    [         R                  " 5       nUS:X  a  SS KnUR                  5       $ SS KnUR                  5       R                  5       $ 7f)Ntrior   )sniffiocurrent_async_libraryr   current_timeasyncioget_event_looptime)selflibraryr   r   s       r   	_get_timeTimer._get_time$  sH     //1f$$&&))+0022s   AANc                 8    [         R                  " 5       U l        g r   r   perf_counterstartedr   s    r   
sync_startTimer.sync_start/  s    ((*r   c                 J   #    U R                  5       I S h  vN U l        g  N
7fr   r   r   r   s    r   async_startTimer.async_start2  s     !^^---s   #!#c                 H    [         R                  " 5       nXR                  -
  $ r   r   r   nows     r   sync_elapsedTimer.sync_elapsed5  s    !\\!!r   c                 Z   #    U R                  5       I S h  vN nXR                  -
  $  N7fr   r   r   s     r   async_elapsedTimer.async_elapsed9  s&     NN$$\\!! %s   +)+)r   )r   N)__name__
__module____qualname____firstlineno__floatr   r   r   r   r   __static_attributes__r   r   r   r   r   #  s0    	3 	3+."e ""U "r   r   c                       \ rS rSrSrS\SS4S jrSSS\4S	 jr\	S\
R                  \\\4   4S
 j5       rS\4S jrSS S\4S jrS\
R                   S\4S jrSrg)
URLPatterni>  aC  
A utility class currently used for making lookups against proxy keys...

# Wildcard matching...
>>> pattern = URLPattern("all://")
>>> pattern.matches(httpx.URL("http://example.com"))
True

# Witch scheme matching...
>>> pattern = URLPattern("https://")
>>> pattern.matches(httpx.URL("https://example.com"))
True
>>> pattern.matches(httpx.URL("http://example.com"))
False

# With domain matching...
>>> pattern = URLPattern("https://example.com")
>>> pattern.matches(httpx.URL("https://example.com"))
True
>>> pattern.matches(httpx.URL("http://example.com"))
False
>>> pattern.matches(httpx.URL("https://other.com"))
False

# Wildcard scheme, with domain matching...
>>> pattern = URLPattern("all://example.com")
>>> pattern.matches(httpx.URL("https://example.com"))
True
>>> pattern.matches(httpx.URL("http://example.com"))
True
>>> pattern.matches(httpx.URL("https://other.com"))
False

# With port matching...
>>> pattern = URLPattern("https://example.com:1234")
>>> pattern.matches(httpx.URL("https://example.com:1234"))
True
>>> pattern.matches(httpx.URL("https://example.com"))
False
patternr   Nc                 t   SSK Jn  U(       a  SU;  a  [        SU SU S35      eU" U5      nXl        UR                  S:X  a  SOUR                  U l        UR
                  S	:X  a  SOUR
                  U l        UR                  U l        UR
                  (       a  UR
                  S	:X  a  S U l        g UR
                  R                  S
5      (       aC  [        R                  " UR
                  SS  5      n[        R                  " SU S35      U l        g UR
                  R                  S	5      (       aC  [        R                  " UR
                  SS  5      n[        R                  " SU S35      U l        g [        R                  " UR
                  5      n[        R                  " SU S35      U l        g )Nr   r   :zUProxy keys should use proper URL forms rather than plain scheme strings. Instead of "z", use "z://"rv   r!   ry   z*.   z^.+\.$z^(.+\.)?^)_urlsr   rH   r   rl   rp   rj   
host_regex
startswithrF   escapecompile)r   r   r   rC   domains        r   __init__URLPattern.__init__h  sM   s')&ixy>  'lJJ%/bSZZ((c/Bsxx	HH	xx388s?DHDOXX  &&YYsxx|,F jj6&);<DOXX  %%YYsxx|,F jj9VHA)>?DO YYsxx(F jj1VHA7DOr   rn   r   c                 >   U R                   (       a  U R                   UR                   :w  a  gU R                  (       a8  U R                  b+  U R                  R                  UR                  5      (       d  gU R                  b  U R                  UR                  :w  a  gg)NFT)rl   rp   r   r,   rj   r   rn   s     r   matchesURLPattern.matches  sg    ;;4;;%,,6II+OO))%**5599 TYY%**%<r   c                     U R                   b  SOSn[        U R                  5      * n[        U R                  5      * nXU4$ )zu
The priority allows URLPattern instances to be sortable, so that
we can match from most specific to least specific.
r   r   )rj   lenrp   rl   )r   port_priorityhost_priorityscheme_prioritys       r   priorityURLPattern.priority  s?     "YY2TYYt{{++o>>r   c                 ,    [        U R                  5      $ r   )hashr   r   s    r   __hash__URLPattern.__hash__  s    DLL!!r   c                 4    U R                   UR                   :  $ r   )r   r   s     r   __lt__URLPattern.__lt__  s    }}u~~--r   c                 b    [        U[        5      =(       a    U R                  UR                  :H  $ r   )r   r   r   r   s     r   __eq__URLPattern.__eq__  s!    %,N1NNr   )rp   r   r   rj   rl   )r   r   r   r   __doc__r"   r   boolr   propertyr2   Tupleintr   r   r   Anyr   r   r   r   r   r   r   >  s    'R8 8 8<U t  ?&,,sC}5 ? ?"# ".L .T .OFJJ O4 Or   r   r   c                 v     [         R                  " U R                  S5      S   5        g! [         a     gf = fN/r   FT)	ipaddressIPv4AddressrG   	Exceptionr   s    r   r|   r|     <    hnnS1!45      (+ 
88c                 v     [         R                  " U R                  S5      S   5        g! [         a     gf = fr   )r   IPv6AddressrG   r   r   s    r   r}   r}     r   r   r   )zutf-8)Br&   email.messagerU   r   r   r:   rF   r   r2   pathlibr   urllib.requestr   r   _typesr   TYPE_CHECKINGr   r   r.   updaterangechrformatr   joinkeysr   r4   Unionr"   r   r   Optionalr   r   r$   r)   r6   r@   ListDictrQ   rZ   r`   Iterabler   AnyStrIteratorrd   r   rm   rq   rt   r   r   r_   ra   r   r   r   r   r   r   r|   r}   )cs   0r   <module>r     s       	 	    %  !	 +0v$> ! ! ( (*//G/Q$Y SVYa  /G **II%F%K%K%MN%Mryy|%MNO  &*9<<U
#99 ooc"9 	9" GK-<<U
#-/5s/C-
-/ c   	(C 	( 	( 	(	 4 	"c "fkk&++c3h2G&H "J1S 1V__S5I 1 %&;< ??6<<v}}(DEF__V\\&--">?@6 66??3#7 6U 5 T 5 E d .S&//#2F-F!G .bGFLLe, G G% GG&,,sEz* Gc G GG3 Gv}} G GB3 B3 B!5 &//#:N  0D 2" "6jO jOZs t s t { H Os   (	L/5L/L4