o �J�h�&�@s�ddlmZddlZddlZddlZddlZddlmZddlm Z ddl m Z m Z mZmZmZGdd�de je je je je j�Ze ej�Ze�d ed �ZGd d �d e�ZGd d�de�ZGdd�de�ZGdd�de�ZGdd�de�Z dS)�)� annotationsN)�cached_property�)�pyparsing_unicode)�_collapse_string_to_ranges�col�line�lineno�replaced_by_pep8c@s eZdZdS)�_ExceptionWordUnicodeSetN)�__name__� __module__� __qualname__�rr�RC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\pyparsing\exceptions.pyr sr z([z ]{1,16})|.c@seZdZUdZded<ded<ded<ded<d ed <d Z d9d:dd�Zed;d<dd��Ze d=dd��Z e d>dd��Z e d?dd��Z e d?dd ��Ze d?d!d"��Ze d>d#d$��Zed%d&��Zejd'd&��Zd(d)�Zd>d*d+�Zd>d,d-�Zd.d/�Z d@d0d1�dAd4d5�Zd;dBd6d7�Zed8e�Zd S)C�ParseBaseExceptionz7base exception class for all parsing runtime exceptions�int�loc�str�msg�pstrz typing.Any�parser_elementz%tuple[str, int, typing.Optional[str]]�args�rrrrrrN�typing.Optional[str]�return�NonecCs:|dur |d}}||_||_||_||_|||f|_dS)N�r)�selfrrr�elemrrr�__init__1s zParseBaseException.__init__��exc� Exception�depthc Cs�ddl}ddlm}|durt��}g}t|t�r*|�|j�|�dd|j ����|�t |�j �d|���|dks@|j durEd� |�S|j|j |d �}t�}|| d�D]h}|d}|j�d d�} t| |�r�|jj�d �sqqWt| �|vrxqW|�t| ��t | �} |�| j�d | j �d | ���n$| dur�t | �} |�| j�d | j ���n|j} | jdvr�qW|�| j�|d8}|s�nqWd� |�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�^�>z: � )�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 ) r"r$r.r%�ret�callers�seen�ff�frm�f_self� self_type�coderrr�explain_exceptionAsH         � z$ParseBaseException.explain_exceptioncCs||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�perrr�_from_exception�sz"ParseBaseException._from_exceptioncC�t|j|j�S)zG Return the line of text where the exception occurred. )rrr�rrrrr��zParseBaseException.linecCrM)zV Return the 1-based line number of text where the exception occurred. )r rrrNrrrr �rOzParseBaseException.linenocCrM�z] Return the 1-based column on the line of text where the exception occurred. �rrrrNrrrr�rOzParseBaseException.colcCrMrPrQrNrrrr4�rOzParseBaseException.columncCsh|jsdS|jt|j�krdSt�|j|j�}|dur!|�d�}n |j|j|jd�}t|��dd�S)Nrz end of textrrz\\�\)rr�len�_exception_word_extractor�match�group�repr�replace)r� found_matchZ found_textrrr�found�s zParseBaseException.foundcCs|jS�N�rrNrrr� parserElement�sz ParseBaseException.parserElementcC� ||_dSr[r\)rrrrrr]�s cCs t�|�Sr[)�copyrNrrrr_�� zParseBaseException.copyc Cs>|jr d|j��nd}|j�|�d|j�d|j�d|j�d� S)Nz, found rz (at char z ), (line:z, col:�))rZrrr r4)rZ found_phraserrr�formatted_message�s(z$ParseBaseException.formatted_messagecCs|��Sr[)rbrNrrr�__str__��zParseBaseException.__str__cCst|�Sr[)rrNrrr�__repr__�rdzParseBaseException.__repr__z>!<)� markerString� marker_stringrfcCsL|dur|n|}|j}|jd}|r"|d|��|�||d���}|��S)z� Extracts the exception line from the input string, and marks the location of the exception with a special symbol. Nr)rr4�strip)rrgrf�line_str� line_columnrrr�mark_input_line�s   z"ParseBaseException.mark_input_linecCs |�||�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:: # 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:: 123 456 A789 ^ ParseException: Expected W:(0-9), found 'A' (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`` )rI)rr$rrr�explain�s 'zParseBaseException.explain� markInputline)rNN)rrrrrrrr)r!)r"r#r$rrr)rr�rr)rrr[)rgrrfrrr)r$rrr)r r r�__doc__�__annotations__� __slots__r � staticmethodrI� classmethodrLrrr rr4rZ�propertyr]�setterr_rbrcrerkrlr rmrrrrrsP   �?          �� +rc@�eZdZdZdS)�ParseExceptionaw Exception thrown when a parse expression doesn't match the input string Example:: integer = Word(nums).set_name("integer") try: integer.parse_string("ABC") except ParseException as pe: print(pe, f"column: {pe.column}") prints:: Expected integer, found 'ABC' (at char 0), (line:1, col:1) column: 1 N�r r rrorrrrrw �rwc@rv)�ParseFatalExceptionzu User-throwable exception thrown when inconsistent parse content is found; stops all parsing immediately Nrxrrrrrzryrzc@rv)�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. Nrxrrrrr{#ryr{c@s$eZdZdZd dd�Zd dd�Zd S) �RecursiveGrammarExceptiona6 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>` Deprecated: only used by deprecated method ParserElement.validate. rrcCr^r[��parseElementTrace)r�parseElementListrrrr 5r`z"RecursiveGrammarException.__init__rcCs d|j��S)NzRecursiveGrammarException: r}rNrrrrc8s z!RecursiveGrammarException.__str__N)rrrn)r r rror rcrrrrr|,s r|)!� __future__rr_�rer0�typing� functoolsr�unicoder�ppu�utilrrrr r �Latin1�LatinA�LatinB�Greek�Cyrillicr � alphanums�_extract_alphanums�compilerTr#rrwrzr{r|rrrr�<module>s&    � l
Memory