§
    0›j4%  ã                  ó   — 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m	Z	m
Z
 ddl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 dd	lmZ dd
lmZ d,d-d„Zd.d„Zd/d0d„Zd1d„Z G d „ d!¦  «        Z	 	 	 	 	 d2d3d(„Zd4d)„Z d5d+„Z!dS )6a  Coverage data for coverage.py.

This file had the 4.x JSON data support, which is now gone.  This file still
has storage-agnostic helpers, and is kept to avoid changing too many imports.
CoverageData is now defined in sqldata.py, and imported here to keep the
imports working.

é    )ÚannotationsN)ÚCallableÚIterable)ÚLiteral)ÚCoverageExceptionÚNoDataError)ÚPathAliases)ÚHasherÚfile_be_goneÚhuman_sortedÚplural)ÚCoverageData)Úfilename_matchFÚdatar   ÚfullpathÚboolÚreturnúdict[str, int]c                óÎ   — i }|rd„ }nt           j        j        }|                      ¦   «         D ]6}|                      |¦  «        }|€J ‚t          |¦  «        | ||¦  «        <   Œ7|S )aH  Return a dict summarizing the line coverage data.

    Keys are based on the file names, and values are the number of executed
    lines.  If `fullpath` is true, then the keys are the full pathnames of
    the files, otherwise they are the basenames of the files.

    Returns a dict mapping file names to counts of lines.

    c                ó   — | S ©N© )Úfs    úL/home/lighthouse/health/venv/lib64/python3.11/site-packages/coverage/data.pyú<lambda>zline_counts.<locals>.<lambda>+   s   €  € ó    )ÚosÚpathÚbasenameÚmeasured_filesÚlinesÚlen)r   r   ÚsummÚfilename_fnÚfilenamer!   s         r   Úline_countsr&      s~   € ð €Dàð 'à!�kˆˆå”gÔ&ˆØ×'Ò'Ñ)Ô)ð 1ð 1ˆØ—
’
˜8Ñ$Ô$ˆØÐ Ð Ð Ý&)¨%¡j¤jˆˆ[ˆ[˜Ñ"Ô"Ñ#Ð#Ø€Kr   r%   ÚstrÚhasherr
   ÚNonec                ó4  — |                       ¦   «         r8|                     t          |                      |¦  «        pg ¦  «        ¦  «         n#|                     t	          | |¦  «        ¦  «         |                     |                      |¦  «        ¦  «         dS )zÊContribute `filename`'s data to the `hasher`.

    `hasher` is a `coverage.misc.Hasher` instance to be updated with
    the file's data.  It should only get the results data, not the run
    data.

    N)Úhas_arcsÚupdateÚsortedÚarcsÚsorted_linesÚfile_tracer)r   r%   r(   s      r   Úadd_data_to_hashr1   5   s„   € ð ‡}‚}�„ð 4Ø�Š•f˜TŸYšY xÑ0Ô0Ð6°BÑ7Ô7Ñ8Ô8Ð8Ð8à�Š•l 4¨Ñ2Ô2Ñ3Ô3Ð3Ø
‡M‚M�$×"Ò" 8Ñ,Ô,Ñ-Ô-Ð-Ð-Ð-r   Ú	data_fileÚ
data_pathsúIterable[str] | Noneú	list[str]c                óÈ  — t           j                             t           j                             | ¦  «        ¦  «        \  }}|p|g}g }|D ]ÿ}t           j                             |¦  «        r3|                     t           j                             |¦  «        ¦  «         ŒTt           j                             |¦  «        rzt          j        t           j         	                    t           j                             |¦  «        |¦  «        ¦  «        dz   }| 
                    t          j        |¦  «        ¦  «         Œít          d|› d�¦  «        ‚d„ |D ¦   «         }t          |¦  «        S )zÃMake a list of data files to be combined.

    `data_file` is a path to a data file.  `data_paths` is a list of files or
    directories of files.

    Returns a list of absolute file paths.
    z.*z)Couldn't combine from non-existent path 'ú'c                ó<   — g | ]}|                      d ¦  «        °|‘ŒS )z-journal)Úendswith)Ú.0Úfnms     r   ú
