From 25e9733389f1c98d5920f1ffbe09d5f97c50786f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Gr=C3=BCbel?= Date: Sat, 7 Aug 2021 22:53:26 +0900 Subject: [PATCH] add missing type hints in trace (#5865) * Parameter func in Trace.runfunc() became positional only in Python 3.9 * Add is_ignored_filename() --- stdlib/trace.pyi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stdlib/trace.pyi b/stdlib/trace.pyi index 810639869..dc8e8751f 100644 --- a/stdlib/trace.pyi +++ b/stdlib/trace.pyi @@ -1,3 +1,4 @@ +import sys import types from _typeshed import StrPath from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, TypeVar, Union @@ -20,6 +21,7 @@ class CoverageResults: def write_results_file( self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: Optional[str] = ... ) -> Tuple[int, int]: ... + def is_ignored_filename(self, filename: str) -> bool: ... # undocumented class Trace: def __init__( @@ -41,7 +43,10 @@ class Trace: globals: Optional[Mapping[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ..., ) -> None: ... - def runfunc(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... + if sys.version_info >= (3, 9): + def runfunc(self, __func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... + else: + def runfunc(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ... def file_module_function_of(self, frame: types.FrameType) -> _fileModuleFunction: ... def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ... def globaltrace_countfuncs(self, frame: types.FrameType, why: str, arg: Any) -> None: ...