HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //snap/certbot/current/lib64/python3.12/site-packages/pyparsing/__pycache__/results.cpython-312.pyc
�

Ȗ0i�l���UddlmZddlZddlmZmZmZmZmZddl	Z	ddl
mZddlm
Z
eefZded<ed	�d
D��ZGd�d�ZGd
�d�Zej,e�ej,e�y)�)�annotationsN)�MutableMapping�Mapping�MutableSequence�Iterator�Iterable)�Any�)�replaced_by_pep8ztuple[type, ...]�str_typec#� K�|]}|���y�w�N�)�.0�_s  ��/build/snapcraft-certbot-3159324ea1206d36e7f0992193f2ac71/parts/certbot/install/lib/python3.12/site-packages/pyparsing/results.py�	<genexpr>rs�����a���s�rc�8�eZdZUded<dgZdd�Zd�Zd�Zd�Zy)	�_ParseResultsWithOffsetztuple[ParseResults, int]�tupc��||f|_yr�r)�self�p1�p2s   r�__init__z _ParseResultsWithOffset.__init__s
��.0�"�X���c� �|j|Srr�r�is  r�__getitem__z#_ParseResultsWithOffset.__getitem__s���x�x��{�rc��|jSrr�rs r�__getstate__z$_ParseResultsWithOffset.__getstate__!s���x�x�rc��|d|_y�Nrr)r�argss  r�__setstate__z$_ParseResultsWithOffset.__setstate__$s
����7��rN)r�ParseResultsr�int�return�None)	�__name__�
__module__�__qualname__�__annotations__�	__slots__rr!r$r(rrrrrs#��	!�!���I�6���rrc���eZdZUdZdgdfZded<ded<ded<d	ed
<ded<d
ed<ded<dZGd�de�Zd>d�Z	dddde
f	d?d�Zd�Ze
fd�Z
d�Zd@d�ZdAd�Zd@d�ZdBd�ZdBd�Zd�Zd �Zd!�Zd@d"�Zd#�ZdCd$�Zd%�Zd&�Zd'�Zd(�Zd)�ZdDd*�ZdDd+�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:

    .. testcode::

       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:

    .. testoutput::

       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'

    Nrztuple[Any, ...]�_null_values�str�_name�_parentzset[str]�
_all_names�bool�_modalz	list[Any]�_toklistzdict[str, Any]�_tokdict)r5r6r7r9r:r;c��eZdZdZdd�Zy)�ParseResults.Lista9
        Simple wrapper class to distinguish parsed list results that should be preserved
        as actual Python lists, instead of being converted to :class:`ParseResults`:

        .. testcode::

           import pyparsing as pp
           ppc = pp.common

           LBRACK, RBRACK, LPAR, RPAR = pp.Suppress.using_each("[]()")
           element = pp.Forward()
           item = ppc.integer
           item_list = pp.DelimitedList(element)
           element_list = LBRACK + item_list + RBRACK | LPAR + item_list + RPAR
           element <<= item | element_list

           # add parse action to convert from ParseResults
           # to actual Python collection types
           @element_list.add_parse_action
           def as_python_list(t):
               return pp.ParseResults.List(t.as_list())

           element.run_tests('''
               100
               [2,3,4]
               [[2, 1],3,4]
               [(2, 1),3,4]
               (2,3,4)
               ([2, 3], 4)
               ''', post_parse=lambda s, r: (r[0], type(r[0]))
           )

        prints:

        .. testoutput::
           :options: +NORMALIZE_WHITESPACE


           100
           (100, <class 'int'>)

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

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

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

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

           ([2, 3], 4)
           ([[2, 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  rrCzParseResults.List.__new__�sT��� ��	��i��.���|�|�n�$N�t�T]��Og�Og�Nh�i����<�<��$�$rr)r-r.r/�__doc__rCrrr�Listr=ns
��9	�v		%rrGc�^�t|t�r|Stj|�}d|_d|_t
�|_|�g|_nOt|ttf�r1t|tj�r|ddgn
t|�|_n|g|_t�|_
|Sr)r?r)�objectrCr5r6�setr7r:r@�_generator_typerG�dictr;)rD�toklist�name�kwargsrs     rrCzParseResults.__new__�s����g�|�,��N��~�~�c�"����
�����%����?��D�M�
��$��!8�
9��g�|�'8�'8�9������'�]�
�M�%�I�D�M����
��rTc���|||_|�|dk(ry||t�rt|�}|s|h|_||_||j
vry||ttf�r|g}|rV||t�r#tt|j�d�||<ntt|d�d�||<|||_y	|d||<y#tttf$r||ur|||<Yy||_YywxYw)N�r)r9r*r4r7r5r3rrBr)rr:�KeyErrorrA�
IndexError)rrMrN�asList�modalr?s      rrzParseResults.__init__�s���	
�����<�4�2�:���d�C� ��t�9�D��#�f�D�O���
��d�'�'�'���g��$�/�0��i�G���'�<�0�4�\�'�BR�BR�5S�UV�W��T�
�4�\�'�!�*�5M�q�Q��T�
�#�D��J���	"� ���D��J���)�Z�0�	"��d�"�$��T�
�!��
�		"�s�9C�C+�!C+�*C+c���t|ttf�r|j|S||jvr|j
|ddSt
|j
|D�cgc]}|d��	c}�Scc}w)N���r)r?r*�slicer:r7r;r))rr �vs   rr!zParseResults.__getitem__�sj���a�#�u��&��=�=��#�#��D�O�O�#��=�=��#�B�'��*�*��4�=�=��+;�<�a�Q�q�T�<�=�=��<s�A2c�z�||t�r;|jj|t��|gz|j|<|d}n^||tt
f�r||j|<|}n9|jj|g�t|d�gz|j|<|}||t�r||_yyr&)	rr;�getr@r*rXr:r)r6)r�krYr?�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��B�7�'��1�-�;� �D�M�M�!���C��c�<�(��C�K�)rc	���t|ttf�s|j|=yt	|j
�}|j
|=t|t�r|dkr||z
}t||dz�}t
t|j|���}|j�|jj�D]4}|D]-}t|�D]\}\}}t||||kDz
�||<��/�6y)Nrr
)
r?r*rXr;�lenr:r@�range�indices�reverse�values�	enumerater)	rr �mylen�removed�occurrences�jr\�value�positions	         r�__delitem__zParseResults.__delitem__s����!�c�5�\�*��
�
�a� ���D�M�M�"���M�M�!���a����1�u��U�
���a��Q���A��u�a�i�i��.�/�0�������=�=�/�/�1�	�K��
��,5�k�,B��(�A�(��x�%<��x�8�a�<�8�&�K��N��
�	rc��||jvSr�r;)rr\s  r�__contains__zParseResults.__contains__#s���D�M�M�!�!rc�,�t|j�Sr)r`r:r#s r�__len__zParseResults.__len__&s���4�=�=�!�!rc�:�|jxs|jSr)r:r;r#s r�__bool__zParseResults.__bool__)s���
�
�6����7�7�7rc�,�t|j�Sr��iterr:r#s r�__iter__zParseResults.__iter__,����D�M�M�"�"rc�8�t|jddd��S�NrWrur#s r�__reversed__zParseResults.__reversed__/s���D�M�M�$�B�$�'�(�(rc�,�t|j�Sr)rvr;r#s r�keyszParseResults.keys2rxrc�6���fd��j�D�S)Nc3�(�K�|]	}�|���y�wrr�rr\rs  �rrz&ParseResults.values.<locals>.<genexpr>6s�����-�A��Q��-�s��r}r#s`rrdzParseResults.values5s���-�����-�-rc�6���fd��j�D�S)Nc3�,�K�|]}|�|f���
y�wrrr�s  �rrz%ParseResults.items.<locals>.<genexpr>9s�����2���D��G��2�s�r�r#s`r�itemszParseResults.items8s���2�d�i�i�k�2�2rc��|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.haskeys;s���}�}�$�$�$rc���|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:

        .. doctest::

           >>> 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)
           [W:(0-9)]...
           >>> 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())
           ['AAB', '123', '321']
           - LABEL: 'AAB'

           >>> # 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)
           {W:(A-Za-z) {W:(0-9)}...}
           >>> print(patt.parse_string("AAB 123 321").dump())
           ['AAB', '123', '321']

        rW�defaultrz)pop() got an unexpected keyword argument r
)r�rAr?r*r`)rr'rOr\rY�index�ret�defaultvalues        r�popzParseResults.popAs���\��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��rc��||vr||S|S)as
        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:

        .. doctest::

           >>> integer = Word(nums)
           >>> date_str = integer("year") + '/' + integer("month") + '/' + integer("day")

           >>> result = date_str.parse_string("1999/12/31")
           >>> result.get("year")
           '1999'
           >>> result.get("hour", "not specified")
           'not specified'
           >>> result.get("hour")

        r)r�key�
default_values   rr[zParseResults.gets��.�$�;���9�� � rc���|jj||�|jj�D]-}t	|�D]\}\}}t||||kDz�||<��/y)a�
        Inserts new element at location index in the list of parsed tokens.

        Similar to ``list.insert()``.

        Example:

        .. doctest::

           >>> 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)
           [W:(0-9)]...
           >>> print(numlist.parse_string("0 123 321"))
           [0, '0', '123', '321']

        N)r:�insertr;rdrer)rr��
ins_stringrhr\rjrks       rr�zParseResults.insert�so��2	
�
�
���U�J�/��=�=�/�/�1�	�K�(1�+�(>�
�$��$�E�8�!8��8�x�%�'7�8�"��A��
�	rc�:�|jj|�y)a�
        Add single element to end of ``ParseResults`` list of elements.

        Example:

        .. doctest::

           >>> 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)
           [W:(0-9)]...
           >>> print(numlist.parse_string("0 123 321"))
           ['0', '123', '321', 444]
        N)r:�append)r�items  rr�zParseResults.append�s��,	
�
�
���T�"rc�~�t|t�r|j|�y|jj	|�y)as
        Add sequence of elements to end of :class:`ParseResults` list of elements.

        Example:

        .. testcode::

           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"))

        prints:

        .. testoutput::

           ['lskdjsdlkjflksddsklfjkldsjdksl']
        N)r?r)�__iadd__r:�extend)r�itemseqs  rr�zParseResults.extend�s,��2�g�|�,��M�M�'�"��M�M� � ��)rc�V�|jdd�=|jj�y)z7
        Clear all elements and results names.
        N)r:r;�clearr#s rr�zParseResults.clear�s ��
�M�M�!���
�
���rc�d�	||S#t$r|jd�rt|��YywxYw)N�__rQ)rR�
startswith�AttributeError)rrNs  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����
rc����|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�rrr
)	r;r`r:r�rr?r)r6r7)	rr��	addoffset�
otheritemsr\�vlistrY�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�<�rc�n�t|�j�d|j�d|j��d�S)N�(�, �))rBr-r:�as_dictr#s r�__repr__zParseResults.__repr__$s2���t�*�%�%�&�a��
�
�'8��4�<�<�>�:J�!�L�Lrc
��ddj|jD�cgc](}t|t�rt	|�n
t|���*c}�zdzScc}w)N�[r��])�joinr:r?r)r4�reprrs  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)r:r�r?r)�
_asStringListr4)r�sep�outr�s    rr�zParseResults._asStringList3s^�����M�M�	&�D��s��
�
�3���$��-��t�)�)�+�+���
�
�3�t�9�%�
	&��
