o
    Ȑil                     @  s   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D ZG dd dZG dd dZee ee dS )    )annotationsN)MutableMappingMappingMutableSequenceIteratorIterable)Any   )replaced_by_pep8ztuple[type, ...]str_typec                 c  s    | ]}|V  qd S N ).0_r   r   `/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/pyparsing/results.py	<genexpr>   s    r   r   c                   @  s>   e Zd ZU ded< dgZdd	d
Zdd Zdd Zdd ZdS )_ParseResultsWithOffsetztuple[ParseResults, int]tupp1ParseResultsp2intreturnNonec                 C  s   ||f| _ d S r   r   )selfr   r   r   r   r   __init__      z _ParseResultsWithOffset.__init__c                 C  s
   | j | S r   r   r   ir   r   r   __getitem__      
z#_ParseResultsWithOffset.__getitem__c                 C  s   | j S r   r   r   r   r   r   __getstate__!   s   z$_ParseResultsWithOffset.__getstate__c                 G  s   |d | _ d S Nr   r   )r   argsr   r   r   __setstate__$   r   z$_ParseResultsWithOffset.__setstate__N)r   r   r   r   r   r   )	__name__
__module____qualname____annotations__	__slots__r   r    r#   r&   r   r   r   r   r      s   
 
r   c                   @  s  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 deZdpddZ	dddde
fdqddZdd Ze
fddZdd  Zdrd!d"Zdsd$d%Zdrd&d'Zdtd)d*Zdtd+d,Zd-d. Zd/d0 Zd1d2 Zdrd3d4Zd5d6 Zdud7d8Zd9d: Zd;d< Zd=d> Zd?d@ ZdAdB ZdvdDdEZdvdFdGZ dwdHdIZ!dxdJdKZ"dxdLdMZ#dydOdPZ$dQdRdzdUdVZ%d{dXdYZ&dwdZd[Z'dwd\d]Z(d|d_d`Z)d}dxdbdcZ*ddde Z+dfdg Z,dhdi Z-djdk Z.dldm Z/e0dudwdndoZ1e%Z2	 e&Z3	 e)Z4dS )~r   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'

    Nr   ztuple[Any, ...]_null_valuesstr_name_parentzset[str]
_all_namesbool_modalz	list[Any]_toklistzdict[str, Any]_tokdict)r.   r/   r0   r2   r3   r4   c                   @  s   e Zd ZdZdddZdS )z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                 C  s:   |d u rg }t |tst| j dt|j t| S )Nz* may only be constructed with a list, not )
isinstancelist	TypeErrorr'   type__new__)cls	containedr   r   r   r9      s   

zParseResults.List.__new__r   )r'   r(   r)   __doc__r9   r   r   r   r   Listn   s    ;r=   c                 K  s   t |tr|S t| }d |_d |_t |_|d u rg |_nt |t	t
fr8t |tjr2|d d  gnt	||_n|g|_t |_|S r   )r5   r   objectr9   r.   r/   setr0   r3   r6   _generator_typer=   dictr4   )r:   toklistnamekwargsr   r   r   r   r9      s    


zParseResults.__new__Tr   r   c              
   C  s   |  || _ |d u s|dkrd S ||trt|}|s|h| _|| _|| jv r(d S ||ttfr2|g}|rV||trDt	t|j
d| |< nt	t|d d| |< || | _d S z	|d | |< W d S  tttfyz   || urt|| |< Y d S || _Y d S w )N r   )r2   r   r-   r0   r.   r,   r   r8   r   r   r3   KeyErrorr7   
IndexError)r   rB   rC   asListmodalr5   r   r   r   r      s4   



zParseResults.__init__c                 C  sL   t |ttfr| j| S || jvr| j| d d S tdd | j| D S )Nr   c                 S  s   g | ]}|d  qS )r   r   r   vr   r   r   
<listcomp>       z,ParseResults.__getitem__.<locals>.<listcomp>)r5   r   slicer3   r0   r4   r   r   r   r   r   r       s
   

zParseResults.__getitem__c                 C  s   ||t r| j|t |g | j|< |d }n!||ttfr'|| j|< |}n| j|g t |dg | j|< |}||trC| |_d S d S r$   )	r   r4   getr6   r   rO   r3   r   r/   )r   krL   r5   subr   r   r   __setitem__   s   




