Skip to content

Commit

Permalink
Sync typeshed (#15055)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Apr 15, 2023
1 parent 8f94d9a commit 69c774e
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 55 deletions.
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/asyncio/base_events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ class BaseEventLoop(AbstractEventLoop):
async def sock_connect(self, sock: socket, address: _Address) -> None: ...
async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ...
if sys.version_info >= (3, 11):
async def sock_recvfrom(self, sock: socket, bufsize: int) -> bytes: ...
async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> int: ...
async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> None: ...
async def sock_recvfrom(self, sock: socket, bufsize: int) -> tuple[bytes, _RetAddress]: ...
async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> tuple[int, _RetAddress]: ...
async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> int: ...
# Signal handling.
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...
def remove_signal_handler(self, sig: int) -> bool: ...
Expand Down
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/asyncio/events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,11 @@ class AbstractEventLoop:
async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ...
if sys.version_info >= (3, 11):
@abstractmethod
async def sock_recvfrom(self, sock: socket, bufsize: int) -> bytes: ...
async def sock_recvfrom(self, sock: socket, bufsize: int) -> tuple[bytes, _RetAddress]: ...
@abstractmethod
async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> int: ...
async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> tuple[int, _RetAddress]: ...
@abstractmethod
async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> None: ...
async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> int: ...
# Signal handling.
@abstractmethod
def add_signal_handler(self, sig: int, callback: Callable[..., object], *args: Any) -> None: ...
Expand Down
22 changes: 21 additions & 1 deletion mypy/typeshed/stdlib/dataclasses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,27 @@ class InitVar(Generic[_T], metaclass=_InitVarMeta):
@overload
def __class_getitem__(cls, type: Any) -> InitVar[Any]: ...

if sys.version_info >= (3, 11):
if sys.version_info >= (3, 12):
def make_dataclass(
cls_name: str,
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
*,
bases: tuple[type, ...] = (),
namespace: dict[str, Any] | None = None,
init: bool = True,
repr: bool = True,
eq: bool = True,
order: bool = False,
unsafe_hash: bool = False,
frozen: bool = False,
match_args: bool = True,
kw_only: bool = False,
slots: bool = False,
weakref_slot: bool = False,
module: str | None = None,
) -> type: ...

elif sys.version_info >= (3, 11):
def make_dataclass(
cls_name: str,
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/pathlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ class Path(PurePath):
def resolve(self, strict: bool = False) -> Self: ...
def rglob(self, pattern: str) -> Generator[Self, None, None]: ...
def rmdir(self) -> None: ...
def symlink_to(self, target: str | Path, target_is_directory: bool = False) -> None: ...
def symlink_to(self, target: StrOrBytesPath, target_is_directory: bool = False) -> None: ...
if sys.version_info >= (3, 10):
def hardlink_to(self, target: str | Path) -> None: ...
def hardlink_to(self, target: StrOrBytesPath) -> None: ...

def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None: ...
if sys.version_info >= (3, 8):
Expand Down
14 changes: 14 additions & 0 deletions mypy/typeshed/stdlib/sys.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@ class _int_info(structseq[int], tuple[int, int, int, int]):
@property
def str_digits_check_threshold(self) -> int: ...

_ThreadInfoName: TypeAlias = Literal["nt", "pthread", "pthread-stubs", "solaris"]
_ThreadInfoLock: TypeAlias = Literal["semaphore", "mutex+cond"] | None

@final
class _thread_info(_UninstantiableStructseq, tuple[_ThreadInfoName, _ThreadInfoLock, str | None]):
@property
def name(self) -> _ThreadInfoName: ...
@property
def lock(self) -> _ThreadInfoLock: ...
@property
def version(self) -> str | None: ...

thread_info: _thread_info

@final
class _version_info(_UninstantiableStructseq, tuple[int, int, int, str, int]):
@property
Expand Down
72 changes: 36 additions & 36 deletions mypy/typeshed/stdlib/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1234,16 +1234,16 @@ class Canvas(Widget, XView, YView):
__x1: float,
__y1: float,
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
arrow: Literal["first", "last", "both"] = ...,
arrowshape: tuple[float, float, float] = ...,
capstyle: Literal["round", "projecting", "butt"] = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledstipple: str = ...,
disabledwidth: _ScreenUnits = ...,
Expand All @@ -1263,16 +1263,16 @@ class Canvas(Widget, XView, YView):
__xy_pair_0: tuple[float, float],
__xy_pair_1: tuple[float, float],
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
arrow: Literal["first", "last", "both"] = ...,
arrowshape: tuple[float, float, float] = ...,
capstyle: Literal["round", "projecting", "butt"] = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledstipple: str = ...,
disabledwidth: _ScreenUnits = ...,
Expand All @@ -1298,16 +1298,16 @@ class Canvas(Widget, XView, YView):
| list[tuple[float, float]]
),
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
arrow: Literal["first", "last", "both"] = ...,
arrowshape: tuple[float, float, float] = ...,
capstyle: Literal["round", "projecting", "butt"] = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledstipple: str = ...,
disabledwidth: _ScreenUnits = ...,
Expand All @@ -1329,15 +1329,15 @@ class Canvas(Widget, XView, YView):
__x1: float,
__y1: float,
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand All @@ -1359,15 +1359,15 @@ class Canvas(Widget, XView, YView):
__xy_pair_0: tuple[float, float],
__xy_pair_1: tuple[float, float],
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand Down Expand Up @@ -1395,15 +1395,15 @@ class Canvas(Widget, XView, YView):
| list[tuple[float, float]]
),
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand All @@ -1427,15 +1427,15 @@ class Canvas(Widget, XView, YView):
__x1: float,
__y1: float,
*xy_pairs: float,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand All @@ -1460,15 +1460,15 @@ class Canvas(Widget, XView, YView):
__xy_pair_0: tuple[float, float],
__xy_pair_1: tuple[float, float],
*xy_pairs: tuple[float, float],
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand Down Expand Up @@ -1499,15 +1499,15 @@ class Canvas(Widget, XView, YView):
| list[tuple[float, float]]
),
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand All @@ -1534,15 +1534,15 @@ class Canvas(Widget, XView, YView):
__x1: float,
__y1: float,
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand All @@ -1564,15 +1564,15 @@ class Canvas(Widget, XView, YView):
__xy_pair_0: tuple[float, float],
__xy_pair_1: tuple[float, float],
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand Down Expand Up @@ -1600,15 +1600,15 @@ class Canvas(Widget, XView, YView):
| list[tuple[float, float]]
),
*,
activedash: str | list[int] | tuple[int, ...] = ...,
activedash: str | int | list[int] | tuple[int, ...] = ...,
activefill: str = ...,
activeoutline: str = ...,
activeoutlinestipple: str = ...,
activestipple: str = ...,
activewidth: _ScreenUnits = ...,
dash: str | list[int] | tuple[int, ...] = ...,
dash: str | int | list[int] | tuple[int, ...] = ...,
dashoffset: _ScreenUnits = ...,
disableddash: str | list[int] | tuple[int, ...] = ...,
disableddash: str | int | list[int] | tuple[int, ...] = ...,
disabledfill: str = ...,
disabledoutline: str = ...,
disabledoutlinestipple: str = ...,
Expand Down
13 changes: 7 additions & 6 deletions mypy/typeshed/stdlib/urllib/parse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,15 @@ else:
url: bytes | bytearray | None, scheme: bytes | bytearray | None | Literal[""] = "", allow_fragments: bool = True
) -> SplitResultBytes: ...

