ó
    öÞ jÆ@  ã                  óî  • % S r SSKJr  SSKrSSKrSSKrSSKJrJr  SSK	J
r
JrJr  SSKJr  SSKJrJr  SSKJrJr   SSKrSSKrS	S
KJr  / SQrSrSrSrSr\\S   -  rS\ S'   \ " S S5      5       r!\ " S S5      5       r"\ " S S5      5       r#\ " S S5      5       r$S"S jr%   S#         S$S jjr&S\\SSSSS.                     S%S jjr' " S  S!5      r(g! \ a    Sr N¬f = f)&z÷
Extract a structured traceback from an exception.

Based on work by Will McGugan
<https://github.com/hynek/structlog/pull/407#issuecomment-1150926246>`_ from
`rich.traceback
<https://github.com/Textualize/rich/blob/972dedff/rich/traceback.py>`_.
é    )ÚannotationsN)ÚIterableÚSequence)ÚasdictÚ	dataclassÚfield)Úwalk_tb)Ú
ModuleTypeÚTracebackType)ÚAnyÚ	TypeAliasé   )ÚExcInfo)ÚExceptionDictTransformerÚFrameÚStackÚSyntaxError_ÚTraceÚextractÚsafe_strÚto_reprTé
   éP   é2   )NNNr   Ú
OptExcInfoc                  óF   • \ rS rSr% SrS\S'   S\S'   S\S'   SrS	\S
'   Srg)r   é9   z"
Represents a single stack frame.
ÚstrÚfilenameÚintÚlinenoÚnameNzdict[str, str] | NoneÚlocals© )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r#   Ú__static_attributes__r$   ó    ÚN/var/www/html/gaurav/venv/lib/python3.13/site-packages/structlog/tracebacks.pyr   r   9   s#   ‡ ñð ƒMØƒKØ
ƒIØ$(€FÐ!Ö(r,   r   c                  óL   • \ rS rSr% SrS\S'   S\S'   S\S'   S\S'   S\S	'   S
rg)r   éE   zD
Contains detailed information about :exc:`SyntaxError` exceptions.
r    Úoffsetr   r   Úliner!   Úmsgr$   N©r%   r&   r'   r(   r)   r*   r+   r$   r,   r-   r   r   E   s"   ‡ ñð ƒKØƒMØ
ƒIØƒKØ	†Hr,   r   c                  óš   • \ rS rSr% SrS\S'   S\S'   \" \S9rS\S'   S	r	S
\S'   Sr
S\S'   \" \S9rS\S'   SrS\S'   \" \S9rS\S'   Srg	)r   éR   z¾
Represents an exception and a list of stack frames.

.. versionchanged:: 25.2.0
   Added the *exc_notes* field.

.. versionchanged:: 25.4.0
   Added the *is_group* and *exceptions* fields.
