
    Dgf                        U d dl mZ d dlZd dlmZmZmZmZmZ d dl	Z	d dl
mZ ddlmZ eefZded<    ed	 d
D              Z G d d      Z G d d      Z ej,                  e        ej,                  e       y)    )annotationsN)MutableMappingMappingMutableSequenceIteratorIterable)Any   )replaced_by_pep8ztuple[type, ...]str_typec              #      K   | ]  }|  y wN ).0_s     Q/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/pyparsing/results.py	<genexpr>r      s     as   r   c                  8    e Zd ZU ded<   dgZddZd Zd Zd Zy)	_ParseResultsWithOffsetztuple[ParseResults, int]tupc                    ||f| _         y r   r   )selfp1p2s      r   __init__z _ParseResultsWithOffset.__init__   s    .0"X    c                     | j                   |   S r   r   r   is     r   __getitem__z#_ParseResultsWithOffset.__getitem__   s    xx{r   c                    | j                   S r   r   r   s    r   __getstate__z$_ParseResultsWithOffset.__getstate__    s    xxr   c                    |d   | _         y Nr   r   )r   argss     r   __setstate__z$_ParseResultsWithOffset.__setstate__#   s    7r   N)r   ParseResultsr   int)	__name__
__module____qualname____annotations__	__slots__r   r!   r$   r(   r   r   r   r   r      s#    	!!I6r   r   c                     e Zd ZU dZdg dfZded<   ded<   d ed<   d	ed
<   ded<   ded<   ded<   dZ G d de      Zd>dZ	dddde
f	 d?dZd Ze
fdZd Zd@dZdAdZd@dZdBdZdBdZd Zd  Zd! Zd@d"Zd# ZdCd$Zd% Zd& Zd' Zd( Zd) ZdDd*ZdDd+Z dEd,Z!dFd-Z"dFd.Z#dGd/Z$d0d1dHd2Z%dId3Z&dEd4Z'dEd5Z(dJd6Z)dKdFd7Z*d8 Z+d9 Z,d: Z-d; Z.d< Z/e0dCdEd=       Z1e%Z2	 e&Z3	 e)Z4y)Lr)   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)r3   r4   r5   r7   r8   r9   c                      e Zd ZdZddZy)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.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                    |g }t        |t              s-t        | j                   dt	        |      j                         t        j                  |       S )Nz* may only be constructed with a list, not )
isinstancelist	TypeErrorr+   type__new__)cls	containeds     r   rA   zParseResults.List.__new__   sT     	i.||n$NtT]OgOgNhi  <<$$r   r   )r+   r,   r-   __doc__rA   r   r   r   Listr;   g   s    $	L		%r   rE   c                ^   t        |t              r|S t        j                  |       }d |_        d |_        t               |_        |g |_        nOt        |t        t        f      r1t        |t        j                        r|d d  gn
t        |      |_        n|g|_        t               |_        |S r   )r=   r)   objectrA   r3   r4   setr5   r8   r>   _generator_typerE   dictr9   )rB   toklistnamekwargsr   s        r   rA   zParseResults.__new__   s    g|,N~~c"
%?DM$!89 g|'8'89 '] M %IDMr   Tc                   |  || _         ||dk(  ry  ||t              rt        |      }|s|h| _        || _        || j
                  v ry  ||t        t        f      r|g}|rV ||t              r#t        t        |j                        d      | |<   nt        t        |d         d      | |<   || |   _        y 	 |d   | |<   y # t        t        t        f$ r || ur|| |<   Y y || _        Y y w xY w)N r   )r7   r*   r2   r5   r3   r1   r   r@   r)   r   r8   KeyErrorr?   