rF)�flattenc����fd�}|r
g|���S�jD�cgc]$}t|t�r|j�n|��&c}Scc}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:

        .. doctest::

           >>> 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
           >>> type(result)
           <class 'pyparsing.results.ParseResults'>
           >>> print(result)
           ['sldkj', 'lsdkj', 'sldkj']

        .. doctest::

           >>> # Use as_list() to create an actual list
           >>> result_list = result.as_list()
           >>> type(result_list)
           <class 'list'>
           >>> print(result_list)
           ['sldkj', 'lsdkj', 'sldkj']
        
        .. versionchanged:: 3.2.0
           New ``flatten`` argument.
        c3��K�tjg���}|r@|j�}t|t�r|j|ddd��n|��|r�?yy�wrz)�collections�deque�popleftr?r)�
extendleft)�pr�to_visit�to_dors   �r�	flattenedz'ParseResults.as_list.<locals>.flattened]sV�����"�(�(��4��1�H�� �(�(�*���e�\�2��'�'��d��d��4��K��s�AA�A)r:r?r)�as_list)rr�r��ress`   rr�zParseResults.as_list>sV���>	 ��%�Y�t�_�%�%� �=�=���",�C��!>����
�C�G��
��s�)A
c�R���fd��t�fd�|j�D��S)ac
        Returns the named parse results as a nested dictionary.

        Example:

        .. doctest::

           >>> integer = pp.Word(pp.nums)
           >>> date_str = integer("year") + '/' + integer("month") + '/' + integer("day")

           >>> result = date_str.parse_string('1999/12/31')
           >>> type(result)
           <class 'pyparsing.results.ParseResults'>
           >>> result
           ParseResults(['1999', '/', '12', '/', '31'], {'year': '1999', 'month': '12', 'day': '31'})

           >>> result_dict = result.as_dict()
           >>> type(result_dict)
           <class 'dict'>
           >>> result_dict
           {'year': '1999', 'month': '12', 'day': '31'}

           >>> # even though a ParseResults supports dict-like access,
           >>> # sometime you just need to have a dict
           >>> import json
           >>> print(json.dumps(result))
           Traceback (most recent call last):
           TypeError: Object of type ParseResults is not JSON serializable
           >>> print(json.dumps(result.as_dict()))
           {"year": "1999", "month": "12", "day": "31"}
        c���t|t�r6|j�r|j�S|D�cgc]
}�|���c}S|Scc}wr)r?r)r�r�)�objrY�to_items  �rr�z%ParseResults.as_dict.<locals>.to_item�sA����#�|�,�(+���
�s�{�{�}�T�PS�;T�1�G�A�J�;T�T��
��<Us�A
c3�8�K�|]\}}|�|�f���y�wrr)rr\rYr�s   �rrz'ParseResults.as_dict.<locals>.<genexpr>�s�����=���1�Q���
�O�=�s�)rLr�)rr�s @rr�zParseResults.as_dictns"���B	��=��
�
��=�=�=rc���t|j�}|jj�|_|j|_|xj
|j
zc_|j|_|S)a
        Returns a new shallow copy of a :class:`ParseResults` object.
        :class:`ParseResults` items contained within the source are
        shared with the copy. Use :meth:`ParseResults.deepcopy` to
        create a copy with its own separate content values.
        )r)r:r;r�r6r7r5)rr�s  rr�zParseResults.copy�sS���4�=�=�)���}�}�)�)�+����l�l������$�/�/�)���J�J��	��
rc�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)zm
        Returns a new deep copy of a :class:`ParseResults` object.

        .. versionadded:: 3.1.0
        c3�`K�|]&}t|t�r|j�n|���(y�wr)r?r)�deepcopy)rrYs  rrz(ParseResults.deepcopy.<locals>.<genexpr>�s)����,�KL�J�q�,�$?�A�J�J�L�Q�F�,�s�,.)r�rer:r?r)r�r4�bytesrrBr�r)rr�r r��destr\rYs       rr�zParseResults.deepcopy�s����i�i�k����
�
�.�	�F�A�s��#�|�,�"%�,�,�.����Q���C�#�u��.���C��0�)2��c���4����Q��$��I�I�K�Q�D�A�q�.8��L�.I�a�j�j�l�q�D��G�Q��C��*�"+�$�s�)�,�PS�,�#����Q��	��
rc�����jr�jS�jr;�j}|jj�}t	�fd�|D�d�St��dk(rxt�j�dk(r`t	t
�jj���dddvr,t	t
�jj���Sy)aG
        Returns the results name for this token expression.

        Useful when several different expressions might match
        at a particular location.

        Example:

        .. testcode::

           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:

        .. testoutput::

           age : 22
           ssn : 111-22-3333
           house_number : 221B

        c3�D�K�|]\}}|D]