zParseResults.__setitem__c           	      C  s   t |ttfs| j|= d S t| j}| j|= t |tr*|dk r#||7 }t||d }tt|| }|	  | j
 D ]}|D ]}t|D ]\}\}}t||||k ||< qFq@q<d S )Nr   r	   )r5   r   rO   r4   lenr3   r6   rangeindicesreversevalues	enumerater   )	r   r   mylenremovedoccurrencesjrQ   valuepositionr   r   r   __delitem__  s(   


zParseResults.__delitem__c                 C  s
   || j v S r   r4   )r   rQ   r   r   r   __contains__#  r!   zParseResults.__contains__r   c                 C  
   t | jS r   )rT   r3   r"   r   r   r   __len__&  r!   zParseResults.__len__c                 C  s   | j p| j  S r   )r3   r4   r"   r   r   r   __bool__)  s   zParseResults.__bool__r   c                 C  rc   r   iterr3   r"   r   r   r   __iter__,  r!   zParseResults.__iter__c                 C  s   t | jd d d S NrJ   rf   r"   r   r   r   __reversed__/  s   zParseResults.__reversed__c                 C  rc   r   )rg   r4   r"   r   r   r   keys2  r!   zParseResults.keysc                       fdd   D S )Nc                 3  s    | ]} | V  qd S r   r   r   rQ   r"   r   r   r   6  s    z&ParseResults.values.<locals>.<genexpr>rk   r"   r   r"   r   rX   5     zParseResults.valuesc                   rl   )Nc                 3  s    | ]	}| | fV  qd S r   r   rm   r"   r   r   r   9  s    z%ParseResults.items.<locals>.<genexpr>rn   r"   r   r"   r   items8  ro   zParseResults.itemsc                 C  s
   | 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.ra   r"   r   r   r   haskeys;  s   
zParseResults.haskeysc                 O  s   |sdg}|  D ]\}}|dkr|d |f}q	td|t|d ts2t|dks2|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:

        .. 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']

        rJ   defaultr   z)pop() got an unexpected keyword argument r	   )rp   r7   r5   r   rT   )r   r%   rD   rQ   rL   indexretdefaultvaluer   r   r   popA  s   .&zParseResults.popc                 C  s   || v r| | 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_valuer   r   r   rP     s   zParseResults.getc                 C  sN   | j || | j D ]}t|D ]\}\}}t||||k ||< qqdS )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)r3   insertr4   rX   rY   r   )r   rs   
ins_stringr\   rQ   r^   r_   r   r   r   ry     s   
zParseResults.insertc                 C  s   | j | dS )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)r3   append)r   itemr   r   r   r{     s   zParseResults.appendc                 C  s(   t |tr| | dS | j| dS )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)r5   r   __iadd__r3   extend)r   itemseqr   r   r   r~     s   
zParseResults.extendc                 C  s   | j dd= | j  dS )z7
        Clear all elements and results names.
        N)r3   r4   clearr"   r   r   r   r     s   zParseResults.clearc                 C  s2   z| | W S  t y   |drt|Y dS w )N__rE   )rF   
startswithAttributeError)r   rC   r   r   r   __getattr__  s   

zParseResults.__getattr__otherc                 C  s   |   }||7 }|S r   )copy)r   r   rt   r   r   r   __add__  s   zParseResults.__add__c                   s   |s| S |j r7t| jfdd |j  } fdd|D }|D ]\}}|| |< t|d tr6| |d _q"|  j|j7  _|  j|jO  _| S )Nc                   s   | dk r S |   S r$   r   )a)offsetr   r   <lambda>  rN   z'ParseResults.__iadd__.<locals>.<lambda>c              	     s4   g | ]\}}|D ]}|t |d   |d fqqS )r   r	   )r   )r   rQ   vlistrL   )	addoffsetr   r   rM     s    z)ParseResults.__iadd__.<locals>.<listcomp>r   )r4   rT   r3   rp   r5   r   r/   r0   )r   r   
otheritemsotherdictitemsrQ   rL   r   )r   r   r   r}     s"   



zParseResults.__iadd__c                 C  s"   t |tr|dkr|  S ||  S r$   )r5   r   r   )r   r   r   r   r   __radd__  s   zParseResults.__radd__c                 C  s"   t | j d| jd|   dS )N(, ))r8   r'   r3   as_dictr"   r   r   r   __repr__$  s   "zParseResults.__repr__c                 C  s   dd dd | jD  d S )N[r   c                 S  s&   g | ]}t |trt|nt|qS r   )r5   r   r-   repr)r   r   r   r   r   rM   +  s    z(ParseResults.__str__.<locals>.<listcomp>])joinr3   r"   r   r   r   __str__'  s   zParseResults.__str__rE   c                 C  sL   g }| j D ]}|r|r|| t|tr|| 7 }q|t| q|S r   )r3   r{   r5   r   _asStringListr-   )r   sepoutr|   r   r   r   r   3  s   


zParseResults._asStringListF)flattenr   r6   c                  s,    fdd}|rg | S dd  j D S )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.
        c                 3  sN    t g  }|r%| }t|tr||d d d  n|V  |s