IndexError)r   rK   rL   asListmodalr=   s         r   r   zParseResults.__init__   s     	<42:dC t9D#fDO
d'''g$/0iG'<04\'BRBR5SUVWT
4\'!*5MqQT
#DJ	" DJ)Z0 	"d"$T
!
		"s   9C C+!C+*C+c                    t        |t        t        f      r| j                  |   S || j                  vr| j
                  |   d   d   S t        | j
                  |   D cg c]  }|d   	 c}      S c c}w )Nr   )r=   r*   slicer8   r5   r9   r)   )r   r    vs      r   r!   zParseResults.__getitem__   sj    a#u&==##DOO#==#B'**4==+;<aQqT<==<s   A2c                z    ||t               r;| j                  j                  |t                     |gz   | j                  |<   |d   }n^ ||t        t
        f      r|| j                  |<   |}n9| j                  j                  |g       t        |d      gz   | j                  |<   |} ||t              r| |_        y y r&   )	r   r9   getr>   r*   rV   r8   r)   r4   )r   krW   r=   subs        r   __setitem__zParseResults.__setitem__   s    a01#}}00DF;qcADMM!A$CC<( DMM!C#}}00B7'1-;  DMM! Cc<(CK )r   c           	        t        |t        t        f      s| j                  |= y t	        | j
                        }| j
                  |= t        |t              r|dk  r||z  }t        ||dz         }t        t        |j                  |             }|j                          | j                  j                         D ]4  }|D ]-  }t        |      D ]  \  }\  }}t        ||||kD  z
        ||<    / 6 y )Nr   r
   )r=   r*   rV   r9   lenr8   r>   rangeindicesreversevalues	enumerater   )	r   r    mylenremovedoccurrencesjrZ   valuepositions	            r   __delitem__zParseResults.__delitem__   s    !c5\*a DMM"MM! a1uU
aQAuaii./0==//1 	K ,5k,B (A(x%<x8a<8&KN	r   c                    || j                   v S r   r9   )r   rZ   s     r   __contains__zParseResults.__contains__  s    DMM!!r   c                ,    t        | j                        S r   )r^   r8   r#   s    r   __len__zParseResults.__len__
  s    4==!!r   c                :    | j                   xs | j                    S r   )r8   r9   r#   s    r   __bool__zParseResults.__bool__  s    6777r   c                ,    t        | j                        S r   iterr8   r#   s    r   __iter__zParseResults.__iter__      DMM""r   c                8    t        | j                  d d d         S NrU   rs   r#   s    r   __reversed__zParseResults.__reversed__  s    DMM$B$'((r   c                ,    t        | j                        S r   )rt   r9   r#   s    r   keyszParseResults.keys  rv   r   c                6      fd j                         D        S )Nc              3  (   K   | ]	  }|     y wr   r   r   rZ   r   s     r   r   z&ParseResults.values.<locals>.<genexpr>  s     -AQ-s   r{   r#   s   `r   rb   zParseResults.values  s    ---r   c                6      fd j                         D        S )Nc              3  ,   K   | ]  }||   f  y wr   r   r~   s     r   r   z%ParseResults.items.<locals>.<genexpr>  s     2DG2s   r   r#   s   `r   itemszParseResults.items  s    2diik22r   c                    | 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.rl   r#   s    r   haskeyszParseResults.haskeys  s     }}$$$r   c                    |sdg}|j                         D ]  \  }}|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']
        rU   defaultr   z)pop() got an unexpected keyword argument r
   )r   r?   r=   r*   r^   )r   r'   rM   rZ   rW   indexretdefaultvalues           r   popzParseResults.pop%  s    P 4DLLN 	SDAqI~Q|"KA5 QRR		S
 d1gs#s4yA~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.get]  s    $ $;9  r   c                    | j                   j                  ||       | j                  j                         D ]-  }t	        |      D ]  \  }\  }}t        ||||kD  z         ||<    / y)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)r8   insertr9   rb   rc   r   )r   r   
ins_stringrf   rZ   rh   ri   s          r   r   zParseResults.insertt  so    " 	UJ/==//1 	K(1+(> $$E8!88x%'78"A	r   c                :    | j                   j                  |       y)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)r8   append)r   items     r   r   zParseResults.append  s     	T"r   c                ~    t        |t              r| j                  |       y| j                  j	                  |       y)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)r=   r)   __iadd__r8   extend)r   itemseqs     r   r   zParseResults.extend  s,     g|,MM'"MM  )r   c                V    | j                   dd= | j                  j                          y)z7
        Clear all elements and results names.
        N)r8   r9   clearr#   s    r   r   zParseResults.clear  s      MM!r   c                d    	 | |   S # t         $ r |j                  d      rt        |      Y yw xY w)N__rO   )rP   
startswithAttributeError)r   rL   s     r   __getattr__zParseResults.__getattr__  s:    	: 	t$$T**	s    %//c                0    | j                         }||z  }|S r   )copy)r   otherr   s      r   __add__zParseResults.__add__  s    iiku
r   c                   |s| S |j                   rt        | j                        fd}|j                   j                         }|D cg c]&  \  }}|D ]  }|t	        |d    ||d               f ( }}}}|D ](  \  }}|| |<   t        |d   t              s| |d   _        * | xj                  |j                  z  c_        | xj                  |j                  z  c_        | S c c}}}w )Nc                    | dk  rS | z   S r&   r   )aoffsets    r   <lambda>z'ParseResults.__iadd__.<locals>.<lambda>  s    AE& q6z r   r   r
   )	r9   r^   r8   r   r   r=   r)   r4   r5   )	r   r   	addoffset
otheritemsrZ   vlistrW   otherdictitemsr   s	           @r   r   zParseResults.__iadd__  s    K>>'FAI--/J !+ Au  +AaD)AaD/BCCN 
 ' (1QadL1#'AaDL(
 	'5+++s   +C(c                V    t        |t              r|dk(  r| j                         S || z   S r&   )r=   r*   r   )r   r   s     r   __radd__zParseResults.__radd__  s*    eS!eqj99; 4<r   c                n    t        |       j                   d| j                  d| j                          dS )N(, ))r@   r+   r8   as_dictr#   s    r   __repr__zParseResults.__repr__  s2    t*%%&a'84<<>:J!LLr   c           
         ddj                  | j                  D cg c](  }t        |t              rt	        |      n
t        |      * c}      z   dz   S c c}w )N[r   ])joinr8   r=   r)   r2   reprr   s     r   __str__zParseResults.__str__  s\    ii "]] )L9CFtAwF 		
s   -A
c                    g }| j                   D ]U  }|r|r|j                  |       t        |t              r||j	                         z  }<|j                  t        |             W |S r   )r8   r   r=   r)   _asStringListr2   )r   sepoutr   s       r   r   zParseResults._asStringList  s^    MM 	&Ds

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

3t9%	& 
r   F)flattenc                     fd}|r
g  |       S  j                   D cg c]$  }t        |t              r|j                         n|& c}S c c}w )a  
        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     K   t        j                  g       }|r@|j                         }t        |t              r|j                  |d d d          n| |r?y y wrx   )collectionsdequepopleftr=   r)   
extendleft)prto_visitto_dor   s      r   	flattenedz'ParseResults.as_list.<locals>.flattened  sV     "((41H ((*e\2''dd4K s   AAA)r8   r=   r)   as_list)r   r   r   ress   `   r   r   zParseResults.as_list  sV     	  %Yt_%%  == ",C!>CG  s   )Ac                R    fdt        fd| j                         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| j                         r| j                         S | D cg c]
  } |       c}S | S c c}w r   )r=   r)   r   r   )objrW   to_items     r   r   z%ParseResults.as_dict.<locals>.to_item4  sA    #|,(+s{{}TPS;T1GAJ;TT
 <Us   A
c              3  8   K   | ]  \  }}| |      f  y wr   r   )r   rZ   rW   r   s      r   r   z'ParseResults.as_dict.<locals>.<genexpr>:  s     =1Q
O=s   )rJ   r   )r   r   s    @r   r   zParseResults.as_dict  s!    *	 =

===r   c                    t        | j                        }| j                  j                         |_        | j                  |_        |xj
                  | j
                  z  c_        | j                  |_        |S )a  
        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)   r8   r9   r   r4   r5   r3   )r   r   s     r   r   zParseResults.copy<  sS     4==)}}))+ll$//)JJ	
r   c                0   | j                         }t        | j                        D ]  \  }}t        |t              r|j                         |j                  |<   4t        |t        t        f      rKt        |t              r] t        |             x|j                  |<   }|j                         D ]*  \  }}t        |t              r|j                         n|||<   , t        |t              s t        |      d |D              |j                  |<    |S )zL
        Returns a new deep copy of a :class:`ParseResults` object.
        c              3  `   K   | ]&  }t        |t              r|j                         n| ( y wr   )r=   r)   deepcopy)r   rW   s     r   r   z(ParseResults.deepcopy.<locals>.<genexpr>Z  s)      ,KLJq,$?AJJLQF,s   ,.)r   rc   r8   r=   r)   r   r2   bytesr   r@   r   r   )r   r   r    r   destrZ   rW   s          r   r   zParseResults.deepcopyJ  s     iik. 	FAs#|,"%,,.QC#u.C0)2c4Q$IIK QDAq.8L.IajjlqDGQC*"+$s) ,PS, #Q	 
r   c                     j                   r j                   S  j                  r; j                  }|j                  j                         }t	         fd|D        d      S t               dk(  rxt         j                        dk(  r`t	        t         j                  j                                     d   d   dv r,t	        t         j                  j                                     S y)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  D   K   | ]  \  }}|D ]  \  }}|u r|   y wr   r   )r   rZ   r   rW   locr   s        r   r   z(ParseResults.get_name.<locals>.<genexpr>~  s=       5"' 3Dy s    Nr
   r   )r   rU   )	r3   r4   r9   r   nextr^   rt   rb   r{   )r   parparent_tokdict_itemss   `  r   get_namez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                   g }d}|j                  |r|t        | j                               z   nd       |sdj                  |      S | j	                         rt        d | j                         D              }|D ]  \  }}	|r|j                  |       |j                  | d|z   d| d       t        |	t              s|j                  t        |	             `|	s|j                  t        |	             }|j                  |	j                  ||||dz                 t        d	 | D              sdj                  |      S | }	d}
d}t        |	      D ]  \  }}t        |t              rE|j                  ||||dz         }|j                  | | |
|z   d
| d| | |
|dz   z   | 
       [|j                  | | |
|z   d
| d| | |
|dz   z   | 
        dj                  |      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'
        
rO   c              3  <   K   | ]  \  }}t        |      |f  y wr   )r2   )r   rZ   rW   s      r   r   z$ParseResults.dump.<locals>.<genexpr>  s     @41aCFA;@   z  z- z: r
   )indentfullinclude_list_depthc              3  <   K   | ]  }t        |t                y wr   )r=   r)   )r   vvs     r   r   z$ParseResults.dump.<locals>.<genexpr>  s     ?B:b,/?r   r   z]:)r   r2   r   r   r   sortedr   r=   r)   r   dumpanyrc   )r   r   r   r   r   r   NLr   rZ   rW   incrnlr    r   vv_dumps                  r   r   zParseResults.dump  s   * 

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

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

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

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

d6(4&=/1#RtF8DFUVJDWCXY[X\]	  wws|r   c                R    t        j                   | j                         g|i | y)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'   rM   s      r   r   zParseResults.pprint  s     2 	dlln6t6v6r   c                ~    | j                   | j                  j                         d | j                  | j                  ffS r   )r8   r9   r   r5   r3   r#   s    r   r$   zParseResults.__getstate__  s9    MM""$

	
 	
r   c                d    |\  | _         \  | _        }}| _        t        |      | _        d | _        y r   )r8   r9   r3   rH   r5   r4   )r   stater   inAccumNamess       r   r(   zParseResults.__setstate__   s.    HMEEsL$*l+r   c                2    | j                   | j                  fS r   )r8   r3   r#   s    r   __getnewargs__zParseResults.__getnewargs__  s    }}djj((r   c                ^    t        t        |             t        | j                               z   S r   )dirr@   r>   r{   r#   s    r   __dir__zParseResults.__dir__  s     4:diik!222r   c           	         d } | g       }|j                         D ]A  \  }}t        |t              r|| j                  ||      z  }-| | |g| ||            z  }C | | |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                Z    	 t        |        t        | t               S # t        $ r Y yw xY w)NF)rt   r=   r   	Exception)r   s    r   is_iterablez+ParseResults.from_dict.<locals>.is_iterable  s4    5S	
 &c8444	  s    	**)rL   )rL   rR   )r   r=   r   	from_dict)rB   r   rL   r   r   rZ   rW   s          r   r   zParseResults.from_dict  s    	5 "gKKM 	?DAq!W%s}}QQ}//sA3Q{1~>>		?
 se$'C
r   )NN)returnNone)r   r6   )r   r*   )r   r   r   )r   r)   r   r)   )r   r)   )r   r2   )rO   )r   r6   r   r>   )r   rJ   )r   z
str | None)rO   TTr   )5r+   r,   r-   rD   r1   r.   r/   r>   rE   rA   r=   r   r!   r\   rj   rm   ro   rq   ru   ry   r{   rb   r   r   r   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r$   r(   r   r   classmethodr   rR   asDictgetNamer   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

	 */ B>:*.`HT78	

)3  4 F+F+G,r   r)   )
__future__r   r   collections.abcr   r   r   r   r   r   typingr	   utilr   r2   r   r   r.   r@   rI   r   r)   registerr   r   r   <module>r     sx    "     " "5\
 )2' "D- D-N    %    &r   