warnings: ignore the type of category when message is a Warning (#3121)

This commit is contained in:
Ran Benita authored and Sebastian Rittau committed 2019-07-24 21:46:23 +02:00
1 parent 0177dedc42
commit 9a7b286c66
1 file changed
+12 -4
+12 -4
View File
@@ -1,11 +1,19 @@
# Stubs for warnings
from typing import Any, Dict, List, NamedTuple, Optional, TextIO, Tuple, Type, Union
from typing import Any, Dict, List, NamedTuple, Optional, overload, TextIO, Tuple, Type, Union
from types import ModuleType, TracebackType
def warn(message: Union[str, Warning], category: Optional[Type[Warning]] = ...,
stacklevel: int = ...) -> None: ...
def warn_explicit(message: Union[str, Warning], category: Type[Warning],
@overload
def warn(message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ...) -> None: ...
@overload
def warn_explicit(message: str, category: Type[Warning],
filename: str, lineno: int, module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...) -> None: ...
@overload
def warn_explicit(message: Warning, category: Any,
filename: str, lineno: int, module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...) -> None: ...