K iJddlmZddlZddlZddlZddlmZmZddgZ dZ ejGddZ dd Z ejGd d Zdd Zdd Zy)) annotationsN) InvalidProxy InvalidURI parse_uri WebSocketURIz:/?#[]@!$&'()*+,;=ceZdZUdZded<ded<ded<ded<ded <d Zd ed <d Zd ed <eddZeddZ y )ra WebSocket URI. Attributes: secure: :obj:`True` for a ``wss`` URI, :obj:`False` for a ``ws`` URI. host: Normalized to lower case. port: Always set even if it's the default. path: May be empty. query: May be empty if the URI doesn't include a query component. username: Available when the URI contains `User Information`_. password: Available when the URI contains `User Information`_. .. _User Information: https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1 boolsecurestrhostintportpathqueryN str | Noneusernamepasswordcx|jr |j}nd}|jr|d|jzz }|S)N/?)rr)self resource_names T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/websockets/uri.pyrzWebSocketURI.resource_name+s7 99 IIMM :: S4::- -Mch|jy|jJ|j|jfSNrrrs r user_infozWebSocketURI.user_info52 == }}((( t}}--r)returnr r"ztuple[str, str] | None) __name__ __module__ __qualname____doc____annotations__rrpropertyrr rrrrs\ L I I I JHjHj ..rc tjj|}|jdvr t |d|j t |d|j dk7r t |d|jdk(}|j }|jxs|rdnd}|j}|j}|j}|j}|| t |d  |jd t#|||||||S#t$r|jd j}tjj|t }tjj|t }|N|Jtjj|t }tjj|t }YwxYw) z Parse and validate a WebSocket URI. Args: uri: WebSocket URI. Returns: Parsed WebSocket URI. Raises: InvalidURI: If ``uri`` isn't a valid WebSocket URI. )wswsszscheme isn't ws or wsshostname isn't providedz"fragment identifier is meaninglessr-P"username provided without passwordasciiidnasafe)urllibparseurlparseschemerhostnamefragmentrrrrrencodeUnicodeEncodeErrordecodequoteDELIMSr) uriparsedr r rrrrrs rrr=s\\ " "3 'F }}M)677 788 "BCC ]]e #F ??D ;; 1&3bD ;;D LLEHH 0BCC A 7 dD%8 LL  A{{6"))+||!!$V!4 ""5v"6  ' ''||))()@H||))()@H AsC??CGGc^eZdZUdZded<ded<ded<dZded <dZded <ed d Zy) Proxya Proxy. Attributes: scheme: ``"socks5h"``, ``"socks5"``, ``"socks4a"``, ``"socks4"``, ``"https"``, or ``"http"``. host: Normalized to lower case. port: Always set even if it's the default. username: Available when the proxy address contains `User Information`_. password: Available when the proxy address contains `User Information`_. .. _User Information: https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1 r r:r rrNrrrch|jy|jJ|j|jfSrrrs rr zProxy.user_infor!rr#) r$r%r&r'r(rrr)r r*rrrErEos>  K I IHjHj ..rrEc`tjj|}|jdvrt |d|jd|j t |d|j dvr t |d|jdk7r t |d|jdk7r t |d |j}|j }|jxs|jd k(rd nd }|j}|j}|| t |d  |jdt#|||||S#t$rr|jdj}|N|Jtjj|t }tjj|t }YwxYw)z Parse and validate a proxy. Args: proxy: proxy. Returns: Parsed proxy. Raises: InvalidProxy: If ``proxy`` isn't a valid proxy. )socks5hsocks5socks4asocks4httpshttpzscheme z isn't supportedr.)r/rzpath is meaninglessr/zquery is meaninglesszfragment is meaninglessrLr0r1r2r3r4r5)r7r8r9r:rr;rrr<rrrr=r>r?r@rArE)proxyrCr:r rrrs r parse_proxyrOs\\ " "5 )F }}WW5GFMM?:J"KLL 5";<< {{)#5"788 ||r5"899 "5";<< ]]F ??D ;; C&--7":3DHH 05"FGG A W tXx 88 A{{6"))+  ' ''||))()@H||))()@HAsD22A8F-,F-cTtjj|jd|jrytjj }|j rgd}ngd}|D]7}|j|}||dk(r|jdrd|ddz}|cSy) zU Return the proxy to use for connecting to the given WebSocket URI, if any. :N)r-socksrL)r,rRrLrMrRzhttp://z socks5h://) r7request proxy_bypassr r getproxiesr get startswith)rBproxiesschemesr:rNs r get_proxyr[s ~~""chhZq #;<nn'')G zz+2 F#   U%5%5i%@$uQRy0L r)rBr r"r)rNr r"rE)rBrr"r) __future__r dataclasses urllib.parser7urllib.request exceptionsrr__all__rA dataclassrrrErOr[r*rrrcsx"0  '  (.(.(.V/Md ...