Ë
    oPêj"  ã                  ó6  — d Z ddlm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 ddlmZmZ ddlmZmZmZ dd	lmZmZ dd
lmZ ddlmZmZ ddlmZmZ ddlm Z  ddl!m"Z"m#Z#m$Z$m%Z% e
rddlm&Z&  ee«      Ze'Z'dd„Z(dd„Z)dd„Z*dd„Z+dd„Z, G d„ de«      Z-y)z'Python source expertise for coverage.pyé    )ÚannotationsN)ÚIterable)ÚTYPE_CHECKING)Úenv)ÚCoverageExceptionÚNoSource)Úcanonical_filenameÚrelative_filenameÚzip_location)Úisolate_moduleÚ
join_regex)ÚPythonParser)Úsource_encodingÚsource_token_lines)Ú
CodeRegionÚFileReporter)Úcode_regions)ÚTArcÚTLineNoÚTMorfÚTSourceTokenLines)ÚCoveragec                ó¨   — t        | d«      5 }|j                  «       }ddd«       j                  dd«      j                  dd«      S # 1 sw Y   Œ+xY w)zFRead the Python source text from `filename`.

    Returns bytes.

    ÚrbNs   
ó   
ó   )ÚopenÚreadÚreplace)ÚfilenameÚfÚsources      úT/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/coverage/python.pyÚread_python_sourcer$   !   sP   € ô 
ˆh˜Ó	ð  Ø—‘“ˆ÷ð �>‰>˜' 5Ó)×1Ñ1°%¸Ó?Ð?÷ð ús   �AÁAc                ó¬  — t         j                  j                  | «      \  }}|dk(  rt        j                  rddg}n|g}|D ]B  }||z   }t         j                  j                  |«      rt        |«      } n"t        |«      }|€ŒB n t        d| › d�d¬«      ‚|j                  dd«      }|j                  t        |«      d	«      }|r|d
   dk7  r|dz  }|S )z#Return the source code, as unicode.ú.pyz.pywzNo source for code: 'z'.z	no-source)Úslugó   ó    r   éÿÿÿÿú
)ÚosÚpathÚsplitextr   ÚWINDOWSÚexistsr$   Úget_zip_bytesr   r   Údecoder   )r    ÚbaseÚextÚextsÚtry_filenameÚsource_bytesr"   s          r#   Úget_python_sourcer8   -   sç   € ä—‘× Ñ  Ó*�I€Dˆ#Ø
ˆe‚|œŸšØ�vˆ‰àˆuˆð ò OˆØ˜c‘zˆÜ�7‰7�>‰>˜,Ô'ä-¨lÓ;ˆLÙô % \Ó2ˆØÑ#ÙðOô Ð.¨x¨j¸Ð;À+ÔNÐNð  ×'Ñ'¨¨tÓ4€LØ× Ñ ¤°Ó!>À	ÓJ€Fñ �&˜‘* Ò$Ø�$‰ˆà€Mó    c                óÌ   — t        | «      }|�/|\  }}	 t        j                  |«      }	 |j	                  |«      }|S y# t        j                  $ r Y yw xY w# t
        $ r Y yw xY w)zûGet data from `filename` if it is a zip file path.

    Returns the bytestring data read from the zip file, or None if no zip file
    could be found or `filename` isn't in it.  The data returned will be
    an empty string if the file is empty.

    N)r   Ú	zipimportÚzipimporterÚZipImportErrorÚget_dataÚOSError)r    Úzipfile_innerÚzipfileÚinnerÚziÚdatas         r#   r1   r1   P   s|   € ô ! Ó*€MØÐ Ø&‰ˆ�ð	Ü×&Ñ& wÓ/ˆBð	Ø—;‘;˜uÓ%ˆDð ˆØøô ×'Ñ'ò 	Ùð	ûô ò 	Ùð	ús    ”> ªA ¾AÁAÁ	A#Á"A#c                ó
  — | j                  d«      r| S | j                  d«      r^| dd }t        j                  j                  |«      r|S t        j
                  r&|dz   }t        j                  j                  |«      r|S |S | S )z™Return the source filename for `filename`.

    Given a file name being traced, return the best guess as to the source
    file to attribute it to.

    r&   )z.pycz.pyoNr*   Úw)Úendswithr,   r-   r0   r   r/   )r    Úpy_filenameÚpyw_filenames      r#   Úsource_for_filerJ   g   s{   € ð ×Ñ˜Ôàˆà	×	Ñ	Ð+Ô	,à˜s �mˆÜ�7‰7�>‰>˜+Ô&àÐÜ�;Š;à&¨Ñ,ˆLÜ�w‰w�~‰~˜lÔ+Ø#Ð#àÐð €Or9   c                ó¼   — t        | d«      r| j                  r| j                  }n+t        | t        j                  «      rt        d| › d�«      ‚| }t        |«      }|S )z6Get the source filename for the module-or-file `morf`.Ú__file__zModule z has no file)ÚhasattrrL   Ú
