Allow Warning message in showwarning and formatwarning (#4239)

This commit is contained in:
Vlad Emelianov
2020-06-18 02:44:09 +02:00
committed by GitHub
parent 68a7b9b178
commit d21370965a

View File

@@ -1,15 +1,15 @@
import sys
from types import ModuleType, TracebackType
from typing import Any, List, NamedTuple, Optional, TextIO, Type, overload
from typing import Any, List, NamedTuple, Optional, TextIO, Type, Union, overload
from typing_extensions import Literal
from _warnings import warn as warn, warn_explicit as warn_explicit
def showwarning(
message: str, category: Type[Warning], filename: str, lineno: int, file: Optional[TextIO] = ..., line: Optional[str] = ...
message: Union[Warning, str], category: Type[Warning], filename: str, lineno: int, file: Optional[TextIO] = ..., line: Optional[str] = ...
) -> None: ...
def formatwarning(message: str, category: Type[Warning], filename: str, lineno: int, line: Optional[str] = ...) -> str: ...
def formatwarning(message: Union[Warning, str], category: Type[Warning], filename: str, lineno: int, line: Optional[str] = ...) -> str: ...
def filterwarnings(
action: str, message: str = ..., category: Type[Warning] = ..., module: str = ..., lineno: int = ..., append: bool = ...
) -> None: ...
@@ -19,7 +19,7 @@ def resetwarnings() -> None: ...
class _OptionError(Exception): ...
class WarningMessage:
message: Warning
message: Union[Warning, str]
category: Type[Warning]
filename: str
lineno: int
@@ -29,7 +29,7 @@ class WarningMessage:
source: Optional[Any]
def __init__(
self,
message: Warning,
message: Union[Warning, str],
category: Type[Warning],
filename: str,
lineno: int,
@@ -40,7 +40,7 @@ class WarningMessage:
else:
def __init__(
self,
message: Warning,
message: Union[Warning, str],
category: Type[Warning],
filename: str,
lineno: int,