Improve unittest.removeHandler in Python 2 (#7055)

This brings the signature in line with the signature of `removeHandler` in Python 3:

a54e21992c/stdlib/unittest/signals.pyi (L11-L14)
This commit is contained in:
Alex Waygood
2022-01-27 17:04:18 +00:00
committed by GitHub
parent 2d8decd237
commit f7a7e0b386

View File

@@ -2,9 +2,11 @@ import datetime
import types
from abc import ABCMeta, abstractmethod
from typing import Any, Callable, Iterable, Iterator, Mapping, NoReturn, Pattern, Sequence, Text, TextIO, TypeVar, Union, overload
from typing_extensions import ParamSpec
_T = TypeVar("_T")
_FT = TypeVar("_FT")
_P = ParamSpec("_P")
_ExceptionType = Union[type[BaseException], tuple[type[BaseException], ...]]
_Regexp = Union[Text, Pattern[Text]]
@@ -251,7 +253,7 @@ def removeResult(result: TestResult) -> bool: ...
@overload
def removeHandler() -> None: ...
@overload
def removeHandler(function: Callable[..., Any]) -> Callable[..., Any]: ...
def removeHandler(function: Callable[_P, _T]) -> Callable[_P, _T]: ...
# private but occasionally used
util: types.ModuleType