+
     Bi!                     B   R t ^ RIt^ RIt^ RIt^ RIt^RIHt ^RIHt ^RIHt Rt	]P                  ! RRR7       ! R	 R4      4       t]P                  ! RRR7       ! R
 R4      4       tRR/R R lltRR^RR/R R llltRR^RR/R R llltRRRR^RR/R R llltR# )z*Introspection utils for tasks call graphs.N)events)futures)tasksFrameCallGraphEntryFutureCallGraphT)frozenslotsc                   ,   a  ] tR t^t o V 3R ltRtV tR# )r   c                :   < V ^8  d   Qh/ S[ P                  ;R&   # )   frame)types	FrameType)format__classdict__s   "$/usr/lib/python3.14/asyncio/graph.py__annotate__ FrameCallGraphEntry.__annotate__   s     ??      N__name__
__module____qualname____firstlineno____annotate_func____static_attributes____classdictcell__r   s   @r   r   r            r   c                   ,   a  ] tR t^!t o V 3R ltRtV tR# )r   c                n   < V ^8  d   Qh/ S[ P                  ;R&   S[R,          ;R&   S[R,          ;R&   # )r   future
call_stack
awaited_by)r   .)r   .)r   Futuretuple)r   r   s   "r   r   FutureCallGraph.__annotate__!   s:     NN  011  ,--	 r   r   Nr   r   s   @r   r   r   !   r   r   limitc                ^    V ^8  d   QhR\         P                  R\        R,          R\        /# )r   r"   r(   Nreturnr   r%   intr   )r   s   "r   r   r   (   s5     (A (ANN(A :(A 	(Ar   c                   \        V \        P                  4      '       g   \        V : R 24      hRp\	        V RR4      ;p'       d   V^ 8w  d   V! 4       MRp. p. pVe   \        VR4      '       d3   VP                  \        VP                  4      4       VP                  pKH  \        VR4      '       d3   VP                  \        VP                  4      4       VP                  pK   V P                  '       d/   V P                   F  pVP                  \        WaR7      4       K   	  Ve   V^ 8  d   VRV pMV^ 8  d   WAR pVP                  4        \        V \        V4      \        V4      4      # )< object does not appear to be compatible with asyncio.FutureNget_corocr_awaitag_awaitr(   )
isinstancer   r%   	TypeErrorgetattrhasattrappendr   cr_framer0   r1   _asyncio_awaited_by_build_graph_for_futurereverser   r&   )r"   r(   coror/   str$   parents   &$     r   r:   r:   (   sA   
 fgnn--j " #
 	

 D6:t44x4"aZxzT$&B(*J

4$$II)$--89==DT:&&II)$--89==D!!!00F5fJK 1 19FUBQYFBJJL659eJ.?@@r   depthc          	          V ^8  d   QhR\         P                  R,          R\        R\        R,          R\        R,          /# r   r"   Nr?   r(   r*   r+   )r   s   "r   r   r   S   sP     cI cINNT!cI 	cI
 :cI tcIr   c              r   \         P                  ! 4       pV e-   Ve   V \        P                  ! VR7      Jd   \	        WR7      # M&Vf   \        R4      h\        P                  ! VR7      p V f   R# \        V \        P                  4      '       g   \        V : R24      h. pV^ 8w  d   \        P                  ! V4      MRp Vef   VP                  RJpVP                  \        V4      4       V'       d(   VP                  e   VP                  P                  f   MVP                  pKi  ?. pV P                   '       d/   V P                    F  pVP                  \	        WR7      4       K   	  Ve"   VR,          pV^ 8  d   VRV pMV^ 8  d   WBR p\#        V \%        V4      \%        V4      4      #   ?i ; i)a  Capture the async call graph for the current task or the provided Future.

The graph is represented with three data structures:

* FutureCallGraph(future, call_stack, awaited_by)

  Where 'future' is an instance of asyncio.Future or asyncio.Task.

  'call_stack' is a tuple of FrameGraphEntry objects.

  'awaited_by' is a tuple of FutureCallGraph objects.

* FrameCallGraphEntry(frame)

  Where 'frame' is a frame object of a regular Python function
  in the call stack.

Receives an optional 'future' argument. If not passed,
the current task will be used. If there's no current task, the function
returns None.

If "capture_call_graph()" is introspecting *the current task*, the
optional keyword-only 'depth' argument can be used to skip the specified
number of frames from top of the stack.

