Edit File: jsonreport.cpython-311.pyc
� ����q�d�����������������������������d�Z�ddlmZ�ddlZddlZddlZddlmZmZm Z m Z mZmZm Z mZ�ddlmZ�ddlmZ�ddlmZmZ�ddlmZmZ�erdd lmZ�dd lmZ��G�d��d������������Zdd�ZdS�)zJson reporting for coverage.py�����)�annotationsN)�Any�Dict�IO�Iterable�List�Optional�Tuple� TYPE_CHECKING)�__version__)�get_analysis_to_report)�Analysis�Numbers)�TMorf�TLineNo)�Coverage)�CoverageDatac�������������������.�����e�Zd�ZdZdZdd�Zdd �Zdd�ZdS�)�JsonReporterz-A reporter for writing JSON coverage results.zJSON report�coverager����return�Nonec����������������������||�_���������|�j���������j��������|�_��������t����������|�j��������j��������������������|�_��������i�|�_��������d�S�)N)r����configr���� precision�total�report_data)�selfr���s��� �f/builddir/build/BUILD/cloudlinux-venv-1.0.2/venv/lib64/python3.11/site-packages/coverage/jsonreport.py�__init__zJsonReporter.__init__���s7������ �� ��m�*����T�[�2�3�3�� �+-����������morfs�Optional[Iterable[TMorf]]�outfile�IO[str]�floatc����������������������|pt�����������j��������}|�j�������������������������������������������}|���������������������|�j��������j���������������������t����������t����������j��������� ����������������������������������� ����������������������������������|�����������������������������������|�j��������j��������d�|�j ��������d<���i�}t����������|�j��������|������������D�]0\��}}|����������������������||������������||�����������������������������������<����1||�j ��������d<���|�j��������j��������|�j��������j��������|�j��������j��������|�j��������j��������|�j��������j��������|�j��������j��������d�|�j ��������d<���|�����������������������������������rM|�j ��������d������������������������������|�j��������j��������|�j��������j��������|�j��������j��������|�j��������j��������d��������������t;����������j��������|�j ��������||�j��������j��������rdnd� �������������|�j��������j��������o|�j��������j��������S�) z�Generate a json report for `morfs`. `morfs` is a list of modules or file names. `outfile` is a file object to write the json to. )�version� timestamp�branch_coverage� show_contexts�meta�files�� covered_lines�num_statements�percent_covered�percent_covered_display� missing_lines�excluded_lines�totals��num_branches�num_partial_branches�covered_branches�missing_branches����N)�indent) �sys�stdoutr����get_data�set_query_contextsr����report_contextsr����datetime�now� isoformat�has_arcs�json_show_contextsr���r ����report_one_file�relative_filenamer���� n_executed�n_statements� pc_covered�pc_covered_str� n_missing� n_excluded�update� n_branches�n_partial_branches�n_executed_branches�n_missing_branches�json�dump�json_pretty_print)r���r"���r$���� coverage_data�measured_files� file_reporter�analysiss��� r����reportzJsonReporter.report#���s��������'�S�Z��� �.�.�0�0� ��(�(���)D�E�E�E�"�!�*�.�.�0�0�:�:�<�<�,�5�5�7�7�!�[�;� $ ��$ ���� ����'=�d�m�U�'S�'S�� �� �#�M�8�@D�@T�@T���A��A�N�=�:�:�<�<�=�=� �%3����!��"�Z�2�"�j�5�#�z�4�'+�z�'@�!�Z�1�"�j�3� & ��& ����"���!�!�#�#�� ���X�&�-�-� $� � 5�(,� �(E�$(�J�$B�$(�J�$A� /��/�� �� �� �� � ������6�@�A�A�D� �� �� �� ���z�&�@�4�:�+@�@r!���rW���r���rZ���r����Dict[str, Any]c���������������������|j���������}|�xj��������|z ��c_��������|j��������|j��������|j��������|j��������|j��������|j��������d�}t����������|j ��������������������|t����������|j ��������������������t����������|j��������������������d�}|�j��������j ��������r"|j�����������������������������|j��������������������|d<���|�����������������������������������r�|���������������������|j��������|j��������|j��������|j��������d��������������t/����������t1����������|�����������������������������������������������������������|d<���t/����������t1����������|�����������������������������������������������������������|d<���|S�)z3Extract the relevant report data for a single file.r.���)�executed_lines�summaryr3���r4����contextsr6����executed_branchesr:���)�numbersr���rI���rJ���rK���rL���rM���rN����sorted�executed�missing�excludedr���rF����data�contexts_by_lineno�filenamerE���rO���rP���rQ���rR���rS����list�_convert_branch_arcs�executed_branch_arcs�missing_branch_arcs)r���rW���rZ����numsr_���� reported_files��� r���rG���zJsonReporter.report_one_fileW���s]��������� � �d�� � �!�_�"�/�#��'+�':�!�^�"�o� �� ���%�X�%6�7�7��#�H�$4�5�5�$�X�%6�7�7� �� � ���;�)�� \�(0� �(H�(H��IZ�([�([�M�*�%��!�!�#�#�� ��N�N� $��(,�(?�$(�$<�$(�$;� ���� �� �� ��26�$�X�%B�%B�%D�%D�E�E�2��2�M�-�.��15�$�X�%A�%A�%C�%C�D�D�1��1�M�,�-���r!���N)r���r���r���r���)r"���r#���r$���r%���r���r&���)rW���r���rZ���r���r���r\���)�__name__� __module__�__qualname__�__doc__�report_typer ���r[���rG�����r!���r���r���r������s`��������������7�7��K�.��.��.��.�2A��2A��2A��2A�h!��!��!��!��!��!r!���r����branch_arcs�Dict[TLineNo, List[TLineNo]]r����!Iterable[Tuple[TLineNo, TLineNo]]c��������������#���T���K����|�������������������������������������D�]\��}}|D�]}||fV���� �dS�)z4Convert branch arcs to a list of two-element tuples.N)�items)rv����source�targets�targets��� r���rk���rk���{���sX�����������'�,�,�.�.��!��!������ !�� !�F��&�.� � � � � !�!��!r!���)rv���rw���r���rx���)rs���� __future__r���rB���rT���r=����typingr���r���r���r���r���r ���r ���r���r���r����coverage.report_corer ����coverage.resultsr���r����coverage.typesr���r���r���� coverage.datar���r���rk���ru���r!���r����<module>r�������sE�����%��$��"��"��"��"��"��"������������ � � � ��P��P��P��P��P��P��P��P��P��P��P��P��P��P��P��P��P��P��P��P�� �� �� �� �� �� ��7��7��7��7��7��7��.��.��.��.��.��.��.��.��)��)��)��)��)��)��)��)���+�!�!�!�!�!�!�*�*�*�*�*�*�`��`��`��`��`��`��`��`�F!��!��!��!��!��!r!���