SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > coverage > >


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11/site-packages/coverage//

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
fullcoverage Directory - -
htmlfiles Directory - -
__init__.py File 1284 bytes April 17 2025 13:10:59.
__main__.py File 257 bytes April 17 2025 13:10:59.
annotate.py File 3758 bytes April 17 2025 13:10:59.
bytecode.py File 713 bytes April 17 2025 13:10:59.
cmdline.py File 34427 bytes April 17 2025 13:10:59.
collector.py File 20558 bytes April 17 2025 13:10:59.
config.py File 21989 bytes April 17 2025 13:10:59.
context.py File 2483 bytes April 17 2025 13:10:59.
control.py File 51705 bytes April 17 2025 13:10:59.
data.py File 7508 bytes April 17 2025 13:10:59.
debug.py File 17805 bytes April 17 2025 13:10:59.
disposition.py File 1916 bytes April 17 2025 13:10:59.
env.py File 6081 bytes April 17 2025 13:10:59.
exceptions.py File 1362 bytes April 17 2025 13:10:59.
execfile.py File 12133 bytes April 17 2025 13:10:59.
files.py File 19374 bytes April 17 2025 13:10:59.
html.py File 23165 bytes April 17 2025 13:10:59.
inorout.py File 23900 bytes April 17 2025 13:10:59.
jsonreport.py File 4754 bytes April 17 2025 13:10:59.
lcovreport.py File 4939 bytes April 17 2025 13:10:59.
misc.py File 12172 bytes April 17 2025 13:10:59.
multiproc.py File 3846 bytes April 17 2025 13:10:59.
numbits.py File 4669 bytes April 17 2025 13:10:59.
parser.py File 56720 bytes April 17 2025 13:10:59.
phystokens.py File 7805 bytes April 17 2025 13:10:59.
plugin.py File 19525 bytes April 17 2025 13:10:59.
plugin_support.py File 10351 bytes April 17 2025 13:10:59.
py.typed File 72 bytes April 17 2025 13:10:59.
python.py File 8066 bytes April 17 2025 13:10:59.
pytracer.py File 14420 bytes April 17 2025 13:10:59.
report.py File 10623 bytes April 17 2025 13:10:59.
report_core.py File 4068 bytes April 17 2025 13:10:59.
results.py File 13384 bytes April 17 2025 13:10:59.
sqldata.py File 51295 bytes April 17 2025 13:10:59.
templite.py File 10952 bytes April 17 2025 13:10:59.
tomlconfig.py File 7569 bytes April 17 2025 13:10:59.
tracer.cpython-311-x86_64-linux-gnu.so File 29464 bytes April 17 2025 13:11:30.
types.py File 5526 bytes April 17 2025 13:10:59.
version.py File 1431 bytes April 17 2025 13:10:59.
xmlreport.py File 9795 bytes April 17 2025 13:10:59.

Reading File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/coverage///report_core.py

# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt

"""Reporter foundation for coverage.py."""

from __future__ import annotations

import sys

from typing import Callable, Iterable, Iterator, IO, Optional, Tuple, TYPE_CHECKING

from coverage.exceptions import NoDataError, NotPython
from coverage.files import prep_patterns, GlobMatcher
from coverage.misc import ensure_dir_for_file, file_be_gone
from coverage.plugin import FileReporter
from coverage.results import Analysis
from coverage.types import Protocol, TMorf

if TYPE_CHECKING:
    from coverage import Coverage


class Reporter(Protocol):
    """What we expect of reporters."""

    report_type: str

    def report(self, morfs: Optional[Iterable[TMorf]], outfile: IO[str]) -> float:
        """Generate a report of `morfs`, written to `outfile`."""


def render_report(
    output_path: str,
    reporter: Reporter,
    morfs: Optional[Iterable[TMorf]],
    msgfn: Callable[[str], None],
) -> float:
    """Run a one-file report generator, managing the output file.

    This function ensures the output file is ready to be written to. Then writes
    the report to it. Then closes the file and cleans up.

    """
    file_to_close = None
    delete_file = False

    if output_path == "-":
        outfile = sys.stdout
    else:
        # Ensure that the output directory is created; done here because this
        # report pre-opens the output file.  HtmlReporter does this on its own
        # because its task is more complex, being multiple files.
        ensure_dir_for_file(output_path)
        outfile = open(output_path, "w", encoding="utf-8")
        file_to_close = outfile
        delete_file = True

    try:
        ret = reporter.report(morfs, outfile=outfile)
        if file_to_close is not None:
            msgfn(f"Wrote {reporter.report_type} to {output_path}")
        delete_file = False
        return ret
    finally:
        if file_to_close is not None:
            file_to_close.close()
            if delete_file:
                file_be_gone(output_path)           # pragma: part covered (doesn't return)


def get_analysis_to_report(
    coverage: Coverage,
    morfs: Optional[Iterable[TMorf]],
) -> Iterator[Tuple[FileReporter, Analysis]]:
    """Get the files to report on.

    For each morf in `morfs`, if it should be reported on (based on the omit
    and include configuration options), yield a pair, the `FileReporter` and
    `Analysis` for the morf.

    """
    file_reporters = coverage._get_file_reporters(morfs)
    config = coverage.config

    if config.report_include:
        matcher = GlobMatcher(prep_patterns(config.report_include), "report_include")
        file_reporters = [fr for fr in file_reporters if matcher.match(fr.filename)]

    if config.report_omit:
        matcher = GlobMatcher(prep_patterns(config.report_omit), "report_omit")
        file_reporters = [fr for fr in file_reporters if not matcher.match(fr.filename)]

    if not file_reporters:
        raise NoDataError("No data to report.")

    for fr in sorted(file_reporters):
        try:
            analysis = coverage._analyze(fr)
        except NotPython:
            # Only report errors for .py files, and only if we didn't
            # explicitly suppress those errors.
            # NotPython is only raised by PythonFileReporter, which has a
            # should_be_python() method.
            if fr.should_be_python():       # type: ignore[attr-defined]
                if config.ignore_errors:
                    msg = f"Couldn't parse Python file '{fr.filename}'"
                    coverage._warn(msg, slug="couldnt-parse")
                else:
                    raise
        except Exception as exc:
            if config.ignore_errors:
                msg = f"Couldn't parse '{fr.filename}': {exc}".rstrip()
                coverage._warn(msg, slug="couldnt-parse")
            else:
                raise
        else:
            yield (fr, analysis)

SILENT KILLER Tool