bgt\ddlZddlZddlZddlmZmZmZmZmZmZm Z m Z ddl m Z ddl mZddlZdZe eZeddefdejejfd efgZ ed ZGd d ejZGd dejZGddeeZdeedefdZdddefdZ d-dejdejedede de deef dZ!ded e ejde fd!Z"Gd"d#Z#Gd$d%Z$dejde fd&Z%d'Z&d e ejfd(Z'e& d.dejd)ejed*e$ded ed+ede de dejefd,Z(dS)/N)List NamedTupleGenericTypeVarDictCallableSetIterable)Template)StringIOaM {% if not head %} {% else %} {{ head | safe }} {% endif %} {{ body | safe }} {% for diagram in diagrams %}

{{ diagram.title }}

{{ diagram.text }}
{{ diagram.svg }}
{% endfor %} NamedDiagramnamediagramindexTc&eZdZdZdZfdZxZS)EachItemz Custom railroad item to compose a: - Group containing a - OneOrMore containing a - Choice of the elements in the Each with the group label indicating that all must be matched z[ALL]ctjt|dz g|R}tj|}t ||jdS)Nitem)label)railroadChoicelen OneOrMoresuper__init__ all_label)selfitems choice_itemone_or_more_item __class__s k/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pyparsing/diagram/__init__.pyrzEachItem.__init__Is^oc%jj1n=u=== #-;??? )@@@@@)__name__ __module__ __qualname____doc__rr __classcell__r$s@r%rr>sRIAAAAAAAAAr&rc(eZdZdZdeffd ZxZS) AnnotatedItemzC Simple subclass of Group that creates an annotation label rc|t||rd|n|dS)Nz[{}]rr)rrformat)r rrr$s r%rzAnnotatedItem.__init__Ts< d%*R&--*>*>*>USSSSSr&)r'r(r)r*strrr+r,s@r%r.r.OsYTcTTTTTTTTTTr&r.ceZdZdZdedefdedefdZe dedefddfd Z e d Z defd Z d S) EditablePartialz Acts like a functools.partial, but can be edited. In other words, it represents a type that hasn't yet been constructed. func.argskwargsc0||_||_||_dSNr5r6r7)r r5r6r7s r%rzEditablePartial.__init__as   r&returnEditablePartial[T]c@t|t||S)z If you call this function in the same way that you would call the constructor, it will store the arguments as you expect. For example EditablePartial.from_call(Fraction, 1, 3)() == Fraction(1, 3) r:)r4list)clsr5r6r7s r% from_callzEditablePartial.from_callfs DtDzz&IIIIr&c|jdS)Nr)r7r s r%rzEditablePartial.namens{6""r&c|j}|j}tj|j}|j|jvr|||jz }|j|i|S)z< Evaluate the partial and return the result )r6copyr7inspectgetfullargspecr5varargspop)r r6r7arg_specs r%__call__zEditablePartial.__call__rs|y~~!!##)$)44  t{ * * FJJx/00 0Dty$)&)))r&N)r'r(r)r*rrr>dictr classmethodr@propertyrrJr&r%r4r4XsXc1f-T4 JXc1f-JCWJJJ[J##X# *! * * * * * *r&r4diagramsr;c $g}|D]y}|j t}|j|j|j}|jdkr|dz }||d|dztj dd|i|S)z Given a list of NamedDiagram, produce a single HTML string that visualises those diagrams :params kwargs: kwargs to be passed in to the template Nrz (root))titletextsvgrOrN) rr writeSvgwriterrappendgetvaluetemplaterender)rOr7datariorRs r%railroad_to_htmlr]s DHH ? "  ZZ  ***  =A   Y E eR FFGGGG ? 3 3D 3F 3 33r&partialr<cPt|trz#resolve_partial..s 444q""444r&c4i|]\}}|t|SrNra)rckeyrds r% z#resolve_partial..s&FFFFC_Q''FFFr&) isinstancer4rbr6r7r>rKr!)r^s r%rbrbs'?++ &w|44 (88wyy GT " "44G4444 GT " "FFgmmooFFFFr&Felementdiagram_kwargsverticalshow_results_names show_groupscbt|pi}t||d|||t|}||vr2|js d||_||||dt |j}t|dkrmt}g} |D]M} | jdkr| j8| j|vr/| | j| | Nd | D} n d |D} t| d S) a Convert a pyparsing element tree into a list of diagrams. This is the recommended entrypoint to diagram creation if you want to access the Railroad tree before it is converted to HTML :param element: base element of the parser being diagrammed :param diagram_kwargs: kwargs to pass to the Diagram() constructor :param vertical: (optional) - int - limit at which number of alternatives should be shown vertically instead of horizontally :param show_results_names - bool to indicate whether results name annotations should be included in the diagram :param show_groups - bool to indicate whether groups should be highlighted with an unlabeled surrounding box )rlN)lookupparentrmrnrorQT)forcerz...c,g|]}t|SrNrarcr^s r%rezto_railroad..s JJJOG,,JJJr&c,g|]}t|SrNrarus r%rezto_railroad..s BBBOG,,BBBr&c|jSr9r)diags r%zto_railroad..sTZr&)rg)ConverterState_to_diagram_elementid customNamermark_for_extractionr>rOvaluesrsetaddrWsorted) rkrlrmrnrorqroot_iddiagsseen deduped_diagsdresolveds r% to_railroadrsf(>+?R @ @ @F- kkG&! &#%F7O w++GV4+HHH '')) * *E 5zzA~~uu  ( (Avv!afD&8&8   $$Q'''JJMJJJCBEBBB ( 7 7 8 8 88r& specificationexprscJ|dStt||kS)zF Returns true if we should return a vertical list of elements NF)r_visible_exprs)rrs r%_should_verticalrs* u>%(())]::r&cteZdZdZ ddejdedededede j ef d Z dd ed d dede fdZ dS) ElementStatez< State recorded for an individual pyparsing Element Nrk convertedrrnumberr parent_indexcv||_||_||_||_||_||_d|_d|_dSNF)rkrrrrrrextractcomplete)r rkrrrrrrs r%rzElementState.__init__sA18 *. *3'- ! 2>" # r&Fel_idstater{rscd|_|js/|r||_n%|jjr|jj|_nd|_|s|jr+t |jr||dSdSdS)a Called when this instance has been seen twice, and thus should eventually be extracted into a sub-diagram :param el_id: id of the element :param state: element/diagram state tracker :param name: name to use for this element's text :param force: If true, force extraction now, regardless of the state of this. Only useful for extracting the root element when we know we're finished TrQN)rrrkr~r_worth_extractingextract_into_diagram)r rrrrss r%rz ElementState.mark_for_extraction s y    (  L3   .T] .'8'F'F .  & &u - - - - - . . . .r&)NNr)r'r(r)r* pyparsing ParserElementr4intr2typingOptionalrboolrrNr&r%rrs-1$$($#$ $  $  $oc*$$$$6TY...!1.9<.LP......r&rceZdZdZddejefdZdede fdZ dede fd Z defd Z defd Z defd Zdefd ZdefdZdS)r{zR Stores some state that persists between recursions into the element tree Nrlcvi|_i|_d|_d|_|pi|_t |_dS)Nrr)_element_diagram_statesrO unnamed_indexrrlrextracted_diagram_names)r rls r%rzConverterState.__init__.s?@B$BD "# $2$8b14$$$r&rgvaluec||j|<dSr9r)r rgrs r% __setitem__zConverterState.__setitem__;s,1$S)))r&r;c|j|Sr9rr rgs r% __getitem__zConverterState.__getitem__>s+C00r&c|j|=dSr9rrs r% __delitem__zConverterState.__delitem__As  ( - - -r&c||jvSr9rrs r% __contains__zConverterState.__contains__Dsd222r&c0|xjdz c_|jS)zT Generate a number used in the name of an otherwise unnamed diagram r)rrBs r%generate_unnamedzConverterState.generate_unnamedGs! a!!r&c0|xjdz c_|jS)z; Generate a number used to index a diagram rrxrBs r%generate_indexzConverterState.generate_indexNs a zr&rc ||}|jrqttj|j}d|jjvr||jjd<n(d|jjvr||jjd|j<|jj tj kr|jjd}n|j}tt|jtjtj |fi|j |j|j|<||=dS)z Used when we encounter the same token twice in the same tree. When this happens, we replace all instances of that token with a terminal, and create a new subdiagram for the token rSrr!)rrrN)rrr4r@r NonTerminalrr7rrr5Groupr DiagramrlrrO)r rpositionretcontents r%rz#ConverterState.extract_into_diagramUs ; ? M!++H,@x}+UUC///14&v..HO222IL&w/0EF   "hn 4 4(/7GG(G.88 #- '-1-@/ 9   e KKKr&r9)r'r(r)r*rrrKrrrrrrrrrrrNr&r%r{r{)s 7 7vt'< 7 7 7 72s2<22221s1|1111.s....33333"#""""#r&r{c\|}td|DS)z Returns true if this element is worth having its own sub-diagram. Simply, if any of its children themselves have children, then its complex enough to extract c3>K|]}|VdSr9)recurse)rcchilds r% z$_worth_extracting..}s*555u}}555555r&)rany)rkchildrens r%rrws0   H 55H555 5 55r&c ddtjdtjtdt dt dt d td td td tjtffd }|S)z decorator to ensure enhancements to a diagram item (such as results name annotations) get applied on return from _to_diagram_element (we do this since there are several returns in _to_diagram_element) NrFrkrrrqrmr name_hintrnror;c  ||||||||}|r@|>|j} | r5| |jrdndz } ttj|| }|S)NrQ*r0) resultsName modalResultsr4r@rr) rkrrrqrmrrrnrorelement_results_namefns r%_innerz0_apply_diagram_item_enhancements.._innersb             #/#*#6 # $g.B(KK$%//N4H0 r&NNrNFF) rrrrr4r{rr2r)rrs` r% _apply_diagram_item_enhancementsrs"&#(!  ( 0       !    )      D Mr&cptjtjtjjffd|DS)NcPg|]"}|j |jt| |#SrN)r~rri)rcenon_diagramming_exprss r%rez"_visible_exprs..sR      !"  2ttj|j| jd}|St |tjr|sdSt+t-d|DdkrCttjd t1t+| }nt3||r(ttjg }nHttjg }n t |tjtjfre|sdSt3||r)ttjdg }nttjg }nt |tj r'|sdSttBg }nTt |tj"r$ttFd d }nt |tj$r$ttFdd }nt |tj%r$ttFdd }nt |tj&rO|r$ttFd d }nZttj&d d }n1t |tj'rHttFtQ|j)d }nt |tj*r(ttj+d }nt |tjr(ttjd }nKt |tj,r(ttj,d }n t |tj&r(ttj&d| }nt |tj-r |jsd}nt+|dkr'ttjg }nit+|dkr*| s(ttj&d | }n,ttj.|j/}|}|dSta|||||1|| <|jr"||  | ||jd}|D]}d|jvr!|jd2|dt|||||||}|3d|jvr ||jd<Xd|jvr||jd|<|dz }wd|jvr|jd|=|rbd|jvrt+|jddksd|jvr2|jd%ttj.| }| |vr d|| _3| |vrm|| j4r`|| j3rS|5| |.s+::qAFAM*::::::r&rrQ)rrepeat)r!NOT)rr LOOKAHEAD LOOKBEHINDrr0)rkrrrrrr!)rrrqrmrrnrorT)6rr~r$r'r}rrirLocatedr|exprrrr4r@rrrrOr7rrrrr2rStackSequenceOr MatchFirstrHorizontalChoiceEachrNotAnyr. FollowedBy PrecededByrTokenConvertertypelowerOptr ZeroOrMoreEmptyTerminal defaultNamerrinsertrrr)rkrrrqrmrrrnrorrrrpropagated_name looked_uprterminalirrs r%r|r|s0 OO  E  H* Hg.?.HD wKKE".    !     Qx*+&*OO&*O*L!!%-'9 +    !! F??u I  ) )%i ) H H H!++H,@y~+VVCJ fo % %"++$6?5+A+H+P,CJ '9=)): 4 s::E::::: ; ;q @ @!++"CE OO,CCh . . I!++HN"+EECC!++H,=R+HHCC GilI,@A B B- 4 He , , Q!++HOQb+IICC!++H,ER+PPCC GY^ , ,& 4''';; GY- . ."'' U'LL GY1 2 2 '' [r'RR GY1 2 2'' \PR'SS GY_ - -  O!++M"+MMCC!++HN"2+NNCC GY5 6 6'' g!7!=!=!?!?b(   GY] + +''(9'CC GY0 1 1''(:'DD GY1 2 2''(;"'EE GY_ - - '' N-A(   GY_ - - g6H  Ua''(9'DD Ua 4''Rt'LL",,X->@STT {!$$&& F5MMu ))%9KLLL A'' cj Jw  & &q$ / / /" 1#     ##%) 6""CJ&&)- 7#A&Q  " " 7#A& A CJ  3sz'':#;#;q#@#@ cj SZ%7%?''(94@@ !%u  6%=0VE]5K##E*** ?!++$6?5+A+H+P,C Jr&)NrjFFr))rrrrrrrrrr r jinja2r r\r rEjinja2_template_sourcerYr2r DiagramItemrr rrrr.r4r]rbrrKrrrrr{rrrr|rNr&r%rs                      : 8* + +z c]Y0D EFRUW  GCLLAAAAAx~AAA"TTTTTHNTTT'*'*'*'*'*gaj'*'*'*T4tL144444& 1 a    $-1$ 7979  $79OD)7979 79  79  , 79797979t ; ;' (?@ ;  ; ; ; ;;.;.;.;.;.;.;.;.|KKKKKKKK\6y6646666)))X (9#:;    ""$HH  $H OO ,H H H  H  HHH __%HHH"!HHHr&