ó
    Ð]jü!  ã                  ó  • S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	  SSK
Jr  SSKJrJrJr   " S S	5      rSS
 jrSS jr\" SSS5      r\" SS5      r\" SS5      r " S S5      r\\\   \\   4   r\\\4   r      SS jrSS jrg)z!Bytecode analysis for coverage.pyé    )ÚannotationsN)ÚIterableÚMapping)ÚCodeType)ÚOptional)ÚTArcÚTLineNoÚTOffsetc                  ód   • \ rS rSrSrSSSS.       SS jjrSS jrSS jrSS jrSS	 jr	S
r
g)Ú
ByteParseré   z3Parse bytecode to understand the structure of code.N)ÚcodeÚtextÚfilenamec               óH   • Uc  Uc   e[        X#=(       d    SSSS9nXl        g )Nz<string>ÚexecT)Údont_inherit)Úcompiler   )Úselfr   r   r   s       ÚN/home/mande/repo/quber/.venv/lib/python3.13/site-packages/coverage/bytecode.pyÚ__init__ÚByteParser.__init__   s-   € ð ‰<ØÑ#Ð#Ð#Ü˜4×!7¨Z¸ÈdÑSˆDØ�	ó    c                ó0   • S U R                  5        5       $ )aL  Iterate over all the code objects nested within this one.

The iteration includes `self` as its first value.

We skip code objects named `__annotate__` since they are deferred
annotations that usually are never run.  If there are errors in the
annotations, they will be caught by type checkers or other tools that
use annotations.

c              3  óV   #   • U  H  oR                   S :w  d  M  [        US9v •  M!     g7f)Ú__annotate__©r   N)Úco_namer   )Ú.0Úcs     r   Ú	<genexpr>Ú,ByteParser._child_parsers.<locals>.<genexpr>+   s$   é € Ð_Ò,? qÇ9Á9ÐP^ÑC^Ó"”
 Ö"Ò,?ùs   ‚)™))Úcode_objects)r   s    r   Ú_child_parsersÚByteParser._child_parsers    s   € ñ `¨D×,=Ñ,=Ô,?Ó_Ð_r   c              #  óæ   #   • U R                   /nU(       aY  UR                  5       nUR                   H+  n[        U[        5      (       d  M  UR                  U5        M-     Uv •  U(       a  MX  gg7f)z,Iterate over all the code objects in `code`.N)r   ÚpopÚ	co_constsÚ
isinstancer   Úappend)r   Ústackr   r    s       r   r#   ÚByteParser.code_objects-   sT   é € à—‘�ˆÞð —9‘9“;ˆDØ—^”^�Ü˜a¤×*Ó*Ø—L‘L –Oñ $ð ŠJ÷ Šeùs   ‚AA1Á A1Á/A1c              #  ón   #   • U R                   R                  5        H  u    pU(       d  M  Uv •  M     g7f)ziYield the line numbers possible in this code object.

Uses co_lines() to produce a sequence: l0, l1, ...
N)r   Úco_lines)r   Ú_Úlines      r   Ú_line_numbersÚByteParser._line_numbers9   s,   é € ð
 Ÿ)™)×,Ñ,Ö.‰JˆAˆqßˆtØ”
ò /ùs   ‚&5¬	5c              #  ón   #   • U R                  5        H  nUR                  5        Sh  v•N   M     g N	7f)zœFind the statements in `self.code`.

Produce a sequence of line numbers that start statements.  Recurses
into all code objects reachable from `self.code`.

N)r$   r1   )r   Úbps     r   Úfind_statementsÚByteParser.find_statementsB   s/   é € ð ×%Ñ%Ö'ˆBà×'Ñ'Ó)×)Ò)ò (á)ùs   ‚'5©3ª
5r   )r   zCodeType | Noner   ú
str | Noner   r7   ÚreturnÚNone)r8   zIterable[ByteParser])r8   zIterable[CodeType])r8   zIterable[TLineNo])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r$   r#   r1   r5   Ú__static_attributes__© r   r   r   r      sR   † Ù=ð
 !%ØØ#ñ
ð ð
ð ð	
ð
 ð
