Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.129.209.194
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/ansible_test/_internal/commands/coverage/analyze/targets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /lib/python3/dist-packages/ansible_test/_internal/commands/coverage/analyze/targets/combine.py
"""Combine integration test target code coverage reports."""
from __future__ import annotations
import typing as t

from .....executor import (
    Delegate,
)

from .....provisioning import (
    prepare_profiles,
)

from . import (
    CoverageAnalyzeTargetsConfig,
    get_target_index,
    make_report,
    read_report,
    write_report,
)

from . import (
    Arcs,
    IndexedPoints,
    Lines,
    TargetIndexes,
)


class CoverageAnalyzeTargetsCombineConfig(CoverageAnalyzeTargetsConfig):
    """Configuration for the `coverage analyze targets combine` command."""

    def __init__(self, args: t.Any) -> None:
        super().__init__(args)

        self.input_files: list[str] = args.input_file
        self.output_file: str = args.output_file


def command_coverage_analyze_targets_combine(args: CoverageAnalyzeTargetsCombineConfig) -> None:
    """Combine integration test target code coverage reports."""
    host_state = prepare_profiles(args)  # coverage analyze targets combine

    if args.delegate:
        raise Delegate(host_state=host_state)

    combined_target_indexes: TargetIndexes = {}
    combined_path_arcs: Arcs = {}
    combined_path_lines: Lines = {}

    for report_path in args.input_files:
        covered_targets, covered_path_arcs, covered_path_lines = read_report(report_path)

        merge_indexes(covered_path_arcs, covered_targets, combined_path_arcs, combined_target_indexes)
        merge_indexes(covered_path_lines, covered_targets, combined_path_lines, combined_target_indexes)

    report = make_report(combined_target_indexes, combined_path_arcs, combined_path_lines)

    write_report(args, report, args.output_file)


def merge_indexes(
    source_data: IndexedPoints,
    source_index: list[str],
    combined_data: IndexedPoints,
    combined_index: TargetIndexes,
) -> None:
    """Merge indexes from the source into the combined data set (arcs or lines)."""
    for covered_path, covered_points in source_data.items():
        combined_points = combined_data.setdefault(covered_path, {})

        for covered_point, covered_target_indexes in covered_points.items():
            combined_point = combined_points.setdefault(covered_point, set())

            for covered_target_index in covered_target_indexes:
                combined_point.add(get_target_index(source_index[covered_target_index], combined_index))

Anon7 - 2022
AnonSec Team