hf'HdZddlZddlmZmZmZmZmZmZddl m Z m Z GddZ Gdd e Z Gd d e ZGd d e Zee efZeeeefZeZeeZGddeZdedefdZde defdZde deeeeeffdZde dededefdZde deefdZde deefdZde defdZde defdZdedefdZde defdZ de defdZ!de defd Z"de defd!Z#d"ede fd#Z$d$edefd%Z%de defd&Z&dS)'zHandwritten parser of dependency specifiers. The docstring for each __parse_* function contains ENBF-inspired grammar representing the implementation. N)AnyList NamedTupleOptionalTupleUnion) DEFAULT_RULES TokenizercBeZdZdeddfdZdefdZdefdZdefdZdS)NodevaluereturnNc||_dSNr)selfrs q/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/packaging/_parser.py__init__z Node.__init__s  c|jSrrrs r__str__z Node.__str__s zrc(d|jjd|dS)N) __class____name__rs r__repr__z Node.__repr__s 74>*77d7777rctr)NotImplementedErrorrs r serializezNode.serializes!!r)r __module__ __qualname__strrrrr!rrr r scd8#8888"3""""""rr ceZdZdefdZdS)Variablerc t|Srr$rs rr!zVariable.serialize4yyrNrr"r#r$r!r%rrr'r'/3rr'ceZdZdefdZdS)Valuercd|dS)N"r%rs rr!zValue.serialize!s4{{{rNr+r%rrr.r. s/3rr.ceZdZdefdZdS)Oprc t|Srr)rs rr!z Op.serialize&r*rNr+r%rrr2r2%r,rr2cZeZdZUeed<eed<eeed<eed<eeed<dS)ParsedRequirementnameurlextras specifiermarkerN)rr"r#r$__annotations__rr MarkerListr%rrr5r54sN III HHH INNN Z      rr5sourcercHtt|tSN)rules)_parse_requirementr r r=s rparse_requirementrC?s imDDD E EEr tokenizercT|d|dd}|j}|dt|}|dt |\}}}|ddt |||||S)zI requirement = WS? IDENTIFIER WS? extras WS? requirement_details WS IDENTIFIERz1package name at the start of dependency specifierexpectedENDzend of dependency specifier)consumeexpecttext _parse_extras_parse_requirement_detailsr5)rD name_tokenr6r8r7r9r:s rrArACsd!!R"J ?D d 9 % %F d7 BBCF U%BCCC T3 6 B BBrcXd}d}d}|dr||d|j}|ddj}|dd r|||fS|dd |dd r|||fSt ||d }n]|j}t|}|d|dd r|||fSt |||rdnd }|||fS)z~ requirement_details = AT URL (WS requirement_marker?)? | specifier WS? (requirement_marker)? NATrFURLz URL after @rHrJTpeekzwhitespace after URLzURL and whitespace) span_startafterversion specifierz#name and no valid version specifier)checkreadrKpositionrLrM_parse_requirement_marker_parse_specifier)rDr9r7r: url_startspecifier_starts rrOrOXs~I C Ft" $& u}==B ??5t? , , ,F+ +(>??? ??5t? , , ,F+ +* )3G   $,$Y// $ ??5t? , , ,F+ +* &;##:     F ##rrWrXc|ds|d|d||t|}|d|S)z3 requirement_marker = SEMICOLON marker WS? SEMICOLONz!Expected end or semicolon (after ))rWrF)rZraise_syntax_errorr[ _parse_markerrK)rDrWrXr:s rr]r]s~ ??; ' ' $$ 8 8 8 8! %   NN 9 % %F d Mrc |ddsgS|ddd5|dt|}|ddddn #1swxYwY|S) zG extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)? LEFT_BRACKETTrU RIGHT_BRACKETr8aroundrFN)rZenclosing_tokensrK_parse_extras_list)rDr8s rrNrNs ??>? 5 5  # # $    $#I..$                Ms:A88A<?A<cg}|ds|S||j |d|ddr|dn|dsn[||d|dd}||j|S) z> extras_list = identifier (wsp* ',' wsp* identifier)* rGTrFrUz"Expected comma between extra namesCOMMAzextra name after commarH)rZappendr[rMrKrdrL)rDr8 extra_tokens rrlrlsF ??< ( (  MM)..""'((( ($ ??V&WW  k&''' ( Mrc|ddd5|dt|}|ddddn #1swxYwY|S)zr specifier = LEFT_PARENTHESIS WS? version_many WS? RIGHT_PARENTHESIS | WS? version_many WS? LEFT_PARENTHESISRIGHT_PARENTHESISrYrirFN)rkrK_parse_version_many)rDparsed_specifierss rr^r^s  # #" $    $/ ::$                s:AA#&A#c2d}|dr|j}||jz }|ddr |d||jdz|d dr|d ||j|d |d snF||jz }|d |d|S) z@ version_many = (SPECIFIER (WS? COMMA WS? SPECIFIER)*)? rR SPECIFIERVERSION_PREFIX_TRAILTrUz6.* suffix can only be used with `==` or `!=` operatorsr )rWspan_endVERSION_LOCAL_LABEL_TRAILz@Local version label can only be used with `==` or `!=` operatorsrFrn)rZr\r[rMrdrK)rDrurWs rrtrts@ //+ & & ' Y^^--22 ??1? = =   ( (H%"+a/ )    ??6T? B B   ( (R%"+ )    $w''  Y^^--22$' //+ & & * rcHtt|tSr?)rer r rBs r parse_markerr|s 6??? @ @@rct|g}|drT|}t|}||j|f|dT|S)z4 marker = marker_atom (BOOLOP marker_atom)+ BOOLOP)_parse_marker_atomrZr[extendrM)rD expressiontoken expr_rights rreres}%Y//0J //( # #4  ' 22 5:z2333 //( # #4 rcz|d|ddrj|ddd5|dt|}|ddddn #1swxYwYnt |}|d|S) zw marker_atom = WS? LEFT_PARENTHESIS WS? marker WS? RIGHT_PARENTHESIS WS? | WS? marker_item WS? rFrrTrUrszmarker expressionriN)rKrZrkre_parse_marker_item)rDr:s rrrs  d)55 /  ' '  &(   $ $   d # # #!.y!9!9F   d # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $$I.. d Ms:B  BBc|dt|}|dt|}|dt|}|d|||fS)zG marker_item = WS? marker_var WS? marker_op WS? marker_var WS? rF)rK_parse_marker_var_parse_marker_op)rDmarker_var_left marker_opmarker_var_rights rrr$sd' 22O d ++I d(33 d Y(8 99rcF|dr:t|jddS|dr&t |jS|ddS)z/ marker_var = VARIABLE | QUOTED_STRING VARIABLE._ QUOTED_STRINGz+Expected a marker variable or quoted string)messageN)rZprocess_env_varr[rMreplaceprocess_python_strrdrDs rrr2sz"" y~~//4<=, >, ~=, ===, in, not in)rZr[r2rLrMrdrs rrrOst $xx     (@AAA(:;;;(||    )..""'(((++ 8   r)'__doc__rtypingrrrrrr _tokenizerr r r r'r.r2 MarkerVar MarkerItem MarkerAtomr<r5r$rCrArOintr]rNrlr^rtr|rerrrrrrr%rrrs  @@@@@@@@@@@@@@@@00000000 " " " " " " " "t D  (E/ " 9b)+ ,  #Y !!!!! !!!FcF&7FFFFC)C0ACCCC*0$0$ 3Xj) )*0$0$0$0$f),58(Y49&)S 6 c"9@AAAAAA Y :    ) , :) : : : : :    y     !S!X!!!!35   b      r