Add typestubs for the warnings module (#3543)

This commit is contained in:
dave-shawley
2019-12-21 15:29:34 -05:00
committed by Jelle Zijlstra
parent 0c563130fd
commit c44a556fb0
3 changed files with 74 additions and 34 deletions

View File

@@ -2,6 +2,7 @@ import datetime
import logging
import sys
import unittest.result
import warnings
from types import TracebackType
from typing import (
Any, AnyStr, Callable, Container, ContextManager, Dict, FrozenSet, Generic,
@@ -233,9 +234,10 @@ class _AssertRaisesContext(Generic[_E]):
exc_tb: Optional[TracebackType]) -> bool: ...
class _AssertWarnsContext:
warning: Warning
warning: warnings.WarningMessage
filename: str
lineno: int
warnings: List[warnings.WarningMessage]
def __enter__(self) -> _AssertWarnsContext: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]) -> None: ...