<listcomp>z$combinable_files.<locals>.<listcomp>[   s)   € ÐXÐXÐX ¸s¿|º|ÈJÑ?WÔ?WÐX˜ÐXÐXÐXr   )r   r   ÚsplitÚabspathÚisfileÚappendÚisdirÚglobÚescapeÚjoinÚextendr   r-   )r2   r3   Údata_dirÚlocalÚfiles_to_combineÚpÚpatterns          r   Úcombinable_filesrK   D   s5  € õ ”g—m’m¥B¤G§O¢O°IÑ$>Ô$>Ñ?Ô?�O€HˆeàÐ) ˜z€JØÐØð Pð PˆÝŒ7�>Š>˜!ÑÔð 	PØ×#Ò#¥B¤G§O¢O°AÑ$6Ô$6Ñ7Ô7Ð7Ð7ÝŒW�]Š]˜1ÑÔð 	PÝ”k¥"¤'§,¢,­r¬w¯ª¸qÑ/AÔ/AÀ5Ñ"IÔ"IÑJÔJÈTÑQˆGØ×#Ò#¥D¤I¨gÑ$6Ô$6Ñ7Ô7Ð7Ð7åÐNÈ!ÐNÐNÐNÑOÔOÐOð YÐXÐ'7ÐXÑXÔXÐõ
 Ð"Ñ#Ô#Ð#r   Ú
dbfilenamec                ó6  — t          | ¦  «        }|r|d         r|d         S t          | d¦  «        5 }t          j        dd¬¦  «        }|                     |                     ¦   «         ¦  «         ddd¦  «         n# 1 swxY w Y   |                     ¦   «         S )z%Get the hash of the data in the file.ÚhashÚrbÚsha3_256F)ÚusedforsecurityN)r   ÚopenÚhashlibÚnewr,   ÚreadÚ	hexdigest)rL   ÚmÚfobjr(   s       r   Úhash_for_data_filerY   c   sÐ   € å�zÑ"Ô"€AØð "ˆQˆvŒYð "Ø�ŒyÐå�*˜dÑ#Ô#ð 	' tÝ”[ ¸UÐCÑCÔCˆFØ�MŠM˜$Ÿ)š)™+œ+Ñ&Ô&Ð&ð	'ð 	'ð 	'ñ 	'ô 	'ð 	'ð 	'ð 	'ð 	'ð 	'ð 	'øøøð 	'ð 	'ð 	'ð 	'ð ×ÒÑ!Ô!Ð!s   ²>A<Á<B ÂB c                  ó"   — e Zd ZdZd
d„Zdd„Zd	S )ÚDataFileClassifierz.Track what files to combine and which to skip.r   r)   c                ó,   — t          ¦   «         | _        d S r   )ÚsetÚfile_hashes)Úselfs    r   Ú__init__zDataFileClassifier.__init__r   s   € Ý%(¡U¤UˆÔÐÐr   r   r'   úLiteral['combine', 'skip']c                ó”   — 	 t          |¦  «        }n# t          $ r Y dS w xY w|| j        v rdS | j                             |¦  «         dS )z/Determine whether to combine or skip this file.ÚcombineÚskip)rY   Ú	Exceptionr^   Úadd)r_   r   Úshas      r   ÚclassifyzDataFileClassifier.classifyu   sk   € ð	Ý$ QÑ'Ô'ˆCˆCøÝð 	ð 	ð 	ð �9�9ð	øøøð �$Ô"Ð"Ð"Ø�6àÔ× Ò  Ñ%Ô%Ð%Ø�9s   ‚ ’
 Ÿ N)r   r)   )r   r'   r   ra   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r`   rh   r   r   r   r[   r[   o   sB   € € € € € Ø8Ð8ð+ð +ð +ð +ðð ð ð ð ð r   r[   ÚaliasesúPathAliases | NoneÚstrictÚkeepÚmessageúCallable[[str], None] | Nonec                óp  — t          |                      ¦   «         |¦  «        }|r|st          d¦  «        ‚|€d}nt          j        |j        ¦  «        }t          ¦   «         }d}	dx}
x}}|D �]b}||                      ¦   «         k    r8| j         	                    d¦  «        r| j         
                    d|›�¦  «         ŒS	 t          j                             |¦  «        }n# t          $ r |}Y nw xY w|                     |¦  «        }| }|dk    �r9| j         	                    d¦  «        r| j         
                    d|›�¦  «         	 t!          || j        ¬	¦  «        }|                     ¦   «          |                      ||¬
