Files
intellecton/venv/lib/python3.12/site-packages/pyparsing/__pycache__/exceptions.cpython-312.pyc
T

159 lines
14 KiB
Plaintext
Raw Normal View History

Ë
vRjå*ã ó¼—ddlmZddlZddlZddlZddlZddlZddlmZddlm Z ddl
m Z 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__©óúW/home/antigravity/intellecton/venv/lib/python3.12/site-packages/pyparsing/exceptions.pyrrs„ð rrz([z
]{1,16})|.cód—eZdZUdZded<ded<ded<ded<d ed
<d Z d dd
„Zed d!d„«Ze d"d„«Z
e d#d„«Z e d$d„«Z
e d$d„«Ze d$d„«Ze d#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#d d«} 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.
)r rr©r"s rr zParseBaseException.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!z end 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
r r6Ú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Ú classmethodrQrr r 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