
    Ixhb                        U d dl mZmZmZmZ d dlZd dlmZ d dl	m
Z
mZ eefZe
edf         ed<    ed dD                       Z G d	 d
          Z G d d          Z ej        e            ej        e           dS )    )MutableMappingMappingMutableSequenceIteratorN)ref)TupleAny.str_typec              #      K   | ]}|V  d S N ).0_s     Z/var/www/html/what/lib/python3.11/site-packages/pkg_resources/_vendor/pyparsing/results.py	<genexpr>r      s      a    r   c                   ,    e Zd ZdgZd Zd Zd Zd ZdS )_ParseResultsWithOffsettupc                     ||f| _         d S r   r   )selfp1p2s      r   __init__z _ParseResultsWithOffset.__init__   s    8r   c                     | j         |         S r   r   r   is     r   __getitem__z#_ParseResultsWithOffset.__getitem__   s    x{r   c                     | j         S r   r   r   s    r   __getstate__z$_ParseResultsWithOffset.__getstate__   s	    xr   c                      |d         | _         d S Nr   r   )r   argss     r   __setstate__z$_ParseResultsWithOffset.__setstate__   s    7r   N)__name__
__module____qualname__	__slots__r   r   r"   r&   r   r   r   r   r      sW        I          r   r   c                      e Zd ZU dZdg ddfZeedf         ed<   g dZ G d d	e	          Z
d3d
ZddddefdZd ZefdZd ZdefdZdefdZdefdZdefdZdefdZd Zd Zd ZdefdZd Zd4dZd Zd Z d Z!d Z"d  Z#d5d!Z$d5d"Z%d5d#Z&de'fd$Z(de'fd%Z)d6d&Z*de	fd'Z+de,fd(Z-d5d)Z.d* Z/d7de'fd,Z0d- Z1d. Z2d/ Z3d0 Z4d1 Z5e6d4d5d2            Z7e+Z8e-Z9e/Z:dS )8ParseResultsa  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("{} -> {}".format(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'
    N r   ._null_values)_name_parent
_all_names_modal_toklist_tokdict__weakref__c                       e Zd ZdZddZdS )ParseResults.Lista  
        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.delimited_list(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                     |g }t          |t                    s:t          d                    | j        t          |          j                            t                              |           S )Nz.{} may only be constructed with a list, not {})
isinstancelist	TypeErrorformatr'   type__new__)cls	containeds     r   r>   zParseResults.List.__new__|   sd     	i.. $fS\4	??3KLL  
 <<$$$r   r   )r'   r(   r)   __doc__r>   r   r   r   Listr7   U   s3        $	 $	L
	% 
	% 
	% 
	% 
	% 
	%r   rB   c                    t          |t                    r|S t                              |           }d |_        d |_        t                      |_        |g |_        n^t          |t          t          f          r:t          |t          j                  r|d d          gnt          |          |_        n|g|_        t                      |_        |S r   )r9   r,   objectr>   r/   r0   setr1   r3   r:   _generator_typerB   dictr4   )r?   toklistnamekwargsr   s        r   r>   zParseResults.__new__   s    g|,, 	N~~c""
%%?DMM$!899 	& g|'899#']] MM %IDMr   Tc                 4   || _         |	|dk    r ||t                    rt          |          }|s|h| _        || _        || j        vr ||t          t          f          r|g}|rl ||t                    r&t          t          |j
                  d          | |<   n&t          t          |d                   d          | |<   || |         _        d S 	 |d         | |<   d S # t          t          t          f$ r || ur|| |<   Y d S || _        Y d S w xY wd S d S d S )Nr-   r   )r2   intstrr1   r/   r.   r
   r=   r,   r   r3   KeyErrorr;   
IndexError)r   rH   rI   asListmodalr9   s         r   r   zParseResults.__init__   sl    