¦  «         |
dz  }
d}	| j         	                    d¦  «        r| j         
                    d|› �¦  «         n½# t&          $ rt}|dz  }| j        r"|                      t+          |¦  «        ¦  «         | j         	                    d¦  «        r | j         
                    d|› d|› �¦  «         d}Y d}~nDd}~ww xY w|dz  }| j         	                    d¦  «        r| j         
                    d|› �¦  «         |rF| j         	                    d¦  «        r| j         
                    d|›�¦  «         t-          |¦  «         �Œd|r|	st          d¦  «        ‚|rO|
|z   |z   dk    rEdt/          |
d¦  «        › �}|r|d|› �z  }|r|dt/          |d¦  «        › d�z  } ||¦  «         dS dS dS )aÿ  Combine a number of data files together.

    `data` is a CoverageData.

    Treat `data.filename` as a file prefix, and combine the data from all
    of the data files starting with that prefix plus a dot.

    If `aliases` is provided, it's a `PathAliases` object that is used to
    re-map paths to match the local machine's.

    If `data_paths` is provided, it is a list of directories or files to
    combine.  Directories are searched for files that start with
    `data.filename` plus dot as a prefix, and those files are combined.

    If `data_paths` is not provided, then the directory portion of
    `data.filename` is used as the directory to search for data files.

    Unless `keep` is True every data file found and combined is then deleted
    from disk. If a file cannot be read, a warning will be issued, and the
    file will not be deleted.

    If `strict` is true, and no files are found to combine, an error is
    raised.

    `message` is a function to use for printing messages to the user.

    zNo data to combineNFr   ÚdataiozSkipping combining ourself: rc   zCombining data file )Údebug)Úmap_pathé   TzCombined data file zCouldn't combine data file ú: zSkipping duplicate data zDeleting data file zNo usable data filesz	Combined Úfilez
, skipped z, z errored)rK   Úbase_filenamer   Ú	functoolsÚcacheÚmapr[   Údata_filenameÚ_debugÚshouldÚwriter   r   ÚrelpathÚ
ValueErrorrh   r   rU   r,   r   Ú_warnr'   r   r   )r   rm   r3   ro   rp   rq   rH   rv   Ú
classifierÚcombined_anyÚcombinedÚskippedÚerroredr   Úrel_file_nameÚfile_actionÚdelete_this_oneÚnew_dataÚexcÚmsgs                       r   Úcombine_parallel_datar�   „   så  € õF (¨×(:Ò(:Ñ(<Ô(<¸jÑIÔIÐàð 0Ð&ð 0ÝÐ.Ñ/Ô/Ð/à€Øˆˆå”? 7¤;Ñ/Ô/ˆå#Ñ%Ô%€JØ€Là#$Ð$€HÐ$ˆw˜Øð 0ñ 0ˆØ�×"Ò"Ñ$Ô$Ò$Ð$ð Œ{×!Ò! (Ñ+Ô+ð HØ”×!Ò!Ð"FÀÐ"FÐ"FÑGÔGÐGØð	ÝœGŸOšO¨AÑ.Ô.ˆMˆMøÝð 	ð 	ð 	ð ˆMˆMˆMð		øøøð !×)Ò)¨!Ñ,Ô,ˆà"˜(ˆØ˜)Ò#Ñ#ØŒ{×!Ò! (Ñ+Ô+ð @Ø”×!Ò!Ð">¸Ð">Ð">Ñ?Ô?Ð?ðMÝ'¨°´Ð=Ñ=Ô=�Ø—’‘”�ð —’˜H¨x�Ñ8Ô8Ð8Ø˜A‘�Ø#�Ø”;×%Ò% iÑ0Ô0ð MØ”K×%Ò%Ð&K¸MÐ&KÐ&KÑLÔLÐLøøõ %ð (ð (ð (Ø˜1‘�Ø”:ð )ð —J’J�s 3™xœxÑ(Ô(Ð(Ø”;×%Ò% iÑ0Ô0ð \Ø”K×%Ò%Ð&ZÀMÐ&ZÐ&ZÐUXÐ&ZÐ&ZÑ[Ô[Ð[Ø"'������øøøøð(øøøð  �q‰LˆGØŒ{×!Ò! )Ñ,Ô,ð NØ”×!Ò!Ð"L¸]Ð"LÐ"LÑMÔMÐMàð 	ØŒ{×!Ò! (Ñ+Ô+ð ?Ø”×!Ò!Ð"=¸Ð"=Ð"=Ñ>Ô>Ð>Ý˜‰OŒOˆOùàð 2�lð 2ÝÐ0Ñ1Ô1Ð1àð �H˜wÑ&¨Ñ0°1Ò4Ð4Ø4�& ¨6Ñ2Ô2Ð4Ð4ˆØð 	*ØÐ) Ð)Ð)Ñ)ˆCØð 	:ØÐ9�˜w¨Ñ/Ô/Ð9Ð9Ð9Ñ9ˆCØˆ�‰Œˆˆˆðð Ð4Ð4s+   Ã C Ã C/Ã.C/Å	*G	Ç	
IÇA*IÉIc                ó   — t          | ¦  «        }|                     ¦   «         } t          d| › �¦  «         t          j                             | ¦  «        st          d¦  «         dS |                     ¦   «          t          d|                     ¦   «         ›�¦  «         t          |d¬¦  «        }t          | 
                    ¦   «         ¦  «        }t          |¦  «        }t          t          |d¦  «        › d�¦  «         |D ]L}|› d	t          ||         d
