Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,20 +1,13 @@
from types import ModuleType, TracebackType
from typing import Any, List, Optional, TextIO, Type, Union, overload
from typing import Any, List, TextIO, Type, overload
from typing_extensions import Literal
from _warnings import warn as warn, warn_explicit as warn_explicit
def showwarning(
message: Union[Warning, str],
category: Type[Warning],
filename: str,
lineno: int,
file: Optional[TextIO] = ...,
line: Optional[str] = ...,
message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ...
) -> None: ...
def formatwarning(
message: Union[Warning, str], category: Type[Warning], filename: str, lineno: int, line: Optional[str] = ...
) -> str: ...
def formatwarning(message: Warning | str, category: Type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ...
def filterwarnings(
action: str, message: str = ..., category: Type[Warning] = ..., module: str = ..., lineno: int = ..., append: bool = ...
) -> None: ...
@@ -24,34 +17,34 @@ def resetwarnings() -> None: ...
class _OptionError(Exception): ...
class WarningMessage:
message: Union[Warning, str]
message: Warning | str
category: Type[Warning]
filename: str
lineno: int
file: Optional[TextIO]
line: Optional[str]
source: Optional[Any]
file: TextIO | None
line: str | None
source: Any | None
def __init__(
self,
message: Union[Warning, str],
message: Warning | str,
category: Type[Warning],
filename: str,
lineno: int,
file: Optional[TextIO] = ...,
line: Optional[str] = ...,
source: Optional[Any] = ...,
file: TextIO | None = ...,
line: str | None = ...,
source: Any | None = ...,
) -> None: ...
class catch_warnings:
@overload
def __new__(cls, *, record: Literal[False] = ..., module: Optional[ModuleType] = ...) -> _catch_warnings_without_records: ...
def __new__(cls, *, record: Literal[False] = ..., module: ModuleType | None = ...) -> _catch_warnings_without_records: ...
@overload
def __new__(cls, *, record: Literal[True], module: Optional[ModuleType] = ...) -> _catch_warnings_with_records: ...
def __new__(cls, *, record: Literal[True], module: ModuleType | None = ...) -> _catch_warnings_with_records: ...
@overload
def __new__(cls, *, record: bool, module: Optional[ModuleType] = ...) -> catch_warnings: ...
def __enter__(self) -> Optional[List[WarningMessage]]: ...
def __new__(cls, *, record: bool, module: ModuleType | None = ...) -> catch_warnings: ...
def __enter__(self) -> List[WarningMessage] | None: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class _catch_warnings_without_records(catch_warnings):