Your IP : 18.216.186.122
�
��bg�����dZddlmZddlZddlZddlmZmZmZddl m
Z
ddlmZm
Z
ddlmZddlmZdd lmZdd
lmZerddlmZe
e��ZGd�d
��ZdS)z'Source file annotation for coverage.py.�)�annotationsN)�Iterable�Optional�
TYPE_CHECKING)�
flat_rootname)�
ensure_dir�isolate_module)�FileReporter)�get_analysis_to_report)�Analysis)�TMorf)�Coveragec�l�eZdZdZdd�Zejd��Zejd��Zddd�Z dd�Z
d S)�AnnotateReporteraGenerate annotated source files showing line coverage.
This reporter creates annotated copies of the measured source files. Each
.py file is copied as a .py,cover file, with a left-hand margin annotating
each line::
> def h(x):
- if 0: #pragma: no cover
- pass
> if x == 1:
! a = 1
> else:
> a = 2
> h(2)
Executed lines use ">", lines not executed use "!", lines excluded from
consideration use "-".
�coverager�return�Nonec�D�||_|jj|_d|_dS�N)r�config� directory)�selfrs �d/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/coverage/annotate.py�__init__zAnnotateReporter.__init__0s �� ��
��m�*���(,�����z\s*(#|$)z\s*else\s*:\s*(#|$)N�morfs�Optional[Iterable[TMorf]]r�
Optional[str]c��||_|j���t|j|��D]\}}|�||���dS)zIRun the report.
See `coverage.report()` for arguments.
N)rr�get_datar�
annotate_file)rrr�fr�analysiss r�reportzAnnotateReporter.report8sa��#����
��� � � �2�4�=�%�H�H� -� -�L�B�����r�8�,�,�,�,� -� -rr"r
r#rc�&�t|j��}t|j��}t|j��}|jr�t|j��tj�|jt|�
������}|�d��r
|dd�dz}|dz
}n
|jdz}t|dd���5}d x}} d
}
|���}t|�d
��d���D�]�\}}
|t#|��kr0|||kr$|dz
}|t#|��kr|||k�$| t#|��kr0|| |kr$| dz
} | t#|��kr|| |k�$|t#|��kr+|||kr| t#|��kp|| |k}
|j�|
��r|�d
��n�|j�|
��rg| t#|��kr|�d��n�|||| kr|�d��n]|�d��nG||vr|�d��n-|
r|�d��n|�d��|�|
����� ddd��dS#1swxYwYdS)z]Annotate a single file.
`fr` is the FileReporter for the file to annotate.
�_pyN���z.pyz,cover�wzutf-8)�encodingrT�)�startz z> z! z- )�sorted�
statements�missing�excludedrr�os�path�joinr�relative_filename�endswith�filename�open�source� enumerate�
splitlines�len�blank_re�match�write�else_re)rr"r#r-r.r/� dest_file�dest�i�j�coveredr7�lineno�lines rr!zAnnotateReporter.annotate_fileCsX���H�/�0�0�
���)�*�*���(�+�,�,���>� /��t�~�&�&�&�����T�^�]�2�CW�CW�CY�CY�5Z�5Z�[�[�I��!�!�%�(�(�
3�%�c�r�c�N�U�2� ���!�I�I���h�.�I�
�)�S�7�
3�
3�
3� !�t��I�A���G��Y�Y�[�[�F� )�&�*;�*;�D�*A�*A�� K� K� K�
!�
!�����#�j�/�/�)�)�j��m�f�.D�.D���F�A��#�j�/�/�)�)�j��m�f�.D�.D��#�g�,�,�&�&�7�1�:��+>�+>���F�A��#�g�,�,�&�&�7�1�:��+>�+>��s�:���&�&�:�a�=�F�+B�+B��3�w�<�<�/�F�7�1�:��3F�G��=�&�&�t�,�,�%��J�J�t�$�$�$�$��\�'�'��-�-�
%��C��L�L�(�(��
�
�4�(�(�(�(�#�A��'�!�*�4�4��
�
�4�(�(�(�(��
�
�4�(�(�(�(��x�'�'��J�J�t�$�$�$�$��%��J�J�t�$�$�$�$��J�J�t�$�$�$��
�
�4� � � � �1
!� !� !� !� !� !� !� !� !� !� !� !� !���� !� !� !� !� !� !s� HL�L
�
L
)rrrrr)rrrrrr)r"r
r#rrr)�__name__�
__module__�__qualname__�__doc__r�re�compiler;r>r$r!�rrrrs���������*-�-�-�-�
�r�z�+�&�&�H��b�j�/�0�0�G� -� -� -� -� -�/!�/!�/!�/!�/!�/!rr)rI�
__future__rr0rJ�typingrrr�coverage.filesr�
coverage.miscrr �coverage.pluginr
�coverage.report_corer�coverage.resultsr�coverage.typesr
rrrrLrr�<module>rUs&��.�-�"�"�"�"�"�"� � � � � � � � �4�4�4�4�4�4�4�4�4�4�(�(�(�(�(�(�4�4�4�4�4�4�4�4�(�(�(�(�(�(�7�7�7�7�7�7�%�%�%�%�%�%� � � � � � ��"�!�!�!�!�!�!��^�B����X!�X!�X!�X!�X!�X!�X!�X!�X!�X!r
?>