Your IP : 216.73.216.158


Current Path : /snap/certbot/5528/lib/python3.12/site-packages/pyparsing/__pycache__/
Upload File :
Current File : //snap/certbot/5528/lib/python3.12/site-packages/pyparsing/__pycache__/exceptions.cpython-312.pyc

�

tI�i�*�	��ddlmZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddl
mZmZmZmZmZmZGd�d	ej(ej*ej,ej.ej0�Zeej4�Zej8d
e�d��ZGd�d
e�ZGd�de�Z Gd�de�Z!Gd�de!�Z"Gd�de�Z#y)�)�annotationsN)�cached_property�)�PyparsingDeprecationWarning)�pyparsing_unicode)�_collapse_string_to_ranges�col�deprecate_argument�line�lineno�replaced_by_pep8c��eZdZy)�_ExceptionWordUnicodeSetN)�__name__�
__module__�__qualname__����/build/snapcraft-certbot-53a6961353a63169611ae8a78f6bfa4f/parts/certbot/install/lib/python3.12/site-packages/pyparsing/exceptions.pyrrs��	rrz([z
]{1,16})|.c�d�eZdZUdZded<ded<ded<ded<d	ed
<dZ			d							dd
�Zed d!d��Ze	d"d��Z
ed#d��Zed$d��Z
ed$d��Zed$d��Zed#d��Zed��Zej&d��Zd�Zd#d�Zd#d�Zd�Z	d%			d&d�Zd d'd�Zede�Zy)(�ParseBaseExceptionz7base exception class for all parsing runtime exceptions�int�loc�str�msg�pstrz
typing.Any�parser_elementz%tuple[str, int, typing.Optional[str]]�args�rrrrrNc�\�|�|d}}||_||_||_||_|||f|_y)N�r)�selfrrr�elems     r�__init__zParseBaseException.__init__4s=���;��b��C���������	�"����3��$��	rc�V�ddl}ddlm}|�tj�}g}t|t�r<|j|j�|jdd|j�d���|jt|�j�d|���|dks|j�d	j|�S|j|j|�
�}t�}||dD�]/}|d}|j j#dd�}	t|	|�r�|j$j&j)d�s�Wt+|	�|vr�e|j-t+|	��t|	�}
|j|
j.�d
|
j�d|	���no|	�6t|	�}
|j|
j.�d
|
j���n7|j$}|j&dvr��|j|j&�|dz}|r��0nd	j|�S)a�
        Method to take an exception and translate the Python internal traceback into a list
        of the pyparsing expressions that caused the exception to be raised.

        Parameters:

        - exc - exception raised during parsing (need not be a ParseException, in support
          of Python exceptions that might be raised in a parse action)
        - depth (default=16) - number of levels back in the stack trace to list expression
          and function names; if None, the full stack trace names will be listed; if 0, only
          the failing input line, marker, and exception string will be shown

        Returns a multi-line string listing the ParserElements and/or function names in the
        exception's stack trace.
        rNr)�
ParserElement�^�>r!�: �
)�contextr")�	parseImpl�
_parseNoCache�.z - )�wrapperz<module>)�inspect�corer&�sys�getrecursionlimit�
isinstancer�appendr�column�typer�
__traceback__�join�getinnerframes�set�f_locals�get�f_code�co_name�
startswith�id�addr)�exc�depthr0r&�ret�callers�seen�ff�frm�f_self�	self_type�codes            r�explain_exceptionz$ParseBaseException.explain_exceptionDs���"	�'��=��)�)�+�E����c�-�.��J�J�s�x�x� ��J�J�#�a��
�
�|�0�^�,�.��
�
�d�3�i�(�(�)��C�5�1�2��A�:��*�*�2��9�9�S�>�!��(�(��):�):�E�(�J������5�&�'�"�	�B��Q�%�C��\�\�%�%�f�d�3�F��&�-�0��z�z�)�)�4�4�5S�T���f�:��%������F��$� ��L�	��
�
�i�2�2�3�1�Y�5G�5G�4H��F�8�T�U��#� ��L�	��
�
�i�2�2�3�1�Y�5G�5G�4H�I�J��z�z���<�<�#:�:���
�
�4�<�<�(��Q�J�E���7	�:�y�y��~�rc�h�||j|j|j|j�S)z�
        internal factory method to simplify creating one type of ParseException
        from another - avoids having __init__ signature conflicts among subclasses
        )rrrr)�cls�pes  r�_from_exceptionz"ParseBaseException._from_exception�s'���2�7�7�B�F�F�B�F�F�B�,=�,=�>�>rc�B�t|j|j�S)zG
        Return the line of text where the exception occurred.
        )rrr�r"s rrzParseBaseException.line�s��
