ó
    §ZÇ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    ÚI/home/mande/repo/quber/.venv/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Ó-‘°W¸X¸JÐ3Gð �X˜S�>Ó"ñ +ð 0:¯~©~¸dÀBÓ/G×/MÑ/MÈcÔ/RÓSÒ/R t—j‘j–lÑ/R€NÐ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"   € Ü˜u¤c×*Ñ*ˆ5ÐF°·±¸XÓ0FÐ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Ñ2ˆ5Ð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'   € Ø ™( e¨B¡iÕ6°3Ö6ˆ5��2ˆ;ÐA¸EÐ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Ø—[‘[ ¤B§K¡KÓ0ˆFØ�K‰K˜Õð
 €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
)Ú
URLPatternéx   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 'Ó)Üðà&˜i x°¨y¸ð>óð ñ �'‹lˆØŒØŸJ™J¨%Ó/‘b°S·Z±ZˆŒØŸ(™( c›/‘B¨s¯x©xˆŒ	Ø—H‘HˆŒ	Ø�x�x˜3Ÿ8™8 s›?Ø:>ˆD�OØ�X‰X× Ñ  ×&Ñ&ä—Y’Y˜sŸx™x¨¨˜|Ó,ˆFÜ Ÿjšj¨6°&°¸Ð);Ó<ˆD�OØ�X‰X× Ñ  ×%Ñ%ä—Y’Y˜sŸx™x¨¨˜|Ó,ˆFÜ Ÿjšj¨9°V°H¸AÐ)>Ó?ˆD�Oô —Y’Y˜sŸx™xÓ(ˆFÜ Ÿjšj¨1¨V¨H°A¨Ó7ˆD�Or   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Øà�I�IØ—‘Ñ+Ø—O‘O×)Ñ)¨%¯*©*×5Ñ5àØ�9‰9Ñ  T§Y¡Y°%·*±*Ó%<ØØ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?   € ð "ŸY™YÑ2™¸ˆä˜TŸY™Y›˜ˆä˜tŸ{™{Ó+Ð+ˆØ¨oÐ>Ð>r   c                ó,   • [        U R                  5      $ r*   )ÚhashrU   )r\   s    r   Ú__hash__ÚURLPattern.__hash__Û   s   € Ü�D—L‘LÓ!Ð!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   å   ó<   € ðÜ×Ò˜hŸn™n¨SÓ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   