\}}|�ur|����y�wrr)rr\r�rY�locrs     �rrz(ParseResults.get_name.<locals>.<genexpr>�s=������ ��5�"'����3��D�y�����s� Nr
r)rrW)	r5r6r;r��nextr`rvrdr})r�par�parent_tokdict_itemss`  r�get_namezParseResults.get_name�s����@�:�:��:�:��
�\�\� $���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�rc���g}d}|j|r|t|j��znd�|sdj|�S|j	�r�td�|j
�D��}|D]�\}}	|r|j|�|j|�d|z�d|�d��t|	t�s|jt|	���`|	s|jt|	���}|j|	j||||dz�����td	�|D��sdj|�S|}	d}
d}t|	�D]�\}}
t|
t�rE|
j||||dz��}|j|�|�|
|z�d
|�d|�|�|
|dzz�|��
��[|j|�|�|
|z�d
|�d|�|�|
|dzz�|
��
���dj|�S)as
        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:

        .. testcode::

           integer = Word(nums)
           date_str = integer("year") + '/' + integer("month") + '/' + integer("day")

           result = date_str.parse_string('1999/12/31')
           print(result.dump())

        prints:

        .. testoutput::

           ['1999', '/', '12', '/', '31']
           - day: '31'
           - month: '12'
           - year: '1999'
        �
rQc3�<K�|]\}}t|�|f���y�wr)r4)rr\rYs   rrz$ParseResults.dump.<locals>.<genexpr>s����@�4�1�a�C��F�A�;�@���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�r�z]:)
r�r4r�r�r��sortedr�r?r)r��dump�anyre)rr�r�r�r�r��NLr�r\rY�incr�nlr r��vv_dumps               rr�zParseResults.dump�s��2��
���
�
�<�6�C�����/�/�R�H���7�7�3�<���<�<�>��@�4�:�:�<�@�@�E��
���1���J�J�r�N��
�
�f�X�t�f�}�%6�b���2�>�?�!�!�\�2��J�J�t�A�w�'����J�J�s�1�v�&���
�
��F�F�%�!�%1�%��z�	���
�(�?�$�?�?��7�7�3�<������
���q�\�	�E�A�r��"�l�+��'�'�!��!-�!�A�:�	"����
�
��d�6�(�4�&�=�/��1�#�R��t�F�8�D�F�UV�J�DW�CX�Y`�Xa�b���
�
��d�6�(�4�&�=�/��1�#�R��t�F�8�D�F�UV�J�DW�CX�Y[�X\�]��	� �w�w�s�|�rc�R�tj|j�g|��i|��y)aF
        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:

        .. testcode::

           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:

        .. testoutput::

           ['fna',
            ['a',
             'b',
             ['(', 'fnb', ['c', 'd', '200'], ')'],
             '100']]
        N)�pprintr�)rr'rOs   rr�zParseResults.pprintAs ��:	�
