Ë
    oPêjý  ã                  óÎ   — d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZ ddlmZ ddlmZmZ eeeeeef   eeef   ef   Zee   Zdd„Zdd„Zdd	„Zdd
„Zdd„Zy)z"Better tokenizing for coverage.py.é    )ÚannotationsN)ÚIterable)Úenv)ÚTLineNoÚTSourceTokenLinesc              #  ó^  K  — d}d}d}| D �]  \  }}\  }}\  }}	}
||k7  rÖ|rÒ|j                  d«      rÁd}|j                  d«      rd}ny|t        j                  k(  r7|j                  d«      r#|j                  d«      j                  |«      rd}n2d}n/t        j
                  j                  r|t        j                  k(  rd}|r0t        |j                  d	«      d
   «      dz
  }dd||f||dz   f|f–— |
}|t        j                  t        j                  fvr|}||||f||	f|
f–— |}�Œ  y­w)aB  Return all physical tokens, even line continuations.

    tokenize.generate_tokens() doesn't return a token for the backslash that
    continues lines.  This wrapper provides those tokens so that we can
    re-create a faithful representation of the original source.

    Returns the same values as generate_tokens()

    NéÿÿÿÿÚ z\
Tú\Fz \
ú
éþÿÿÿé   iŸ† é   )ÚendswithÚtokenÚSTRINGÚrstripr   Ú
PYBEHAVIORÚfstring_syntaxÚFSTRING_MIDDLEÚlenÚsplitÚtokenizeÚNEWLINEÚNL)ÚtoksÚ	last_lineÚlast_linenoÚ
last_ttextÚttypeÚttextÚslinenoÚscolÚelinenoÚecolÚltextÚinject_backslashÚccols                úX/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/coverage/phystokens.pyÚ_phys_tokensr*      sO  è ø€ ð !€IØ€KØ€JØAEó 0Ñ=ˆˆu‘o�w ¡¨°¸Ø˜'Ò!Ù˜Y×/Ñ/°Ô7ð  $(Ð Ø×&Ñ& tÔ,Ø',Ñ$ØœeŸl™lÒ*à!×*Ñ*¨6Ô2Ø%×,Ñ,¨WÓ5×>Ñ>¸zÔJð ,0Ñ(ð ,1Ñ(Ü—^‘^×2Ò2°uÄ×@TÑ@TÒ7TØ',Ð$Ù#ä˜yŸ™¨tÓ4°RÑ8Ó9¸AÑ=�Dà  &¨7°D¨/¸GÀTÈAÁXÐ;NÐPYÐZÒZØˆIØœ×)Ñ)¬8¯;©;Ð7Ñ7ØˆJØ�e˜g t˜_¨w¸¨o¸uÐEÒEØŠña0ùs   ‚D+D-c                ó2  — d| vsd| vr8t         j                  dk  sd| vr!t         j                  dk  sd| vr
t        «       S t        «       }t        j                  t        j
                  | «      «      D �]   }t        |t        j                  «      rR|j                  |j                  «       |j                  D ]'  }|j                  |j                  j                  «       Œ) Œpt         j                  dk\  r6t        |t        j                  «      r|j                  |j                  «       Œ¹t         j                  dk\  sŒÍt        |t        j                  t        j                  f«      sŒø|j                  s�Œ|j                  |j                  «       �Œ# |S )zCHelper for finding lines with soft keywords, like match/case lines.ÚmatchÚcase)é   é   Útype)r.   é   Úlazy)ÚsysÚversion_infoÚsetÚastÚwalkÚparseÚ