isinstanceÚtypesÚ
ModuleTyper   rJ   )Úmorfr    s     r#   Úsource_for_morfrR   „   sU   € äˆt�ZÔ  T§]¢]Ø—=‘=‰Ü	�Dœ%×*Ñ*Ô	+ô   '¨$¨¨|Ð <Ó=Ð=àˆä˜xÓ(€HØ€Or9   c                  óÒ   ‡ — e Zd ZdZddˆ fd„Zdd„Zdd„Zedd„«       Zdd„Z	dd„Z
dd„Zdd	„Zdd
„Zdd„Zdd„Zdd„Z	 d	 	 	 	 	 	 	 dd„Zd d„Zdd„Zd!d„Zd"d„Zd#d„Zd$d„Zˆ xZS )%ÚPythonFileReporterz!Report support for a Python file.c                ó  •— || _         t        |«      }|}d}| j                   �"| j                   j                  j                  rd}|rt	        |«      }t
        ‰| �  |«       t        |d«      rt|j                  j                  dt        j                  «      }t        j                  j                  |«      j                  d«      r|t        j                  dz   z  }|dz  }nt        |«      }|| _        d | _        d | _        y )NTFÚ__name__ú.z	__init__.Ú__init__r&   )ÚcoveragerR   ÚconfigÚrelative_filesr	   ÚsuperrX   rM   rV   r   r,   Úsepr-   ÚbasenameÚ
startswithr
   ÚrelnameÚ_sourceÚ_parser)ÚselfrQ   rY   r    ÚfnameÚcanonicalizeÚnameÚ	__class__s          €r#   rX   zPythonFileReporter.__init__–   sÖ   ø€ Ø ˆŒä" 4Ó(ˆàˆØˆØ�=‰=Ð$Ø�}‰}×#Ñ#×2Ò2Ø$�ÙÜ& xÓ0ˆEÜ‰Ñ˜Ôä�4˜Ô$Ø—=‘=×(Ñ(¨¬b¯f©fÓ5ˆDÜ�w‰w×Ñ Ó)×4Ñ4°[ÔAØœŸ™ Ñ+Ñ+�Ø�E‰M‰Dä$ XÓ.ˆDØˆŒà#'ˆŒØ,0ˆ�r9   c                ó"   — d| j                   ›d�S )Nz<PythonFileReporter ú>)r    ©rc   s    r#   Ú__repr__zPythonFileReporter.__repr__°   s   € Ø% d§m¡mÐ%6°aÐ8Ð8r9   c                ó   — | j                   S ©N)r`   rj   s    r#   r
   z$PythonFileReporter.relative_filename³   s   € Ø�|‰|Ðr9   c                óì   — | j                   €J ‚| j                  €Ot        | j                  | j                   j	                  d«      ¬«      | _        | j                  j                  «        | j                  S )z&Lazily create a :class:`PythonParser`.Úexclude)r    ro   )rY   rb   r   r    Ú_exclude_regexÚparse_sourcerj   s    r#   ÚparserzPythonFileReporter.parser¶   s_   € ð �}‰}Ð(Ð(Ð(Ø�<‰<ÐÜ'ØŸ™ØŸ™×4Ñ4°YÓ?ôˆDŒLð �L‰L×%Ñ%Ô'Ø�|‰|Ðr9   c                ó.   — | j                   j                  S )z2Return the line numbers of statements in the file.)rr   Ú
statementsrj   s    r#   ÚlineszPythonFileReporter.linesÂ   s   € à�{‰{×%Ñ%Ð%r9   c                ó.   — | j                   j                  S )z>A map of line numbers to first-line in a multi-line statement.)rr   Úmultiline_maprj   s    r#   rw   z PythonFileReporter.multiline_mapÆ   s   € à�{‰{×(Ñ(Ð(r9   c                ó.   — | j                   j                  S )z;Return the line numbers of excluded statements in the file.)rr   Úexcludedrj   s    r#   Úexcluded_linesz!PythonFileReporter.excluded_linesÊ   s   € à�{‰{×#Ñ#Ð#r9   c                ó8   — | j                   j                  |«      S rm   )rr   Útranslate_lines)rc   ru   s     r#   r|   z"PythonFileReporter.translate_linesÎ   s   € Ø�{‰{×*Ñ*¨5Ó1Ð1r9   c                ó8   — | j                   j                  |«      S rm   )rr   Útranslate_arcs)rc   Úarcss     r#   r~   z!PythonFileReporter.translate_arcsÑ   s   € Ø�{‰{×)Ñ)¨$Ó/Ð/r9   c                óè   — | j                   €J ‚| j                  j                  t        | j                   j                  j
                  | j                   j                  j                  z   «      «      }|S rm   )rY   rr   Úlines_matchingr   rZ   Úpartial_listÚpartial_always_list)rc   Ú	no_branchs     r#   Úno_branch_linesz"PythonFileReporter.no_branch_linesÔ   s[   € Ø�}‰}Ð(Ð(Ð(Ø—K‘K×.Ñ.Ü�t—}‘}×+Ñ+×8Ñ8¸4¿=¹=×;OÑ;O×;cÑ;cÑcÓdó