ð 
õ
ô`ô
ô÷	*r   r   c                óv   • 0 nU R                  5        H"  u  p#nUc  M  [        X#S5       H  nXAU'   M	     M$     U$ )z6Make a dict mapping byte code offsets to line numbers.é   )r.   Úrange)r   Úb2lÚbstartÚbendÚlinenoÚboffsets         r   Úbytes_to_linesrI   N   sA   € à
€CØ $§¡¦Ñˆ�fØÓÜ  ¨qÖ1�Ø%�G“ó 2ñ !0ð €Jr   c                 ó¦   • U  Vs1 s H-  n[         R                  R                  U5      =n(       d  M+  UiM/     nnU(       d
   SU  35       eU$ s  snf )zwMake a set of opcodes from instruction names.

The names might not exist in this version of Python, skip those if not.
z At least one opcode must exist: )ÚdisÚopmapÚget)Úop_namesÚnameÚopÚopss       r   Úop_setrR   X   sO   € ñ
 #Ó
Bš(�$¬S¯Y©Y¯]©]¸4Ó-@Ð'@ rÓ'@�2™(€CÐ
BÞÐ=Ð2°8°*Ð=Ó=ˆ3Ø€Jùò Cs
   …*A³AÚJUMP_BACKWARDÚJUMP_BACKWARD_NO_INTERRUPTÚJUMP_FORWARDÚRETURN_VALUEÚRETURN_GENERATORÚNOPÚ	NOT_TAKENc                  ó@   • \ rS rSrSrS
S jrSSS.     SS jjrSrg	)ÚInstructionWalkerév   aI  Utility to step through trails of instructions.

We have two reasons to need sequences of instructions from a code object:
First, in strict sequence to visit all the instructions in the object.
This is `walk(follow_jumps=False)`.  Second, we want to follow jumps to
understand how execution will flow: `walk(follow_jumps=True)`.
c                ó¸   • Xl         0 U l        S n[        R                  " U5       H  nX R                  UR                  '   M     Uc   eUR                  U l        g ©N)r   ÚinstsrK   Úget_instructionsÚoffsetÚ
max_offset)r   r   Úinsts      r   r   ÚInstructionWalker.__init__   sQ   € ØŒ	Ø57ˆŒ
àˆÜ×(Ò(¨Ö.ˆDØ&*�J‰J�t—{‘{Ó#ñ /ð ÑÐÐØŸ+™+ˆ�r   r   T©Ústart_atÚfollow_jumpsc             #  óH  #   • [        5       nUnX@R                  S-   :  a€  XC;   a  gUR                  U5        U R                  R	                  U5      =n(       a-  Uv •  U(       a"  UR
                  [        ;   a  UR                  nMx  US-  nX@R                  S-   :  a  M  gg7f)ze
Yield instructions starting from `start_at`.  Follow unconditional
jumps if `follow_jumps` is true.
é   rB   N)Úsetrb   Úaddr_   rM   ÚopcodeÚALWAYS_JUMPSÚjump_target)r   rf   rg   Úseenra   rc   s         r   ÚwalkÚInstructionWalker.walkŠ   s‰   é € ô ‹uˆØˆØ—‘¨Ñ*Ó*Ø‹~ØØ�H‰H�VÔØ—z‘z—~‘~ fÓ-Ð-ˆtÕ-Ø’
Þ D§K¡K´<Ó$?Ø!×-Ñ-�FÙØ�a‰KˆFð —‘¨Ñ*×*ùs   ‚BB"Â B")r   r_   rb   N)r   r   r8   r9   )rf   r
   rg   Úboolr8   zIterable[dis.Instruction])r:   r;   r<   r=   r>   r   rp   r?   r@   r   r   r[   r[   v   s5   † ñô	&ð &'¸TñØ"ðØ6:ðà	"÷ð r   r[   c                ó>  ^ ^^	^
• [         R                  " S 5      n[        T 5      m
T
R                  SS9 Hã  nUR                  (       d  M  UR
                  [        ;   a  M,  UR                  m	T	c  M=  TR                  T	T	5      m	      SU U	U
U4S jjn[         R                  " [        5      nU" XSR                  S-   S9  U" XSR                  S9  XRUR                  '   UR                  5        H$  u  pgU H  nX(   U   R                  U5        M     M&     Må     U$ )aÍ  
Calculate branch trails for `code`.

`multiline_map` maps line numbers to the first line number of a
multi-line statement.

Instructions can have a jump_target, where they might jump to next.  Some
instructions with a jump_target are unconditional jumps (ALWAYS_JUMPS), so
they aren't interesting to us, since they aren't the start of a branch
possibility.

Instructions that might or might not jump somewhere else are branch
possibilities.  For each of those, we track a trail of instructions.  These
are lists of instruction offsets, the next instructions that can execute.
We follow the trail until we get to a new source line.  That gives us the
arc from the original instruction's line to the new source line.

c                 ó6   • [         R                  " [        5      $ r^   )ÚcollectionsÚdefaultdictrj   r@   r   r   Ú<lambda>Úbranch_trails.<locals>.<lambda>¹   s   € Ä×@WÒ@WÔX[Ô@\r   F©rg   c                óÆ  >• [        5       nS nTR                  USS9 H™  nUR                  UR                  5        UR                  nUb  T	R                  XU5      nU(       a
  UT:w  a  Un  ONUR                  (       a  UR                  [        ;  a    O'UR                  [        ;   d  MŒ  TR                  * n  O   Ub  U TU4   R                  U5        g [        5       U S '   g )NTre   )rj   rp   rk   ra   Úline_numberrM   rn   rl   rm   ÚRETURNSÚco_firstlinenoÚupdate)
Útrailsrf   Úinst_offsetsÚto_lineÚinst2Úl2r   Ú	from_lineÚiwalkerÚmultiline_maps
         €€€€r   Úadd_one_branch_trailÚ+branch_trails.<locals>.add_one_branch_trailÈ   sË   ø€ ô
 *-«ˆLØˆGØ Ÿ™¨xÀd˜ÓK�Ø× Ñ  §¡Ô.Ø×&Ñ&�Ø‘>Ø&×*Ñ*¨2Ó2�BÞ˜" 	›/Ø �GÙØ×&×&¨E¯L©LÄÓ,LÙØ—\‘\¤WÕ,Ø#×2Ñ2Ð2�GÙñ Lð Ñ"Ø˜	 7Ð+Ñ,×3Ñ3°LÕAä"›u��t’r   rB   )rf   )r   ÚTBranchTrailsOneSourcerf   r
   r8   r9   )ru   rv   r[   rp   rn   rl   rm   r{   rM   rj   ra   Úitemsr~   )r   r†   Ú
the_trailsrc   r‡   r   ÚarcÚoffsetsra   r„   r…   s   ``       @@r   Úbranch_trailsrŽ   £   s  û€ ô, !,× 7Ò 7Ñ8\Ó ]€JÜ Ó%€GØ—‘¨%�Ó0ˆØ××áØ�;‰;œ,Ó&áà×$Ñ$ˆ	ØÑÙØ!×%Ñ% i°Ó;ˆ	ð	%Ø*ð	%àð	%ð ÷	%ò 	%ô6 *5×)@Ò)@ÄÓ)EˆÙ˜V¯k©k¸A©oÒ>Ù˜V×.>Ñ.>Ò?Ø"(�4—;‘;Ñð #ŸL™LžN‰LˆCÛ!�ØÑ" 3Ñ'×.Ñ.¨wÖ7ó "ó +ñc 1ðj Ðr   c                ó
  • 0 n[        U 5      nUR                  SS9 Hb  nUR                  [        ;   a  UR                  XR
                  '   M1  UR                  [        ;   d  MG  UR
                  S-   XR
                  '   Md     U$ )z}Make a map of unconditional bytecodes jumping to others.

Only include bytecodes that do no work and go to another bytecode.
Fry   rB   )r[   rp   rl   rm   rn   ra   ÚNOPS)r   Újumpsr…   rc   s       r   Úalways_jumpsr’   ó   sm   € ð
 €EÜ Ó%€GØ—‘¨%�Ó0ˆØ�;‰;œ,Ó&Ø!%×!1Ñ!1ˆE—+‘+ÓØ�[‰[œDÕ Ø!%§¡¨q¡ˆE—+‘+Óñ	 1ð
 €Lr   )r   r   r8   zdict[TOffset, TLineNo])rN   Ústrr8   zset[int])r   r   r†   zMapping[TLineNo, TLineNo]r8   ÚTBranchTrails)r   r   r8   zdict[TOffset, TOffset])r>   Ú
__future__r   ru   rK   Úcollections.abcr   r   Útypesr   Útypingr   Úcoverage.typesr   r	   r
   r   rI   rR   rm   r|   r�   r[   Údictrj   r‰   r”   rŽ   r’   r@   r   r   Ú<module>r›      sÎ   ðñ (å "ã Û 
ß -Ý Ý ç 1Ñ 1÷:*ñ :*ôzôñ ØØ Øó€ñ ØØó€ñ Ø	Øó€÷&ñ &ðR ˜h t™n¨c°'©lÐ:Ñ;Ð Ø�WÐ4Ð4Ñ5€ðMØ
ðMà,ðMð ôMõ`r   