�D�H�H�d�i�i�(�(rc�B�t|j|j�S)zV
        Return the 1-based line number of text where the exception occurred.
        )rrrrSs rrzParseBaseException.lineno�s��
�d�h�h��	�	�*�*rc�B�t|j|j�S�z]
        Return the 1-based column on the line of text where the exception occurred.
        �r	rrrSs rr	zParseBaseException.col����
�4�8�8�T�Y�Y�'�'rc�B�t|j|j�SrVrWrSs rr6zParseBaseException.column�rXrc�H�|jsy|jt|j�k\rytj	|j|j�}|�|d}n&|j|j|jdz}t|�j
dd�S)Nr!zend of textrrz\\�\)rr�len�_exception_word_extractor�match�repr�replace)r"�found_match�
found_texts   r�foundzParseBaseException.found�s����y�y���8�8�s�4�9�9�~�%� �0�5�5�d�i�i����J���"�$�Q��J����4�8�8�d�h�h��l�;�J��J��'�'��t�4�4rc�R�tjdtd��|jS�Nz/parserElement is deprecated, use parser_element�)�
stacklevel��warnings�warnrrrSs r�
parserElementz ParseBaseException.parserElement�s%���
�
�=�'��	
�
�"�"�"rc�J�tjdtd��||_yrerh)r"r#s  rrkz ParseBaseException.parserElement�s!���
�
�=�'��	
�
#��rc�,�tj|�S�N)�copyrSs rrozParseBaseException.copy�s���y�y���rc	��|jrd|j��nd}|j�|�d|j�d|j�d|j�d�	S)z�
        Output the formatted exception message.
        Can be overridden to customize the message formatting or contents.

        .. versionadded:: 3.2.0
        z, found r!z  (at char z	), (line:z, col:�))rcrrrr6)r"�found_phrases  r�formatted_messagez$ParseBaseException.formatted_message�sU��37�*�*��$�*�*��.�"���(�(��L�>��T�X�X�J�i����}�TZ�[_�[f�[f�Zg�gh�i�irc	���	|j�S#t$rH}t|�j�d|j�dt|�j�d|�d�cYd}~Sd}~wwxYw)zl
        .. versionchanged:: 3.2.0
           Now uses :meth:`formatted_message` to format message.
        r)z (z while formatting message)N)rs�	Exceptionr7rr)r"�exs  r�__str__zParseBaseException.__str__�sf��
	��)�)�+�+���	���:�&�&�'�r�$�(�(���T�"�X�&�&�'�r�"��-G�I�
��	�s��	A#�=A�A#�A#c��t|�Srn)rrSs r�__repr__zParseBaseException.__repr__�s���4�y�rc��t|dd�}|�|n|}|j}|jdz
}|r|d|�|�||d��}|j�S)z�
        Extracts the exception line from the input string, and marks
        the location of the exception with a special symbol.
        �markerStringz>!<Nr)r