ˆ	ð Ðr9   c                ó6   — | j                   j                  «       S rm   )rr   r   rj   s    r#   r   zPythonFileReporter.arcsÛ   s   € Ø�{‰{×ÑÓ!Ð!r9   c                ó6   — | j                   j                  «       S rm   )rr   Úexit_countsrj   s    r#   rˆ   zPythonFileReporter.exit_countsÞ   s   € Ø�{‰{×&Ñ&Ó(Ð(r9   c                ó:   — | j                   j                  ||«      S rm   )rr   Úmissing_arc_description)rc   ÚstartÚendÚexecuted_arcss       r#   rŠ   z*PythonFileReporter.missing_arc_descriptioná   s   € ð �{‰{×2Ñ2°5¸#Ó>Ð>r9   c                ó:   — | j                   j                  ||«      S rm   )rr   Úarc_description)rc   r‹   rŒ   s      r#   r�   z"PythonFileReporter.arc_descriptioné   s   € Ø�{‰{×*Ñ*¨5°#Ó6Ð6r9   c                óf   — | j                   €t        | j                  «      | _         | j                   S rm   )ra   r8   r    rj   s    r#   r"   zPythonFileReporter.sourceì   s&   € Ø�<‰<ÐÜ,¨T¯]©]Ó;ˆDŒLØ�|‰|Ðr9   c                ó†   — t         j                  j                  | j                  «      \  }}|j	                  d«      ry|syy)zäDoes it seem like this file should contain Python?

        This is used to decide if a file reported as part of the execution of
        a program was really likely to have contained Python in the first
        place.

        r&   TF)r,   r-   r.   r    r_   )rc   Ú_r4   s      r#   Úshould_be_pythonz#PythonFileReporter.should_be_pythonñ   s:   € ô —‘×!Ñ! $§-¡-Ó0‰ˆˆ3ð �>‰>˜%Ô ØáØàr9   c                ó4   — t        | j                  «       «      S rm   )r   r"   rj   s    r#   r   z%PythonFileReporter.source_token_lines  s   € Ü! $§+¡+£-Ó0Ð0r9   c                ó4   — t        | j                  «       «      S rm   )r   r"   rj   s    r#   r   zPythonFileReporter.code_regions  s   € Ü˜DŸK™K›MÓ*Ð*r9   c                ó
   — ddgS )N)ÚfunctionÚ	functions)ÚclassÚclasses© rj   s    r#   Úcode_region_kindsz$PythonFileReporter.code_region_kinds  s   € à%Ø ð
ð 	
r9   rm   )rQ   r   rY   zCoverage | NoneÚreturnÚNone)r�   Ústr)r�   r   )r�   úset[TLineNo])r�   zdict[TLineNo, TLineNo])ru   zIterable[TLineNo]r�   r    )r   zIterable[TArc]r�   ú	set[TArc])r�   r¡   )r�   zdict[TLineNo, int])r‹   r   rŒ   r   r�   zIterable[TArc] | Noner�   rŸ   )r‹   r   rŒ   r   r�   rŸ   )r�   Úbool)r�   r   )r�   zIterable[CodeRegion])r�   zIterable[tuple[str, str]])rV   Ú
__module__Ú__qualname__Ú__doc__rX   rk   r
   Úpropertyrr   ru   rw   rz   r|   r~   r…   r   rˆ   rŠ   r�   r"   r“   r   r   rœ   Ú__classcell__)rg   s   @r#   rT   rT   “   sŸ   ø„ Ù+ö1ó49óð ò	ó ð	ó&ó)ó$ó2ó0óó"ó)ð 04ð	?àð?ð ð?ð -ð	?ð
 
ó?ó7óó
ó(1ó+÷
r9   rT   )r    rŸ   r�   Úbytes)r    rŸ   r�   rŸ   )r    rŸ   r�   zbytes | None)rQ   r   r�   rŸ   ).r¥   Ú
__future__r   Úos.pathr,   rO   r;   Úcollections.abcr   Útypingr   rY   r   Úcoverage.exceptionsr   r   Úcoverage.filesr	   r
   r   Úcoverage.miscr   r   Úcoverage.parserr   Úcoverage.phystokensr   r   Úcoverage.pluginr   r   Úcoverage.regionsr   Úcoverage.typesr   r   r   r   r   r   r$   r8   r1   rJ   rR   rT   r›   r9   r#   ú<module>rµ      s}   ðñ .å "ã Û Û Ý $Ý  å ß ;ß NÑ Nß 4Ý (ß Cß 4Ý )ß BÓ BáÝ!ñ �BÓ€à€ó	@ó óFó.ó:ô|
˜õ |
r9   