
    hf                        % S SK Jr  S SKrS SKJrJrJrJrJr  S SK	r	S SK
Jr  SSKJr  \\4rS\S'   \" S	 S
 5       5      r " S S5      r " S S5      r\R,                  " \5        \R,                  " \5        g)    )annotationsN)MutableMappingMappingMutableSequenceIteratorIterable)Any   )replaced_by_pep8ztuple[type, ...]str_typec              #  $   #    U  H  ov   M     g 7fN ).0_s     C/var/www/html/env/lib/python3.13/site-packages/pyparsing/results.py	<genexpr>r      s     2a2s   r   c                  B    \ rS rSr% S\S'   S/rS
S jrS rS rS r	Sr
g	)_ParseResultsWithOffset   ztuple[ParseResults, int]tupc                    X4U l         g r   r   )selfp1p2s      r   __init__ _ParseResultsWithOffset.__init__   s    .0X    c                     U R                   U   $ r   r   r   is     r   __getitem__#_ParseResultsWithOffset.__getitem__   s    xx{r   c                    U R                   $ r   r   r   s    r   __getstate__$_ParseResultsWithOffset.__getstate__    s    xxr   c                    US   U l         g Nr   r   )r   argss     r   __setstate__$_ParseResultsWithOffset.__setstate__#   s    7r   r   N)r   ParseResultsr   intreturnNone)__name__
__module____qualname____firstlineno____annotations__	__slots__r   r#   r'   r,   __static_attributes__r   r   r   r   r      s#    	!!I6r   r   c                     \ rS rSr% SrS/ S4rS\S'   S\S'   S \S	'   S
\S'   S\S'   S\S'   S\S'   Sr " S S\5      r	S@S jr
SSSS\4 SAS jjrS r\4S jrS rSBS jrSCS jrSBS jrSDS jrSDS jrS  rS! rS" rSBS# jrS$ rSES% jrS& rS' rS( rS) rS* rSFS+ jr SFS, jr!SGS- jr"SHS. jr#SHS/ jr$SIS0 jr%S1S2.SJS3 jjr&SKS4 jr'SGS5 jr(SGS6 jr)SLS7 jr*SMSHS8 jjr+S9 r,S: r-S; r.S< r/S= r0\1SESGS> jj5       r2\&r3 \'r4 \*r5S?r6g)Nr.   '   a  Structured 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.<results_name>`` - 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   ztuple[Any, ...]_null_valuesstr_name_parentzset[str]
_all_namesbool_modalz	list[Any]_toklistzdict[str, Any]_tokdict)r=   r>   r?   rA   rB   rC   c                  "    \ rS rSrSrSS jrSrg)ParseResults.Listg   a  
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, <class 'int'>)

    [2,3,4]
    ([2, 3, 4], <class 'list'>)

    [[2, 1],3,4]
    ([[2, 1], 3, 4], <class 'list'>)

