kf/ddlZddlZddlZddlmZmZddlmZddlm Z ddl m Z m Z m Z mZmZmZddlZddlmZmZddlmZmZd d d d d ZeZd ed efdZGddZdZeGddZdZdZ ej!e da"ej!e da#edZ$edZ%ee e ddZ&dS)N)MappingSequence)suppress) ip_address) SplitResult parse_qslquoteurljoinurlsplit urlunsplit) MultiDictMultiDictProxy)_Quoter _UnquoterPi)httphttpswswssobjreturncd|_|S)Nyarl) __module__)rs k/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/yarl/_url.pyrewrite_modulersCN Jc(eZdZdZdZefdZdZdS)cached_propertyaRUse as a class method decorator. It operates almost exactly like the Python `@property` decorator, but it puts the result of the method it decorates into the instance dict after the first call, effectively replacing the function it decorates with an instance variable. It is, in Python parlance, a data descriptor. cv||_ |j|_n#t$r d|_YnwxYw|j|_dS)N)wrapped__doc__AttributeError__name__name)selfr#s r__init__zcached_property.__init__!sM  "?DLL   DLLL $ s **c||S|j|j|}||ur|S||}||j|j<|SN)_cachegetr'r#)r(instowner _sentinelvals r__get__zcached_property.__get__)sW <Kkoodi33 i  Jll4  !$ DI rc td)Nzcached property is read-only)r%)r(r.values r__set__zcached_property.__set__3s;<<Ze,dAZ?e,dBZ@e,dCZAe,dDZBe,dEZCe,dFZDe,dGZEe,dHZFe,dIZGeHdJZIdbdKZJedLZKedbdMZLe dcdNZMdOZNdPZOdQZPdRZQdSZRddTdUZSedVZTeHdWZUdXZVdYZWdZZXd[ZYd\ZZd]Z[d^Z\ddTd_Z]d`Z^dS)dURL)r,_valF)requotez@:z/+)safe protectedrH)rIrJz?/:@z=+&;T)rIrJqsrH)rIrJrK)rIrKrH)rIrH)rI+)unsafe)rKr"N)encodedstrictc|tjdt||ur|St|turt |}nit|t ur|st dnAt|trt t|}ntd|s |dsd}d}nh|j }|t d |j }n"#t $r}t d|d}~wwxYw| |j |j ||dd }||d }|r||}||| ||d } ||d } t |d||| | }t&|} || _i| _| S)Nzstrict parameter is ignoredz$Cannot apply decoding to SplitResultz#Constructor parameter should be strrr"z/Invalid URL: host is required for absolute urlsz/Invalid URL: port can't be converted to integerT)encoderHhostpathr)warningswarntypestrr r ValueError isinstance TypeErrorhostnameport _make_netlocusernamepassword_PATH_REQUOTER_normalize_path _validate_authority_uri_abs_path_QUERY_REQUOTER_FRAGMENT_REQUOTERobject__new__rGr,) clsr1rNrOnetlocrTr`erUqueryfragmentr(s rrjz URL.__new__s   M7 8 8 8 99  J 99  3--CC #YY+ % % I !GHHH I S ! ! C3s88$$CCABB B Eq6 |<$%VWWW8DD!$I ))L#,d4QU*%%c!f--D 1**400  0 0d 0 F F F''A//E--c!f55Hc!ffdE8DDC~~c""   s"C** D 4DD ) scheme authorityuserrcrTr`rUrn query_stringrorNc |r|s|s|s|rtd|r|std|r| rtd| |||| | td|rG| r|} njtd|ddd} || j| j| j| jd} n(|s |s|s|sd} n|||||| | } | sm||}| r| |}| || | | } | | } |t|| || | d }|r| |S|S) zCreates and returns a new URLz@Can't mix "authority" with "user", "password", "host" or "port".z/Can't build URL with "port" but without "host".z6Only one of "query" or "query_string" should be passedNz}NoneType is illegal for "scheme", "authority", "host", "path", "query_string", and "fragment" args, use empty string instead.r"T)rQ)rQ encode_hostrSrN)r\r^rrarbrcr_r` _PATH_QUOTERrerf _QUERY_QUOTER_FRAGMENT_QUOTER with_query)rkrprqrrrcrTr`rUrnrsrorNrltmpurls rbuildz URL.builds*$  $ ( d d S   Q QOPP P  W\ WUVV V N ||#Q    "!"iR<<))L#, cht* h t D FF%%hdw;PWK&F 6##D))D 1**400  0 0d 0 F F F,,\::L++H55Hc lH E Et     >>%(( (Jrc(td|d)NzInheriting a class z from URL is forbidden)r^)rks r__init_subclass__zURL.__init_subclass__sKcKKKLLLrc|j}|js8|r$|js|jr|d}t |SN/rU)rGrU is_absoluternro_replacer r(r1s r__str__z URL.__str__ sWix )D,,.. )CI ) ),,C,((C#rc@|jjdt|dS)Nz('z')) __class__r&r[r(s r__repr__z URL.__repr__&s$.)::SYY::::rcFt|dS)Nascii)r[rQrs r __bytes__z URL.__bytes__)s4yy(((rc(t|turtS|j}|js*|r|d}|j}|js*|r|d}||kSr)rZrFNotImplementedrGrUrr)r(otherval1val2s r__eq__z URL.__eq__,sE{{c!!! !yy +T--// +==c=**Dzy +U..00 +==c=**Dt|rc|jd}|Q|j}|js*|r|d}t |x}|jd<|S)Nhashrr)r,r-rGrUrrr)r(retr1s r__hash__z URL.__hash__:smkoof%% ;)C8 - 0 0 2 2 -lll,,(,S 1C$+f% rc\t|turtS|j|jkSr+rZrFrrGr(rs r__le__z URL.__le__C(E{{c!!! !yEJ&&rc\t|turtS|j|jkSr+rrs r__lt__z URL.__lt__H(E{{c!!! !y5:%%rc\t|turtS|j|jkSr+rrs r__ge__z URL.__ge__Mrrc\t|turtS|j|jkSr+rrs r__gt__z URL.__gt__Rrrcht|turtS||fSr+)rZr[r _make_childr(r's r __truediv__zURL.__truediv__Ws/DzzS  ! !(((rc,||Sr+) update_query)r(rns r__mod__z URL.__mod__\s  '''rrc|t|jjp#|jjp|jjp |jjSr+)boolrGrlrUrnrors r__bool__z URL.__bool___s8 I  W  W$)/ WTYEW   rc|jfSr+)rGrs r __getstate__zURL.__getstate__ds  |rc|d/t|dtr|dd|_n |^|_}i|_dS)NrrrG)r]dictrGr,)r(stateunuseds r __setstate__zURL.__setstate__gsH 8  58T : : a(DII!& DI rc|jduS)zA check for absolute URLs. Return True for absolute ones (having scheme or starting with //), False otherwise. N)raw_hostrs rrzURL.is_absoluteos}D((rcp|jdSt|j}|dS|j|kS)zA check for default port. Return True if port is default for specified scheme, e.g. 'http://python.org' or 'http://python.org:80', False otherwise. NF)r` DEFAULT_PORTSr-rp)r(defaults ris_default_portzURL.is_default_portxs= 9 5##DK00 ?5yG##rc$|std|jjstd|j}|dd|j|j}||ddd}t|dS)z}Return an URL with scheme, host and port parts only. user, password, path, query and fragment are removed. URL should be absolutezURL should have schemeNr")rlrUrnroTrv) rr\rGrprar_r`rrF)r(vrlr1s roriginz URL.origins!! 7566 6y 7566 6 I""4qz16BBjjRrBjGG3%%%%rc|std|jdd}t |dS)zhReturn a relative part of the URL. scheme, user, password, host and port are removed. rr")rprlTrv)rr\rGrrFrs rrelativez URL.relativesT !! 7566 6i  2 663%%%%rc|jjS)zdScheme for absolute URLs. Empty string for relative URLs or URLs starting with // )rGrprs rrpz URL.schemeyrc|jjS)zQEncoded authority part of URL. Empty string for relative URLs. )rGrlrs r raw_authorityzURL.raw_authorityrrc^||j|j|j|jdS)zQDecoded authority part of URL. Empty string for relative URLs. Fru)rarrrcrTr`rs rrqz URL.authoritys4  It}di!   rc&|jj}|sdS|S)zEEncoded user part of URL. None if user is missing. N)rGrbr(rs rraw_userz URL.raw_users i  4 rc6||jS)zEDecoded user part of URL. None if user is missing. ) _UNQUOTERrrs rrrzURL.users~~dm,,,rc|jjS)zMEncoded password part of URL. None if password is missing. )rGrcrs r raw_passwordzURL.raw_passwordy!!rc6||jS)zMDecoded password part of URL. None if password is missing. )rrrs rrcz URL.password~~d/000rc|jjS)zDEncoded host part of URL. None for relative URLs. )rGr_rs rrz URL.raw_hostsy!!rcB|j}|dSd|vr|St|S)zDDecoded host part of URL. None for relative URLs. N%)r _idna_decode)r(raws rrTzURL.hosts3m ;4 #::JC   rcb|jjp#t|jjS)zPort part of URL, with scheme-based fallback. None for relative URLs or URLs without explicit port and scheme without default port substitution. )rGr`rr-rprs rr`zURL.ports&y~D!2!2493C!D!DDrc|jjS)zyPort part of URL, without scheme-based fallback. None for relative URLs or URLs without explicit port. )rGr`rs r explicit_portzURL.explicit_port sy~rcN|jj}|s|rd}|S)zNEncoded path of URL. / for absolute URLs without path part. r)rGrUrrs rraw_pathz URL.raw_paths2in t'')) C rc6||jS)zNDecoded path of URL. / for absolute URLs without path part. )_PATH_UNQUOTERrrs rrUzURL.path"s""4=111rcftt|jd}t|S)zA MultiDictProxy representing parsed query parameters in decoded representation. Empty value if URL has no query part. Tkeep_blank_values)r rraw_query_stringrrs rrnz URL.query+s/ $"74PPPQQc"""rc|jjS)zOEncoded query part of URL. Empty string if query is missing. )rGrnrs rrzURL.raw_query_string6syrc6||jS)zODecoded query part of URL. Empty string if query is missing. ) _QS_UNQUOTERrrs rrszURL.query_string?s  !6777rc@|js|jS|jd|jS)zDecoded path of URL with query.?)rsrUrs rpath_qsz URL.path_qsHs0  9 )11d/111rc@|js|jS|jd|jS)zEncoded path of URL with query.r)rrrs r raw_path_qszURL.raw_path_qsOs0$ != -99$"7999rc|jjS)zUEncoded fragment part of URL. Empty string if fragment is missing. )rGrors r raw_fragmentzURL.raw_fragmentVrrc6||jS)zUDecoded fragment part of URL. Empty string if fragment is missing. )rrrs rroz URL.fragment_rrcH|jj}|r(|sdg}nndg|dddz}nL|dr"dg|dddz}n|d}t |S)zjA tuple containing encoded *path* parts. ('/',) for absolute URLs if *path* is missing. rrN)rGrUrsplit startswithtuple)r(rUpartss r raw_partsz URL.raw_partshsy~      ( 4QRRs 3 33s## (QRRs 3 33 3U||rcDtfdjDS)zjA tuple containing decoded *path* parts. ('/',) for absolute URLs if *path* is missing. c3BK|]}|VdSr+r).0partr(s r zURL.parts..s/EEdT^^D))EEEEEEr)rrrs`rrz URL.parts|s*EEEEdnEEEEEErcR|j}|r|dkr;|js|jr+t|jdddS|S|d}|jd|dddd}t|dS) z]A new URL with last part of path removed and cleaned up query and fragment. rr")rnroTrvNr<rUrnro)rrrrFrGrrjoin)r(rUrr1s rparentz URL.parents } ts{{  TD$9 T49--B-DDdSSSSK 3i  chhuSbSz&:&:"r RR3%%%%rct|j}|r|dd}|sdS|dS|dS)zThe last part of raw_parts.rNr"r<)rr)r(rs rraw_namez URL.raw_namesM      !""IE !rRy 9 rc6||jS)zThe last part of parts.)rrrs rr'zURL.names~~dm,,,rc|j}|d}d|cxkrt|dz kr nn ||dSdS)Nr;rrr")rrfindlen)r(r'is r raw_suffixzURL.raw_suffixsV} JJsOO q 3t99q= 8O2rc6||jSr+)rrrs rsuffixz URL.suffixs~~do...rc|j}|drdS|d}td|dddDS)Nr;r8c3 K|] }d|zV dSr;Nr8)rrs rrz#URL.raw_suffixes..s&DDfS6\DDDDDDrr)rendswithlstriprrrs r raw_suffixeszURL.raw_suffixessc} ==   2{{3DD 30CDDDDDDrcDtfdjDS)Nc3BK|]}|VdSr+r)rrr(s rrzURL.suffixes..s/LLT^^F++LLLLLLr)rr rs`rsuffixesz URL.suffixess)LLLL$:KLLLLLLrct|dkr7t|dkr&|dstddSdSdS)znEnsure that path in URL with authority starts with a leading slash. Raise ValueError if not. rrzCPath in a URL with authority should start with a slash ('/') if setN)rrr\rSs rrfz$URL._validate_authority_uri_abs_pathsU t99q==SYY]]4??33G3G]U  =]]]]rcg}t|D]}|s|ddkrtd|d|r|n||}d|vr0|dt|dDz }q|dkr||||jj}|r,g|dd|}| r"t|}|r|ddkrdg|}d |}t|j |ddd S) zIadd segments to self._val.path, accounting for absolute vs relative pathsrrzAppending path z! starting from slash is forbiddenc3*K|]}|r |dk |VdSr r8)rsubs rrz"URL._make_child..s7sGJczzCzzzzrr;r"rTrv)reversedr\rwrr@reverserGrUrstriprrDrrFr)r(rArNparsedrCold_pathnew_paths rrzURL._make_childsH%% # #C 1v}} NcNNN!<##d&7&7&<&  A@xs++11#66@@F      '-f55F '&)r//v88F## I  HB  D Dd    rcd}|dr d}|dd}|d}|dt|zS)Nr"rr)rrrrD)rkrUprefixrAs rrezURL._normalize_paths` ??3   F8D::c??!9(!C!CDDDDrc< |d\}}}t|}|j}|r|d|zz }|jdkrd|zdz}nM#t$r@|}|s|r|cYSt|}YnwxYw|S)Nr[]) partitionr compressedversionr\lowerisascii _idna_encode)rkrThumanipsepzones r _encode_hostzURL._encode_hosts ( NN3//MBTBB=D #d "zQTzC' & & &::<||}|r||}t|dkr|ddkrd|z}t |j|dddS)z$Return a new URL with path replaced.rrr"rTrv)rwrrerrFrGr)r(rUrNs r with_pathz URL.with_paths 2$$T**D!! 2++D11 t99q==T!W^^:D49%%4rB%GGQUVVVVrc#K|D]\}}t|ttfr5|D]1}||dz|||zV2V||dz|||zVdS)N=)r]listr _query_var)rkr0pairskeyr1rs r_query_seq_pairszURL._query_seq_pairss F FHC#e}-- FHHA &+++ffS^^A5F5F.G.GGGGGGHfSkkC'&&1D1D*E*EEEEEE  F Frct|}t|tr|St|trbt j|rt dt j|rt dtt|St|tr%|turtt|Std ||)Nzfloat('inf') is not supportedzfloat('nan') is not supportedzMInvalid variable type: value should be str, int or float, got {!r} of type {}) rZ issubclassr[floatmathisinfr\isnanr;rr^format)rrks rrBzURL._query_vars1gg c3   H c5 ! ! !z!}} B !@AAAz!}} B !@AAAuQxx== c3   CtOOs1vv;;  3   rc|r%t|dkrtd|}n+t|dkr |d}ntd|d}nt|trCjd|}nt|tr |}nt|tttfrtdt|tr*jdfd|D}ntd|S)Nrz7Either kwargs or single query parameter must be presentr&zAInvalid query type: bytes, bytearray and memoryview are forbiddenc3xK|]4\}}|dz|zV5dS)r@N)rB)rkrr0r(s rrz%URL._get_str_query..s_AEAq C&&););"<"<<rzRInvalid query type: only str, mapping or sequence of (key, value) pairs is allowed)rr\r]r_QUERY_PART_QUOTERrrEitemsr[rxbytes bytearray memoryviewr^r)r(argskwargsrnr0s` @r_get_str_queryzURL._get_str_querys  X4yy1}} MEE YY!^^GEEVWW W =EE w ' ' ,FHHT2265;;==IIJJEE s # # &&u--EE y*= > > S x ( ( ,F HHINEE<   rc|j|i|pd}t|j|jj|dS)a[Return a new URL with query part replaced. Accepts any Mapping (e.g. dict, multidict.MultiDict instances) or str, autoencode the argument if needed. A sequence of (key, value) pairs is supported as well. It also can take an arbitrary number of keyword arguments. Clear query if None is passed. r")rUrnTrv)rXrFrGrrU)r(rVrW new_querys rrzzURL.with_querysU(D'888>B  I  DIN)  D Dd    rc0|j|i|}d}|Gtt|d}t|j}||t |j||pddS)z)Return a new URL with query part updated.NTrr")rnrv)rXr rrnupdaterFrGr)r(rVrWsrnrZs rrzURL.update_querys D  0 0 0 =!)A"F"F"FGGIdj))E LL # # # I  T%8%8%?%?%E2  F FPT    rc|d}n9t|tstd||}|j|kr|St |j|dS)zReturn a new URL with fragment replaced. Autoencode fragment if needed. Clear fragment to default if None is passed. Nr"zInvalid fragment type)roTrv)r]r[r^ryrrFrGr)r(rors r with_fragmentzURL.with_fragments~  LLHc** ;344 400::L   , ,K49%%|%<>>>rc0|||S)zAReturn a new URL with the elements in other appended to the path.rv)r)r(rNrs rjoinpathz URL.joinpathZsw777rc t|jd}t|jd}|j}|r||jd}t|jd}dd|jD}t|j d}tt|j | ||||jjd |||S) z.fs\  1 NN<733\!W5M5M N N      rr"Fr)rjrrrcrTr*rUrrnrRror rrprarGr`)r(rrrcrTrUrsros r human_reprzURL.human_repr^sDIw// w77y  <$$TYd$;;DDIt,,xx   ((**       r22  !!IN % "     r)r")F)FTF)_r&rr6 __slots__rr/r.rwrdrxrgrQryrhrrrrrj classmethodr}rrrrrrrrrrrrrrrrrrrrpropertyrprr rqrrrrrcrrTr`rrrUrnrrsrrrrorrrrr'rrr r staticmethodrfrrer*rar2r5r7r9r<r>rErBrXrzrr_rardrrgrkr8rrrFrFOsN#Ige$$$G I7eDDDLW$$777NG6dERRRMg6VEEEO fuEEEwFE::: f--- IYc***N9%%%L.d.....`    DDDD[DLMMM ;;;)))   ''' &&& ''' &&& ))) ((( $    ))) $ $ $&&& & & &  X   X   _   X --_-""X"11_1""X"!!_! EEXEX  X 22_2##_#X88_822_2 ::_: ""X"11_1_&FF_F & &_ &  _ --_-_//_/EE_EMM_M\    @ E E[ E[*QV[2LLL   4   2   0   ,*/WWWWWFF[F  \ $&&&P   (    LLL&   @$$$*???"(-88888     rrFc|s|Sd|zD]-}||vr'||dt|d}.|r|Sdd|DS)Nr02Xr"c3`K|])}|r|nt|V*dSr+) isprintabler )rcs rrz_human_quote..s9AA! 511U1XXAAAAAAr)replaceordrsr)r]rMrts rrjrj|s  6\// 66 !-Q---..A}} 77AAqAAA A AArc tj|dS#t$r+|ddcYSwxYw)Nridna)rydecoderQ UnicodeError)rs rrrsd2{3::g../// 222zz'""))&111112s&)2AAc tj|ddS#t$r+|ddcYSwxYw)NT)uts46rry)ryrQrzr{)rTs rr%r%sk3{4t,,,33G<<< 333{{6""))'222223s(+2A A cjttdSr+)r cache_clearr%r8rrrrs,rchttdS)N) idna_encode idna_decode)r% cache_inforr8rrrrs1$..00#..00  ridna_encode_sizeidna_decode_sizectj|tjatj|tjadSr+) functools lru_cacher% __wrapped__rrs rcache_configurersD99&'7889QRRL89&'7889QRRLLLr)'rrIrXcollections.abcrr contextlibr ipaddressr urllib.parserrr r r r ry multidictr r_quotingrrrrir7rr rDrFrj _MAXCACHErrr%rrrr8rrrsV -------- UUUUUUUUUUUUUUUU ////////((((((((cC@@ 6886 ========>0i i i i i i i i X!BBB  Y22 2Y33 3 (1ISSSSSSSr