If the optional keyword-only 'limit' argument is provided, each call stack
in the resulting graph is truncated to include at most ``abs(limit)``
entries. If 'limit' is positive, the entries left are the closest to
the invocation point. If 'limit' is negative, the topmost entries are
left. If 'limit' is omitted or None, all entries are present.
If 'limit' is 0, the call stack is not captured at all, only
"awaited by" information is present.
N)loopr2   zicapture_call_graph() is called outside of a running event loop and no *future* to introspect was providedr.   )r   _get_running_loopr   current_taskr:   RuntimeErrorr3   r   r%   r4   sys	_getframef_generatorr7   r   f_backr9   r   r&   )	r"   r?   r(   rC   r#   fis_asyncr$   r>   s	   "$$      r   capture_call_graphrN   S   s   R ##%D <6););)FF*6?? G <HI I ##.~ fgnn--j " #
 	

 -/J %
eAm}}D0H1!4588'AHH,@,@,H AJ!!!00F5fJK 1 19#FU+JQY#F+J65#4eJ6GHH s   A)F3 3F6c                x    V ^8  d   QhR\         P                  R,          R\        R\        R,          R\        /# rA   )r   r%   r,   str)r   s   "r   r   r      sE     P PNNT!P 	P
 :P 	Pr   c                 a R V3R llo\        W^,           VR7      pVf   R# . p S! W4^ 4       ?RP                  V4      #   ?i ; i)zReturn the async call graph as a string for `future`.

If `future` is not provided, format the call graph for the current task.
c                V    V ^8  d   QhR\         R\        \        ,          R\        RR/# )r   r=   buflevelr*   N)r   listrP   r,   )r   s   "r   r   'format_call_graph.<locals>.__annotate__   s,     72 72 72tCy 72 72 72r   c                 \  <aa R  VV3R llp\        V P                  \        P                  4      '       d>   V! RV P                  P	                  4       : R\        V P                  4      R R24       M V! R\        V P                  4      R R24       V P                  '       d   V! R4       V P                   F  pVP                  pVP                  fT   VP                  pV! R	VP                  P                  : R
VP                   RVP                  P                   R24       Kp  VP                  p VP                  pVP                  pRpT! R	TP                  P                  : R
TP                   RT RTP                   R2	4       K  	  V P(                  '       d/   V! R4       V P(                   F  p	S
! V	SS^,           4       K  	  R# R#   \         dK     TP                   pTP"                  pRp L  \         d    TP$                  pTP&                  pRp  Li ; ii ; i)c                (    V ^8  d   QhR\         RR/# )r   liner*   N)rP   )r   s   "r   r   =format_call_graph.<locals>.render_level.<locals>.__annotate__   s     	. 	.3 	.4 	.r   c                 F   < SP                  SR ,          V ,           4       R# )z    N)r7   )rY   rS   rT   s   &r   add_line9format_call_graph.<locals>.render_level.<locals>.add_line   s    JJuv~,-r   z* Task(name=z, id=z#x)z* Future(id=z  + Call stack:Nz  |   File z, line z, in z()asynczasync generator	generator z  + Awaited by:)r3   r"   r   Taskget_nameidr#   r   rJ   f_codeco_filenamef_linenoco_qualnamer8   cr_codeAttributeErrorag_frameag_codegi_framegi_coder$   )r=   rS   rT   r\   sterL   ccodetagfutrender_levels   &ff       r   rt   'format_call_graph.<locals>.render_level   s   	. 	. bii,,ryy1136eBryyM";MQO r"))}R02 ===! }}II==(		A%ahh&:&:%= >!!" -HH0015 A.JJ yy% %ahh&:&:%= >!!" -5$"2"2!3277 %B ===! }}S#uqy1 %	 ! * .. !

A#$99D"3C- . !

A#$99D"-C..s*   8GH+"G>>%H'#H+&H''H+r?   r(    
)rN   join)r"   r?   r(   graphrS   rt   s   "$$  @r   format_call_graphr{      sV    72 72r vQYeDE}CU# 99S> s   	A Afilec          
          V ^8  d   QhR\         P                  R,          R\        P                  \        ,          R,          R\
        R\
        R,          RR/# )r   r"   Nr|   r?   r(   r*   )r   r%   ioWriterrP   r,   )r   s   "r   r   r     s]     	J 	JNNT!	J ))C.4
		J
 	J :	J 
	Jr   c              6    \        \        WVR7      VR7       R# )zGPrint the async call graph for the current task or the provided Future.rv   )r|   N)printr{   )r"   r|   r?   r(   s   "$$$r   print_call_graphr     s     

Fu
=DIr   )rN   r{   r   r   r   )N)__doc__dataclassesr~   rH   r   rw   r   r   r   __all__	dataclassr   r   r:   rN   r{   r   r   r   r   <module>r      s    0  	 
      d$/  0 d$/. . 0.(A (AVcI 	cI
 cI cILP 	P
 P Pd	J #'		J
 	J 	J 	Jr   