Ë
    oPêjÀ  ã                  ó¨  — d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
mZmZ  G d„ d«      Zdd	„Zdd
„Z eddd«      Z edd«      Z ed«      Zej&                  j)                  dd«      Zej&                  d   Z eej0                  «       eej2                  «      z  ZeD � ch c]  } dej6                  |    v sŒ| ’Œ c} Z G d„ d«      Zyc c} w )z!Bytecode analysis for coverage.pyé    )ÚannotationsN)ÚIterableÚMapping)ÚCodeType)ÚTArcÚTLineNoÚTOffsetc                  óP   — e Zd ZdZddddœ	 	 	 	 	 	 	 d	d„Zd
d„Zdd„Zdd„Zdd„Zy)Ú
ByteParserz3Parse bytecode to understand the structure of code.N)ÚcodeÚtextÚfilenamec               óD   — |€|€J ‚t        ||xs ddd¬«      }|| _        y )Nz<string>ÚexecT)Údont_inherit)Úcompiler   )Úselfr   r   r   s       úV/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/coverage/bytecode.pyÚ__init__zByteParser.__init__   s1   € ð ˆ<ØÐ#Ð#Ð#Ü˜4 Ò!7¨Z¸ÈdÔSˆDØˆ�	ó    c                ó0   — d„ | j                  «       D «       S )a|  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  óT   K  — | ]   }|j                   d k7  sŒt        |¬«      –— Œ" y­w)Ú__annotate__)r   N)Úco_namer   )Ú.0Úcs     r   ú	<genexpr>z,ByteParser._child_parsers.<locals>.<genexpr>)   s$   è ø€ Ò_ qÀ1Ç9Á9ÐP^ÓC^”
 ×"Ð"Ñ_ùs   ‚(—()Úcode_objects)r   s    r   Ú_child_parserszByteParser._child_parsers   s   € ñ `¨D×,=Ñ,=Ó,?Ô_Ð_r   c              #  óÀ   K  — | j                   g}|rK|j                  «       }|j                  D ]$  }t        |t        «      sŒ|j                  |«       Œ& |–— |rŒJyy­w)z,Iterate over all the code objects in `code`.N)r   ÚpopÚ	co_constsÚ
isinstancer   Úappend)r   Ústackr   r   s       r   r   zByteParser.code_objects+   sU   è ø€ à—‘�ˆÙð —9‘9“;ˆDØ—^‘^ò $�Ü˜a¤Õ*Ø—L‘L •Oð$ð ŠJô ùs   ‚?AÁAÁAc              #  ó`   K  — | j                   j                  «       D ]  \  }}}|sŒ
|–— Œ y­w)zyYield 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_numberszByteParser._line_numbers7   s2   è ø€ ð
 Ÿ)™)×,Ñ,Ó.ò 	‰JˆAˆq�$ÚØ“
ñ	ùs   ‚$.§.c              #  ój   K  — | j                  «       D ]  }|j                  «       E d{  –—†  Œ y7 Œ­w)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   r*   )r   Úbps     r   Úfind_statementszByteParser.find_statements@   s5   è ø€ ð ×%Ñ%Ó'ò 	*ˆBà×'Ñ'Ó)×)Ñ)ñ	*à)ús   ‚'3©1ª3)r   zCodeType | Noner   ú
str | Noner   r.   ÚreturnÚNone)r/   zIterable[ByteParser])r/   zIterable[CodeType])r/   zIterable[TLineNo])	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r*   r-   © r   r   r   r      sR   „ Ù=ð
 !%ØØ#ñ
ð ð
ð ð	
ð
 ð
