Files
aitsc/.venv/Lib/site-packages/httpx/__pycache__/_utils.cpython-312.pyc

86 lines
9.1 KiB
Plaintext
Raw Normal View History

2025-02-23 09:07:52 +08:00
<EFBFBD>
2025-08-16 19:28:45 +08:00
<00><18>hO!<00><01><><00>ddlmZddlZddlZddlZddlZddlmZddlm Z ejrddl m Z dd<07>Z dd<08>Zddd <09>Zddd
2025-02-23 09:07:52 +08:00
<EFBFBD>Zdd <0B>Zdd <0C>Zdd <0A>ZGd<0E>d<0F>Zdd<10>Zdd<11>Zy)<1B>)<01> annotationsN)<01>
getproxies<EFBFBD>)<01> PrimitiveData<74><01>URLc<01>2<00>|dury|dury|<00>yt|<00>S)z<>
Coerce a primitive data type into a string value.
Note that we prefer JSON-style 'true'/'false' for boolean values here.
2025-08-16 19:28:45 +08:00
T<>trueF<65>false<73>)<01>str<74><01>values <20>0D:\aitsc\.venv\Lib\site-packages\httpx\_utils.py<70>primitive_value_to_strrs*<00><00>  <0A><04>}<7D><15> <0E>%<25><1E><16> <0E><1D><11> <0E>u<EFBFBD>:<3A><15>c<01><><00>t<00>}i}dD]*}|j|<02>s<01>||}d|vr|nd|<03><00>||<02>d<02><<00>,|jdd<05>jd<06>D<00>cgc]}|j<00><00><02>}}|D]e}|dk(ricS|s<01>d|vrd||<<00>t |<03>r d|d |<03><00><<00>-t |<03>r
2025-02-23 09:07:52 +08:00
d|d
|<03>d <0B><<00>B|j <00>d k(r d|d |<03><00><<00>^d|d |<03><00><<00>g|Scc}w)z+Gets proxy information from the environment)<03>http<74>https<70>allz://zhttp://<2F>nor <00>,<2C>*Nzall://zall://[<5B>]<5D> localhostzall://*)r<00>get<65>split<69>strip<69>is_ipv4_hostname<6D>is_ipv6_hostname<6D>lower)<06>
proxy_info<EFBFBD>mounts<74>scheme<6D>hostname<6D>host<73>no_proxy_hostss r<00>get_environment_proxiesr(s*<00><00><1C><1C>J<EFBFBD>$&<26>F<EFBFBD>*<2A><06> <15>><3E>><3E>&<26> !<21>!<21>&<26>)<29>H<EFBFBD>!<21>X<EFBFBD>-<2D><08>W<EFBFBD>X<EFBFBD>J<EFBFBD>3G<33> <13>f<EFBFBD>X<EFBFBD>S<EFBFBD>><3E> "<22>+<2B>0:<3A>~<7E>~<7E>d<EFBFBD>B<EFBFBD>/G<>/M<>/M<>c<EFBFBD>/R<>S<>/R<>t<EFBFBD>d<EFBFBD>j<EFBFBD>j<EFBFBD>l<EFBFBD>/R<>N<EFBFBD>S<>"<22><08> <14>s<EFBFBD>?<3F>
<16>I<EFBFBD> <15><15><08> <20>#'<27><06>x<EFBFBD> <20>!<21>(<28>+<2B>.2<EFBFBD><06><16><08>z<EFBFBD>*<2A>+<2B>!<21>(<28>+<2B>04<30><06><17><18>
<EFBFBD>!<21>,<2C>-<2D><19><1E><1E>!<21>[<5B>0<>.2<EFBFBD><06><16><08>z<EFBFBD>*<2A>+<2B>/3<><06><17><18>
<EFBFBD>+<2B>,<2C>5#<23>8 <12>M<EFBFBD><4D>;Ts<00>C$c<01>H<00>t|t<00>r|j|<01>S|S<00>N<><03>
isinstancer <00>encode<64>r<00>encodings r<00>to_bytesr0Os<00><00>%/<2F><05>s<EFBFBD>%;<3B>5<EFBFBD><<3C><<3C><08> !<21>F<><15>Frc<01>H<00>t|t<00>r|S|j|<01>Sr*)r,r <00>decoder.s r<00>to_strr3Ss<00><00><1E>u<EFBFBD>c<EFBFBD>*<2A>5<EFBFBD>F<><05> <0C> <0C>X<EFBFBD>0F<30>Frc<01>F<00>t|t<00>r|S|j<00>Sr*r+)r<00> match_type_ofs r<00>to_bytes_or_strr6Ws<00><00><1E>}<7D>c<EFBFBD>2<>5<EFBFBD>F<><05> <0C> <0C><0E>Frc<01>8<00>|d|dcxk(rdk(rnn|ddS|S)Nr<00><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"r<00>rs r<00>unquoter;[s'<00><00><1F><01>(<28>e<EFBFBD>B<EFBFBD>i<EFBFBD>6<>3<EFBFBD>6<>5<EFBFBD><11>2<EFBFBD>;<3B>A<>E<EFBFBD>Arc<01>B<00> |j<00>}tj|<01>j}|S#tt
f$r\ |j <00>}|jdtj<00>}|j|<03>Y|S#tt
f$rYYywxYwwxYw)zs
Given a file-like stream object, return its length in number of bytes
without reading it into memory.
rN) <09>fileno<6E>os<6F>fstat<61>st_size<7A>AttributeError<6F>OSError<6F>tell<6C>seek<65>SEEK_END)<04>stream<61>fd<66>length<74>offsets r<00>peek_filelike_lengthrJ_s<><00><00>
<18> <13>]<5D>]<5D>_<EFBFBD><02><13><18><18>"<22><1C>%<25>%<25><06> <12>M<EFBFBD><4D> <1B>G<EFBFBD> $<24>
<18> <18><1C>[<5B>[<5B>]<5D>F<EFBFBD><1B>[<5B>[<5B><11>B<EFBFBD>K<EFBFBD>K<EFBFBD>0<>F<EFBFBD> <12>K<EFBFBD>K<EFBFBD><06> <1F>
<12>M<EFBFBD><4D> <1F><07>(<28> <18><17> <18><>
<18>s(<00>/3<00>B<03>AB<02>B<05>B<03>B<05>Bc<01>J<00>eZdZdZd d<02>Zd
d<03>Zed d<04><04>Zd d<05>Zd d<06>Z dd<07>Z
y)<0F>
URLPatterna<EFBFBD>
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<01>8<00>ddlm}|rd|vrtd|<01>d|<01>d<06><05><00>||<01>}||_|jdk(rdn |j|_|j
d k(rdn |j
|_|j |_|j
r|j
d k(rd|_y|j
jd
<EFBFBD>rAtj|j
d d<00>}tjd |<04>d <0A><03>|_y|j
jd <09>rAtj|j
dd<00>}tjd|<04>d <0A><03>|_ytj|j
<00>}tjd|<04>d <0A><03>|_y)Nrr<00>:zUProxy keys should use proper URL forms rather than plain scheme strings. Instead of "z", use "z://"rr rz*.<2E>z^.+\.<2E>$z^(.+\.)?<3F>^) <0C>_urlsr<00>
ValueError<EFBFBD>patternr$r&<00>port<72>
host_regex<EFBFBD>
startswith<EFBFBD>re<72>escape<70>compile)<05>selfrTr<00>url<72>domains r<00>__init__zURLPattern.__init__<5F>sI<00><00><1E> <12>s<EFBFBD>'<27>)<29><1C><1F>&<26>i<EFBFBD>x<EFBFBD><07>y<EFBFBD><04>><3E><0E> <0E> <12>'<27>l<EFBFBD><03><1E><04> <0C><1F>J<EFBFBD>J<EFBFBD>%<25>/<2F>b<EFBFBD>S<EFBFBD>Z<EFBFBD>Z<EFBFBD><04> <0B><1D>(<28>(<28>c<EFBFBD>/<2F>B<EFBFBD>s<EFBFBD>x<EFBFBD>x<EFBFBD><04> <09><17>H<EFBFBD>H<EFBFBD><04> <09><12>x<EFBFBD>x<EFBFBD>3<EFBFBD>8<EFBFBD>8<EFBFBD>s<EFBFBD>?<3F>:><3E>D<EFBFBD>O<EFBFBD> <10>X<EFBFBD>X<EFBFBD> <20> <20><14> &<26><17>Y<EFBFBD>Y<EFBFBD>s<EFBFBD>x<EFBFBD>x<EFBFBD><01><02>|<7C>,<2C>F<EFBFBD> <20>j<EFBFBD>j<EFBFBD>6<EFBFBD>&<26><18><11>);<3B><<3C>D<EFBFBD>O<EFBFBD> <10>X<EFBFBD>X<EFBFBD> <20> <20><13> %<25><17>Y<EFBFBD>Y<EFBFBD>s<EFBFBD>x<EFBFBD>x<EFBFBD><01><02>|<7C>,<2C>F<EFBFBD> <20>j<EFBFBD>j<EFBFBD>9<EFBFBD>V<EFBFBD>H<EFBFBD>A<EFBFBD>)><3E>?<3F>D<EFBFBD>O<EFBFBD><18>Y<EFBFBD>Y<EFBFBD>s<EFBFBD>x<EFBFBD>x<EFBFBD>(<28>F<EFBFBD> <20>j<EFBFBD>j<EFBFBD>1<EFBFBD>V<EFBFBD>H<EFBFBD>A<EFBFBD><1D>7<>D<EFBFBD>Orc<01><00>|jr|j|jk7ry|jr2|j<00>&|jj|j<00>sy|j<00>|j|jk7ryy)NFT)r$r&rV<00>matchrU<00>r[<00>others r<00>matcheszURLPattern.matches<65>sd<00><00> <0F>;<3B>;<3B>4<EFBFBD>;<3B>;<3B>%<25>,<2C>,<2C>6<><18> <10>I<EFBFBD>I<EFBFBD><14><0F><0F>+<2B><18>O<EFBFBD>O<EFBFBD>)<29>)<29>%<25>*<2A>*<2A>5<><18> <0F>9<EFBFBD>9<EFBFBD> <20>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>%<25>*<2A>*<2A>%<<3C><18>rc<01><><00>|j<00>dnd}t|j<00> }t|j<00> }|||fS)z<>
The priority allows URLPattern instances to be sortable, so that
we can match from most specific to least specific.
rr)rU<00>lenr&r$)r[<00> port_priority<74> host_priority<74>scheme_prioritys r<00>priorityzURLPattern.priority<74>sA<00><00>"<22>Y<EFBFBD>Y<EFBFBD>2<><01><01> <0A><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD><1E><0F> <0A><1E>t<EFBFBD>{<7B>{<7B>+<2B>+<2B><0F><1D>}<7D>o<EFBFBD>><3E>>rc<01>,<00>t|j<00>Sr*)<02>hashrT)r[s r<00>__hash__zURLPattern.__hash__<5F>s<00><00><13>D<EFBFBD>L<EFBFBD>L<EFBFBD>!<21>!rc<01>4<00>|j|jkSr*)riras r<00>__lt__zURLPattern.__lt__<5F>s<00><00><13>}<7D>}<7D>u<EFBFBD>~<7E>~<7E>-<2D>-rc<01>X<00>t|t<00>xr|j|jk(Sr*)r,rLrTras r<00>__eq__zURLPattern.__eq__<5F>s!<00><00><19>%<25><1A>,<2C>N<><14><1C><1C><15><1D><1D>1N<31>NrN)rTr <00>return<72>None)rbrrq<00>bool)rqztuple[int, int, int])rq<00>int)rbrLrqrs)rb<00>
typing.Anyrqrs) <0B>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__r^rc<00>propertyrirlrnrpr:rrrLrLxs6<00><00>'<08>R8<>< <14><0E> ?<3F><0E> ?<3F>"<22>.<2E>OrrLc<01>r<00> tj|jd<01>d<00>y#t$rYywxYw<01>N<>/rFT)<04> ipaddress<73> IPv4Addressr<00> Exception<6F>r%s rrr<00><00><<00><00><15><11><1D><1D>h<EFBFBD>n<EFBFBD>n<EFBFBD>S<EFBFBD>1<>!<21>4<>5<> <10><> <15><15><14><15><> <00>'*<00> 6<03>6c<01>r<00> tj|jd<01>d<00>y#t$rYywxYwr|)r~<00> IPv6Addressrr<>r<>s rr r <00>r<>r<>)rrrqr )rqzdict[str, str | None])zutf-8)r<00> str | bytesr/r rq<00>bytes)rr<>r/r rqr )rr r5<00> typing.AnyStrrqr<>)rr rqr )rFrurqz
int | None)r%r rqrs)<17>
__future__rr~r>rX<00>typing<6E>urllib.requestr<00>_typesr<00> TYPE_CHECKINGrRrrr(r0r3r6r;rJrLrr r:rr<00><module>r<>sg<00><01>"<22><10> <09> <09> <0A>%<25>!<21> <09><17><17><1A> <16>.<12>bG<01>G<01>G<01>B<01><12>2jO<01>jO<01>Z<10>r