
    h]                         S SK J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	  \R                  (       a  SSKJr  SS jrSS jrSSS	 jjrSSS
 jjrSS jrSS jrSS jr " S S5      rSS jrSS jrg)    )annotationsN)
getproxies   )PrimitiveDataURLc                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values    >/var/www/html/env/lib/python3.13/site-packages/httpx/_utils.pyprimitive_value_to_strr      s*     }	%	u:    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)httphttpsallz://zhttp://nor   ,*Nzall://zall://[]	localhostzall://*)r   getsplitstripis_ipv4_hostnameis_ipv6_hostnamelower)
proxy_infomountsschemehostnamehostno_proxy_hostss         r   get_environment_proxiesr(      s-    J$&F*>>&!!!)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
isinstancer   encoder   encodings     r   to_bytesr0   O   s"    %/s%;%;5<<!FFr   c                R    [        U [        5      (       a  U $ U R                  U5      $ r*   )r,   r   decoder.   s     r   to_strr3   S   s"    uc**5FX0FFr   c                P    [        U[        5      (       a  U $ U R                  5       $ r*   r+   )r   match_type_ofs     r   to_bytes_or_strr6   W   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   s    r   unquoter;   [   s'    (eBi63652;AEAr   c                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)	filenoosfstatst_sizeAttributeErrorOSErrortellseekSEEK_END)streamfdlengthoffsets       r   peek_filelike_lengthrJ   _   s    
]]_"%% M G$ 
	 [[]F[[BKK0FKK
 M	 ( 		
s(   04 B!AB		BB!BB!c                  ^    \ rS rSrSrSS jrSS jr\SS j5       rSS jr	SS jr
SS jrS	rg
)
URLPatternx   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
c                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://"r   r   r   z*.   z^.+\.$z^(.+\.)?^)_urlsr   
ValueErrorpatternr$   r&   port
host_regex
startswithreescapecompile)selfrU   r   urldomains        r   __init__URLPattern.__init__   sM   s')&ixy>  'lJJ%/bSZZ((c/Bsxx	HH	xx388s?:>DOXX  &&YYsxx|,F jj6&);<DOXX  %%YYsxx|,F jj9VHA)>?DO YYsxx(F jj1VHA7DOr   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)r$   r&   rW   matchrV   r\   others     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   )rV   lenr&   r$   )r\   port_priorityhost_priorityscheme_prioritys       r   priorityURLPattern.priority   s?     "YY2TYYt{{++o>>r   c                ,    [        U R                  5      $ r*   )hashrU   )r\   s    r   __hash__URLPattern.__hash__   s    DLL!!r   c                4    U R                   UR                   :  $ r*   )rl   rc   s     r   __lt__URLPattern.__lt__   s    }}u~~--r   c                b    [        U[        5      =(       a    U R                  UR                  :H  $ r*   )r,   rL   rU   rc   s     r   __eq__URLPattern.__eq__   s!    %,N1NNr   )r&   rW   rU   rV   r$   N)rU   r   returnNone)rd   r   rx   bool)rx   ztuple[int, int, int])rx   int)rd   rL   rx   rz   )rd   
typing.Anyrx   rz   )__name__
__module____qualname____firstlineno____doc__r_   re   propertyrl   rp   rs   rv   __static_attributes__r:   r   r   rL   rL   x   s6    'R8< ? ?".Or   rL   c                v     [         R                  " U R                  S5      S   5        g! [         a     gf = fN/r   FT)	ipaddressIPv4Addressr   	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   IPv6Addressr   r   r   s    r   r    r       r   r   )r   r   rx   r   )rx   zdict[str, str | None])zutf-8)r   str | bytesr/   r   rx   bytes)r   r   r/   r   rx   r   )r   r   r5   typing.AnyStrrx   r   )r   r   rx   r   )rF   r|   rx   z
int | None)r%   r   rx   rz   )
__future__r   r   r>   rY   typingurllib.requestr   _typesr   TYPE_CHECKINGrS   r   r   r(   r0   r3   r6   r;   rJ   rL   r   r    r:   r   r   <module>r      sg    "  	 	  % !	.bGGGB2jO jOZr   