Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions stdlib/warnings.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ if sys.version_info >= (3, 14):
_ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "module", "once"]
else:
_ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "all", "module", "once"]
filters: Sequence[tuple[str, re.Pattern[str] | None, type[Warning], re.Pattern[str] | None, int]] # undocumented, do not mutate
filters: Sequence[
tuple[str, re.Pattern[str] | None, type[Warning] | tuple[type[Warning], ...], re.Pattern[str] | None, int]
] # undocumented, do not mutate

def showwarning(
message: Warning | str,
Expand All @@ -43,7 +45,9 @@ def formatwarning(
def filterwarnings(
action: _ActionKind, message: str = "", category: type[Warning] = ..., module: str = "", lineno: int = 0, append: bool = False
) -> None: ...
def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = 0, append: bool = False) -> None: ...
def simplefilter(
action: _ActionKind, category: type[Warning] | tuple[type[Warning], ...] = ..., lineno: int = 0, append: bool = False
) -> None: ...
def resetwarnings() -> None: ...

class _OptionError(Exception): ...
Expand Down Expand Up @@ -92,7 +96,7 @@ class catch_warnings(Generic[_W_co]):
record: Literal[False] = False,
module: ModuleType | None = None,
action: _ActionKind | None = None,
category: type[Warning] = ...,
category: type[Warning] | tuple[type[Warning], ...] = ...,
lineno: int = 0,
append: bool = False,
) -> None: ...
Expand All @@ -103,7 +107,7 @@ class catch_warnings(Generic[_W_co]):
record: Literal[True],
module: ModuleType | None = None,
action: _ActionKind | None = None,
category: type[Warning] = ...,
category: type[Warning] | tuple[type[Warning], ...] = ...,
lineno: int = 0,
append: bool = False,
) -> None: ...
Expand All @@ -114,7 +118,7 @@ class catch_warnings(Generic[_W_co]):
record: bool,
module: ModuleType | None = None,
action: _ActionKind | None = None,
category: type[Warning] = ...,
category: type[Warning] | tuple[type[Warning], ...] = ...,
lineno: int = 0,
append: bool = False,
) -> None: ...
Expand Down
Loading