$62 GRAYBYTE WORDPRESS FILE MANAGER $99

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.174
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/coverage/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/coverage//context.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

"""Determine contexts for coverage.py"""

from __future__ import annotations

from types import FrameType
from typing import cast, Callable, Optional, Sequence


def combine_context_switchers(
    context_switchers: Sequence[Callable[[FrameType], Optional[str]]],
) -> Optional[Callable[[FrameType], Optional[str]]]:
    """Create a single context switcher from multiple switchers.

    `context_switchers` is a list of functions that take a frame as an
    argument and return a string to use as the new context label.

    Returns a function that composites `context_switchers` functions, or None
    if `context_switchers` is an empty list.

    When invoked, the combined switcher calls `context_switchers` one-by-one
    until a string is returned.  The combined switcher returns None if all
    `context_switchers` return None.
    """
    if not context_switchers:
        return None

    if len(context_switchers) == 1:
        return context_switchers[0]

    def should_start_context(frame: FrameType) -> Optional[str]:
        """The combiner for multiple context switchers."""
        for switcher in context_switchers:
            new_context = switcher(frame)
            if new_context is not None:
                return new_context
        return None

    return should_start_context


def should_start_context_test_function(frame: FrameType) -> Optional[str]:
    """Is this frame calling a test_* function?"""
    co_name = frame.f_code.co_name
    if co_name.startswith("test") or co_name == "runTest":
        return qualname_from_frame(frame)
    return None


def qualname_from_frame(frame: FrameType) -> Optional[str]:
    """Get a qualified name for the code running in `frame`."""
    co = frame.f_code
    fname = co.co_name
    method = None
    if co.co_argcount and co.co_varnames[0] == "self":
        self = frame.f_locals.get("self", None)
        method = getattr(self, fname, None)

    if method is None:
        func = frame.f_globals.get(fname)
        if func is None:
            return None
        return cast(str, func.__module__ + "." + fname)

    func = getattr(method, "__func__", None)
    if func is None:
        cls = self.__class__
        return cast(str, cls.__module__ + "." + cls.__name__ + "." + fname)

    return cast(str, func.__module__ + "." + func.__qualname__)


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
9 Apr 2026 8.31 AM
root / root
0755
__pycache__
--
11 Feb 2026 9.30 AM
root / root
0755
fullcoverage
--
11 Feb 2026 9.30 AM
root / root
0755
htmlfiles
--
11 Feb 2026 9.30 AM
root / root
0755
__init__.py
1.254 KB
20 Jan 2026 1.01 PM
root / root
0644
__main__.py
0.251 KB
20 Jan 2026 1.01 PM
root / root
0644
annotate.py
3.67 KB
20 Jan 2026 1.01 PM
root / root
0644
bytecode.py
0.696 KB
20 Jan 2026 1.01 PM
root / root
0644
cmdline.py
33.62 KB
20 Jan 2026 1.01 PM
root / root
0644
collector.py
20.076 KB
20 Jan 2026 1.01 PM
root / root
0644
config.py
21.474 KB
20 Jan 2026 1.01 PM
root / root
0644
context.py
2.425 KB
20 Jan 2026 1.01 PM
root / root
0644
control.py
50.493 KB
20 Jan 2026 1.01 PM
root / root
0644
data.py
7.332 KB
20 Jan 2026 1.01 PM
root / root
0644
debug.py
17.388 KB
20 Jan 2026 1.01 PM
root / root
0644
disposition.py
1.871 KB
20 Jan 2026 1.01 PM
root / root
0644
env.py
5.938 KB
20 Jan 2026 1.01 PM
root / root
0644
exceptions.py
1.33 KB
20 Jan 2026 1.01 PM
root / root
0644
execfile.py
11.849 KB
20 Jan 2026 1.01 PM
root / root
0644
files.py
18.92 KB
20 Jan 2026 1.01 PM
root / root
0644
html.py
22.622 KB
20 Jan 2026 1.01 PM
root / root
0644
inorout.py
23.34 KB
20 Jan 2026 1.01 PM
root / root
0644
jsonreport.py
4.643 KB
20 Jan 2026 1.01 PM
root / root
0644
lcovreport.py
4.823 KB
20 Jan 2026 1.01 PM
root / root
0644
misc.py
11.887 KB
20 Jan 2026 1.01 PM
root / root
0644
multiproc.py
3.756 KB
20 Jan 2026 1.01 PM
root / root
0644
numbits.py
4.56 KB
20 Jan 2026 1.01 PM
root / root
0644
parser.py
55.391 KB
20 Jan 2026 1.01 PM
root / root
0644
phystokens.py
7.622 KB
20 Jan 2026 1.01 PM
root / root
0644
plugin.py
19.067 KB
20 Jan 2026 1.01 PM
root / root
0644
plugin_support.py
10.108 KB
20 Jan 2026 1.01 PM
root / root
0644
py.typed
0.07 KB
20 Jan 2026 1.01 PM
root / root
0644
python.py
7.877 KB
20 Jan 2026 1.01 PM
root / root
0644
pytracer.py
14.082 KB
20 Jan 2026 1.01 PM
root / root
0644
report.py
10.374 KB
20 Jan 2026 1.01 PM
root / root
0644
report_core.py
3.973 KB
20 Jan 2026 1.01 PM
root / root
0644
results.py
13.07 KB
20 Jan 2026 1.01 PM
root / root
0644
sqldata.py
50.093 KB
20 Jan 2026 1.01 PM
root / root
0644
templite.py
10.695 KB
20 Jan 2026 1.01 PM
root / root
0644
tomlconfig.py
7.392 KB
20 Jan 2026 1.01 PM
root / root
0644
tracer.cpython-311-x86_64-linux-gnu.so
28.773 KB
20 Jan 2026 1.18 PM
root / root
0755
types.py
5.396 KB
20 Jan 2026 1.01 PM
root / root
0644
version.py
1.397 KB
20 Jan 2026 1.01 PM
root / root
0644
xmlreport.py
9.565 KB
20 Jan 2026 1.01 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF