add missing type hints in trace (#5865)

* Parameter func in Trace.runfunc() became positional only in Python 3.9
* Add is_ignored_filename()
This commit is contained in:
Anton Grübel
2021-08-07 22:53:26 +09:00
committed by GitHub
parent 36799fd63c
commit 25e9733389

View File

@@ -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: ...