z$$$ !4yy )#'&DJd///:g$'788 (&iG .!z'<88 %<()9::A& &T

 &=(44a& &T
 (,DJ$$$.%,QZT


$i< . . ."$..)0DJJJJ)-DJJJJ	.- 

 0/s   C# # DDDc                     t          |t          t          f          r| j        |         S || j        vr| j        |         d         d         S t          d | j        |         D                       S )Nr   c                     g | ]
}|d          S )r   r   )r   vs     r   
<listcomp>z,ParseResults.__getitem__.<locals>.<listcomp>   s    $D$D$DaQqT$D$D$Dr   )r9   rL   slicer3   r1   r4   r,   r   s     r   r   zParseResults.__getitem__   sn    a#u&& 	F=##''}Q'+A..#$D$D4=3C$D$D$DEEEr   c                     ||t                     r<| j                            |t                                |gz   | j        |<   |d         }nh ||t          t
          f          r|| j        |<   |}nC| j                            |t                                t          |d          gz   | j        |<   |} ||t                    rt          |           |_	        d S d S r$   )
r   r4   getr:   rL   rW   r3   r,   wkrefr0   )r   krU   r9   subs        r   __setitem__zParseResults.__setitem__   s    :a011 
	#}00DFF;;qcADM!A$CCZC<(( 	 DM!CC#}00DFF;;'1--?  DM! C:c<(( 	&++CKKK	& 	&r   c           	         t          |t          t          f          rt          | j                  }| j        |= t          |t                    r|dk     r||z  }t          ||dz             }t          t          |                    |                     }|                                 | j	        
                                D ]<\  }}|D ]4}t          |          D ]"\  }\  }}	t          ||	|	|k    z
            ||<   #5=d S | j	        |= d S )Nr      )r9   rL   rW   lenr3   r:   rangeindicesreverser4   items	enumerater   )
r   r   mylenremovedrI   occurrencesjr[   valuepositions
             r   __delitem__zParseResults.__delitem__   s1   a#u&& 	!&&Ea  !S!! $q55JA!QUOO5!))E"2"2344GOO%)]%8%8%:%:  !k   A09+0F0F  ,,E8)@!8x!|#<* *A  a   r   returnc                     || j         v S r   )r4   )r   r[   s     r   __contains__zParseResults.__contains__   s    DM!!r   c                 *    t          | j                  S r   )r`   r3   r!   s    r   __len__zParseResults.__len__   s    4=!!!r   c                 "    | j         p| j          S r   )r3   r4   r!   s    r   __bool__zParseResults.__bool__   s    6777r   c                 *    t          | j                  S r   iterr3   r!   s    r   __iter__zParseResults.__iter__       DM"""r   c                 <    t          | j        d d d                   S )NrS   ru   r!   s    r   __reversed__zParseResults.__reversed__   s    DM$$B$'(((r   c                 *    t          | j                  S r   )rv   r4   r!   s    r   keyszParseResults.keys   rx   r   c                 D      fd                                  D             S )Nc              3   (   K   | ]}|         V  d S r   r   r   r[   r   s     r   r   z&ParseResults.values.<locals>.<genexpr>  s'      --AQ------r   r|   r!   s   `r   valueszParseResults.values   s%    --------r   c                 D      fd                                  D             S )Nc              3   ,   K   | ]}||         fV  d S r   r   r   s     r   r   z%ParseResults.items.<locals>.<genexpr>  s+      22DG222222r   r   r!   s   `r   rd   zParseResults.items  s%    2222diikk2222r   c                 *    t          | j                  S )z
        Since ``keys()`` returns an iterator, this method is helpful in bypassing
        code that looks for the existence of any defined results names.)boolr4   r!   s    r   haskeyszParseResults.haskeys  s     DM"""r   c                 R   |sdg}|                                 D ]7\  }}|dk    r|d         |f}t          d                    |                    t          |d         t                    st          |          dk    s
|d         | v r|d         }| |         }| |= |S |d         }|S )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']
        rS   defaultr   z-pop() got an unexpected keyword argument {!r}r_   )rd   r;   r<   r9   rL   r`   )r   r%   rJ   r[   rU   indexretdefaultvalues           r   popzParseResults.pop  s    P  	4DLLNN 	 	DAqI~~Q|CJJ1MM   d1gs## 	 s4yyA~~aDGEu+CUJ7Lr   c                     || v r| |         S |S )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   rY   zParseResults.getF  s    $ $;;9  r   c                     | j                             ||           | j                                        D ]7\  }}t	          |          D ]"\  }\  }}t          ||||k    z             ||<   #8dS )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)r3   insertr4   rd   re   r   )r   r   
ins_stringrI   rh   r[   rj   rk   s           r   r   zParseResults.insert]  s    " 	UJ///!%!4!4!6!6 	 	D+(1+(>(>  $$E8!88x%'78" "A	 	r   c                 :    | j                             |           dS )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)r3   append)r   items     r   r   zParseResults.appendv  s      	T"""""r   c                     t          |t                    r|                     |           dS | j                            |           dS )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)r9   r,   __iadd__r3   extend)r   itemseqs     r   r   zParseResults.extend  sJ     g|,, 	*MM'"""""M  )))))r   c                 L    | j         dd= | j                                         dS )z7
        Clear all elements and results names.
        N)r3   r4   clearr!   s    r   r   zParseResults.clear  s,     M!!!r   c                 ~    	 | |         S # t           $ r( |                    d          rt          |          Y dS w xY w)N__r-   )rN   
