mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +08:00
add _lsprof module (#11159)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
@@ -73,6 +73,7 @@ extra-standard-library = [
|
||||
"_imp",
|
||||
"_json",
|
||||
"_locale",
|
||||
"_lsprof",
|
||||
"_markupbase",
|
||||
"_msi",
|
||||
"_operator",
|
||||
|
||||
@@ -36,6 +36,7 @@ _heapq: 3.0-
|
||||
_imp: 3.0-
|
||||
_json: 3.0-
|
||||
_locale: 3.0-
|
||||
_lsprof: 3.0-
|
||||
_markupbase: 3.0-
|
||||
_msi: 3.0-
|
||||
_operator: 3.4-
|
||||
|
||||
35
stdlib/_lsprof.pyi
Normal file
35
stdlib/_lsprof.pyi
Normal file
@@ -0,0 +1,35 @@
|
||||
import sys
|
||||
from _typeshed import structseq
|
||||
from collections.abc import Callable
|
||||
from types import CodeType
|
||||
from typing import Any, Final, final
|
||||
|
||||
class Profiler:
|
||||
def __init__(
|
||||
self, timer: Callable[[], float] | None = None, timeunit: float = 0.0, subcalls: bool = True, builtins: bool = True
|
||||
) -> None: ...
|
||||
def getstats(self) -> list[profiler_entry]: ...
|
||||
def enable(self, subcalls: bool = True, builtins: bool = True) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
|
||||
@final
|
||||
class profiler_entry(structseq[Any], tuple[CodeType | str, int, int, float, float, list[profiler_subentry]]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("code", "callcount", "reccallcount", "totaltime", "inlinetime", "calls")
|
||||
code: CodeType | str
|
||||
callcount: int
|
||||
reccallcount: int
|
||||
totaltime: float
|
||||
inlinetime: float
|
||||
calls: list[profiler_subentry]
|
||||
|
||||
@final
|
||||
class profiler_subentry(structseq[Any], tuple[CodeType | str, int, int, float, float]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("code", "callcount", "reccallcount", "totaltime", "inlinetime")
|
||||
code: CodeType | str
|
||||
callcount: int
|
||||
reccallcount: int
|
||||
totaltime: float
|
||||
inlinetime: float
|
||||
@@ -1,3 +1,4 @@
|
||||
import _lsprof
|
||||
from _typeshed import StrOrBytesPath, Unused
|
||||
from collections.abc import Callable
|
||||
from types import CodeType
|
||||
@@ -15,13 +16,8 @@ _T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
_Label: TypeAlias = tuple[str, int, str]
|
||||
|
||||
class Profile:
|
||||
class Profile(_lsprof.Profiler):
|
||||
stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] # undocumented
|
||||
def __init__(
|
||||
self, timer: Callable[[], float] = ..., timeunit: float = ..., subcalls: bool = ..., builtins: bool = ...
|
||||
) -> None: ...
|
||||
def enable(self) -> None: ...
|
||||
def disable(self) -> None: ...
|
||||
def print_stats(self, sort: str | int = -1) -> None: ...
|
||||
def dump_stats(self, file: StrOrBytesPath) -> None: ...
|
||||
def create_stats(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user