2biDh%SSKJrJrJrJrJrJr SSKrSSKJ r J r J r J r J r \\4r\ \S4\S'\"SS55r"SS 5r"S S 5r\R,"\5 \R,"\5 g) )MutableMappingMappingMutableSequenceIteratorSequence ContainerN)TupleAnyDictSetList.str_typec#$# UHov M g7fN).0_s ڏ/builddir/build/BUILDROOT/alt-python313-pip-23.3.1-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/pip/_vendor/pyparsing/results.py rs2a2srcT\rSrSr%\S\4\S'S/rSSS\4SjrSr Sr S r S r g ) _ParseResultsWithOffset ParseResultstupp1p2cX4Ulgrr)selfrrs r__init__ _ParseResultsWithOffset.__init__s .0Xc URU$rrris r __getitem__#_ParseResultsWithOffset.__getitem__sxx{r"cUR$rrrs r __getstate__$_ParseResultsWithOffset.__getstate__s xxr"cUSUlgNrr)rargss r __setstate__$_ParseResultsWithOffset.__setstate__s 7r"rN) __name__ __module__ __qualname____firstlineno__r int__annotations__ __slots__r r&r*r/__static_attributes__rr"rrrs; ~s" ##I6>6s6r"rc@\rSrSr%SrS/S4r\\S4\S'\ \S'S\S'\ \ \S '\ \S '\ \\S '\ \ \4\S 'S r"SS\5r S:SjrSSSS\4SjrSr\4SjrSrS\ 4SjrS\4SjrS\ 4SjrS\4SjrS\4SjrSrSrSrS\ 4Sjr S r!S;S!jr"S"r#S#r$S$r%S%r&S&r'SS,jr-S\4S-jr.S\/4S.jr0S=S/jr1S=S0jr2S1r3S?S\ 4S2jjr4S3r5S4r6S5r7S6r8S7r9\:S;S=S8jj5r;\.r<\0r=\3r>S9r?g)@r"aStructured parse results, to provide multiple means of access to the parsed data: - as a list (``len(results)``) - by list index (``results[0], results[1]``, etc.) - by attribute (``results.`` - see :class:`ParserElement.set_results_name`) Example:: integer = Word(nums) date_str = (integer.set_results_name("year") + '/' + integer.set_results_name("month") + '/' + integer.set_results_name("day")) # equivalent form: # date_str = (integer("year") + '/' # + integer("month") + '/' # + integer("day")) # parse_string returns a ParseResults object result = date_str.parse_string("1999/12/31") def test(s, fn=repr): print(f"{s} -> {fn(eval(s))}") test("list(result)") test("result[0]") test("result['month']") test("result.day") test("'month' in result") test("'minutes' in result") test("result.dump()", str) prints:: list(result) -> ['1999', '/', '12', '/', '31'] result[0] -> '1999' result['month'] -> '12' result.day -> '31' 'month' in result -> True 'minutes' in result -> False result.dump() -> ['1999', '/', '12', '/', '31'] - day: '31' - month: '12' - year: '1999' Nr. _null_values_name_parent _all_names_modal_toklist_tokdict)r<r=r>r?r@rAc"\rSrSrSrSSjrSrg)zParseResults.Listba Simple wrapper class to distinguish parsed list results that should be preserved as actual Python lists, instead of being converted to :class:`ParseResults`:: LBRACK, RBRACK = map(pp.Suppress, "[]") element = pp.Forward() item = ppc.integer element_list = LBRACK + pp.DelimitedList(element) + RBRACK # add parse actions to convert from ParseResults to actual Python collection types def as_python_list(t): return pp.ParseResults.List(t.as_list()) element_list.add_parse_action(as_python_list) element <<= item | element_list element.run_tests(''' 100 [2,3,4] [[2, 1],3,4] [(2, 1),3,4] (2,3,4) ''', post_parse=lambda s, r: (r[0], type(r[0]))) prints:: 100 (100, ) [2,3,4] ([2, 3, 4], ) [[2, 1],3,4] ([[2, 1], 3, 4], ) (Used internally by :class:`Group` when `aslist=True`.) NcUc/n[U[5(d-[URS[ U5R35e[R U5$)Nz* may only be constructed with a list, not ) isinstancelist TypeErrorr1type__new__)cls containeds rrIParseResults.List.__new__sW  i..||n$NtT]OgOgNhi<<$ $r"rr)r1r2r3r4__doc__rIr8rr"rr ParseResults.Listbs $ L %r"r c ~[U[5(aU$[RU5nSUlSUl[ 5UlUc/UlOY[U[[45(a6[U[R5(aUSS/O [U5UlOU/Ul[5Ul U$r)rErobjectrIr<r=setr>r@rF_generator_typer dictrA)rJtoklistnamekwargsrs rrIParseResults.__new__s g| , ,N~~c"  % ?DM $!8 9 9g|'8'899 '] M %IDM  r"TcU X@lUbUS:waU"U[5(a [U5nU(dU1UlX lXR ;aU"U[ [45(aU/nU(aXU"U[5(a"[[UR5S5X'O[[US5S5X'X UlgUSX'gggg![[[4a XLaXU'gX lgf=f)Nr)r?r5strr>r<r;rrHrrr@KeyErrorrG IndexError)rrTrUasListmodalrEs rr ParseResults.__init__s    $$$4y#'&J///g$'788&iG!'<88%<()9)9:A& &=(4a& (,J$.%,QZ 0 !+ ,%i<.".)0J)-J .sCD8DDc[U[[45(aURU$XR;aUR USS$[ UR UVs/sHo"SPM sn5$s snf)Nr)rEr5slicer@r>rAr)rr%vs rr&ParseResults.__getitem__so a#u & &==# #'}}Q'+A..#4==3C$D3CaqT3C$DEE$Ds%A:cU"U[5(a;URRU[55U/-URU'USnOjU"U[[ 45(aX R U'UnOAURRU[55[US5/-URU'UnU"U[5(aXlggr-) rrAgetrFr5rbr@rr=)rkrcrEsubs r __setitem__ParseResults.__setitem__s a0 1 1#}}00DF;qcADMM! A$C C< ( ( MM! C#}}00DF;'1-? DMM! C c< ( (K )r"c [U[[45(a[UR5nURU [U[5(aUS:aX- n[XS-5n[ [ URU565nUR5 URR5H7upEUH,n[U5Hunup[XX:- 5XW'M M. M9 gURU g)Nr) rEr5rblenr@rFrangeindicesreverserAitems enumerater) rr%mylenremovedrU occurrencesjrgvaluepositions r __delitem__ParseResults.__delitem__s a#u & & &E a !S!!q5JA!UO5!))E"234G OO %)]]%8%8%:! A09+0F,,E)@!x|#<* 1G!&; a r"returncXR;$rrA)rrgs r __contains__ParseResults.__contains__sMM!!r"c,[UR5$r)rmr@r)s r__len__ParseResults.__len__s4==!!r"cHUR=(d UR($r)r@rAr)s r__bool__ParseResults.__bool__s 677r"c,[UR5$riterr@r)s r__iter__ParseResults.__iter__DMM""r"c8[URSSS25$)Nrarr)s r __reversed__ParseResults.__reversed__sDMM$B$'((r"c,[UR5$r)rrAr)s rkeysParseResults.keys rr"c8^U4SjTR55$)Nc3.># UH nTUv M g7frrrrgrs rr&ParseResults.values..s-AQsrr)s`rvaluesParseResults.values s---r"c8^U4SjTR55$)Nc30># UH oTU4v M g7frrrs rr%ParseResults.items..s2kDG ksrr)s`rrqParseResults.itemss2diik22r"c"UR($)z Since ``keys()`` returns an iterator, this method is helpful in bypassing code that looks for the existence of any defined results names.r}r)s rhaskeysParseResults.haskeyss}}$$r"cU(dS/nUR5H!up4US:Xa USU4nM[SU<35e [US[5(d[ U5S:Xd USU;a USnXnX U$USnU$)a Removes and returns item at specified index (default= ``last``). Supports both ``list`` and ``dict`` semantics for ``pop()``. If passed no argument or an integer argument, it will use ``list`` semantics and pop tokens from the list of parsed tokens. If passed a non-integer argument (most likely a string), it will use ``dict`` semantics and pop the corresponding value from any defined results names. A second default return value argument is supported, just as in ``dict.pop()``. Example:: numlist = Word(nums)[...] print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321'] def remove_first(tokens): tokens.pop(0) numlist.add_parse_action(remove_first) print(numlist.parse_string("0 123 321")) # -> ['123', '321'] label = Word(alphas) patt = label("LABEL") + Word(nums)[1, ...] print(patt.parse_string("AAB 123 321").dump()) # Use pop() in a parse action to remove named result (note that corresponding value is not # removed from list form of results) def remove_LABEL(tokens): tokens.pop("LABEL") return tokens patt.add_parse_action(remove_LABEL) print(patt.parse_string("AAB 123 321").dump()) prints:: ['AAB', '123', '321'] - LABEL: 'AAB' ['AAB', '123', '321'] radefaultrz)pop() got an unexpected keyword argument rl)rqrGrEr5rm)rr.rVrgrcindexret defaultvalues rpopParseResults.popsP4DLLNDAI~Q|"KA5 QRR # d1gs # #s4yA~aDGE+C J7L r"cX;aX$U$)a Returns named result matching the given key, or if there is no such name, then returns the given ``default_value`` or ``None`` if no ``default_value`` is specified. Similar to ``dict.get()``. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parse_string("1999/12/31") print(result.get("year")) # -> '1999' print(result.get("hour", "not specified")) # -> 'not specified' print(result.get("hour")) # -> None r)rkey default_values rrfParseResults.getQs$ ;9  r"cURRX5 URR5H.up4[ U5Hunupg[ XgXq:-5XE'M M0 g)a Inserts new element at location index in the list of parsed tokens. Similar to ``list.insert()``. Example:: numlist = Word(nums)[...] print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321'] # use a parse action to insert the parse location in the front of the parsed results def insert_locn(locn, tokens): tokens.insert(0, locn) numlist.add_parse_action(insert_locn) print(numlist.parse_string("0 123 321")) # -> [0, '0', '123', '321'] N)r@insertrArqrrr)rr ins_stringrUrurgrwrxs rrParseResults.inserths^" U/!%!4!4!6 D(1+(>$$E!8x'78" )?"7r"c:URRU5 g)a Add single element to end of ``ParseResults`` list of elements. Example:: numlist = Word(nums)[...] print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321'] # use a parse action to compute the sum of the parsed integers, and add it to the end def append_sum(tokens): tokens.append(sum(map(int, tokens))) numlist.add_parse_action(append_sum) print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321', 444] N)r@append)ritems rrParseResults.appends T"r"c[U[5(aURU5 gURR U5 g)a Add sequence of elements to end of ``ParseResults`` list of elements. Example:: patt = Word(alphas)[1, ...] # use a parse action to append the reverse of the matched strings, to make a palindrome def make_palindrome(tokens): tokens.extend(reversed([t[::-1] for t in tokens])) return ''.join(tokens) patt.add_parse_action(make_palindrome) print(patt.parse_string("lskdj sdlkjf lksd")) # -> 'lskdjsdlkjflksddsklfjkldsjdksl' N)rEr__iadd__r@extend)ritemseqs rrParseResults.extends/ g| , , MM' " MM  )r"cVURSS2 URR5 g)z' Clear all elements and results names. N)r@rAclearr)s rrParseResults.clears  MM!  r"cnX$![a$ URS5(a [U5egf=f)N__rY)r[ startswithAttributeError)rrUs r __getattr__ParseResults.__getattr__s; :  t$$$T** s +44c.UR5nX!- nU$r)copy)rotherrs r__add__ParseResults.__add__siik  r"c^U(dU$UR(a[UR5mU4SjnURR5nUVVVs/sH)upEUHnU[ USU"US554PM M+ nnnnUH,upFX`U'[ US[ 5(dM#XSlM. U=RUR- slU=RUR-slU$s snnnf)Nc>US:aT$UT-$r-r)aoffsets r'ParseResults.__iadd__..sAE&"Aq6z"Ar"rrl) rArmr@rqrrErr=r>) rr addoffset otheritemsrgvlistrcotherdictitemsrs @rrParseResults.__iadd__sK >>'FAI--/J!+ *HAA+AaD)AaD/BCD *  'QadL11#'aDL' '  5+++ s0C=c`[U[5(aUS:XaUR5$X-$r-)rEr5r)rrs r__radd__ParseResults.__radd__s+ eS ! !eqj99; < r"cp[U5RSUR<SUR5S3$)N(, ))rHr1r@as_dictr)s r__repr__ParseResults.__repr__s2t*%%&a '84<<>:J!LLr"c SSRURVs/sH.n[U[5(a [ U5O [ U5PM0 sn5-S-$s snf)N[r])joinr@rErrZreprr$s r__str__ParseResults.__str__sd ii"]]*)L99CFtAwF*   s5A c/nURHenU(aU(aURU5 [U[5(aX#R 5- nMKUR[ U55 Mg U$r)r@rrEr _asStringListrZ)rsepoutrs rrParseResults._asStringListsZMMDs 3$ --))++ 3t9% " r"cURVs/sH*n[U[5(aUR5OUPM, sn$s snf)a( Returns the parse results as a nested list of matching tokens, all converted to strings. Example:: patt = Word(alphas)[1, ...] result = patt.parse_string("sldkj lsdkj sldkj") # even though the result prints in string-like form, it is actually a pyparsing ParseResults print(type(result), result) # -> ['sldkj', 'lsdkj', 'sldkj'] # Use as_list() to create an actual list result_list = result.as_list() print(type(result_list), result_list) # -> ['sldkj', 'lsdkj', 'sldkj'] )r@rEras_list)rress rrParseResults.as_listsD"}} $(\::CKKM C$   s1AcV^U4Sjm[U4SjUR555$)aG Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parse_string('12/31/1999') print(type(result), repr(result)) # -> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]}) result_dict = result.as_dict() print(type(result_dict), repr(result_dict)) # -> {'day': '1999', 'year': '12', 'month': '31'} # even though a ParseResults supports dict-like access, sometime you just need to have a dict import json print(json.dumps(result)) # -> Exception: TypeError: ... is not JSON serializable print(json.dumps(result.as_dict())) # -> {"month": "31", "day": "1999", "year": "12"} c>[U[5(a>UR5(aUR5$UVs/sH nT"U5PM sn$U$s snfr)rErrr)objrcto_items rr%ParseResults.as_dict..to_itemsL#|,,(+ s{{}TPS;TPS1GAJPS;TT # UHupUT"U54v M g7frr)rrgrcrs rr'ParseResults.as_dict..!s= Q O s)rSrq)rrs @rrParseResults.as_dicts!*  = ===r"c[UR5nURR5UlURUlU=R UR -slUR UlU$)z Returns a new shallow copy of a :class:`ParseResults` object. `ParseResults` items contained within the source are shared with the copy. Use :class:`ParseResults.deepcopy()` to create a copy with its own separate content values. )rr@rArr=r>r<)rrs rrParseResults.copy#sS4==)}}))+ ll  $//)JJ  r"cpUR5n[UR5GH up#[U[5(aUR 5URU'M:[U[ [45(aMW[U[5(ac[U5"5=URU'nUR5H.upV[U[5(aUR 5OUXE'M0 M[U[5(dM[U5"SU55URU'GM U$)z< Returns a new deep copy of a :class:`ParseResults` object. c3p# UH,n[U[5(aUR5OUv M. g7fr)rErdeepcopy)rrcs rr(ParseResults.deepcopy..As+-PS1Jq,$?$?AJJLQFPSs46) rrrr@rErrrZbytesrrHrqr)rrr%rdestrgrcs rrParseResults.deepcopy1siik .FA#|,,#&<<> a C#u..C00*.s)+5 a 4IIKDA.8L.I.IajjlqDG(C++#'9-PS-$ a / r"c^TR(a TR$TR(a<TRnURR5n[ U4SjU5S5$[ T5S:Xa{[ TR5S:Xab[ [ TRR555SSS;a,[ [ TRR555$g)a Returns the results name for this token expression. Useful when several different expressions might match at a particular location. Example:: integer = Word(nums) ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d") house_number_expr = Suppress('#') + Word(nums, alphanums) user_data = (Group(house_number_expr)("house_number") | Group(ssn_expr)("ssn") | Group(integer)("age")) user_info = user_data[1, ...] result = user_info.parse_string("22 111-22-3333 #221B") for item in result: print(item.get_name(), ':', item[0]) prints:: age : 22 ssn : 111-22-3333 house_number : 221B c3R># UHupUHup4UTLdM Uv M M g7frr)rrgrrclocrs rr(ParseResults.get_name..es2$8"'DyA"'$8s' 'Nrlr)rra) r<r=rArqnextrmrrr)rparparent_tokdict_itemss` rget_nameParseResults.get_nameFs2 ::::  \\"&,,C#&<<#5#5#7 $8   INDMM"a'T$--..01215a8GCT]]//123 3r"c/nSnURU(aU[UR55-OS5 U(GaUR5(a[ SUR 555nUHupU(aURU5 URUSU-SUS35 [ U [5(aIU (a&URU RUUUUS-S95 M{UR[U 55 MUR[U 55 M [S U55(aUn [U 5Hup[ U [5(aCURS RUSU-U USUS--U RUUUUS-S955 M]URS USU-U USUS--[U 54-5 M SRU5$) a Diagnostic method for listing out the contents of a :class:`ParseResults`. Accepts an optional ``indent`` argument so that this string can be embedded in a nested display of other data. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parse_string('1999/12/31') print(result.dump()) prints:: ['1999', '/', '12', '/', '31'] - day: '31' - month: '12' - year: '1999'  rYc3@# UHup[U5U4v M g7fr)rZ)rrgrcs rr$ParseResults.dump..sD|tqA{|sz z- z: rl)indentfull include_list_depthc3B# UHn[U[5v M g7fr)rEr)rvvs rrrs?$B:b,//$sz {}{}[{}]: {}{}{}z %s%s[%d]: %s%s%s)rrZrrsortedrqrErdumpranyrrformatr) rr r r r rNLrqrgrcr%rs rrParseResults.dumpvs*  <6C //RH ||~~Dtzz|DD!DA 2JJ&4&=):"QCrBC!!\22JJ !+1)-1=+1A: !'!" JJs1v. 47+#"$?$???&q\EA!"l33 188 &!% ! &!%!!4 "+1)-1=+1A: !(!"   1 &!% ! &!%!!4 #B  %*<wws|r"cT[R"UR5/UQ70UD6 g)a Pretty-printer for parsed results as a list, using the `pprint `_ module. Accepts additional positional or keyword args as defined for `pprint.pprint `_ . Example:: ident = Word(alphas, alphanums) num = Word(nums) func = Forward() term = ident | num | Group('(' + func + ')') func <<= ident + Group(Optional(DelimitedList(term))) result = func.parse_string("fna a,b,(fnb c,d,200),100") result.pprint(width=40) prints:: ['fna', ['a', 'b', ['(', 'fnb', ['c', 'd', '200'], ')'], '100']] N)pprintr)rr.rVs rrParseResults.pprints 2  dlln6t6v6r"c~URURR5SURUR44$r)r@rArr>r<r)s rr*ParseResults.__getstate__s9 MM ""$    r"cbUuUluUlp#Ul[U5UlSUlgr)r@rAr<rQr>r=)rstater inAccumNamess rr/ParseResults.__setstate__s,HME E s$*l+ r"c2URUR4$r)r@r<r)s r__getnewargs__ParseResults.__getnewargs__s}}djj((r"c^[[U55[UR55-$r)dirrHrFrr)s r__dir__ParseResults.__dir__s 4:diik!222r"c SnU"/5nUR5H=upV[U[5(aX@RXeS9- nM-X@"U/XS"U5S9- nM? UbU"U/US9nU$)z Helper classmethod to construct a ``ParseResults`` from a ``dict``, preserving the name-value relations as results names. If an optional ``name`` argument is given, a nested ``ParseResults`` will be returned. cd[U5 [U[5(+$![a gf=f)NF)rrEr Exception)rs r is_iterable+ParseResults.from_dict..is_iterables4 5S &c8444   s " //)rU)rUr])rqrEr from_dict)rJrrUr(rrgrcs rr*ParseResults.from_dictsx 5"gKKMDA!W%%}}Q}//sA3Q{1~>> "  se$'C r")r>r?r<r=rAr@)NNr)rrr{r)r{r)rY)rYTTr)@r1r2r3r4rMr;r r r6rZr boolr r r7rFrIrEr r&riryr~r5rrrrrrrrqrrrfrrrrrrrrrrrrrSrrrrrrr*r/rr# classmethodr*r]asDictgetNamer8rr"rrr"s+Z&*2rNL%S/2 J C L3i38nI0%t0%d0d$:.BF,6 !.""""8$8#(#)h)#.3%% 6 p!.2#"*( , M#M       (>>: *.`NN`78   )34F+ F+G,r"r)collections.abcrrrrrrrtypingr r r r r rZrrrHr6rRrrregisterrr"rr3sy..!5\%c )2'"v -v -r %&r"