| 1 |
import sys |
| 2 |
import types |
| 3 |
from _typeshed import Incomplete, StrPath, TraceFunction |
| 4 |
from collections.abc import Callable, Iterable, Mapping, Sequence |
| 5 |
from typing import Any, TypeVar |
| 6 |
from typing_extensions import ParamSpec, TypeAlias |
| 7 |
|
| 8 |
__all__ = ["Trace", "CoverageResults"] |
| 9 |
|
| 10 |
_T = TypeVar("_T") |
| 11 |
_P = ParamSpec("_P") |
| 12 |
_FileModuleFunction: TypeAlias = tuple[str, str | None, str] |
| 13 |
|
| 14 |
class CoverageResults: |
| 15 |
counts: dict[tuple[str, int], int] |
| 16 |
counter: dict[tuple[str, int], int] |
| 17 |
calledfuncs: dict[_FileModuleFunction, int] |
| 18 |
callers: dict[tuple[_FileModuleFunction, _FileModuleFunction], int] |
| 19 |
inifile: StrPath | None |
| 20 |
outfile: StrPath | None |
| 21 |
def __init__( |
| 22 |
self, |
| 23 |
counts: dict[tuple[str, int], int] | None = None, |
| 24 |
calledfuncs: dict[_FileModuleFunction, int] | None = None, |
| 25 |
infile: StrPath | None = None, |
| 26 |
callers: dict[tuple[_FileModuleFunction, _FileModuleFunction], int] | None = None, |
| 27 |
outfile: StrPath | None = None, |
| 28 |
) -> None: ... |
| 29 |
def update(self, other: CoverageResults) -> None: ... |
| 30 |
if sys.version_info >= (3, 13): |
| 31 |
def write_results( |
| 32 |
self, |
| 33 |
show_missing: bool = True, |
| 34 |
summary: bool = False, |
| 35 |
coverdir: StrPath | None = None, |
| 36 |
*, |
| 37 |
ignore_missing_files: bool = False, |
| 38 |
) -> None: ... |
| 39 |
else: |
| 40 |
def write_results(self, show_missing: bool = True, summary: bool = False, coverdir: StrPath | None = None) -> None: ... |
| 41 |
|
| 42 |
def write_results_file( |
| 43 |
self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: str | None = None |
| 44 |
) -> tuple[int, int]: ... |
| 45 |
def is_ignored_filename(self, filename: str) -> bool: ... |
| 46 |
|
| 47 |
class _Ignore: |
| 48 |
def __init__(self, modules: Iterable[str] | None = None, dirs: Iterable[StrPath] | None = None) -> None: ... |
| 49 |
def names(self, filename: str, modulename: str) -> int: ... |
| 50 |
|
| 51 |
class Trace: |
| 52 |
inifile: StrPath | None |
| 53 |
outfile: StrPath | None |
| 54 |
ignore: _Ignore |
| 55 |
counts: dict[str, int] |
| 56 |
pathtobasename: dict[Incomplete, Incomplete] |
| 57 |
donothing: int |
| 58 |
trace: int |
| 59 |
start_time: int | None |
| 60 |
globaltrace: TraceFunction |
| 61 |
localtrace: TraceFunction |
| 62 |
def __init__( |
| 63 |
self, |
| 64 |
count: int = 1, |
| 65 |
trace: int = 1, |
| 66 |
countfuncs: int = 0, |
| 67 |
countcallers: int = 0, |
| 68 |
ignoremods: Sequence[str] = (), |
| 69 |
ignoredirs: Sequence[str] = (), |
| 70 |
infile: StrPath | None = None, |
| 71 |
outfile: StrPath | None = None, |
| 72 |
timing: bool = False, |
| 73 |
) -> None: ... |
| 74 |
def run(self, cmd: str | types.CodeType) -> None: ... |
| 75 |
def runctx( |
| 76 |
self, cmd: str | types.CodeType, globals: Mapping[str, Any] | None = None, locals: Mapping[str, Any] | None = None |
| 77 |
) -> None: ... |
| 78 |
def runfunc(self, func: Callable[_P, _T], /, *args: _P.args, **kw: _P.kwargs) -> _T: ... |
| 79 |
def file_module_function_of(self, frame: types.FrameType) -> _FileModuleFunction: ... |
| 80 |
def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ... |
| 81 |
def globaltrace_countfuncs(self, frame: types.FrameType, why: str, arg: Any) -> None: ... |
| 82 |
def globaltrace_lt(self, frame: types.FrameType, why: str, arg: Any) -> None: ... |
| 83 |
def localtrace_trace_and_count(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ... |
| 84 |
def localtrace_trace(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ... |
| 85 |
def localtrace_count(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ... |
| 86 |
def results(self) -> CoverageResults: ... |