diff --git a/stdlib/2/os/__init__.pyi b/stdlib/2/os/__init__.pyi index 8dad31d6b..3951ba6c9 100644 --- a/stdlib/2/os/__init__.pyi +++ b/stdlib/2/os/__init__.pyi @@ -3,6 +3,7 @@ from builtins import OSError as error from io import TextIOWrapper as _TextIOWrapper +from posix import stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078 import sys from typing import ( Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr, @@ -126,6 +127,7 @@ _StatVFS = NamedTuple('_StatVFS', [('f_bsize', int), ('f_frsize', int), ('f_bloc ('f_bfree', int), ('f_bavail', int), ('f_files', int), ('f_ffree', int), ('f_favail', int), ('f_flag', int), ('f_namemax', int)]) + def ctermid() -> str: ... # Unix only def getegid() -> int: ... # Unix only def geteuid() -> int: ... # Unix only diff --git a/stdlib/2and3/traceback.pyi b/stdlib/2and3/traceback.pyi index 211390992..d53adfe9e 100644 --- a/stdlib/2and3/traceback.pyi +++ b/stdlib/2and3/traceback.pyi @@ -1,6 +1,6 @@ # Stubs for traceback -from typing import Generator, IO, Iterator, List, Mapping, Optional, Tuple, Type +from typing import Any, Dict, Generator, IO, Iterator, List, Mapping, Optional, Tuple, Type from types import FrameType, TracebackType import sys @@ -92,10 +92,19 @@ if sys.version_info >= (3, 5): if sys.version_info >= (3, 5): class FrameSummary: + filename: str + lineno: int + name: str + line: str + locals: Optional[Dict[str, str]] def __init__(self, filename: str, lineno: int, name: str, lookup_line: bool = ..., locals: Optional[Mapping[str, str]] = ..., line: Optional[int] = ...) -> None: ... + # TODO: more precise typing for __getitem__ and __iter__, + # for a namedtuple-like view on (filename, lineno, name, str). + def __getitem__(self, i: int) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... class StackSummary(List[FrameSummary]): @classmethod @@ -105,3 +114,4 @@ if sys.version_info >= (3, 5): capture_locals: bool = ...) -> StackSummary: ... @classmethod def from_list(cls, a_list: List[_PT]) -> StackSummary: ... + def format(self) -> List[str]: ... diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index c3cda6d87..80fc8e509 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -50,7 +50,7 @@ class object: def __sizeof__(self) -> int: ... def __reduce__(self) -> tuple: ... def __reduce_ex__(self, protocol: int) -> tuple: ... - def __dir__(self) -> List[str]: ... + def __dir__(self) -> Iterable[str]: ... if sys.version_info >= (3, 6): def __init_subclass__(cls) -> None: ... diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index f21bc5f13..6c0e409d9 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -11,7 +11,7 @@ from types import ModuleType, TracebackType _T = TypeVar('_T') -_FT = TypeVar('_FT', bound=Callable[[Any], Any]) +_FT = TypeVar('_FT', bound=Callable[..., Any]) _E = TypeVar('_E', bound=Exception)