rr6�strip)r"�
marker_string�kwargsr{�line_str�line_columns      r�mark_input_linez"ParseBaseException.mark_input_line�sf��/�v�~�u�M��(5�(A�}�|���9�9���k�k�A�o���"�<�K�0�1�,�����@V�?W�X�H��~�~��rc�&�|j||�S)a�
        Method to translate the Python internal traceback into a list
        of the pyparsing expressions that caused the exception to be raised.

        Parameters:

        - depth (default=16) - number of levels back in the stack trace to list expression
          and function names; if None, the full stack trace names will be listed; if 0, only
          the failing input line, marker, and exception string will be shown

        Returns a multi-line string listing the ParserElements and/or function names in the
        exception's stack trace.

        Example:

        .. testcode::

            # an expression to parse 3 integers
            expr = pp.Word(pp.nums) * 3
            try:
                # a failing parse - the third integer is prefixed with "A"
                expr.parse_string("123 456 A789")
            except pp.ParseException as pe:
                print(pe.explain(depth=0))

        prints:

        .. testoutput::

            123 456 A789
                    ^
            ParseException: Expected W:(0-9), found 'A789'  (at char 8), (line:1, col:9)

        Note: the diagnostic output will include string representations of the expressions
        that failed to parse. These representations will be more helpful if you use `set_name` to
        give identifiable names to your expressions. Otherwise they will use the default string
        forms, which may be cryptic to read.

        Note: pyparsing's default truncation of exception tracebacks may also truncate the
        stack of expressions that are displayed in the ``explain`` output. To get the full listing
        of parser expressions, you may have to set ``ParserElement.verbose_stacktrace = True``
        )rM)r"rDs  r�explainzParseBaseException.explain�s��V�%�%�d�E�2�2r�
markInputline)rNN)rrrrr�typing.Optional[str]�return�None)�)rCrurDrr�r)r�r�r�r)r�rrn)r}r�r�r)rDrr�r)rrr�__doc__�__annotations__�	__slots__r$�staticmethodrM�classmethodrQrrrr	r6rc�propertyrk�setterrorsrwryr�r�r
r�rrrrr!s[��A�	�H�	�H�

�I���
/�/��I��$(�
�%��%��%�"�	%�
�
%� �=��=�~�?��?��)��)��+��+��(��(��(��(��5��5�"�#��#����#��#��j���59� �1� �	� � +3�^%�_�o�F�Mrrc��eZdZdZy)�ParseExceptiona�
    Exception thrown when a parse expression doesn't match the input string

    Example:

    .. testcode::

        integer = Word(nums).set_name("integer")
        try:
            integer.parse_string("ABC")
        except ParseException as pe:
            print(pe, f"column: {pe.column}")

    prints:

    .. testoutput::

       Expected integer, found 'ABC'  (at char 0), (line:1, col:1) column: 1

    N�rrrr�rrrr�r�,s��rr�c��eZdZdZy)�ParseFatalExceptionzu
    User-throwable exception thrown when inconsistent parse content
    is found; stops all parsing immediately
    Nr�rrrr�r�Cs��rr�c��eZdZdZy)�ParseSyntaxExceptionz�
    Just like :class:`ParseFatalException`, but thrown internally
    when an :class:`ErrorStop<And._ErrorStop>` ('-' operator) indicates
    that parsing is to stop immediately because an unbacktrackable
    syntax error has been found.
    Nr�rrrr�r�Js��rr�c� �eZdZdZdd�Zdd�Zy)�RecursiveGrammarExceptionaL
    .. deprecated:: 3.0.0
       Only used by the deprecated :meth:`ParserElement.validate`.

    Exception thrown by :class:`ParserElement.validate` if the
    grammar could be left-recursive; parser may need to enable
    left recursion using :class:`ParserElement.enable_left_recursion<ParserElement.enable_left_recursion>`
    c��||_yrn��parseElementTrace)r"�parseElementLists  rr$z"RecursiveGrammarException.__init__]s
��!1��rc� �d|j��S)NzRecursiveGrammarException: r�rSs rrwz!RecursiveGrammarException.__str__`s��,�T�-C�-C�,D�E�ErN)r�r�r�)rrrr�r$rwrrrr�r�Ss���2�Frr�)$�
__future__rro�rer2�typingri�	functoolsrr�unicoder�ppu�utilrr	r
rrr
�Latin1�LatinA�LatinB�Greek�Cyrillicr�	alphanums�_extract_alphanums�compiler]rurr�r�r�r�rrr�<module>r�s���"��	�
�
��%�1�-���	��J�J��
�
�C�J�J��	�	�3�<�<�	�0�0H�0R�0R�S��&�B�J�J�"�-?�,@��'M�N��GG��GG�V�'��.�,���.��F�	�Fr