| 1 |
import _lsprof |
| 2 |
from _typeshed import StrOrBytesPath, Unused |
| 3 |
from collections.abc import Callable, Mapping |
| 4 |
from types import CodeType |
| 5 |
from typing import Any, TypeVar |
| 6 |
from typing_extensions import ParamSpec, Self, TypeAlias |
| 7 |
|
| 8 |
__all__ = ["run", "runctx", "Profile"] |
| 9 |
|
| 10 |
def run(statement: str, filename: str | None = None, sort: str | int = -1) -> None: ... |
| 11 |
def runctx( |
| 12 |
statement: str, globals: dict[str, Any], locals: Mapping[str, Any], filename: str | None = None, sort: str | int = -1 |
| 13 |
) -> None: ... |
| 14 |
|
| 15 |
_T = TypeVar("_T") |
| 16 |
_P = ParamSpec("_P") |
| 17 |
_Label: TypeAlias = tuple[str, int, str] |
| 18 |
|
| 19 |
class Profile(_lsprof.Profiler): |
| 20 |
stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] |
| 21 |
def print_stats(self, sort: str | int = -1) -> None: ... |
| 22 |
def dump_stats(self, file: StrOrBytesPath) -> None: ... |
| 23 |
def create_stats(self) -> None: ... |
| 24 |
def snapshot_stats(self) -> None: ... |
| 25 |
def run(self, cmd: str) -> Self: ... |
| 26 |
def runctx(self, cmd: str, globals: dict[str, Any], locals: Mapping[str, Any]) -> Self: ... |
| 27 |
def runcall(self, func: Callable[_P, _T], /, *args: _P.args, **kw: _P.kwargs) -> _T: ... |
| 28 |
def __enter__(self) -> Self: ... |
| 29 |
def __exit__(self, *exc_info: Unused) -> None: ... |
| 30 |
|
| 31 |
def label(code: str | CodeType) -> _Label: ... |