Skip to content

Sync typeshed #10383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
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
16 changes: 1 addition & 15 deletions mypy/typeshed/stdlib/@python2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ from typing import (
Union,
ValuesView,
overload,
runtime_checkable,
)
from typing_extensions import Literal

Expand Down Expand Up @@ -838,15 +837,6 @@ def cmp(__x: Any, __y: Any) -> int: ...
_N1 = TypeVar("_N1", bool, int, float, complex)

def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ...

# 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)
@runtime_checkable
class _PathLike(Protocol[_AnyStr_co]):
def __fspath__(self) -> _AnyStr_co: ...

def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
def delattr(__obj: Any, __name: Text) -> None: ...
def dir(__o: object = ...) -> List[str]: ...
Expand Down Expand Up @@ -1017,11 +1007,7 @@ def round(number: SupportsFloat) -> float: ...
def round(number: SupportsFloat, ndigits: int) -> float: ...
def setattr(__obj: Any, __name: Text, __value: Any) -> None: ...
def sorted(
__iterable: Iterable[_T],
*,
cmp: Callable[[_T, _T], int] = ...,
key: Optional[Callable[[_T], Any]] = ...,
reverse: bool = ...,
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...
) -> List[_T]: ...
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
Expand Down
1 change: 1 addition & 0 deletions mypy/typeshed/stdlib/@python2/_functools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ from typing import Any, Callable, Dict, Iterable, Optional, Tuple, TypeVar, over

_T = TypeVar("_T")
_S = TypeVar("_S")

@overload
def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ...
@overload
Expand Down
16 changes: 1 addition & 15 deletions mypy/typeshed/stdlib/@python2/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ from typing import (
Union,
ValuesView,
overload,
runtime_checkable,
)
from typing_extensions import Literal

Expand Down Expand Up @@ -838,15 +837,6 @@ def cmp(__x: Any, __y: Any) -> int: ...
_N1 = TypeVar("_N1", bool, int, float, complex)

def coerce(__x: _N1, __y: _N1) -> Tuple[_N1, _N1]: ...

# 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)
@runtime_checkable
class _PathLike(Protocol[_AnyStr_co]):
def __fspath__(self) -> _AnyStr_co: ...

def compile(source: Union[Text, mod], filename: Text, mode: Text, flags: int = ..., dont_inherit: int = ...) -> Any: ...
def delattr(__obj: Any, __name: Text) -> None: ...
def dir(__o: object = ...) -> List[str]: ...
Expand Down Expand Up @@ -1017,11 +1007,7 @@ def round(number: SupportsFloat) -> float: ...
def round(number: SupportsFloat, ndigits: int) -> float: ...
def setattr(__obj: Any, __name: Text, __value: Any) -> None: ...
def sorted(
__iterable: Iterable[_T],
*,
cmp: Callable[[_T, _T], int] = ...,
key: Optional[Callable[[_T], Any]] = ...,
reverse: bool = ...,
__iterable: Iterable[_T], *, cmp: Callable[[_T, _T], int] = ..., key: Optional[Callable[[_T], Any]] = ..., reverse: bool = ...
) -> List[_T]: ...
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
Expand Down
1 change: 1 addition & 0 deletions mypy/typeshed/stdlib/@python2/functools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ _AnyCallable = Callable[..., Any]

_T = TypeVar("_T")
_S = TypeVar("_S")

@overload
def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T]) -> _T: ...
@overload
Expand Down
1 change: 1 addition & 0 deletions mypy/typeshed/stdlib/@python2/itertools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ _T3 = TypeVar("_T3")
_T4 = TypeVar("_T4")
_T5 = TypeVar("_T5")
_T6 = TypeVar("_T6")