# Requires an iterable of length 6
@overload
def urlunparse(
components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]
) -> AnyStr: ...
def urlunparse(components: Iterable[None]) -> Literal[b""]: ...
@overload
def urlunparse(components: Sequence[AnyStr | None]) -> AnyStr: ...
def urlunparse(components: Iterable[AnyStr | None]) -> AnyStr: ...

# Requires an iterable of length 5
@overload
def urlunsplit(components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]) -> AnyStr: ...
def urlunsplit(components: Iterable[None]) -> Literal[b""]: ...
@overload
def urlunsplit(components: Sequence[AnyStr | None]) -> AnyStr: ...
def urlunsplit(components: Iterable[AnyStr | None]) -> AnyStr: ...
def unwrap(url: str) -> str: ...
14 changes: 10 additions & 4 deletions mypy/typeshed/stdlib/zipfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,11 @@ class ZipInfo:
def is_dir(self) -> bool: ...
def FileHeader(self, zip64: bool | None = None) -> bytes: ...

class _PathOpenProtocol(Protocol):
def __call__(self, mode: _ReadWriteMode = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...

if sys.version_info >= (3, 8):
if sys.version_info < (3, 9):
class _PathOpenProtocol(Protocol):
def __call__(self, mode: _ReadWriteMode = "r", pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...

class Path:
@property
def name(self) -> str: ...
Expand All @@ -245,7 +246,12 @@ if sys.version_info >= (3, 8):
def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = "") -> None: ...
if sys.version_info >= (3, 9):
def open(
self, mode: _ReadWriteBinaryMode = "r", *args: Any, pwd: bytes | None = None, **kwargs: Any
self,
mode: _ReadWriteBinaryMode = "r",
encoding: str | None = None,
*args: Any,
pwd: bytes | None = None,
**kwargs: Any,
) -> IO[bytes]: ...
else:
@property
Expand Down

0 comments on commit 69c774e

Please sign in to comment.