
     h                        S r SSKJr  SSKrSSKrSSKrSSKrSSKJ	r	  SSK
Jr  SSKJrJr  SSKJr  SSKJrJrJrJr  SS	KJr  SSS
 jjrSS jrSSS jjr     S             SS jjrSS jrSS jrg)a  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)Iterable)Callable)CoverageExceptionNoDataError)PathAliases)Hasherfile_be_gonehuman_sortedplural)CoverageDatac                    0 nU(       a  S nO[         R                  R                  nU R                  5        H,  nU R	                  U5      nUc   e[        U5      X#" U5      '   M.     U$ )a4  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                    U $ N )fs    k/root/racknerd_01/codex-conversation/amazon-q-terraform/.venv/lib/python3.13/site-packages/coverage/data.py<lambda>line_counts.<locals>.<lambda>*   s        )ospathbasenamemeasured_fileslineslen)datafullpathsummfilename_fnfilenamer   s         r   line_countsr"      sg     D!gg&&'')

8$   &)%j["# * Kr   c                   U R                  5       (       a3  UR                  [        U R                  U5      =(       d    / 5      5        OUR                  [	        X5      5        UR                  U R                  U5      5        g)zContribute `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!   hashers      r   add_data_to_hashr+   4   sV     }}fTYYx06B78l423
MM$""8,-r   c                    [         R                  R                  [         R                  R                  U 5      5      u  p#U=(       d    U/n/ nU GH  n[         R                  R	                  U5      (       a0  UR                  [         R                  R                  U5      5        MX  [         R                  R                  U5      (       a{  [        R                  " [         R                  R                  [         R                  R                  U5      U5      5      S-   nUR                  [        R                  " U5      5        M  [        SU S35      e   U Vs/ s H  owR                  S5      (       a  M  UPM     nn[        U5      $ s  snf )zMake 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 ''z-journal)r   r   splitabspathisfileappendisdirglobescapejoinextendr   endswithr&   )	data_file
data_pathsdata_dirlocalfiles_to_combineppatternfnms           r   combinable_filesr@   C   s    ggmmBGGOOI$>?OH)zJ77>>!##BGGOOA$67WW]]1kk"'',,rwwq/A5"IJTQG##DIIg$67 I!ANOO  (8X'7||J?W'7X
 "## Ys   F8Fc                   [        U R                  5       U5      nU(       a  U(       d  [        S5      eUc  SnO [        R                  " UR
                  5      n[        5       nSn	U GH  n
XR                  5       :X  aA  U R                  R                  S5      (       a  U R                  R                  SU
< 35        MX   [        R                  R                  U
5      n[        U
S5       n[         R"                  " SSS9nUR%                  UR'                  5       5        UR)                  5       nX;  nSSS5        U(       + nW(       a  U R                  R                  S5      (       a  U R                  R                  S	U
< 35        UR+                  W5         [-        XR                  S
9nUR'                  5         U R%                  UUS9  Sn	U(       a  U" SU 35        OU(       a  U" SU 35        U(       d  GM  U R                  R                  S5      (       a  U R                  R                  SU
< 35        [5        U
5        GM     U(       a  U	(       d  [        S5      egg! [         a    U
n GNf = f! , (       d  f       GNO= f! [.         aL  nU R0                  (       a  U R1                  [3        U5      5        U(       a  U" SU SU 35        Sn SnANSnAff = f)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 combineNFdataiozSkipping combining ourself: rbsha3_256)usedforsecurityzCombining data file )debug)map_pathTzCombined data file zCouldn't combine data file : zSkipping duplicate data zDeleting data file zNo usable data files)r@   base_filenamer   	functoolscachemapsetdata_filename_debugshouldwriter   r   relpath
ValueErroropenhashlibnewr%   readdigestaddr   r   _warnstrr
   )r   aliasesr9   strictkeepmessager<   rG   file_hashescombined_anyr   rel_file_namefobjr*   shacombine_this_onedelete_this_onenew_dataexcs                      r   combine_parallel_datari   b   sc   F ((:(:(<jI&.//??7;;/%KL""$$ {{!!(++!!$@"FG	GGOOA.M !T]d[[UCFMM$))+&--/C"5	  #({{!!(++!!$8">?OOC C'= Hx8#1-AB2=/BC?{{!!(++!!$7u"=>Oe h l011 #vU  	 M		 ] % (:: JJs3x(9-3%PQ"'(s8   I*,A	I=#J*I:9I:=
J	
K%AK  K%c           	     8   [        U 5      nUR                  5       n [        SU  35        [        R                  R                  U 5      (       d  [        S5        gUR                  5         [        SUR                  5       < 35        [        USS9n[        UR                  5       5      n[        U5      n[        U S[        U5       S35        U HF  nU S	X%    S
[        X%   5       3nUR                  U5      nU(       a	  USU S3-  n[        U5        MH     g)z(Implementation of 'coverage debug data'.zpath: z%No data collected: file doesn't existNz
has_arcs: T)r   z file:rH   z linez [])r   rN   printr   r   existsrW   r$   r"   r   keysr   r   r)   )r!   r   summary	filenamesnfilesr   lineplugins           r   debug_data_fileru      s    !D!!#H	F8*
77>>(##56IIK	Jt}})
*+$.GW\\^,I^F	VHE&.)
+,Bwzl%wz(:';<!!!$bN"Dd r   c                L    U R                  U5      n[        U=(       d    / 5      $ )z+Get the sorted lines for a file, for tests.)r   r&   )r   r!   r   s      r   r(   r(      s    JJx E%+2r   )F)r   r   r   boolreturnzdict[str, int])r   r   r!   r[   r*   r	   rx   Noner   )r8   r[   r9   Iterable[str] | Nonerx   z	list[str])NNFFN)r   r   r\   zPathAliases | Noner9   rz   r]   rw   r^   rw   r_   zCallable[[str], None] | Nonerx   ry   )r!   r[   rx   ry   )r   r   r!   r[   rx   z	list[int])__doc__
__future__r   rJ   r3   rU   os.pathr   collections.abcr   typingr   coverage.exceptionsr   r   coverage.filesr   coverage.miscr	   r
   r   r   coverage.sqldatar   r"   r+   r@   ri   ru   r(   r   r   r   <module>r      s    #     $  > & D D 90.$B #''+,0e2
e2e2 %e2 	e2
 e2 *e2 
e2P,r   