%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/pyparsing/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/pyparsing/__pycache__/results.cpython-312.pyc

�

&
�dDh����UddlmZmZmZmZmZmZddlZddlm	Z	m
Z
mZmZm
Z
eefZe	edfed<ed�dD��ZGd�d	�ZGd
�d�Zej,e�ej,e�y)�)�MutableMapping�Mapping�MutableSequence�Iterator�Sequence�	ContainerN)�Tuple�Any�Dict�Set�List.�str_typec#� K�|]}|���y�w�N�)�.0�_s  �3/usr/lib/python3/dist-packages/pyparsing/results.py�	<genexpr>rs�����a���s�rc�J�eZdZUedefed<dgZdddefd�Zd�Zd�Z	d�Z
y	)
�_ParseResultsWithOffset�ParseResults�tup�p1�p2c��||f|_yr�r)�selfrrs   r�__init__z _ParseResultsWithOffset.__init__s
��.0�"�X���c� �|j|Srr�r�is  r�__getitem__z#_ParseResultsWithOffset.__getitem__s���x�x��{�r c��|jSrr�rs r�__getstate__z$_ParseResultsWithOffset.__getstate__s���x�x�r c��|d|_y�Nrr)r�argss  r�__setstate__z$_ParseResultsWithOffset.__setstate__s
����7��r N)�__name__�
__module__�__qualname__r	�int�__annotations__�	__slots__rr$r'r+rr rrrs;��	�~�s�"�	#�#���I�6�>�6�s�6���r rc��eZdZUdZdgdfZeedfed<eed<ded<e	eed<e
ed	<eeed
<eeefed<dZ
Gd
�de�Zd8d�Zddddefd�Zd�Zefd�Zd�Zde
fd�Zdefd�Zde
fd�Zdefd�Zdefd�Zd�Zd�Zd�Zde
fd�Zd�Z d9d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d%�Z&d:d&�Z'd:d'�Z(d;d(�Z)defd)�Z*defd*�Z+d<d+�Z,defd,�Z-de.fd-�Z/d;d.�Z0d;d/�Z1d0�Z2d=defd1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8e9d9d;d7��Z:e-Z;	e/Z<	e2Z=y)>ra{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.�_null_values�_name�_parent�
_all_names�_modal�_toklist�_tokdict)r4r5r6r7r8r9c��eZdZdZdd�Zy)�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�dt	|�j����tj|�S)Nz* may only be constructed with a list, not )�
isinstance�list�	TypeErrorr,�type�__new__)�cls�	containeds  rrAzParseResults.List.__new__�sT��� ��	��i��.���|�|�n�$N�t�T]��Og�Og�Nh�i����<�<��$�$r r)r,r-r.�__doc__rArr rr
r;bs
��$	�L		%r r
c�^�t|t�r|Stj|�}d|_d|_t
�|_|�g|_nOt|ttf�r1t|tj�r|ddgn
t|�|_n|g|_t�|_
|Sr)r=r�objectrAr4r5�setr6r8r>�_generator_typer
�dictr9)rB�toklist�name�kwargsrs     rrAzParseResults.__new__�s����g�|�,��N��~�~�c�"����
�����%����?��D�M�
��$��!8�
9��g�|�'8�'8�9������'�]�
�M�%�I�D�M����
��r Tc���|||_|��|dk7r�||t�rt|�}|s|h|_||_||j
vrx||ttf�r|g}|rV||t�r#tt|j�d�||<ntt|d�d�||<|||_y	|d||<yyyy#tttf$r||ur|||<Yy||_YywxYw)N�r)r7r/�strr6r4r3rr@rrr8�KeyErrorr?�
IndexError)rrJrK�asList�modalr=s      rrzParseResults.__init__�s
��	
��������
��$��$��4�y���#'�&����D�J��d�/�/�/��g��$�'7�8�&�i�G��!�'�<�8�%<�(��)9�)9�:�A�&��T�
�&=�(����4�a�&��T�
�(,�D��J�$�.�%,�Q�Z��T�
�0�
!+���,%�i��<�.�"�$�.�)0�D��J�)-�D�J�	.�s�7C�C,�"C,�+C,c���t|ttf�r|j|S||jvr|j
|ddSt
|j
|D�cgc]}|d��	c}�Scc}w)N���r)r=r/�slicer8r6r9r)rr#�vs   rr$zParseResults.__getitem__�sj���a�#�u��&��=�=��#�#�����'��}�}�Q�'��+�A�.�.�#�4�=�=��3C�$D�a�Q�q�T�$D�E�E��$Ds�A2c��||t�r;|jj|t��|gz|j|<|d}nf||tt
f�r||j|<|}nA|jj|t��t|d�gz|j|<|}||t�r||_yyr))	rr9�getr>r/rVr8rr5)r�krWr=�subs     r�__setitem__zParseResults.__setitem__�s����a�0�1�#�}�}�0�0��D�F�;�q�c�A�D�M�M�!���A�$�C�
��C��<�
(� �D�M�M�!���C�#�}�}�0�0��D�F�;�'��1�-�?� �D�M�M�!���C��c�<�(��C�K�)r c	���t|ttf�r�t|j�}|j|=t|t�r|dkr||z
}t||dz�}tt
|j|���}|j�|jj�D]7\}}|D]-}t|�D]\}\}}	t||	|	|kDz
�||<��/�9y|j|=y)Nr�)
r=r/rV�lenr8r>�range�indices�reverser9�items�	enumerater)
rr#�mylen�removedrK�occurrences�jrZ�value�positions
          r�__delitem__zParseResults.__delitem__�s����a�#�u��&���
�
�&�E��
�
�a� ��!�S�!��q�5���J�A��!�Q��U�O���5�!�)�)�E�"2�3�4�G��O�O��%)�]�]�%8�%8�%:�
�!��k� ��A�09�+�0F��,��,�E�8�)@�!�8�x�!�|�#<�*��A����
��
�
�a� r �returnc��||jvSr�r9)rrZs  r�__contains__zParseResults.__contains__�s���D�M�M�!�!r c�,�t|j�Sr)r_r8r&s r�__len__zParseResults.__len__�s���4�=�=�!�!r c�:�|jxs|jSr)r8r9r&s r�__bool__zParseResults.__bool__s���
�
�6����7�7�7r c�,�t|j�Sr��iterr8r&s r�__iter__zParseResults.__iter__����D�M�M�"�"r c�8�t|jddd��S)NrUrur&s r�__reversed__zParseResults.__reversed__s���D�M�M�$�B�$�'�(�(r c�,�t|j�Sr)rvr9r&s r�keyszParseResults.keys
rxr c�6���fd��j�D�S)Nc3�(�K�|]	}�|���y�wrr�rrZrs  �rrz&ParseResults.values.<locals>.<genexpr>s�����-�A��Q��-�s��r|r&s`r�valueszParseResults.values
s���-�����-�-r c�6���fd��j�D�S)Nc3�,�K�|]}|�|f���
y�wrrrs  �rrz%ParseResults.items.<locals>.<genexpr>s�����2���D��G��2�s�r�r&s`rrczParseResults.itemss���2�d�i�i�k�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.rnr&s r�haskeyszParseResults.haskeyss���}�}�$�$�$r c���|sdg}|j�D]\}}|dk(r|d|f}�td|����t|dt�st	|�dk(s|d|vr|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�defaultrz)pop() got an unexpected keyword argument r^)rcr?r=r/r_)rr*rLrZrW�index�ret�defaultvalues        r�popzParseResults.pops���P��4�D��L�L�N�	S�D�A�q��I�~��Q���|���"K�A�5� Q�R�R�		S�
�d�1�g�s�#�s�4�y�A�~��a��D����G�E��u�+�C��U���J���7�L��r c��||vr||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   rrYzParseResults.getQs��$�$�;���9�� � r c���|jj||�|jj�D]0\}}t	|�D]\}\}}t||||kDz�||<��2y)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�insertr9rcrdr)rr��
ins_stringrKrgrZrirjs        rr�zParseResults.inserthst��"	
�
�
���U�J�/�!%���!4�!4�!6�	��D�+�(1�+�(>�
�$��$�E�8�!8��8�x�%�'7�8�"��A��
�	r c�:�|jj|�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  rr�zParseResults.append�s��	
�
�
���T�"r c�~�t|t�r|j|�y|jj	|�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  rr�zParseResults.extend�s,���g�|�,��M�M�'�"��M�M� � ��)r c�V�|jdd�=|jj�y)z7
        Clear all elements and results names.
        N)r8r9�clearr&s rr�zParseResults.clear�s ��
�M�M�!���
�
���r c�d�	||S#t$r|jd�rt|��YywxYw)N�__rN)rP�
startswith�AttributeError)rrKs  r�__getattr__zParseResults.__getattr__�s:��	���:����	����t�$�$�T�*�*��	�s��%/�/c�0�|j�}||z
}|Sr)�copy)r�otherr�s   r�__add__zParseResults.__add__�s���i�i�k���u����
r c����|s|S|jr�t|j���fd�}|jj�}|D���cgc]&\}}|D]}|t	|d||d��f���(}}}}|D](\}}|||<t|dt�s�||d_�*|xj|jz
c_|xj|jzc_|Scc}}}w)Nc���|dkr�S|�zSr)r)�a�offsets �r�<lambda>z'ParseResults.__iadd__.<locals>.<lambda>�s���A��E�&��q�6�z�r rr^)	r9r_r8rcrr=rr5r6)	rr��	addoffset�
otheritemsrZ�vlistrW�otherdictitemsr�s	        @rr�zParseResults.__iadd__�s������K��>�>�����'�F�A�I����-�-�/�J�!+����A�u�����+�A�a�D�)�A�a�D�/�B�C��C��N��
'�
(���1���Q���a��d�L�1�#'�A�a�D�L�
(�
	
�
�
����'�
����5�+�+�+�����s�+C(c�V�t|t�r|dk(r|j�S||zSr))r=r/r�)rr�s  r�__radd__zParseResults.__radd__�s*���e�S�!�e�q�j��9�9�;���4�<�r c�n�t|�j�d|j�d|j��d�S)N�(�, �))r@r,r8�as_dictr&s r�__repr__zParseResults.__repr__�s2���t�*�%�%�&�a��
�
�'8��4�<�<�>�:J�!�L�Lr c
��ddj|jD�cgc](}t|t�rt	|�n
t|���*c}�zdzScc}w)N�[r��])�joinr8r=rrO�reprr"s  r�__str__zParseResults.__str__�s\����i�i�"�]�]���)��L�9�C��F�t�A�w�F���
��
�		
��s�-A
c���g}|jD]U}|r|r|j|�t|t�r||j	�z
}�<|jt|���W|Sr)r8r�r=r�
_asStringListrO)r�sep�outr�s    rr�zParseResults._asStringList�s^�����M�M�	&�D��s��
�
�3���$��-��t�)�)�+�+���
�
�3�t�9�%�
	&��
r c��|jD�cgc]$}t|t�r|j�n|��&c}Scc}w)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']
        )r8r=r�as_list)r�ress  rr�zParseResults.as_list�s<��"�}�}�
��(��\�:�C�K�K�M��C�
�	
��
s�);c�R���fd��t�fd�|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�cgc]
}�|���c}S|Scc}wr)r=rr�r�)�objrW�to_items  �rr�z%ParseResults.as_dict.<locals>.to_itemsA����#�|�,�(+���
�s�{�{�}�T�PS�;T�1�G�A�J�;T�T��
��<Us�A
c3�8�K�|]\}}|�|�f���y�wrr)rrZrWr�s   �rrz'ParseResults.as_dict.<locals>.<genexpr>!s�����=���1�Q���
�O�=�s�)rIrc)rr�s @rr�zParseResults.as_dicts!���*	��=��
�
��=�=�=r c���t|j�}|jj�|_|j|_|xj
|j
zc_|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.
        )rr8r9r�r5r6r4)rr�s  rr�zParseResults.copy#sS���4�=�=�)���}�}�)�)�+����l�l������$�/�/�)���J�J��	��
r c�0�|j�}t|j�D]�\}}t|t�r|j�|j|<�4t|ttf�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.
        c3�`K�|]&}t|t�r|j�n|���(y�wr)r=r�deepcopy)rrWs  rrz(ParseResults.deepcopy.<locals>.<genexpr>As)����-�KL�J�q�,�$?�A�J�J�L�Q�F�-�s�,.)r�rdr8r=rr�rO�bytesrr@rcr)rr�r#r��destrZrWs       rr�zParseResults.deepcopy1s����i�i�k����
�
�.�	�F�A�s��#�|�,�#&�<�<�>��
�
�a� ��C�#�u��.���C��0�*3�$�s�)�+�5��
�
�a� �4��I�I�K�Q�D�A�q�.8��L�.I�a�j�j�l�q�D��G�Q��C��+�#,�4��9�-�PS�-�$��
�
�a� �	��
r c�����jr�jS�jr;�j}|jj�}t	�fd�|D�d�St��dk(rxt�j�dk(r`t	t
�jj���dddvr,t	t
�jj���Sy)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
        c3�D�K�|]\}}|D]