ð 
ó
ó`ó
óô	*r   r   c                óp   — i }| j                  «       D ]   \  }}}|€Œ
t        ||d«      D ]  }|||<   Œ	 Œ" |S )z6Make a dict mapping byte code offsets to line numbers.é   )r'   Úrange)r   Úb2lÚbstartÚbendÚlinenoÚboffsets         r   Úbytes_to_linesr>   L   sQ   € à
€CØ $§¡£ò &Ñˆ��fØÑÜ  ¨¨qÓ1ò &�Ø%��G’ñ&ð&ð €Jr   c                 óŠ   — | D �ch c]&  }t         j                  j                  |«      x}sŒ%|’Œ( }}|s
J d| › �«       ‚|S c c}w )zMake 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_setrG   V   sN   € ð
 #Ö
B�$¬S¯Y©Y¯]©]¸4Ó-@Ð'@ rÑ'@Š2Ð
B€CÐ
BÙÐ=Ð2°8°*Ð=Ó=ˆ3Ø€Jùò Cs
   …&A ¬A ÚJUMP_BACKWARDÚJUMP_BACKWARD_NO_INTERRUPTÚJUMP_FORWARDÚRETURN_VALUEÚRETURN_GENERATORÚRERAISEÚCACHEéÿÿÿÿÚEXTENDED_ARGc                  ó8   — e Zd ZdZ	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Zy)	ÚBranchArcResolveraD  Resolve branch events to line arcs, one (source, dest) pair at a time.

    Branch events are one-shot (they are DISABLEd after firing), so each
    (source offset, destination offset) pair is resolved at most a couple of
    times per code object.  Resolving pairs on demand is much cheaper than
    precomputing trails for every branch in the code object, most of which
    never fire.  We walk the raw bytecode bytes so that we never need to
    disassemble whole code objects with `dis`.

    To resolve one pair:
    starting from the destination, follow the trail of instructions (through
    unconditional jumps) until we reach an instruction on a new source line
    (giving us the arc), a return (an arc to leaving the code object), or
    another branch possibility (no arc: that branch will produce its own
    events).

    c                óP   — || _         |j                  | _        || _        || _        y )N)r   Úco_codeÚbyte_to_lineÚmultiline_map)r   r   rU   rV   s       r   r   zBranchArcResolver.__init__‘   s&   € ð ˆŒ	à—|‘|ˆŒØ(ˆÔØ*ˆÕr   c                óx   — | j                   j                  |«      }|�| j                  j                  ||«      }|S )z>The source line of the instruction at `offset`, de-multilined.)rU   rB   rV   )r   Úoffsetr)   s      r   Úline_atzBranchArcResolver.line_at�   s;   € à× Ñ ×$Ñ$ VÓ,ˆØÐØ×%Ñ%×)Ñ)¨$°Ó5ˆDØˆr   c                ó  — | j                  |«      }|€y| j                  }t        |«      }| j                  }| j                  }|}d}	t        «       }
d|cxk  r|k  �r$n y||
v�r|
j                  |«       ||   }|t        k(  r|dz  }Œ9|t        k(  r|	||dz      z  dz  }	|dz  }ŒV|j                  |«      }|�|j                  ||«      }|r	||k7  r||fS |t        v r]|t        v rT|	||dz      z  }|dz   }||k  r#||   t        k(  r|dz  }||k  r||   t        k(  rŒ|t        v r	|d|z  z
  }n|d|z  z   }d}	Œêy|t        v r|| j                  j                   fS |t         v ryd}	|dz  }d|cxk  r|k  r	n y||
vr�Œy)zBTurn a branch event's (source, dest) offsets into an arc, or None.Nr   r7   é   é   )rY   rT   ÚlenrU   rV   ÚsetÚaddÚ_CACHEÚ_EXTENDED_ARGrB   ÚJUMPSÚALWAYS_JUMPSÚBACKWARD_JUMPSÚRETURNSr   Úco_firstlinenoÚNO_FALL_THROUGH)r   ÚsourceÚdestÚ	from_linerT   Ú
max_offsetrU   rV   rX   Úext_argÚseenrE   r)   ÚargÚnext_offsets                  r   ÚresolvezBranchArcResolver.resolve¤   sð  € à—L‘L Ó(ˆ	ØÐØØ—,‘,ˆÜ˜“\ˆ
Ø×(Ñ(ˆØ×*Ñ*ˆØˆØˆÜ ›UˆØ�6Ô&˜JÕ&ðL ðM ,2¸Ò+=Ø�H‰H�VÔØ˜‘ˆBØ”VŠ|Ø˜!‘�ØØ”]Ò"Ø" W¨V°a©ZÑ%8Ñ8¸QÑ>�Ø˜!‘�ØØ×#Ñ# FÓ+ˆDØÐØ$×(Ñ(¨¨tÓ4�Ù˜D IÒ-Ø% tÐ,Ð,Ø”U‰{ØœÑ%Ø! G¨F°Q©JÑ$7Ñ7�Cð #)¨1¡*�KØ%¨
Ò2°w¸{Ñ7KÌvÒ7UØ# qÑ(˜ð &¨
Ò2°w¸{Ñ7KÌvÓ7Uàœ^Ñ+Ø!,¨q°3©wÑ!6™à!,¨q°3©wÑ!6˜Ø�GØàØ”W‰}Ø! D§I¡I×$<Ñ$<Ð#<Ð=Ð=Ø”_Ñ$ØØˆGØ�a‰KˆFðK �6Ô&˜JÔ&ðL ðM ,2¸Ó+=ðL r   N)r   r   rU   zMapping[TOffset, TLineNo]rV   zMapping[TLineNo, TLineNo]r/   r0   )rX   r	   r/   zTLineNo | None)rh   r	   ri   r	   r/   zTArc | None)r1   r2   r3   r4   r   rY   rp   r5   r   r   rR   rR   ~   s<   „ ñð$
+àð
+ð 0ð
+ð 1ð	
+ð
 
ó
+óô2r   rR   )r   r   r/   zdict[TOffset, TLineNo])rC   Ústrr/   zset[int])r4   Ú
__future__r   r@   Úcollections.abcr   r   Útypesr   Úcoverage.typesr   r   r	   r   r>   rG   rc   re   rg   rA   rB   r`   ra   r^   ÚhasjrelÚhasjabsrb   Úopnamerd   rR   )rE   s   0r   ú<module>ry      sÙ   ðñ (å "ã 
ß -Ý ç 1Ñ 1÷:*ñ :*ózóñ ØØ Øó€ñ ØØó€ñ ˜Ó#€ð
 
�‰�‰�w Ó	#€Ø—	‘	˜.Ñ)€ñ 	ˆC�K‰KÓ™3˜sŸ{™{Ó+Ñ+€ð  %ÖJ˜¨¸3¿:¹:Àb¹>Ò(I’"ÒJ€÷Xò Xùò Ks   Â&CÂ=C