(Used internally by :class:`Group` when `aslist=True`.)
Nc                    Uc  / n[        U[        5      (       d-  [        U R                   S[	        U5      R                   35      e[        R                  U 5      $ )Nz* may only be constructed with a list, not )
isinstancelist	TypeErrorr2   type__new__)cls	containeds     r   rL   ParseResults.List.__new__   sW     	i..||n$NtT]OgOgNhi  <<$$r   r   r   )r2   r3   r4   r5   __doc__rL   r8   r   r   r   ListrE   g   s    $	L		%r   rQ   c                ~   [        U[        5      (       a  U$ [        R                  U 5      nS Ul        S Ul        [        5       Ul        Uc  / Ul        OY[        U[        [        45      (       a6  [        U[        R                  5      (       a  US S  /O
[        U5      Ul        OU/Ul        [        5       Ul        U$ r   )rH   r.   objectrL   r=   r>   setr?   rB   rI   _generator_typerQ   dictrC   )rM   toklistnamekwargsr   s        r   rL   ParseResults.__new__   s    g|,,N~~c"
%?DM$!899 g|'8'899 '] M %IDMr   Tc                   U   X@l         Ub  US:X  a  g U" U[        5      (       a  [        U5      nU(       d  U1U l        X l        XR
                  ;   a  g U" U[        [        45      (       a  U/nU(       aX  U" U[        5      (       a"  [        [        UR                  5      S5      X'   O[        [        US   5      S5      X'   X U   l        g  US   X'   g ! [        [        [        4 a    XLa  XU'    g X l         g f = f)N r   )rA   r/   r<   r?   r=   r;   r   rK   r.   r   rB   KeyErrorrJ   
IndexError)r   rW   rX   asListmodalrH   s         r   r   ParseResults.__init__   s     	<42:dC  t9D#fDO
'''g$/00iG'<004\'BRBR5SUVW
4\'!*5MqQ
#J	" DJ)Z0 	""$T
!
		"s   C D 7D ?D c                    [        U[        [        45      (       a  U R                  U   $ XR                  ;  a  U R
                  U   S   S   $ [        U R
                  U    Vs/ s H  o"S   PM	     sn5      $ s  snf )Nr   )rH   r/   slicerB   r?   rC   r.   )r   r"   vs      r   r#   ParseResults.__getitem__   so    a#u&&==##OO#==#B'**4==+;<+;aqT+;<==<s   %A:c                   U" U[         5      (       a;  U R                  R                  U[        5       5      U/-   U R                  U'   US   nObU" U[        [
        45      (       a  X R                  U'   UnO9U R                  R                  U/ 5      [        US5      /-   U R                  U'   UnU" U[        5      (       a  Xl        g g r*   )	r   rC   getrI   r/   rd   rB   r.   r>   )r   kre   rH   subs        r   __setitem__ParseResults.__setitem__   s    a011#}}00DF;qcADMM!A$CC<(( MM!C#}}00B7'1-;  DMM! Cc<((K )r   c           	        [        U[        [        45      (       d  U R                  U	 g [	        U R
                  5      nU R
                  U	 [        U[        5      (       a  US:  a  X-  n[        XS-   5      n[        [        UR                  U5      6 5      nUR                  5         U R                  R                  5        H5  nU H,  n[        U5       H  u  nu  px[        XxX:  -
  5      XF'   M     M.     M7     g )Nr   r
   )rH   r/   rd   rC   lenrB   rI   rangeindicesreversevalues	enumerater   )	r   r"   mylenremovedoccurrencesjri   valuepositions	            r   __delitem__ParseResults.__delitem__   s    !c5\**a DMM"MM! a1u
aQAuaii./0==//1K,5k,B(A(%<8<8&KN -C  2r   c                    XR                   ;   $ r   rC   )r   ri   s     r   __contains__ParseResults.__contains__  s    MM!!r   c                ,    [        U R                  5      $ r   )rn   rB   r&   s    r   __len__ParseResults.__len__
  s    4==!!r   c                H    U R                   =(       d    U R                  (       $ r   )rB   rC   r&   s    r   __bool__ParseResults.__bool__  s    677r   c                ,    [        U R                  5      $ r   iterrB   r&   s    r   __iter__ParseResults.__iter__      DMM""r   c                8    [        U R                  S S S2   5      $ Nrc   r   r&   s    r   __reversed__ParseResults.__reversed__  s    DMM$B$'((r   c                ,    [        U R                  5      $ r   )r   rC   r&   s    r   keysParseResults.keys  r   r   c                8   ^  U 4S jT R                  5        5       $ )Nc              3  .   >#    U  H
  nTU   v   M     g 7fr   r   r   ri   r   s     r   r   &ParseResults.values.<locals>.<genexpr>  s     -AQs   r   r&   s   `r   rr   ParseResults.values  s    ---r   c                8   ^  U 4S jT R                  5        5       $ )Nc              3  0   >#    U  H  oTU   4v   M     g 7fr   r   r   s     r   r   %ParseResults.items.<locals>.<genexpr>  s     2kDGks   r   r&   s   `r   itemsParseResults.items  s    2diik22r   c                "    U R                   (       $ )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    r   haskeysParseResults.haskeys  s     }}$$r   c                   U(       d  S/nUR                  5        H!  u  p4US:X  a	  US   U4nM  [        SU< 35      e   [        US   [        5      (       d  [	        U5      S:X  d	  US   U ;   a  US   nX   nX	 U$ US   nU$ )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']
rc   defaultr   z)pop() got an unexpected keyword argument r
   )r   rJ   rH   r/   rn   )r   r+   rY   ri   re   indexretdefaultvalues           r   popParseResults.pop%  s    P 4DLLNDAI~Q|"KA5 QRR	 #
 d1gs##s4yA~aDGE+CJ7Lr   c                    X;   a  X   $ 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   )r   keydefault_values      r   rh   ParseResults.get]  s    $ ;9  r   c                    U R                   R                  X5        U R                  R                  5        H,  n[	        U5       H  u  nu  pV[        XVXa:  -   5      X4'   M     M.     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)rB   insertrC   rr   rs   r   )r   r   
ins_stringrv   ri   rx   ry   s          r   r   ParseResults.insertt  s[    " 	U/==//1K(1+(>$$E!8x'78" )? 2r   c                :    U R                   R                  U5        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)rB   append)r   items     r   r   ParseResults.append  s     	T"r   c                    [        U[        5      (       a  U R                  U5        gU R                  R	                  U5        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)rH   r.   __iadd__rB   extend)r   itemseqs     r   r   ParseResults.extend  s/     g|,,MM'"MM  )r   c                V    U R                   SS2	 U R                  R                  5         g)z'
Clear all elements and results names.
N)rB   rC   clearr&   s    r   r   ParseResults.clear  s      MM!r   c                n     X   $ ! [          a$    UR                  S5      (       a  [        U5      e gf = f)N__r\   )r]   
startswithAttributeError)r   rX   s     r   __getattr__ParseResults.__getattr__  s;    	: 	t$$$T**	s    +44c                .    U R                  5       nX!-  nU$ r   )copy)r   otherr   s      r   __add__ParseResults.__add__  s    iik
r   c                  ^ U(       d  U $ UR                   (       a  [        U R                  5      mU4S jnUR                   R                  5       nU VVVs/ s H)  u  pEU  H  nU[	        US   U" US   5      5      4PM     M+     nnnnU H,  u  pFX`U'   [        US   [        5      (       d  M#  XS   l        M.     U =R                  UR                  -  sl        U =R                  UR                  -  sl        U $ s  snnnf )Nc                   > U S:  a  T$ U T-   $ r*   r   )aoffsets    r   <lambda>'ParseResults.__iadd__.<locals>.<lambda>  s    AE&"Aq6z"Ar   r   r
   )	rC   rn   rB   r   r   rH   r.   r>   r?   )	r   r   	addoffset
otheritemsri   vlistre   otherdictitemsr   s	           @r   r   ParseResults.__iadd__  s    K>>'FAI--/J !+ *HAA +AaD)AaD/BC D *  
 'QadL11#'aDL '
 	'5+++s   0C=c                `    [        U[        5      (       a  US:X  a  U R                  5       $ X-   $ r*   )rH   r/   r   )r   r   s     r   __radd__ParseResults.__radd__  s+    eS!!eqj99; <r   c                p    [        U 5      R                   SU R                  < SU R                  5        S3$ )N(, ))rK   r2   rB   as_dictr&   s    r   __repr__ParseResults.__repr__  s2    t*%%&a'84<<>:J!LLr   c           
         SSR                  U R                   Vs/ s H.  n[        U[        5      (       a  [	        U5      O
[        U5      PM0     sn5      -   S-   $ s  snf )N[r   ])joinrB   rH   r.   r<   reprr!   s     r   __str__ParseResults.__str__  sd    ii "]]* )L99CFtAwF* 		
s   5A
c                    / nU R                    He  nU(       a  U(       a  UR                  U5        [        U[        5      (       a  X#R	                  5       -  nMK  UR                  [        U5      5        Mg     U$ r   )rB   r   rH   r.   _asStringListr<   )r   sepoutr   s       r   r   ParseResults._asStringList  sZ    MMDs

3$--))++

3t9% " 
r   F)flattenc                  ^  U 4S jnU(       a
  / U" T 5      Q$ T R                    Vs/ s H*  n[        U[        5      (       a  UR                  5       OUPM,     sn$ s  snf )aw  
Returns the parse results as a nested list of matching tokens, all converted to strings.
If flatten is True, all the nesting levels in the returned list are collapsed.

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) # -> <class 'pyparsing.ParseResults'> ['sldkj', 'lsdkj', 'sldkj']

    # Use as_list() to create an actual list
    result_list = result.as_list()
    print(type(result_list), result_list) # -> <class 'list'> ['sldkj', 'lsdkj', 'sldkj']
c              3     >#    [         R                  " / TQ5      nU(       aK  UR                  5       n[        U[        5      (       a  UR                  US S S2   5        OUv   U(       a  MJ  g g 7fr   )collectionsdequepopleftrH   r.   
extendleft)prto_visitto_dor   s      r   	flattened'ParseResults.as_list.<locals>.flattened  sZ     "((41H ((*e\22''dd4K (s   A(A/-A/)rB   rH   r.   as_list)r   r   r   ress   `   r   r   ParseResults.as_list  s^    "	  %Yt_%%  ==(C ",C!>!>CG(  s   1Ac                V   ^ U4S jm[        U4S jU R                  5        5       5      $ )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)) # -> <class 'pyparsing.ParseResults'> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]})

    result_dict = result.as_dict()
    print(type(result_dict), repr(result_dict)) # -> <class '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>  U R                  5       (       a  U R                  5       $ U  Vs/ s H  nT" U5      PM     sn$ U $ s  snf r   )rH   r.   r   r   )objre   to_items     r   r   %ParseResults.as_dict.<locals>.to_item5  sL    #|,,(+s{{}TPS;TPS1GAJPS;TT
 <Us    Ac              3  <   >#    U  H  u  pUT" U5      4v   M     g 7fr   r   )r   ri   re   r   s      r   r   'ParseResults.as_dict.<locals>.<genexpr>;  s     =Q
Os   )rV   r   )r   r   s    @r   r   ParseResults.as_dict   s!    *	 =

===r   c                    [        U R                  5      nU R                  R                  5       Ul        U R                  Ul        U=R
                  U R
                  -  sl        U R                  Ul        U$ )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.
)r.   rB   rC   r   r>   r?   r=   )r   r   s     r   r   ParseResults.copy=  sS     4==)}}))+ll$//)JJ	
r   c                p   U R                  5       n[        U R                  5       GH  u  p#[        U[        5      (       a  UR                  5       UR                  U'   M:  [        U[        [        45      (       a  MW  [        U[        5      (       ac  [        U5      " 5       =UR                  U'   nUR                  5        H.  u  pV[        U[        5      (       a  UR                  5       OUXE'   M0     M  [        U[        5      (       d  M  [        U5      " S U 5       5      UR                  U'   GM     U$ )z<
Returns a new deep copy of a :class:`ParseResults` object.
c              3  p   #    U  H,  n[        U[        5      (       a  UR                  5       OUv   M.     g 7fr   )rH   r.   deepcopy)r   re   s     r   r   (ParseResults.deepcopy.<locals>.<genexpr>[  s+      ,PS1Jq,$?$?AJJLQFPSs   46)r   rs   rB   rH   r.   r  r<   bytesr   rK   r   r   )r   r   r"   r   destri   re   s          r   r  ParseResults.deepcopyK  s     iik.FA#|,,"%,,.QC#u..C00)-c4Q$IIKDA.8L.I.IajjlqDG (C**"&s) ,PS, #Q / 
r   c                  ^  T R                   (       a  T R                   $ T R                  (       a<  T R                  nUR                  R                  5       n[	        U 4S jU 5       S5      $ [        T 5      S:X  a{  [        T R                  5      S:X  ab  [	        [        T R                  R                  5       5      5      S   S   S;   a,  [	        [        T R                  R                  5       5      5      $ 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
c              3  R   >#    U  H  u  pU  H  u  p4UTL d  M  Uv   M     M     g 7fr   r   )r   ri   r   re   locr   s        r   r   (ParseResults.get_name.<locals>.<genexpr>  s2      $8"'Dy A"' $8s   ''Nr
   r   )r   rc   )	r=   r>   rC   r   nextrn   r   rr   r   )r   parparent_tokdict_itemss   `  r   get_nameParseResults.get_name`  s    2 ::::\\ $C#&<<#5#5#7 $8   INDMM"a'T$--..01215a8GCT]]//1233r   c                    / nSnUR                  U(       a  U[        U R                  5       5      -   OS5        U(       d  SR                  U5      $ U R	                  5       (       a  [        S U R                  5        5       5      nU H  u  pU(       a  UR                  U5        UR                  U SU-   SU S35        [        U	[        5      (       d  UR                  [        U	5      5        Mj  U	(       d  UR                  [        U	5      5        M  UR                  U	R                  UUUUS-   S95        M     [        S	 U  5       5      (       d  SR                  U5      $ U n	Sn
Sn[        U	5       H  u  p[        U[        5      (       aA  UR                  UUUUS-   S9nUR                  U U X-   S
U SU U XS-   -   U 3
5        M[  UR                  U U X-   S
U SU U XS-   -   U 3
5        M     SR                  U5      $ )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'

r\   c              3  @   #    U  H  u  p[        U5      U4v   M     g 7fr   )r<   )r   ri   re   s      r   r   $ParseResults.dump.<locals>.<genexpr>  s     @<41CFA;<s   z  z- z: r
   )indentfullinclude_list_depthc              3  B   #    U  H  n[        U[        5      v   M     g 7fr   )rH   r.   )r   vvs     r   r   r    s     ?$B:b,//$s   r   z]:)r   r<   r   r   r   sortedr   rH   r.   r   dumpanyrs   )r   r  r  r  r  r   NLr   ri   re   incrnlr"   r  vv_dumps                  r   r  ParseResults.dump  s   * 

<6C//RH773<<<>>@4::<@@EJJrN

fXtf}%6b2>?!!\22JJtAw'JJs1v&

FF%!%1%z	   ( ?$???773<q\EA"l++''!!-!A:	 "  

d6(4=/1#RtF8DUVJDWCXY`Xab 

d6(4=/1#RtF8DUVJDWCXY[X\] "  wws|r   c                T    [         R                   " U R                  5       /UQ70 UD6  g)a  
Pretty-printer for parsed results as a list, using the
`pprint <https://docs.python.org/3/library/pprint.html>`_ module.
Accepts additional positional or keyword args as defined for
`pprint.pprint <https://docs.python.org/3/library/pprint.html#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   )r   r+   rY   s      r   r$  ParseResults.pprint  s     2 	dlln6t6v6r   c                ~    U R                   U R                  R                  5       S U R                  U R                  44$ r   )rB   rC   r   r?   r=   r&   s    r   r'   ParseResults.__getstate__  s9    MM""$

	
 	
r   c                b    Uu  U l         u  U l        p#U l        [        U5      U l        S U l        g r   )rB   rC   r=   rT   r?   r>   )r   stater  inAccumNamess       r   r,   ParseResults.__setstate__  s,    HMEEs$*l+r   c                2    U R                   U R                  4$ r   )rB   r=   r&   s    r   __getnewargs__ParseResults.__getnewargs__  s    }}djj((r   c                ^    [        [        U 5      5      [        U R                  5       5      -   $ r   )dirrK   rI   r   r&   s    r   __dir__ParseResults.__dir__	  s     4:diik!222r   c           	         S nU " / 5      nUR                  5        H=  u  pV[        U[        5      (       a  X@R                  XeS9-  nM-  X@" U/XS" U5      S9-  nM?     Ub  U " U/US9nU$ )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.
c                d     [        U 5        [        U [        5      (       + $ ! [         a     gf = f)NF)r   rH   r   	Exception)r   s    r   is_iterable+ParseResults.from_dict.<locals>.is_iterable  s4    5S	
 &c8444	  s   " 
//)rX   )rX   r_   )r   rH   r   	from_dict)rM   r   rX   r6  r   ri   re   s          r   r8  ParseResults.from_dict  sx    	5 "gKKMDA!W%%}}Q}//sA3Q{1~>>	 "
 se$'C
r   )r?   rA   r=   r>   rC   rB   )NN)r0   r1   )r0   r@   )r0   r/   )r0   r   r   )r   r.   r0   r.   )r0   r.   )r0   r<   )r\   )r   r@   r0   rI   )r0   rV   )r0   z
str | None)r\   TTr   )7r2   r3   r4   r5   rP   r;   r6   r7   rI   rQ   rL   rH   r   r#   rk   rz   r~   r   r   r   r   r   rr   r   r   r   rh   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r$  r'   r,   r-  r1  classmethodr8  r_   asDictgetNamer8   r   r   r   r.   r.   '   sb   +Z &*2rNL/2JLI0%t 0%d0 d$:%"	%"N> ,6 0""8#)#.3%6 p!.2#"*(
, M

	 */  D>:*.`HT78	

)3  4 F+F+G,r   r.   )
__future__r   r   collections.abcr   r   r   r   r   r$  typingr	   utilr   r<   r  r   r6   rK   rU   r   r.   registerr   r   r   <module>rB     st    "     " "5\
 )2' "E- E-P    %    &r   