startswithAttributeError)r   rI   s     r   __getattr__zParseResults.__getattr__  sU    	: 	 	 	t$$ +$T***22	s   
 .<<c                 8    |                                  }||z  }|S r   )copy)r   otherr   s      r   __add__zParseResults.__add__  s    iikku
r   c                 p   |j         rt          | j                  fd|j                                         }fd|D             }|D ]?\  }}|| |<   t	          |d         t
                    rt          |           |d         _        @| xj        |j        z  c_        | xj        |j        z  c_        | S )Nc                     | dk     rn| z   S r$   r   )aoffsets    r   <lambda>z'ParseResults.__iadd__.<locals>.<lambda>  s    AEE&&q6z r   c                 n    g | ]1\  }}|D ])}|t          |d           |d                             f*2S )r   r_   )r   )r   r[   vlistrU   	addoffsets       r   rV   z)ParseResults.__iadd__.<locals>.<listcomp>  sd       Au   +AaD))AaD//BBC   r   r   )	r4   r`   r3   rd   r9   r,   rZ   r0   r1   )r   r   
otheritemsotherdictitemsr[   rU   r   r   s         @@r   r   zParseResults.__iadd__  s    > 	/''FAAAAI--//J    *  N
 ' / /1QadL11 /#(;;AaDL'5++r   c                 j    t          |t                    r|dk    r|                                 S || z   S r$   )r9   rL   r   )r   r   s     r   __radd__zParseResults.__radd__  s6    eS!! 	 eqjj99;; 4<r   c                     d                     t          |           j        | j        |                                           S )Nz{}({!r}, {}))r<   r=   r'   r3   as_dictr!   s    r   __repr__zParseResults.__repr__  s-    $$T$ZZ%8$-XXXr   c                 V    dd                     d | j        D                       z   dz   S )N[z, c                 t    g | ]5}t          |t                    rt          |          nt          |          6S r   )r9   r,   rM   repr)r   r   s     r   rV   z(ParseResults.__str__.<locals>.<listcomp>  sG        )L99FCFFFtAww  r   ])joinr3   r!   s    r   __str__zParseResults.__str__  sH    ii !]    		
r   c                     g }| j         D ]j}|r|r|                    |           t          |t                    r||                                z  }H|                    t          |                     k|S r   )r3   r   r9   r,   _asStringListrM   )r   sepoutr   s       r   r   zParseResults._asStringList  s    M 	& 	&D  s  

3$-- &t))+++

3t99%%%%
r   c                 $    d | j         D             S )ax  
        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) # -> <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                 d    g | ]-}t          |t                    r|                                n|.S r   )r9   r,   as_list)r   ress     r   rV   z(ParseResults.as_list.<locals>.<listcomp>  sC     
 
 
 (\::CCKKMMM
 
 
r   )r3   r!   s    r   r   zParseResults.as_list  s%    
 
}
 
 
 	
r   c                 h    fdt          fd|                                 D                       S )a  
        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                     t          | t                    r6|                                 r|                                 nfd| D             S | S )Nc                 &    g | ]} |          S r   r   )r   rU   to_items     r   rV   z9ParseResults.as_dict.<locals>.to_item.<locals>.<listcomp>  s!    ;T;T;T1GGAJJ;T;T;Tr   )r9   r,   r   r   )objr   s    r   r   z%ParseResults.as_dict.<locals>.to_item  sO    #|,, (+Ts{{}}};T;T;T;TPS;T;T;TT
r   c              3   8   K   | ]\  }}| |          fV  d S r   r   )r   r[   rU   r   s      r   r   z'ParseResults.as_dict.<locals>.<genexpr>  s3      ==1Q

O======r   )rG   rd   )r   r   s    @r   r   zParseResults.as_dict  sI    *	 	 	 	 	 ====

======r   c                     t          | j                  }| j                                        |_        | j        |_        |xj        | j        z  c_        | j        |_        |S )zG
        Returns a new copy of a :class:`ParseResults` object.
        )r,   r3   r4   r   r0   r1   r/   )r   r   s     r   r   zParseResults.copy  sQ     4=))}))++l$/)J	
r   c                    | j         r| j         S | j        r(|                                 fd}r ||           ndS t          |           dk    rt          | j                  dk    rtt	          t          | j                                                            d         d         dv r3t	          t          | j                                                            S dS )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                 l     t           fdj                                        D             d           S )Nc              3   :   K   | ]\  }}|D ]\  }}|u 	|V  d S r   r   )r   r[   r   rU   locr\   s        r   r   z@ParseResults.get_name.<locals>.find_in_parent.<locals>.<genexpr>@  sS        $Au&+  #As!88  $8888	 r   )nextr4   rd   )r\   pars   `r   find_in_parentz-ParseResults.get_name.<locals>.find_in_parent>  sO       (+(:(:(<(<     r   Nr_   r   )r   rS   )r/   r0   r`   r4   r   rv   r   r|   )r   r   r   s     @r   get_namezParseResults.get_name   s    2 : 	:\ 	,,..C	 	 	 	 	 ,/8>>$'''D8IINNDM""a''T$-..00112215a8GCCT]//11223334r   r   c                 t   g }d}|                     |r$|t          |                                           z   nd           |r|                                 rt	          d |                                 D                       }|D ]\  }}	|r|                     |           |                     d                    |d|z  |                     t          |	t                    rU|	r0|                     |		                    ||||dz                        |                     t          |	                     |                     t          |	                     t          d | D                       r| }	t          |	          D ]\  }
}t          |t                    rQ|                     d	                    |d|z  |
|d|dz   z  |	                    ||||dz                                  k|                     d
|d|z  |
|d|dz   z  t          |          fz             d                    |          S )aM  
        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   >   K   | ]\  }}t          |          |fV  d S r   )rM   )r   r[   rU   s      r   r   z$ParseResults.dump.<locals>.<genexpr>n  s0      DDtq!A{DDDDDDr   z
{}{}- {}: z  r_   )indentfullinclude_list_depthc              3   @   K   | ]}t          |t                    V  d S r   )r9   r,   )r   vvs     r   r   z$ParseResults.dump.<locals>.<genexpr>  s,      ??B:b,//??????r   z
{}{}[{}]:
{}{}{}z
%s%s[%d]:
%s%s%s)r   rM   r   r   sortedrd   r<   r9   r,   dumpr   anyre   r   )r   r   r   r   r   r   NLrd   r[   rU   r   r   s               r   r   zParseResults.dumpS  s   * 

<G6C////RHHH 3	||~~ ,DDtzz||DDDDD! , ,DAq '

2JJ|226D6MANNOOO!!\22 , 
/JJ !+1)-1=+1A:	 !' !" !"     JJs1vv....