¦  «        › �}|                     |¦  «        }|r	|d|› d�z  }t          |¦  «         ŒMdS )z(Implementation of 'coverage debug data'.zpath: z%No data collected: file doesn't existNz
has_arcs: T)r   ry   ú:rx   Úlinez [ú])r   r~   Úprintr   r   ÚexistsrU   r+   r&   r   Úkeysr"   r   r0   )r%   r   ÚsummaryÚ	filenamesÚnfilesr   r“   Úplugins           r   Údebug_data_filerœ   ó   sT  € å˜Ñ!Ô!€DØ×!Ò!Ñ#Ô#€HÝ	Ð
�8Ð
Ð
ÑÔÐÝŒ7�>Š>˜(Ñ#Ô#ð ÝÐ5Ñ6Ô6Ð6ØˆØ‡I‚I�K„K€KÝ	Ð
*�t—}’}‘”Ð
*Ð
*Ñ+Ô+Ð+Ý˜$¨Ð.Ñ.Ô.€GÝ˜WŸ\š\™^œ^Ñ,Ô,€IÝ�‰^Œ^€FÝ	�V�F˜FÑ#Ô#Ð
&Ð
&Ð
&Ñ'Ô'Ð'Øð ð ˆØÐ3Ð3•v˜g aœj¨&Ñ1Ô1Ð3Ð3ˆØ×!Ò! !Ñ$Ô$ˆØð 	#Ø�N˜�N�N�NÑ"ˆDÝˆd‰Œˆˆðð r   ú	list[int]c                óN   — |                       |¦  «        }t          |pg ¦  «        S )z+Get the sorted lines for a file, for tests.)r!   r-   )r   r%   r!   s      r   r/   r/   	  s%   € à�JŠJ�xÑ Ô €EÝ�%�+˜2ÑÔÐr   )F)r   r   r   r   r   r   )r   r   r%   r'   r(   r
   r   r)   r   )r2   r'   r3   r4   r   r5   )rL   r'   r   r'   )NNFFN)r   r   rm   rn   r3   r4   ro   r   rp   r   rq   rr   r   r)   )r%   r'   r   r)   )r   r   r%   r'   r   r�   )"rl   Ú
__future__r   r{   rB   rS   Úos.pathr   Úcollections.abcr   r   Útypingr   Úcoverage.exceptionsr   r   Úcoverage.filesr	   Úcoverage.miscr
   r   r   r   Úcoverage.sqldatar   r   r&   r1   rK   rY   r[   r�   rœ   r/   r   r   r   ú<module>r§      sÊ  ððð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø €€€Ø €€€Ø €€€Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ø Ð Ð Ð Ð Ð à >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ø &Ð &Ð &Ð &Ð &Ð &Ø DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DØ 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø +Ð +Ð +Ð +Ð +Ð +ðð ð ð ð ð0.ð .ð .ð .ð$ð $ð $ð $ð $ð>	"ð 	"ð 	"ð 	"ðð ð ð ð ñ ô ð ð. #'Ø'+ØØØ,0ðlð lð lð lð lð^ð ð ð ð,ð ð ð ð ð r   