HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/coverage/__pycache__/data.cpython-310.pyc
o

!we�@s�dZddlmZddlZddlZddlZddlmZm	Z	m
Z
mZmZddl
mZmZddlmZddlmZmZmZmZddlmZd,d-dd�Zd.dd�Zd/d0dd�Z							d1d2d%d&�Zd3d'd(�Zd4d*d+�ZdS)5aCoverage 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�Dict�Iterable�List�Optional)�CoverageException�NoDataError)�PathAliases)�Hasher�file_be_gone�human_sorted�plural)�CoverageDataF�datar�fullpath�bool�return�Dict[str, int]cCsRi}|r	dd�}ntjj}|��D]}|�|�}|dusJ�t|�|||�<q|S)aHReturn 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.

    cSs|S�N�)�frr�F/home/arjun/projects/env/lib/python3.10/site-packages/coverage/data.py�<lambda>)szline_counts.<locals>.<lambda>N)�os�path�basename�measured_files�lines�len)rr�summ�filename_fn�filenamerrrr�line_countss


r#r"�str�hasherr�NonecCsF|��r|�t|�|�p
g��n|�t||��|�|�|��dS)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)rr"r%rrr�add_data_to_hash3sr-�	data_file�
data_paths�Optional[Iterable[str]]�	List[str]cCs�tj�tj�|��\}}|p|g}g}|D]8}tj�|�r'|�tj�|��qtj�|�rFt�tj�	tj�|�|��d}|�
t�|��qtd|�d���dd�|D�}|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 '�'cSsg|]	}|�d�s|�qS)z-journal)�endswith)�.0�fnmrrr�
<listcomp>Ysz$combinable_files.<locals>.<listcomp>)rr�split�abspath�isfile�append�isdir�glob�escape�join�extendr	)r.r/�data_dir�local�files_to_combine�p�patternrrr�combinable_filesBs
 rE�aliases�Optional[PathAliases]�strict�keep�message�Optional[Callable[[str], None]]cCs�t|��|�}|r|std��t�}d}|D]�}	|	|��kr.|j�d�r-|j�d|	���qztj	�
|	�}
WntyA|	}
Ynwt|	d��}t
�d�}|�|���|��}
|
|v}Wd�n1sfwY|}|r�|j�d�r|j�d|	���|�|
�z
t|	|jd	�}|��Wn*ty�}z|jr�|�t|��|r�|d
|
�d|���d}WYd}~n!d}~ww|j||d�d
}|r�|d|
���n	|r�|d|
���|r�|j�d�r�|j�d|	���t|	�q|r�|s�td��dSdS)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.

    zNo data to combineF�dataiozSkipping combining ourself: �rb�sha3_256NzCombining data file )�debugzCouldn't combine data file �: )rFTzCombined data file zSkipping duplicate data zDeleting data file zNo usable data files)rE�
base_filenamer	�set�
data_filename�_debug�should�writerr�relpath�
ValueError�open�hashlib�newr(�read�digest�addrr�_warnr$r)rrFr/rHrIrJrB�file_hashes�combined_anyr�
rel_file_name�fobjr%�sha�combine_this_one�delete_this_one�new_data�excrrr�combine_parallel_data^sh#�

�
��	���ricCs�t|�}|��}td|���tj�|�std�dS|��td|�����t|dd�}t	|�
��}t|�}t|�dt|��d��|D]%}|�d	||�d
t||���}|�
|�}|rg|d|�d�7}t|�qFdS)
z(Implementation of 'coverage debug data'.zpath: z%No data collected: file doesn't existNz
has_arcs: T)rz file�:rPz linez [�])rrS�printrr�existsr\r'r#r
�keysrrr,)r"r�summary�	filenames�nfilesr�line�pluginrrr�debug_data_file�s& 

�rt�	List[int]cCs|�|�}t|p	g�S)z+Get the sorted lines for a file, for tests.)rr))rr"rrrrr+�s
r+)F)rrrrrr)rrr"r$r%rrr&r)r.r$r/r0rr1)NNFFN)rrrFrGr/r0rHrrIrrJrKrr&)r"r$rr&)rrr"r$rru)�__doc__�
__future__rr<rZ�os.pathr�typingrrrrr�coverage.exceptionsrr	�coverage.filesr
�
coverage.miscrrr
r�coverage.sqldatarr#r-rErirtr+rrrr�<module>s*	
�
c