�
�d�l�l�n�6�t�6�v�6rc�~�|j|jj�d|j|jffSr)r:r;r�r7r5r#s rr$zParseResults.__getstate__as9���M�M��
�
�"�"�$������
�
�	
�
�	
rc�d�|\|_\|_}}|_t|�|_d|_yr)r:r;r5rJr7r6)r�stater��inAccumNamess    rr(zParseResults.__setstate__ls.��HM�E��
�E��
�s�L�$�*��l�+�����rc�2�|j|jfSr)r:r5r#s r�__getnewargs__zParseResults.__getnewargs__qs���}�}�d�j�j�(�(rc�^�tt|��t|j��zSr)�dirrBr@r}r#s r�__dir__zParseResults.__dir__ts ���4��:���d�i�i�k�!2�2�2rc	���d�}|g�}|j�D]A\}}t|t�r||j||��z
}�-|||g|||���z
}�C|�||g|��}|S)z�
        Helper classmethod to construct a :class:`ParseResults` from a ``dict``, preserving the
        name-value relations as results names. If an optional ``name`` argument is
        given, a nested :class:`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��	*�*)rN)rNrT)r�r?r�	from_dict)rDr�rNr�r�r\rYs       rr�zParseResults.from_dictws���	5��"�g���K�K�M�	?�D�A�q��!�W�%��s�}�}�Q�Q�}�/�/���s�A�3�Q�{�1�~�>�>��		?�
���s�e�$�'�C��
r)NN)r+r,)r+r8)r+r*)r+rr)r�r)r+r))r+r))r+r4)rQ)r�r8r+r@)r+rL)r+z
str | None)rQTTr)5r-r.r/rFr3r0r1r@rGrCr?rr!r^rlrorqrsrwr{r}rdr�r�r�r[r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r$r(r�r��classmethodr�rT�asDict�getNamerrrr)r)(sq��1�f&*�2�r�N�L�/�2��J�
�����L������I�E%�t�E%�N�0��d�$�:�%"�	
�%"�N>�,6�
��0"�"�8�#�)�#�.�3�%�< �|!�8�B#�0*�<���
�, �M�

�	�*/�.�`'>�R��.5�nL�\7�@	
��
)�3�����4�F���F���G�rr))�
__future__rr��collections.abcrrrrrr��typingr	�utilrr4r�rr0rBrKrr)�registerrrr�<module>rsz��#������"�"�5�\��
�)���2��'����"x
�x
�v�����%������&r