\}}|�ur|����y�wrr)rrZr�rW�locrs     �rrz(ParseResults.get_name.<locals>.<genexpr>es=������ ��5�"'����3��D�y�����s� Nr^r)rrU)	r4r5r9rc�nextr_rvr�r|)r�par�parent_tokdict_itemss`  r�get_namezParseResults.get_nameFs����2�:�:��:�:��
�\�\�"&�,�,�C�#&�<�<�#5�#5�#7� ���$8����
�
��I��N��D�M�M�"�a�'��T�$�-�-�.�.�0�1�2�1�5�a�8�G�C���T�]�]�/�/�1�2�3�3�r c��g}d}|j|r|t|j��znd�|�r�|j�r�t	d�|j�D��}|D]�\}}	|r|j|�|j|�d|z�d|�d��t
|	t�rE|	r(|j|	j||||dz����o|jt|	����|jt|	����td	�|D��r�|}	t|	�D]�\}
}t
|t�rE|jd
j|d|z|
|d|dzz|j||||dz�����[|jd|d|z|
|d|dzzt|�fz���dj|�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'
        �
rNc3�<K�|]\}}t|�|f���y�wr)rO)rrZrWs   rrz$ParseResults.dump.<locals>.<genexpr>�s����D�t�q�!��A���{�D���z  z- z: r^)�indent�full�include_list�_depthc3�<K�|]}t|t����y�wr)r=r)r�vvs  rrz$ParseResults.dump.<locals>.<genexpr>�s����?�B�:�b�,�/�?�r�z
{}{}[{}]:
{}{}{}z
%s%s[%d]:
%s%s%s)r�rOr�r��sortedrcr=r�dumpr��anyrd�formatr�)rr�r�r�r�r��NLrcrZrWr#r�s            rr�zParseResults.dumpvs���*��
���
�
�<�6�C�����/�/�R�H���|�|�~��D�t�z�z�|�D�D��!�,�D�A�q���
�
�2���J�J�&��4�&�=�):�"�Q�C�r�B�C�!�!�\�2���J�J� !���+1�)-�1=�+1�A�:�	!'�!"�� �J�J�s�1�v�.��
�
�4��7�+�#,�$�?�$�?�?���&�q�\��E�A�r�!�"�l�3��
�
�1�8�8� &�!%��� !� &�!%��!��!4� "���+1�)-�1=�+1�A�:�	!(�!"�
�� �
�
�1� &�!%��� !� &�!%��!��!4� #�B��
��
�%�<�w�w�s�|�r c�R�tj|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�)rr*rLs   rr�zParseResults.pprint�s ��2	�
�
�d�l�l�n�6�t�6�v�6r c�~�|j|jj�d|j|jffSr)r8r9r�r6r4r&s rr'zParseResults.__getstate__�s9���M�M��
�
�"�"�$������
�
�	
�
�	
r c�d�|\|_\|_}}|_t|�|_d|_yr)r8r9r4rGr6r5)r�stater��inAccumNamess    rr+zParseResults.__setstate__�s.��HM�E��
�E��
�s�L�$�*��l�+�����r c�2�|j|jfSr)r8r4r&s r�__getnewargs__zParseResults.__getnewargs__�s���}�}�d�j�j�(�(r c�^�tt|��t|j��zSr)�dirr@r>r|r&s r�__dir__zParseResults.__dir__�s ���4��:���d�i�i�k�!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$rYywxYw)NF)rvr=r�	Exception)r�s r�is_iterablez+ParseResults.from_dict.<locals>.is_iterables4��
5��S�	�
&�c�8�4�4�4��	�
��
�s��	*�*)rK)rKrR)rcr=r�	from_dict)rBr�rKr�r�rZrWs       rr�zParseResults.from_dict�s���	5��"�g���K�K�M�	?�D�A�q��!�W�%��s�}�}�Q�Q�}�/�/���s�A�3�Q�{�1�~�>�>��		?�
���s�e�$�'�C��
r )NNr)r�rrlr)rlr)rN)rNTTr)>r,r-r.rDr3r	r
r0rOr�boolr
rr1r>rAr=rr$r\rkror/rqrsrrwrzr|r�rcr�r�rYr�r�r�r�r�r�r�r�r�r�r�r�rIr�r�r�r�r�r�r'r+r�r��classmethodr�rR�asDict�getNamerr rrr"s���+�Z&*�2�r�N�L�%��S��/�2��J�
���C����L��3�i���3��8�n���I�0%�t�0%�d�0��d�$�:�.�BF�,6�
�!�."��"�"��"�8�$�8�#�(�#�)�h�)�#�.�3�%��%�6 �p!�.�2#�"*�(���
�, �M�#�M�

��

�	�
��
�(>��>�:��*.�`N��N�`7�8	
��
)�3�����4�F�+�
�F�+��G�,r r)�collections.abcrrrrrrr��typingr	r
rrr
rOr�rr@r0rHrr�registerrr r�<module>r�s}������.�.�!�5�\��%��c�	�
�)���2��'����"v-�v-�r�����%������&r 

Zerion Mini Shell 1.0