8f'dZddlmZddlZddlmZmZmZmZddl m Z m Z GddZ Gd d e Z Gd d e ZGd de Zee efZeeeefZeeedfZeedeefZGddeZd2dZd3dZd4dZd5dZd6d!Zd6d"Zd7d#Zd7d$Zd8d%Zd9d&Zd9d'Z d:d(Z!d;d*Z"dd0Z%d?d1Z&dS)@zHandwritten parser of dependency specifiers. The docstring for each __parse_* function contains EBNF-inspired grammar representing the implementation. ) annotationsN) NamedTupleSequenceTupleUnion) DEFAULT_RULES Tokenizerc.eZdZd dZd dZd dZd dZd S) NodevaluestrreturnNonec||_dSNr )selfr s }/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/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!!rN)r rrrrr)r __module__ __qualname__rrrr"rrr r sd8888""""""rr ceZdZddZdS)Variablerrc t|Srrrs rr"zVariable.serialize4yyrNr#rr$r%r"r&rrr(r((rr(ceZdZddZdS)Valuerrcd|dS)N"r&rs rr"zValue.serialize#s4{{{rNr#r,r&rrr/r/"s(rr/ceZdZddZdS)Oprrc t|Srr*rs rr"z Op.serialize(r+rNr#r,r&rrr3r3'r-rr3 MarkerAtom MarkerListcBeZdZUded<ded<ded<ded<ded<d S) ParsedRequirementrnameurl list[str]extras specifierzMarkerList | NonemarkerN)rr$r%__annotations__r&rrr8r82sE III HHHNNNrr8sourcerrcHtt|tSN)rules)_parse_requirementr r r@s rparse_requirementrF= imDDD E EEr tokenizerr cT|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_detailsr8)rH name_tokenr9r<r:r=r>s rrDrDAsd!!R"J ?D d 9 % %F d7 BBCF U%BCCC T3 6 B BBr"tuple[str, str, MarkerList | None]cXd}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)? NATrJURLz URL after @rLrNTpeekzwhitespace after URLzURL and whitespace) span_startafterversion specifierz#name and no valid version specifier)checkreadrOpositionrPrQ_parse_requirement_marker_parse_specifier)rHr=r:r> url_startspecifier_starts rrSrSVs~I C Ft" $& u}==B ??5t? , , ,F+ +(>??? ??5t? , , ,F+ +* )3G   $,$Y// $ ??5t? , , ,F+ +* &;##:     F ##rr\intr]c|ds|d|d||t|}|d|S)z3 requirement_marker = SEMICOLON marker WS? SEMICOLONz!Expected end or semicolon (after ))r\rJ)r_raise_syntax_errorr` _parse_markerrO)rHr\r]r>s rrbrbs~ ??; ' ' $$ 8 8 8 8! %   NN 9 % %F d Mrr;c |ddsgS|ddd5|dt|}|ddddn #1swxYwY|S) zG extras = (LEFT_BRACKET wsp* extras_list? wsp* RIGHT_BRACKET)? LEFT_BRACKETTrZ RIGHT_BRACKETr<aroundrJN)r_enclosing_tokensrO_parse_extras_list)rHr<s rrRrRs ??>? 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)* rKTrJrZz"Expected comma between extra namesCOMMAzextra name after commarL)r_appendr`rQrOrjrP)rHr< extra_tokens rrrrrsF ??< ( (  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_PARENTHESISr^rorJN)rqrO_parse_version_many)rHparsed_specifierss rrcrcs  # #" $    $/ ::$                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)*)? rW SPECIFIERVERSION_PREFIX_TRAILTrZz6.* suffix can only be used with `==` or `!=` operatorsr)r\span_endVERSION_LOCAL_LABEL_TRAILz@Local version label can only be used with `==` or `!=` operatorsrJrt)r_rar`rQrjrO)rHr{r\s rrzrzs@ //+ & & ' Y^^--22 ??1? = =   ( (H%"+a/ )    ??6T? B B   ( (R%"+ )    $w''  Y^^--22$' //+ & & * rcHtt|tSrB)_parse_full_markerr r rEs r parse_markerrrGrcRt|}|dd|S)NrNzend of marker expressionrL)rkrP)rHretvals rrrs. 9 % %F U%?@@@ Mrct|g}|drT|}t|}||j|f|dT|S)z4 marker = marker_atom (BOOLOP marker_atom)+ BOOLOP)_parse_marker_atomr_r`extendrQ)rH expressiontoken expr_rights rrkrks}%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? rJrxTrZryzmarker expressionroN)rOr_rqrk_parse_marker_item)rHr>s rrrs  d)55 /  ' '  &(   $ $   d # # #!.y!9!9F   d # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $$I.. d Ms:B  BB MarkerItemc|dt|}|dt|}|dt|}|d|||fS)zG marker_item = WS? marker_var WS? marker_op WS? marker_var WS? rJ)rO_parse_marker_var_parse_marker_op)rHmarker_var_left marker_opmarker_var_rights rrr(sd' 22O d ++I d(33 d Y(8 99r MarkerVarcF|dr:t|jddS|dr&t |jS|ddS)z/ marker_var = VARIABLE | QUOTED_STRING VARIABLE._ QUOTED_STRINGz+Expected a marker variable or quoted string)messageN)r_process_env_varr`rQreplaceprocess_python_strrjrHs rrr6sz"" y~~//4<=, >, ~=, ===, in, not in)r_r`r3rPrQrjrs rrrPst $xx     (@AAA(:;;;(||    )..""'(((++ 8   r)r@rrr8)rHr rr8)rHr rrU)rHr r\rfr]rrr6)rHr rr;)rHr rr)r@rrr6)rHr rr6)rHr rr5)rHr rr)rHr rr)rrrr()rrrr/)rHr rr3)'__doc__ __future__rrtypingrrrr _tokenizerr r r r(r/r3rrr5rr6r8rFrDrSrbrRrrrcrzrrrkrrrrrrr&rrrs #""""" 55555555555500000000 " " " " " " " "t D  (E/ " 9b)+ , :x 55 6 eL*c9: ;  FFFFCCCC*0$0$0$0$f(&6"@FFFF    , : : : :     !!!!       r