477++++??$????? &q\\  EAr!"l33 

188 &!% ! &!%!!4 "+1)-1=+1A:	 !( !" !"      

1 &!% ! &!%!!4 #B
 
 
 
 wws||r   c                 T    t          j         |                                 g|R i | dS )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(delimited_list(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%   rJ   s      r   r   zParseResults.pprint  s2    2 	dllnn6t666v66666r   c                     | j         | j                                        | j        d ur|                                 pd | j        | j        ffS r   )r3   r4   r   r0   r1   r/   r!   s    r   r"   zParseResults.__getstate__  sM    M""$$D(;T\\^^Ct
	
 	
r   c                     |\  | _         \  | _        }}| _        t          |          | _        |t          |          | _        d S d | _        d S r   )r3   r4   r/   rE   r1   rZ   r0   )r   stater   inAccumNamess       r   r&   zParseResults.__setstate__  sK    HMEEsL$*l++? ::DLLLDLLLr   c                     | j         | j        fS r   )r3   r/   r!   s    r   __getnewargs__zParseResults.__getnewargs__  s    }dj((r   c                 ~    t          t          |                     t          |                                           z   S r   )dirr=   r:   r|   r!   s    r   __dir__zParseResults.__dir__  s)    4::diikk!2!222r   c           	         d } | g           }|                                 D ]P\  }}t          |t                    r||                     ||          z  }5| | |g| ||                    z  }Q| | |g|          }|S )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                 p    	 t          |            t          | t                     S # t          $ r Y dS w xY w)NF)rv   r9   r
   	Exception)r   s    r   is_iterablez+ParseResults.from_dict.<locals>.is_iterable  sK    5S			 &c84444    uus   ' 
55)rI   )rI   rP   )rd   r9   r   	from_dict)r?   r   rI   r   r   r[   rU   s          r   r   zParseResults.from_dict  s    	5 	5 	5 c"ggKKMM 	? 	?DAq!W%% ?s}}QQ}///ssA3Q{{1~~>>>>#se$'''C
r   )NNr   )rm   r,   )r-   )r-   TTr   );r'   r(   r)   rA   r.   r   r	   __annotations__r*   r:   rB   r>   r9   r   r   r]   rl   r   ro   rL   rq   rs   r   rw   rz   r|   r   rd   r   r   rY   r   r   r   r   r   r   r   r   rM   r   r   r   r   rG   r   r   r   r   r   r"   r&   r   r   classmethodr   rP   asDictgetNamer   r   r   r,   r,      s        + +Z &*2r2$6L%S/666  I1% 1% 1% 1% 1%t 1% 1% 1%f   0 d$:. . . .@F F F ,6 & & & &! ! !." " " " "" " " " "8$ 8 8 8 8#( # # # #)h ) ) ) )# # #. . .3 3 3# # # # #8  8  8 t! ! ! !.  2# # #"* * *(       
   &       Y# Y Y Y Y

 

 

 

 

	 	 	 	
 
 
 
 
(> > > > >:	 	 	 	1 1 1fN N N N N N`7 7 78	
 	
 	
     ) ) )3 3 3     [2 FFGGGr   r,   )collections.abcr   r   r   r   r   weakrefr   rZ   typingr   r	   rM   bytesr
   r=   r   rF   r   r,   registerr   r   r   <module>r      s   N N N N N N N N N N N N N                     !5\%c	
 ) ) )$2''        Y Y Y Y Y Y Y Yx   % % %   & & & & &r   