diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index cad1c3ebf..526cdbd88 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -1207,13 +1207,27 @@ if sys.version_info < (3,): _N1 = TypeVar("_N1", bool, int, float, complex) def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... -if sys.version_info >= (3, 6): - # This class is to be exported as PathLike from os, - # but we define it here as _PathLike to avoid import cycle issues. - # See https://github.com/python/typeshed/pull/991#issuecomment-288160993 - _AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) - class _PathLike(Protocol[_AnyStr_co]): - def __fspath__(self) -> _AnyStr_co: ... +# This class is to be exported as PathLike from os, +# but we define it here as _PathLike to avoid import cycle issues. +# See https://github.com/python/typeshed/pull/991#issuecomment-288160993 +_AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) + +class _PathLike(Protocol[_AnyStr_co]): + def __fspath__(self) -> _AnyStr_co: ... + +if sys.version_info >= (3, 8): + def compile( + source: Union[str, bytes, mod, AST], + filename: Union[str, bytes, _PathLike[Any]], + mode: str, + flags: int = ..., + dont_inherit: int = ..., + optimize: int = ..., + *, + _feature_version: int = ..., + ) -> Any: ... + +elif sys.version_info >= (3, 6): def compile( source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], @@ -1624,9 +1638,9 @@ if sys.version_info < (3,): def reload(__module: Any) -> Any: ... @overload -def reversed(__object: Sequence[_T]) -> Iterator[_T]: ... +def reversed(__sequence: Sequence[_T]) -> Iterator[_T]: ... @overload -def reversed(__object: Reversible[_T]) -> Iterator[_T]: ... +def reversed(__sequence: Reversible[_T]) -> Iterator[_T]: ... def repr(__obj: object) -> str: ... if sys.version_info >= (3,): diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index cad1c3ebf..526cdbd88 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -1207,13 +1207,27 @@ if sys.version_info < (3,): _N1 = TypeVar("_N1", bool, int, float, complex) def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ... -if sys.version_info >= (3, 6): - # This class is to be exported as PathLike from os, - # but we define it here as _PathLike to avoid import cycle issues. - # See https://github.com/python/typeshed/pull/991#issuecomment-288160993 - _AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) - class _PathLike(Protocol[_AnyStr_co]): - def __fspath__(self) -> _AnyStr_co: ... +# This class is to be exported as PathLike from os, +# but we define it here as _PathLike to avoid import cycle issues. +# See https://github.com/python/typeshed/pull/991#issuecomment-288160993 +_AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) + +class _PathLike(Protocol[_AnyStr_co]): + def __fspath__(self) -> _AnyStr_co: ... + +if sys.version_info >= (3, 8): + def compile( + source: Union[str, bytes, mod, AST], + filename: Union[str, bytes, _PathLike[Any]], + mode: str, + flags: int = ..., + dont_inherit: int = ..., + optimize: int = ..., + *, + _feature_version: int = ..., + ) -> Any: ... + +elif sys.version_info >= (3, 6): def compile( source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], @@ -1624,9 +1638,9 @@ if sys.version_info < (3,): def reload(__module: Any) -> Any: ... @overload -def reversed(__object: Sequence[_T]) -> Iterator[_T]: ... +def reversed(__sequence: Sequence[_T]) -> Iterator[_T]: ... @overload -def reversed(__object: Reversible[_T]) -> Iterator[_T]: ... +def reversed(__sequence: Reversible[_T]) -> Iterator[_T]: ... def repr(__obj: object) -> str: ... if sys.version_info >= (3,):