r   Úexc_typeÚ	exc_value)Údefault_factoryz	list[str]Ú	exc_notesNzSyntaxError_ | NoneÚsyntax_errorFÚboolÚis_causezlist[Frame]ÚframesÚis_groupzlist[Trace]Ú
exceptionsr$   )r%   r&   r'   r(   r)   r*   r   Úlistr9   r:   r<   r=   r>   r?   r+   r$   r,   r-   r   r   R   s_   ‡ ñð ƒMØƒNÙ °Ñ6€IˆyÓ6Ø(,€LÐ%Ó,Ø€HˆdÓÙ°Ñ5€FˆKÓ5Ø€HˆdÓÙ#°DÑ9€J�Ö9r,   r   c                  ó$   • \ rS rSr% SrS\S'   Srg)r   éh   z'
Container for a list of stack traces.
zlist[Stack]Ústacksr$   Nr3   r$   r,   r-   r   r   h   s   ‡ ñð Ör,   r   c                óh   •  [        U 5      $ ! [         a  nS[        U5      < S3s SnA$ SnAff = f)z1Don't allow exceptions from __str__ to propagate.z<str-error Ú>N)r   Ú	Exception)Ú_objectÚerrors     r-   r   r   q   s4   € ð-Ü�7‹|ÐøÜó -ØœS ›Z™N¨!Ð,Õ,ûð-ús   ‚
 �
1—,¦1¬1c                óè  • U(       a5  [         b.  [         R                  R                  XUS9R                  5       nU$  [	        U [
        [        45      (       a;  Ub*  [        U 5      U:”  a  [        U 5      U-
  nU SU < SU 3nU$ [        U 5      n U$ [        U 5      nUb(  [        U5      U:”  a  [        U5      U-
  nUSU < SU 3nU$ ! [         a  nS[        U5      < S3n SnAU$ SnAff = f)a‘  
Get repr string for an object, but catch errors.

:func:`repr()` is used for strings, too, so that secret wrappers that
inherit from :func:`str` and overwrite ``__repr__()`` are handled correctly
(i.e. secrets are not logged in plain text).

Args:
    obj: Object to get a string representation for.

    max_length: Maximum length of containers before abbreviating, or
        ``None`` for no abbreviation.

    max_string: Maximum length of string before truncating, or ``None`` to
        disable truncating.

    use_rich: If ``True`` (the default), use rich_ to compute the repr.
        If ``False`` or if rich_ is not installed, fall back to a simpler
        algorithm.

Returns:
    The string representation of *obj*.

.. versionchanged:: 24.3.0
   Added *max_length* argument.  Use :program:`rich` to render locals if it
   is available.  Call :func:`repr()` on strings in fallback
   implementation.
N)Ú
max_lengthÚ
max_stringÚ+z<repr-error rE   )
ÚrichÚprettyÚtraverseÚrenderÚ
isinstancer   ÚbytesÚlenÚreprrF   )ÚobjrJ   rK   Úuse_richÚobj_reprÚ	truncatedrH   s          r-   r   r   y   s  € öD ”DÑ$ô —;‘;×'Ñ'Ø°:ð (ð 
ç
‰&‹(ð 	ð, €Oð	6Ü˜#¤¤U˜|×,Ñ,ØÑ)¬c°#«h¸Ó.CÜ # C£¨:Ñ 5�IØ"% k zÐ"2Ñ!5°Q°y°kÐB�Hð €Oô  $ C›y‘Hð €Oô   ›9�ØÑ)¬c°(«m¸jÓ.HÜ # H£°
Ñ :�IØ"*¨;¨JÐ"7Ñ!:¸!¸I¸;ÐG�Hð €Oøô ó 	6Ø%¤c¨%£j¡^°1Ð5ŒHà€Oûð	6ús$   ¾AC ÂC Â6C Ã
C1ÃC,Ã,C1F©Úshow_localsÚlocals_max_lengthÚlocals_max_stringÚlocals_hide_dunderÚlocals_hide_sunderrV   Ú_seenc               ó’  ^^• / n
SnU	c
  [        5       n	 [        U5      nXÉ;   a  GOU	R                  U5        [        [	        U R
                  5      [	        U5      [        USS5       Vs/ sH  n[	        U5      PM     snUS9n[        R                  S:¼  as  [        U[        [        45      (       aX  SUl        UR                   HA  nUR                  R                  [        [!        U5      UUR"                  UUUTTUU	S9
5        MC     [        U[$        5      (       ah  ['        UR(                  =(       d    S	UR*                  =(       d    S
UR,                  =(       d    S	UR.                  =(       d    SUR0                  S9Ul        U
R                  U5        UR4                  R                  n    SUU4S jjn[7        U5       HÐ  u  nnUR8                  R:                  nU(       a5  UR=                  S5      (       d  [>        R@                  RC                  U5      n[E        U=(       d    S
UUR8                  RF                  U(       a@  U" URH                  RK                  5       5       VVs0 sH  u  nnU[M        UUUUS9_M     snnOSS9nU" U5        MÒ     [        USS5      nU(       a0  UR"                  (       a  URN                  n UnUR"                  nSnGMË  URP                  nU(       aB  UR"                  (       a1  [        USS5      (       d  URN                  n UnUR"                  nSnGM    [S        U
S9$ s  snf s  snnf )aÝ  
Extract traceback information.

Args:
    exc_type: Exception type.

    exc_value: Exception value.

    traceback: Python Traceback object.

    show_locals: Enable display of local variables. Defaults to False.

    locals_max_length:
        Maximum length of containers before abbreviating, or ``None`` for
        no abbreviation.

    locals_max_string:
        Maximum length of string before truncating, or ``None`` to disable
        truncating.

    locals_hide_dunder:
        Hide locals prefixed with double underscore.
        Defaults to True.

    locals_hide_sunder:
        Hide locals prefixed with single underscore.
        This implies hiding *locals_hide_dunder*.
        Defaults to False.

    use_rich: If ``True`` (the default), use rich_ to compute the repr.
        If ``False`` or if rich_ is not installed, fall back to a simpler
        algorithm.

Returns:
    A Trace instance with structured information about all exceptions.

.. versionadded:: 22.1.0

.. versionchanged:: 24.3.0
   Added *locals_max_length*, *locals_hide_sunder*, *locals_hide_dunder*
   and *use_rich* arguments.

.. versionchanged:: 25.4.0
   Handle exception groups.

.. versionchanged:: 25.5.0
   Handle loops in exception cause chain.
FNTÚ	__notes__r$   )r6   r7   r9   r<   )é   é   rY   r   Ú?Ú )r0   r   r!   r1   r2   c              3  óà   >#   • T(       d  T(       d  U  Sh  v•N   gU  HH  u  pT(       a  UR                  S5      (       a  M$  T(       a  UR                  S5      (       a  MC  X4v •  MJ     g NT7f)z-Extract locals from an iterator of key pairs.NÚ__Ú_©Ú
startswith)Úiter_localsÚkeyÚvaluer]   r^   s      €€r-   Ú
get_localsÚextract.<locals>.get_locals)  s[   øé € ö 'Ö*<Ø&×&Ð&ØÛ)‘
�Þ%¨#¯.©.¸×*>Ñ*>ÙÞ%¨#¯.©.¸×*=Ñ*=ÙØ�jÔ ò *ñ 'ùs   ƒA.—A,˜AA.Ú<)rJ   rK   rV   )r   r!   r"   r#   Ú	__cause__Ú__suppress_context__)rC   )rk   úIterable[tuple[str, object]]Úreturnrs   )*ÚsetÚidÚaddr   r   r%   ÚgetattrÚsysÚversion_inforQ   ÚBaseExceptionGroupÚExceptionGroupr>   r?   Úappendr   ÚtypeÚ__traceback__ÚSyntaxErrorr   r0   r   r!   Útextr2   r:   r=   r	   Úf_codeÚco_filenamerj   ÚosÚpathÚabspathr   Úco_nameÚf_localsÚitemsr   Ú	__class__Ú__context__r   )r6   r7   Ú	tracebackrZ   r[   r\   r]   r^   rV   r_   rC   r<   Úexc_idÚnoteÚstackÚ	exceptionr}   rn   Úframe_summaryÚline_nor   rl   rm   ÚframeÚcauses         ``                 r-   r   r   ·   s  ù€ ð| €FØ€Hà�}Ü“ˆà
Ü�I“ˆØ‹?ÙØ�	‰	�&ÔäÜ˜h×/Ñ/Ó0Ü˜yÓ)ä+2°9¸kÈ2Ô+NóÙ+N 4”˜–Ñ+Nñð ñ
ˆô ×Ñ˜wÓ&Ü˜)Ô&8¼.Ð%I×JÑJØ!%�”Ø!*×!5Ô!5�IØ×$Ñ$×+Ñ+ÜÜ  ›OØ%Ø%×3Ñ3Ø(3Ø.?Ø.?Ø/AØ/AØ%-Ø"'ñöñ "6ô  �i¤×-Ñ-Ü!-Ø ×'Ñ'×,¨1Ø"×+Ñ+×2¨sØ ×'Ñ'×,¨1Ø—^‘^×) rØ—M‘Mñ"ˆEÔð 	�‰�eÔØ—‘×$Ñ$ˆð	!Ø5ð	!à)÷	!ð 	!ô '.¨iÖ&8Ñ"ˆM˜7Ø$×+Ñ+×7Ñ7ˆHÞ × 3Ñ 3°C× 8Ñ 8ÜŸ7™7Ÿ?™?¨8Ó4�ô
 Ø!Ÿ SØØ"×)Ñ)×1Ñ1ö #ñ	 +5Ø)×2Ñ2×8Ñ8Ó:ô+ô
ñ+™J˜C ð œWØ!Ø'8Ø'8Ø%-ñ	ò ñ+ó
ð ñ#ˆEñ( �5ŽMñ9 '9ô< ˜	 ;°Ó5ˆÞ�U×(×(Ø—‘ˆHØˆIØ×+Ñ+ˆIØˆHÚà×%Ñ%ˆæØ×#×#Ü˜IÐ'=¸u×EÑEà—‘ˆHØˆIØ×+Ñ+ˆIØˆHÚð 	ä˜ÑÐùòQùó@
s   Á*L>É.Mc            	      ón   • \ rS rSrSr\\\SSS\SS.                 SS jjr	SS jr
SS	 jrS
rg)r   io  a|  
Return a list of exception stack dictionaries for an exception.

These dictionaries are based on :class:`Stack` instances generated by
:func:`extract()` and can be dumped to JSON.

Args:
    show_locals:
        Whether or not to include the values of a stack frame's local
        variables.

    locals_max_length:
        Maximum length of containers before abbreviating, or ``None`` for
        no abbreviation.

    locals_max_string:
        Maximum length of string before truncating, or ``None`` to disable
        truncating.

    locals_hide_dunder:
        Hide locals prefixed with double underscore.
        Defaults to True.

    locals_hide_sunder:
        Hide locals prefixed with single underscore.
        This implies hiding *locals_hide_dunder*.
        Defaults to False.

    suppress:
        Optional sequence of modules or paths for which to suppress the
        display of locals even if *show_locals* is ``True``.

    max_frames:
        Maximum number of frames in each stack.  Frames are removed from
        the inside out.  The idea is, that the first frames represent your
        code responsible for the exception and last frames the code where
        the exception actually happened.  With larger web frameworks, this
        does not always work, so you should stick with the default.

    use_rich: If ``True`` (the default), use rich_ to compute the repr of
        locals.  If ``False`` or if rich_ is not installed, fall back to
        a simpler algorithm.

.. seealso::
    :doc:`exceptions` for a broader explanation of *structlog*'s exception
    features.

.. versionchanged:: 24.3.0
   Added *locals_max_length*, *locals_hide_sunder*, *locals_hide_dunder*,
   *suppress* and *use_rich* arguments.

.. versionchanged:: 25.1.0
   *locals_max_length* and *locals_max_string* may be None to disable
   truncation.

.. versionchanged:: 25.4.0
   Handle exception groups.
TFr$   )rZ   r[   r\   r]   r^   ÚsuppressÚ
max_framesrV   c               óv  • Ub  US:  a  SU 3n	[        U	5      eUb  US:  a  SU 3n	[        U	5      eUS:  a  SU 3n	[        U	5      eXl        X l        X0l        X@l        XPl        / U l        U Hº  n
[        U
[        5      (       dI  U
R                  c  SU
< S3n	[        U	5      e[        R                  R                  U
R                  5      nOU
n[        R                  R                  [        R                  R                  U5      5      nU R                  R                  U5        M¼     Xpl        X€l        g )Nr   z""locals_max_length" must be >= 0: z""locals_max_string" must be >= 0: é   z"max_frames" must be >= 2: z"suppress" item z+ must be a module with '__file__' attribute)Ú
ValueErrorrZ   r[   r\   r]   r^   r–   rQ   r   Ú__file__r„   r…   ÚdirnameÚnormpathr†   r}   r—   rV   )ÚselfrZ   r[   r\   r]   r^   r–   r—   rV   r2   Úsuppress_entityr…   s               r-   Ú__init__Ú!ExceptionDictTransformer.__init__«  s4  € ð Ñ(Ð->ÀÓ-BØ6Ð7HÐ6IÐJˆCÜ˜S“/Ð!ØÑ(Ð->ÀÓ-BØ6Ð7HÐ6IÐJˆCÜ˜S“/Ð!Ø˜‹>Ø/°
¨|Ð<ˆCÜ˜S“/Ð!Ø&ÔØ!2ÔØ!2ÔØ"4ÔØ"4ÔØ')ˆŒÛ'ˆOÜ˜o¬s×3Ñ3Ø"×+Ñ+Ñ3à*¨?Ñ*=ð >;ð <ð ô % S›/Ð)Ü—w‘w—‘ ×'?Ñ'?Ó@‘à&�Ü—7‘7×#Ñ#¤B§G¡G§O¡O°DÓ$9Ó:ˆDØ�M‰M× Ñ  Ö&ñ  (ð %ŒØ �r,   c           
     óø  • [        UU R                  U R                  U R                  U R                  U R
                  U R                  S.6nUR                   HŽ  n[        UR                  5      U R                  ::  a  M(  U R                  S-  n[        SSS[        UR                  5      SU-  -
   3S9n/ UR                  S U QUPUR                  U* S  QUR                  S S & M�     U R                  U5      $ )N)rZ   r[   r\   r]   r^   rV   r™   re   éÿÿÿÿzSkipped frames: )r   r!   r"   )r   rZ   r[   r\   r]   r^   rV   rC   rS   r=   r—   r   Ú_as_dict)rž   Úexc_infoÚtracer�   ÚhalfÚ
fake_frames         r-   Ú__call__Ú!ExceptionDictTransformer.__call__Ö  sÿ   € ÜØØ×(Ñ(Ø"×4Ñ4Ø"×4Ñ4Ø#×6Ñ6Ø#×6Ñ6Ø—]‘]ò
ˆð —\”\ˆEÜ�5—<‘<Ó  D§O¡OÓ3Ùð —‘ 1Ñ$ð ô ØØØ'¬¨E¯L©LÓ(9¸QÀ¹XÑ(FÐ'GÐHñˆJð
Ø—‘˜e˜tÐ$ðàðð —‘˜t˜e˜fÐ%ðˆE�L‰L™ŠOñ "ð$ �}‰}˜UÓ#Ð#r,   c                óf  ^• / nUR                    H˜  n[        U5      nUS    H2  mTS   b&  [        U4S jU R                   5       5      (       d  M/  TS	 M4     UR                  (       a-  UR
                   Vs/ sH  oPR                  U5      PM     snUS'   UR                  U5        Mš     U$ s  snf )Nr=   r#   c              3  óJ   >#   • U H  nTS    R                  U5      v •  M     g7f)r   Nri   )Ú.0r…   Ú
frame_dicts     €r-   Ú	<genexpr>Ú4ExceptionDictTransformer._as_dict.<locals>.<genexpr>ú  s+   øé € ð 7á -˜ð ˜zÑ*×5Ñ5°d×;Ð;Ú -ùs   ƒ #r?   )rC   r   Úanyr–   r>   r?   r¤   r}   )rž   r¦   Ústack_dictsr�   Ú
stack_dictÚtr®   s         @r-   r¤   Ú!ExceptionDictTransformer._as_dictõ  s²   ø€ ØˆØ—\”\ˆEÜ ›ˆJØ(¨Ô2�
Ø˜hÑ'Ñ/´3ô 7à $§¢ó7÷ 4ó 4ð # 8Ò,ñ 3ð �~�~à.3×.>Ò.>ó,Ù.>¨—M‘M !Ö$Ñ.>ñ,�
˜<Ñ(ð ×Ñ˜zÖ*ñ "ð Ðùò	,s   Á8B.)r]   r^   r[   r\   r—   rZ   r–   rV   N)rZ   r;   r[   r    r\   r    r]   r;   r^   r;   r–   zIterable[str | ModuleType]r—   r    rV   r;   rt   ÚNone)r¥   r   rt   úlist[dict[str, Any]])r¦   r   rt   r·   )r%   r&   r'   r(   r)   ÚSHOW_LOCALSÚLOCALS_MAX_LENGTHÚLOCALS_MAX_STRINGÚ
MAX_FRAMESr    r©   r¤   r+   r$   r,   r-   r   r   o  sŒ   † ñ9ð| (Ø!2Ø!2Ø#'Ø#(Ø/1Ø$Øñ)!ð ð)!ð ð	)!ð
 ð)!ð !ð)!ð !ð)!ð -ð)!ð ð)!ð ð)!ð 
õ)!ôV$÷>r,   r   )rG   r   rt   r   )NNT)
rU   r   rJ   ú
int | NonerK   r¼   rV   r;   rt   r   )r6   ztype[BaseException]r7   ÚBaseExceptionrŒ   zTracebackType | NonerZ   r;   r[   r    r\   r    r]   r;   r^   r;   rV   r;   r_   zset[int] | Nonert   r   ))r)   Ú
__future__r   r„   Úos.pathry   Úcollections.abcr   r   Údataclassesr   r   r   rŒ   r	   Útypesr
   r   Útypingr   r   rM   Úrich.prettyÚImportErrorr   Ú__all__r¸   r¹   rº   r»   Útupler   r*   r   r   r   r   r   r   r   r   r$   r,   r-   Ú<module>rÈ      sÌ  ðòõ #ã 	Û Û 
ç .ß 0Ñ 0Ý ß +ß !ðÛÛõ ò	€ð €ØÐ ØÐ Ø€
à %Ð(8Ñ"9Ñ9€
ˆIÓ 9ð ÷)ð )ó ð)ð ÷	ð 	ó ð	ð ÷:ð :ó ð:ð* ÷ð ó ðô-ð "Ø!Øð	;Ø	ð;àð;ð ð;ð ð	;ð
 	õ;ðF Ø.Ø.Ø#Ø$ØØ!ñu Ø!ðu àðu ð $ðu ð
 ðu ð ðu ð ðu ð ðu ð ðu ð ðu ð ðu ð õu ÷pUò Uøða
 ó Ø‚Dðús   ¿C) Ã)C4Ã3C4