
    ^h                     b    S SK r S SKJr  S SKr " S S5      r " S S5      r " S S5      rS	 rg)
    N)Listc                   6    \ rS rSrS\S\S\4S jrS rS rSrg	)
_ArgumentEntry   typenamevaluec                 (    Xl         X l        X0l        g N_type_name_value)selfr   r   r	   s       T/home/james-whalen/.local/lib/python3.13/site-packages/chatdbg/native_util/stacks.py__init___ArgumentEntry.__init__   s    

    c                 v    SU R                    SU R                   SU R                  b  U R                   3$ S 3$ )N(z) z = 	[unknown]r   r   s    r   __str___ArgumentEntry.__str__   s=    4::,bCt{{?V/hii\g/hiir   c                     S[        U R                  5       S[        U R                  5       SU R                  b  [        U R                  5       S3$ S S3$ )Nz_ArgumentEntry(, r   ))reprr   r   r   r   s    r   __repr___ArgumentEntry.__repr__   sw     djj!1 2"T$**5E4Fb^b^i^i^udkkIZ  IH  HI  J  	J  |G  IH  HI  J  	Jr   )r   r   r   N)	__name__
__module____qualname____firstlineno__strr   r   r   __static_attributes__ r   r   r   r      s(    S  C 
jJr   r   c            
       V    \ rS rSrS\S\S\\   S\S\4
S jrS r	S	 r
S
 rS rS rSrg)_FrameSummaryEntry   indexr   	arguments	file_pathlinenoc                 @    Xl         X l        X0l        X@l        XPl        g r   )_indexr   
_arguments
_file_path_lineno)r   r+   r   r,   r-   r.   s         r   r   _FrameSummaryEntry.__init__   s     
##r   c                     U R                   $ r   )r0   r   s    r   r+   _FrameSummaryEntry.index#       {{r   c                     U R                   $ r   )r2   r   s    r   r-   _FrameSummaryEntry.file_path&   s    r   c                     U R                   $ r   )r3   r   s    r   r.   _FrameSummaryEntry.lineno)   s    ||r   c           	          SR                  U R                   Vs/ s H  n[        U5      PM     sn5      nU R                   SU R                   SU SU R
                   SU R                   3	$ s  snf )Nr   z: r   z) at :)joinr1   r%   r0   r   r2   r3   )r   as     r   r   _FrameSummaryEntry.__str__,   s`    IIt7!s1v78++bAaSdoo5Fa~VV 8s   A.c                     SU R                    S[        U R                  5       S[        U R                  5       S[        U R                  5       SU R
                   S3$ )Nz_FrameSummaryEntry(r   r   )r0   r   r   r1   r2   r3   r   s    r   r   _FrameSummaryEntry.__repr__0   sp    $T[[MD4D3ERT__H]G^^`aefjfufuav`wwyz~  {G  {G  zH  HI  J  	Jr   )r1   r2   r0   r3   r   N)r!   r"   r#   r$   intr%   r   r   r   r+   r-   r.   r   r   r&   r'   r   r   r)   r)      sW      '	
  WJr   r)   c                   4    \ rS rSrS\4S jrS rS rS rSr	g)	_SkippedFramesEntry4   countc                     Xl         g r   _count)r   rG   s     r   r   _SkippedFramesEntry.__init__5   s    r   c                     U R                   $ r   rI   r   s    r   rG   _SkippedFramesEntry.count8   r7   r   c                 R    SU R                    SU R                   S:  a  S S3$ S S3$ )N[z skipped frame   s z...]rI   r   s    r   r   _SkippedFramesEntry.__str__;   s3    4;;-~T[[1_c-MTRR"-MTRRr   c                 "    SU R                    S3$ )Nz_SkippedFramesEntry(r   rI   r   s    r   r   _SkippedFramesEntry.__repr__>   s    %dkk]!44r   rI   N)
r!   r"   r#   r$   rC   r   rG   r   r   r&   r'   r   r   rE   rE   4   s    c S5r   rE   c                    / nU (       d  [        S5        g SR                  U  Vs/ s H  n[        U5      PM     sn5      nUR                  U5        [	        U  Vs/ s H*  n[        U[        5      (       a  UR                  5       OSPM,     sn5      nUS:  a  UR                  S5        Sn/ nU  H  n[        U[        5      (       d  M  UR                  5       UR                  5       p[        R                  " XS-
  U	S-   5      u  p[        R                  " X5      n[        R                  " US	5      nUR                  S
UR!                  5        SU SU	 SU S3	5        [#        U5      U:X  d  M    O   U(       a1  UR                  S[#        U5       S3SR                  U5      -   5        O[        S5        SR                  U5      $ s  snf s  snf )Nz%could not generate any frame summary.
rP   i  zdNote that there are over 1000 frames in the stack trace, hinting at a possible stack overflow error.   
   	   z  zFrame #z at r=   z:
z&Here is the source code for the first z
 frames:

z

z.could not retrieve source code for any frames.)printr>   r%   appendsum
isinstancerE   rG   r)   r-   r.   	llm_utils
read_linesnumber_group_of_linestextwrapindentr+   len)	summariespartsrQ   frame_summarytotal_framesmax_initial_locations_to_sendsource_code_entriessummaryr-   r.   linesfirstblocks                r   build_enriched_stacktracero   B   s   E56		9"=9a3q69"=>]#MVWY*Q(;<<QWWY!CYW
 $LLv %&!g122 ' 1 1 3W^^5Ev$//	B;QR
SLE33EAEOOE40E&&'--/*$yk6(#eWBO &'+HH  4S9L5M4Nl[kk-./	

 	>?;;uE #> Xs   G
1G)rb   typingr   r_   r   r)   rE   ro   r'   r   r   <module>rq      s6      
J 
JJ J@5 5(r   