coverage 7.13.1__cp314-cp314t-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- a1_coverage.pth +1 -0
- coverage/__init__.py +38 -0
- coverage/__main__.py +12 -0
- coverage/annotate.py +113 -0
- coverage/bytecode.py +197 -0
- coverage/cmdline.py +1220 -0
- coverage/collector.py +487 -0
- coverage/config.py +732 -0
- coverage/context.py +74 -0
- coverage/control.py +1514 -0
- coverage/core.py +139 -0
- coverage/data.py +251 -0
- coverage/debug.py +669 -0
- coverage/disposition.py +59 -0
- coverage/env.py +135 -0
- coverage/exceptions.py +85 -0
- coverage/execfile.py +329 -0
- coverage/files.py +553 -0
- coverage/html.py +860 -0
- coverage/htmlfiles/coverage_html.js +735 -0
- coverage/htmlfiles/favicon_32.png +0 -0
- coverage/htmlfiles/index.html +199 -0
- coverage/htmlfiles/keybd_closed.png +0 -0
- coverage/htmlfiles/pyfile.html +149 -0
- coverage/htmlfiles/style.css +389 -0
- coverage/htmlfiles/style.scss +844 -0
- coverage/inorout.py +590 -0
- coverage/jsonreport.py +200 -0
- coverage/lcovreport.py +218 -0
- coverage/misc.py +381 -0
- coverage/multiproc.py +120 -0
- coverage/numbits.py +146 -0
- coverage/parser.py +1215 -0
- coverage/patch.py +118 -0
- coverage/phystokens.py +197 -0
- coverage/plugin.py +617 -0
- coverage/plugin_support.py +299 -0
- coverage/pth_file.py +16 -0
- coverage/py.typed +1 -0
- coverage/python.py +272 -0
- coverage/pytracer.py +370 -0
- coverage/regions.py +127 -0
- coverage/report.py +298 -0
- coverage/report_core.py +117 -0
- coverage/results.py +502 -0
- coverage/sqldata.py +1212 -0
- coverage/sqlitedb.py +226 -0
- coverage/sysmon.py +509 -0
- coverage/templite.py +319 -0
- coverage/tomlconfig.py +212 -0
- coverage/tracer.cpython-314t-aarch64-linux-musl.so +0 -0
- coverage/tracer.pyi +43 -0
- coverage/types.py +214 -0
- coverage/version.py +35 -0
- coverage/xmlreport.py +263 -0
- coverage-7.13.1.dist-info/METADATA +200 -0
- coverage-7.13.1.dist-info/RECORD +61 -0
- coverage-7.13.1.dist-info/WHEEL +5 -0
- coverage-7.13.1.dist-info/entry_points.txt +4 -0
- coverage-7.13.1.dist-info/licenses/LICENSE.txt +177 -0
- coverage-7.13.1.dist-info/top_level.txt +1 -0
coverage/context.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
|
|
2
|
+
# For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt
|
|
3
|
+
|
|
4
|
+
"""Determine contexts for coverage.py"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Sequence
|
|
9
|
+
from types import FrameType
|
|
10
|
+
|
|
11
|
+
from coverage.types import TShouldStartContextFn
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def combine_context_switchers(
|
|
15
|
+
context_switchers: Sequence[TShouldStartContextFn],
|
|
16
|
+
) -> TShouldStartContextFn | None:
|
|
17
|
+
"""Create a single context switcher from multiple switchers.
|
|
18
|
+
|
|
19
|
+
`context_switchers` is a list of functions that take a frame as an
|
|
20
|
+
argument and return a string to use as the new context label.
|
|
21
|
+
|
|
22
|
+
Returns a function that composites `context_switchers` functions, or None
|
|
23
|
+
if `context_switchers` is an empty list.
|
|
24
|
+
|
|
25
|
+
When invoked, the combined switcher calls `context_switchers` one-by-one
|
|
26
|
+
until a string is returned. The combined switcher returns None if all
|
|
27
|
+
`context_switchers` return None.
|
|
28
|
+
"""
|
|
29
|
+
if not context_switchers:
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
if len(context_switchers) == 1:
|
|
33
|
+
return context_switchers[0]
|
|
34
|
+
|
|
35
|
+
def should_start_context(frame: FrameType) -> str | None:
|
|
36
|
+
"""The combiner for multiple context switchers."""
|
|
37
|
+
for switcher in context_switchers:
|
|
38
|
+
new_context = switcher(frame)
|
|
39
|
+
if new_context is not None:
|
|
40
|
+
return new_context
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
return should_start_context
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def should_start_context_test_function(frame: FrameType) -> str | None:
|
|
47
|
+
"""Is this frame calling a test_* function?"""
|
|
48
|
+
co_name = frame.f_code.co_name
|
|
49
|
+
if co_name.startswith("test") or co_name == "runTest":
|
|
50
|
+
return qualname_from_frame(frame)
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def qualname_from_frame(frame: FrameType) -> str | None:
|
|
55
|
+
"""Get a qualified name for the code running in `frame`."""
|
|
56
|
+
co = frame.f_code
|
|
57
|
+
fname = co.co_name
|
|
58
|
+
method = None
|
|
59
|
+
if co.co_argcount and co.co_varnames[0] == "self":
|
|
60
|
+
self = frame.f_locals.get("self", None)
|
|
61
|
+
method = getattr(self, fname, None)
|
|
62
|
+
|
|
63
|
+
if method is None:
|
|
64
|
+
func = frame.f_globals.get(fname)
|
|
65
|
+
if func is None:
|
|
66
|
+
return None
|
|
67
|
+
return f"{func.__module__}.{fname}"
|
|
68
|
+
|
|
69
|
+
func = getattr(method, "__func__", None)
|
|
70
|
+
if func is None:
|
|
71
|
+
cls = self.__class__
|
|
72
|
+
return f"{cls.__module__}.{cls.__name__}.{fname}"
|
|
73
|
+
|
|
74
|
+
return f"{func.__module__}.{func.__qualname__}"
|