isinstanceÚMatchÚaddÚlinenoÚcasesÚpatternÚ	TypeAliasÚImportÚ
ImportFromÚis_lazy)ÚsourceÚsoft_key_linesÚnoder-   s       r)   Úfind_soft_key_linesrF   [   s+  € ð �fÑ ¨fÑ 4Ü×Ñ˜gÒ%¨°vÑ)=Ü×Ñ 'Ò)¨V¸6Ñ-AÜ“u�ä#&£5€Nä—‘œŸ™ 6Ó*Ó+ó 0ˆô �dœCŸI™IÔ&Ø×Ñ˜tŸ{™{Ô+ØŸ
™
ò 8�Ø×"Ñ" 4§<¡<×#6Ñ#6Õ7ñ8ä×Ñ Ò(¬Z¸¼c¿m¹mÔ-LØ×Ñ˜tŸ{™{Õ+Ü×Ñ Ó(¬Z¸¼s¿z¹zÌ3Ï>É>Ð>ZÕ-[Ø�|Œ|Ø×"Ñ" 4§;¡;Ö/ð0ð Ðó    c              #  óf  K  — t         j                  t         j                  t         j                  t        j
                  h}g }d}| j                  d«      j                  dd«      } t        | «      }t        | «      }t        |«      D �]ž  \  }}\  }}	\  }
}}
d}d|v rt        j                  d|«      }n|g}|D �]c  }|dk(  r|–— g }d}d}�nM|dk(  rd}�nD||v rd}�n<t        j                  j                  rC|t         j                   k(  r0|j                  d	d
«      j                  dd«      }|	t#        |«      z   }|r |	|kD  r|j%                  dd|	|z
  z  f«       d}t        j&                  j)                  |d«      j+                  «       dd }|t         j,                  k(  rdt/        j0                  |«      rd}nLt/        j2                  |«      r7t#        |«      dk(  rd}nt#        |«      dk(  r|d   d   dk(  rd}nd}|r||v rd}|j%                  ||f«       d}d}	�Œf s�Œ�|}�Œ¡ |r|–— yy­w)a  Generate a series of lines, one for each line in `source`.

    Each line is a list of pairs, each pair is a token::

        [('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]

    Each pair has a token class, and the token text.

    If you concatenate all the token texts, and then join them with newlines,
    you should have your original `source` back, with two differences:
    trailing white space is not preserved, and a final line with no newline
    is indistinguishable from a final line with a newline.

    r   é   z
r   Tz(
)Fr
   ú{z{{ú}z}}Úwsú ÚxxNr.   Úkeyr   )r   ÚINDENTÚDEDENTr   r   r   Ú
expandtabsÚreplaceÚgenerate_tokensrF   r*   Úrer   r   r   r   r   r   ÚappendÚtok_nameÚgetÚlowerÚNAMEÚkeywordÚ	iskeywordÚissoftkeyword)rC   Ú	ws_tokensÚlineÚcolÚtokgenrD   r    r!   Úsliner#   Ú_r%   Ú
mark_startÚpartsÚpartÚmark_endÚ	tok_classÚis_start_of_lines                     r)   Úsource_token_linesrj   v   s.  è ø€ ô  —‘œuŸ|™|¬U¯]©]¼H¿K¹KÐH€IØ"$€DØ
€Cà×Ñ˜qÓ!×)Ñ)¨&°$Ó7€FÜ˜VÓ$€Fä(¨Ó0€Nä5AÀ&Ó5Ió *Ñ1ˆˆu‘m�u˜d¡Y a¨°Øˆ
Ø�5‰=Ü—H‘H˜V UÓ+‰Eà�GˆEØó "	ˆDØ�tŠ|Ø’
Ø�Ø�Ø ’Ø˜’Ø ’Ø˜)Ñ#Ø ’ä—>‘>×0Ò0°U¼e×>RÑ>RÒ5RØŸ<™<¨¨TÓ2×:Ñ:¸3ÀÓE�DØ¤# d£)Ñ+�DÙ $¨¢*Ø—K‘K  s¨d°S©jÑ'9Ð :Ô;Ø!&�JÜ$×-Ñ-×1Ñ1°%¸Ó>×DÑDÓFÀrÈÐJ�	ØœEŸJ™JÒ&Ü×(Ñ(¨Ô/à$)™	Ü ×.Ñ.¨uÔ5ä˜t›9¨š>Ø/3Ñ,Ü! $›i¨1šn°$°q±'¸!±*ÀÒ2DØ/3Ñ,à/4Ð,Ù+°¸Ñ0GØ(-˜IØ—‘˜Y¨Ð-Ô.Ø�ØŠDðE"	óF ØŠCðU*ñX Ø‹
ð ùs   ‚H H1È$H1c                ój   — t        j                  | «      j                  }t        j                  |«      S )zÇA helper around `tokenize.generate_tokens`.

    Originally this was used to cache the results, but it didn't seem to make
    reporting go faster, and caused issues with using too much memory.

    )ÚioÚStringIOÚreadliner   rT   )Útextrn   s     r)   rT   rT   ¿   s)   € ô �{‰{˜4Ó ×)Ñ)€HÜ×#Ñ# HÓ-Ð-rG   c                óz   — t        | j                  d«      «      j                  }t        j                  |«      d   S )zªDetermine the encoding for `source`, according to PEP 263.

    `source` is a byte string: the text of the program.

    Returns a string, the name of the encoding.

    Tr   )ÚiterÚ
splitlinesÚ__next__r   Údetect_encoding)rC   rn   s     r)   Úsource_encodingru   Ê   s5   € ô �F×%Ñ% dÓ+Ó,×5Ñ5€HÜ×#Ñ# HÓ-¨aÑ0Ð0rG   )r   Ú
TokenInfosÚreturnrv   )rC   Ústrrw   zset[TLineNo])rC   rx   rw   r   )ro   rx   rw   rv   )rC   Úbytesrw   rx   )Ú__doc__Ú
__future__r   r6   rl   r[   rU   r3   r   r   Úcollections.abcr   Úcoverager   Úcoverage.typesr   r   ÚtupleÚintrx   ÚTTokenrv   r*   rF   rj   rT   ru   © rG   r)   ú<module>rƒ      sz   ðñ )õ #ã 
Û 	Û Û 	Û 
Û Û Ý $å ß 5ð 
ˆs�C˜˜s C˜x™¨%°°S°©/¸3Ð>Ñ	?€Ø�fÑ€
ó=ó@ó6FóR.ô	1rG   