d S d S ri   )collectionsdequepopleftr5   r   
extendleft)prZto_visitZto_dor"   r   r   	flattened]  s   
z'ParseResults.as_list.<locals>.flattenedc                 S  s"   g | ]}t |tr| n|qS r   )r5   r   as_list)r   resr   r   r   rM   i  s    z(ParseResults.as_list.<locals>.<listcomp>)r3   )r   r   r   r   r"   r   r   >  s   	zParseResults.as_listrA   c                   s&    fdd t  fdd|  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                   s0   t | tr|  r|  S  fdd| D S | S )Nc                   s   g | ]} |qS r   r   rK   to_itemr   r   rM     rN   z9ParseResults.as_dict.<locals>.to_item.<locals>.<listcomp>)r5   r   rq   r   objr   r   r   r     s   
"z%ParseResults.as_dict.<locals>.to_itemc                 3  s     | ]\}}| |fV  qd S r   r   r   rQ   rL   r   r   r   r         z'ParseResults.as_dict.<locals>.<genexpr>)rA   rp   r"   r   r   r   r   n  s   !zParseResults.as_dictc                 C  s:   t | j}| j |_| j|_| j| jO  _| 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   r3   r4   r   r/   r0   r.   )r   rt   r   r   r   r     s   
zParseResults.copyc                 C  s   |   }t| jD ]R\}}t|tr| |j|< q	t|ttfr"q	t|trHt	|  |j|< }|
 D ]\}}t|trB| n|||< q5q	t|tr[t	|dd |D |j|< q	|S )zm
        Returns a new deep copy of a :class:`ParseResults` object.

        .. versionadded:: 3.1.0
        c                 s  s&    | ]}t |tr| n|V  qd S r   )r5   r   deepcopyrK   r   r   r   r     s    
z(ParseResults.deepcopy.<locals>.<genexpr>)r   rY   r3   r5   r   r   r-   bytesr   r8   rp   r   )r   rt   r   r   destrQ   rL   r   r   r   r     s"   


zParseResults.deepcopy
str | Nonec                   s    j r j S  jr j}|j }t fdd|D dS t dkrBt jdkrBtt j d d dv rBtt j S dS )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

        c                 3  s.    | ]\}}|D ]\}}| u r|V  qqd S r   r   )r   rQ   r   rL   locr"   r   r   r     s    z(ParseResults.get_name.<locals>.<genexpr>Nr	   r   )r   rJ   )	r.   r/   r4   rp   nextrT   rg   rX   rk   )r   parZparent_tokdict_itemsr   r"   r   get_name  s     


zParseResults.get_namer   c                 C  s  g }d}| |r|t|   nd |sd|S |  rktdd |  D }|D ]?\}}	|r6| | | | d|  d| d t|	tsR| t	|	 q+|	s\| t|	 q+| |	j
||||d d	 q+td
d | D syd|S | }	d}
d}t|	D ]O\}}t|tr|j
||||d d	}| | | |
|  d| d| | |
|d   | 
 q| | | |
|  d| d| | |
|d   | 
 qd|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'
        
rE   c                 s  s     | ]\}}t ||fV  qd S r   )r-   r   r   r   r   r     r   z$ParseResults.dump.<locals>.<genexpr>z  z- z: r	   )indentfullinclude_list_depthc                 s  s    | ]}t |tV  qd S r   )r5   r   )r   vvr   r   r   r   )  s    r   z]:)r{   r-   r   r   rq   sortedrp   r5   r   r   dumpanyrY   )r   r   r   r   r   r   NLrp   rQ   rL   incrnlr   r   Zvv_dumpr   r   r   r     sZ   




22
zParseResults.dumpc                 O  s    t j |  g|R i | dS )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   )r   r%   rD   r   r   r   r   A  s    zParseResults.pprintc                 C  s   | j | j d | j| jffS r   )r3   r4   r   r0   r.   r"   r   r   r   r#   a  s   zParseResults.__getstate__c                 C  s*   |\| _ \| _}}| _t|| _d | _d S r   )r3   r4   r.   r?   r0   r/   )r   stater   inAccumNamesr   r   r   r&   l  s   

zParseResults.__setstate__c                 C  s   | j | jfS r   )r3   r.   r"   r   r   r   __getnewargs__q  s   zParseResults.__getnewargs__c                 C  s   t t| t|   S r   )dirr8   r6   rk   r"   r   r   r   __dir__t  s   zParseResults.__dir__c                 C  sr   dd }| g }|  D ]\}}t|tr|| j||d7 }q|| |g|||d7 }q|dur7| |g|d}|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                 S  s.   zt |  W n
 ty   Y dS w t| t S )NF)rg   	Exceptionr5   r   r   r   r   r   is_iterable  s   z+ParseResults.from_dict.<locals>.is_iterable)rC   )rC   rH   N)rp   r5   r   	from_dict)r:   r   rC   r   rt   rQ   rL   r   r   r   r   w  s   	
zParseResults.from_dict)NN)r   r   )r   r1   )r   r   )r   r   r   )r   r   r   r   )r   r   )r   r-   )rE   )r   r1   r   r6   )r   rA   )r   r   )rE   TTr   )5r'   r(   r)   r<   r,   r*   r+   r6   r=   r9   r5   r   r    rS   r`   rb   rd   re   rh   rj   rk   rX   rp   rq   rv   rP   ry   r{   r~   r   r   r   r}   r   r   r   r   r   r   r   r   r   r   r   r#   r&   r   r   classmethodr   rH   asDictgetNamer   r   r   r   r   (   st   
 3	
G
'	






>!






0
)

7N r   )
__future__r   r   collections.abcr   r   r   r   r   r   typingr   utilr
   r-   r   r   r*   r8   r@   r   r   registerr   r   r   r   <module>   s&          