@overload
def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
@overload
Expand Down
23 changes: 3 additions & 20 deletions mypy/typeshed/stdlib/@python2/logging/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,13 @@ class Logger(Filterer):
) -> None: ...
fatal = critical
def log(
self,
level: int,
msg: Any,
*args: Any,
exc_info: _ExcInfoType = ...,
extra: Optional[Dict[str, Any]] = ...,
**kwargs: Any,
self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
) -> None: ...
def exception(
self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
) -> None: ...
def _log(
self,
level: int,
msg: Any,
args: _ArgsType,
exc_info: Optional[_ExcInfoType] = ...,
extra: Optional[Dict[str, Any]] = ...,
self, level: int, msg: Any, args: _ArgsType, exc_info: Optional[_ExcInfoType] = ..., extra: Optional[Dict[str, Any]] = ...
) -> None: ... # undocumented
def filter(self, record: LogRecord) -> bool: ...
def addHandler(self, hdlr: Handler) -> None: ...
Expand Down Expand Up @@ -210,13 +199,7 @@ class LoggerAdapter:
self, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
) -> None: ...
def log(
self,
level: int,
msg: Any,
*args: Any,
exc_info: _ExcInfoType = ...,
extra: Optional[Dict[str, Any]] = ...,
**kwargs: Any,
self, level: int, msg: Any, *args: Any, exc_info: _ExcInfoType = ..., extra: Optional[Dict[str, Any]] = ..., **kwargs: Any
) -> None: ...
def isEnabledFor(self, level: int) -> bool: ...

Expand Down
5 changes: 0 additions & 5 deletions mypy/typeshed/stdlib/@python2/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ if sys.platform != "win32":
TMP_MAX: int # Undocumented, but used by tempfile

# ----- os classes (structures) -----
if sys.version_info >= (3, 6):
from builtins import _PathLike

PathLike = _PathLike # See comment in builtins

class _StatVFS(NamedTuple):
f_bsize: int
f_frsize: int
Expand Down
3 changes: 2 additions & 1 deletion mypy/typeshed/stdlib/_ast.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class mod(AST): ...

if sys.version_info >= (3, 8):
class type_ignore(AST): ...
class TypeIgnore(type_ignore): ...
class TypeIgnore(type_ignore):
tag: str
class FunctionType(mod):
argtypes: typing.List[expr]
returns: expr
Expand Down
12 changes: 1 addition & 11 deletions mypy/typeshed/stdlib/_typeshed/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,7 @@ OpenTextModeUpdating = Literal[
"t+x",
"+tx",
]
OpenTextModeWriting = Literal[
"w",
"wt",
"tw",
"a",
"at",
"ta",
"x",
"xt",
"tx",
]
OpenTextModeWriting = Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"]
OpenTextModeReading = Literal["r", "rt", "tr", "U", "rU", "Ur", "rtU", "rUt", "Urt", "trU", "tUr", "Utr"]
OpenTextMode = Union[OpenTextModeUpdating, OpenTextModeWriting, OpenTextModeReading]
OpenBinaryModeUpdating = Literal[
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/abc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
class ABCMeta(type):
def register(cls: ABCMeta, subclass: Type[_T]) -> Type[_T]: ...

def abstractmethod(callable: _FuncT) -> _FuncT: ...
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...

class abstractproperty(property): ...

Expand Down
8 changes: 2 additions & 6 deletions mypy/typeshed/stdlib/asyncio/base_events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ class Server(AbstractServer):
ssl_handshake_timeout: Optional[float],
) -> None: ...
else:
def __init__(
self,
loop: AbstractEventLoop,
sockets: List[socket],
) -> None: ...
def __init__(self, loop: AbstractEventLoop, sockets: List[socket]) -> None: ...

class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def run_forever(self) -> None: ...
Expand Down Expand Up @@ -357,7 +353,7 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def sock_accept(self, sock: socket) -> Future[Tuple[socket, _RetAddress]]: ...
# Signal handling.
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...
def remove_signal_handler(self, sig: int) -> None: ...
def remove_signal_handler(self, sig: int) -> bool: ...
# Error handlers.
def set_exception_handler(self, handler: Optional[_ExceptionHandler]) -> None: ...
def get_exception_handler(self) -> Optional[_ExceptionHandler]: ...
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/asyncio/events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
@abstractmethod
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...
@abstractmethod
def remove_signal_handler(self, sig: int) -> None: ...
def remove_signal_handler(self, sig: int) -> bool: ...
# Error handlers.
@abstractmethod
def set_exception_handler(self, handler: Optional[_ExceptionHandler]) -> None: ...
Expand Down
Loading