ó
    °"³jZ   ã                  óâ   • 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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    ÚJ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/httpx2/_utils.pyÚprimitive_value_to_strr      s*   € ð �‚}ØØ	�%ŠØØ	‰ØÜˆu‹:Ðó    c                 óf  • [        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      (       a2  S
U;   a!  UR                  S
5      u  pgnSUSU SU 3'   Ms  SUSU S3'   M~  UR                  5       S:X  a
  SUS	U 3'   Mœ  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://[z]/Ú]Ú	localhostzall://*)r   ÚgetÚsplitÚstripÚis_ipv4_hostnameÚis_ipv6_hostnameÚ	partitionÚlower)	Ú
proxy_infoÚmountsÚschemeÚhostnameÚhostÚno_proxy_hostsÚaddrÚ_Úsubnets	            r   Úget_environment_proxiesr,      s`  € ô “€JØ$&€Fã*ˆØ�>‰>˜&×!Ó!Ø!Ñ)ˆHØ16¸(Ó1B¡XÈ'ÐRZÐQ[ÐH\ˆF�X˜S�>Ó"ñ +ð
 0:¯~©~¸dÀBÓ/G×/MÑ/MÈcÔ/RÓSÒ/R t—j‘j–lÑ/R€NÐSÛ"ˆð �s‹?ð
 ŠIßˆXð ˜Ó Ø#'�Ó Ü! (×+Ñ+Ø.2�˜ ˜zÐ*Ó+Ü! (×+Ñ+Ø˜(“?Ø&.×&8Ñ&8¸Ó&=‘O�D˜VØ9=�F˜W T F¨"¨V¨HÐ5Ó6à48�F˜W X J¨aÐ0Ó1Ø—‘Ó! [Ó0Ø.2�˜ ˜zÐ*Ó+à/3�˜  
Ð+Ó,ñ= #ð@ €MùòC Ts   Á'D.c                óR   • [        U [        5      (       a  U R                  U5      $ U $ ©N©Ú
isinstancer   Úencode©r   Úencodings     r   Úto_bytesr4   Q   s"   € Ü%/°´s×%;Ñ%;ˆ5�<‰<˜Ó!ÐFÀÐFr   c                óR   • [        U [        5      (       a  U $ U R                  U5      $ r.   )r0   r   Údecoder2   s     r   Úto_strr7   U   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_strr:   Y   s   € Ü˜}¬c×2Ñ2ˆ5ÐF¸¿¹»ÐFr   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_lengthrI   ]   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év   aN  
A utility class currently used for making lookups against proxy keys...

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

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

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

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

# With port matching...
>>> pattern = URLPattern("https://example.com:1234")
>>> pattern.matches(httpx2.URL("https://example.com:1234"))
True
>>> pattern.matches(httpx2.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)ÚselfrT   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'   rV   ÚmatchrU   ©r[   Úothers     r   ÚmatchesÚURLPattern.matches¾   sh   € Ø�;�;˜4Ÿ;™;¨%¯,©,Ó6ØØ�9�9˜Ÿ™Ñ4¸T¿_¹_×=RÑ=RÐSX×S]ÑS]×=^Ñ=^ØØ�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   )rU   Ú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.   )ÚhashrT   )r[   s    r   Ú__hash__ÚURLPattern.__hash__Õ   s   € Ü�D—L‘LÓ!Ð!r   c                ó4   • U R                   UR                   :  $ r.   )rk   rb   s     r   Ú__lt__ÚURLPattern.__lt__Ø   s   € Ø�}‰}˜uŸ~™~Ñ-Ð-r   c                ób   • [        U[        5      =(       a    U R                  UR                  :H  $ r.   )r0   rK   rT   rb   s     r   Ú__eq__ÚURLPattern.__eq__Û   s!   € Ü˜%¤Ó,×N°·±ÀÇÁÑ1NÐNr   )r'   rV   rT   rU   r%   N)rT   r   ÚreturnÚNone)rc   r   rw   Úbool)rw   ztuple[int, int, int])rw   Úint)rc   rK   rw   ry   )rc   ú
typing.Anyrw   ry   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r^   rd   Úpropertyrk   ro   rr   ru   Ú__static_attributes__© r   r   rK   rK   v   s6   † ñ'ôR8ô<ð ó?ó ð?ô"ô.÷Or   rK   c                óv   •  [         R                  " U R                  S5      S   5        g! [         a     gf = f©Nr   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   rw   r   )rw   zdict[str, str | None])zutf-8)r   ústr | bytesr3   r   rw   Úbytes)r   rŽ   r3   r   rw   r   )r   r   r9   útyping.AnyStrrw   r�   )rE   r{   rw   z
int | None)r&   r   rw   ry   )Ú
__future__r   r†   r=   rX   ÚtypingÚurllib.requestr   Ú_typesr   ÚTYPE_CHECKINGrR   r   r   r,   r4   r7   r:   rI   rK   r   r    rƒ   r   r   Ú<module>r–      sa   ðÝ "ã Û 	Û 	Û Ý %å !à	××Ýôô0öfGöGôGô÷2fOñ fOôRõr   