Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 84a9d586544a0408d4654f57f83a93cb048070fb Mon Sep 17 00:00:00 2001
From b6d495c10e79fb56ff64f8fb90c87894090f9cbe Mon Sep 17 00:00:00 2001
From: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date: Sat, 15 Feb 2025 20:11:06 +0100
Subject: [PATCH] Partially revert Clean up argparse hacks
Expand All @@ -8,7 +8,7 @@ Subject: [PATCH] Partially revert Clean up argparse hacks
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mypy/typeshed/stdlib/argparse.pyi b/mypy/typeshed/stdlib/argparse.pyi
index b9fa31139..3c3ba116a 100644
index ae99eb036..c87b8f4fc 100644
--- a/mypy/typeshed/stdlib/argparse.pyi
+++ b/mypy/typeshed/stdlib/argparse.pyi
@@ -2,7 +2,7 @@ import sys
Expand Down Expand Up @@ -41,5 +41,5 @@ index b9fa31139..3c3ba116a 100644
default: Any = ...,
type: _ActionType = ...,
--
2.50.1
2.52.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 3229a6066cff3d80d6cb923322c2d42a300d0be3 Mon Sep 17 00:00:00 2001
From ed11d7e0204868ef1a43c17ed950372b1d78f497 Mon Sep 17 00:00:00 2001
From: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Date: Mon, 26 Sep 2022 12:55:07 -0700
Subject: [PATCH] Remove use of LiteralString in builtins (#13743)
Expand All @@ -8,18 +8,18 @@ Subject: [PATCH] Remove use of LiteralString in builtins (#13743)
1 file changed, 1 insertion(+), 99 deletions(-)

diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi
index 969d16876..044e264d2 100644
index 693dd0b77..8acdeadff 100644
--- a/mypy/typeshed/stdlib/builtins.pyi
+++ b/mypy/typeshed/stdlib/builtins.pyi
@@ -63,7 +63,6 @@ from typing import ( # noqa: Y022,UP035
@@ -64,7 +64,6 @@ from typing import ( # noqa: Y022,UP035
from typing_extensions import ( # noqa: Y023
Concatenate,
Literal,
- LiteralString,
ParamSpec,
Self,
TypeAlias,
@@ -480,31 +479,16 @@ class str(Sequence[str]):
@@ -482,31 +481,16 @@ class str(Sequence[str]):
def __new__(cls, object: object = "") -> Self: ...
@overload
def __new__(cls, object: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> Self: ...
Expand Down Expand Up @@ -51,7 +51,7 @@ index 969d16876..044e264d2 100644
def format(self, *args: object, **kwargs: object) -> str: ...
def format_map(self, mapping: _FormatMapMapping, /) -> str: ...
def index(self, sub: str, start: SupportsIndex | None = None, end: SupportsIndex | None = None, /) -> int: ...
@@ -520,98 +504,34 @@ class str(Sequence[str]):
@@ -522,98 +506,34 @@ class str(Sequence[str]):
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
Expand Down Expand Up @@ -150,7 +150,7 @@ index 969d16876..044e264d2 100644
def zfill(self, width: SupportsIndex, /) -> str: ... # type: ignore[misc]
@staticmethod
@overload
@@ -622,39 +542,21 @@ class str(Sequence[str]):
@@ -624,39 +544,21 @@ class str(Sequence[str]):
@staticmethod
@overload
def maketrans(x: str, y: str, z: str, /) -> dict[int, int | None]: ...
Expand Down Expand Up @@ -192,5 +192,5 @@ index 969d16876..044e264d2 100644
def __getnewargs__(self) -> tuple[str]: ...
def __format__(self, format_spec: str, /) -> str: ...
--
2.51.1
2.52.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 7678bc3f80e4d3f04a0ff0ee3a7d51f49ae4c465 Mon Sep 17 00:00:00 2001
From 69791281c2c5e919cea9a77c4a771f79d9e70384 Mon Sep 17 00:00:00 2001
From: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date: Sat, 21 Dec 2024 22:36:38 +0100
Subject: [PATCH] Revert Remove redundant inheritances from Iterator in
Expand Down Expand Up @@ -36,10 +36,10 @@ index d663f5d93..f43178e4d 100644
@property
def _exception(self) -> BaseException | None: ...
diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi
index 044e264d2..6d813f172 100644
index 8acdeadff..5a3bb5908 100644
--- a/mypy/typeshed/stdlib/builtins.pyi
+++ b/mypy/typeshed/stdlib/builtins.pyi
@@ -1210,7 +1210,7 @@ class frozenset(AbstractSet[_T_co]):
@@ -1226,7 +1226,7 @@ class frozenset(AbstractSet[_T_co]):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

@disjoint_base
Expand All @@ -48,7 +48,7 @@ index 044e264d2..6d813f172 100644
def __new__(cls, iterable: Iterable[_T], start: int = 0) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> tuple[int, _T]: ...
@@ -1404,7 +1404,7 @@ else:
@@ -1413,7 +1413,7 @@ else:
exit: _sitebuiltins.Quitter

@disjoint_base
Expand All @@ -57,7 +57,7 @@ index 044e264d2..6d813f172 100644
@overload
def __new__(cls, function: None, iterable: Iterable[_T | None], /) -> Self: ...
@overload
@@ -1468,7 +1468,7 @@ license: _sitebuiltins._Printer
@@ -1477,7 +1477,7 @@ license: _sitebuiltins._Printer

def locals() -> dict[str, Any]: ...
@disjoint_base
Expand All @@ -66,7 +66,7 @@ index 044e264d2..6d813f172 100644
# 3.14 adds `strict` argument.
if sys.version_info >= (3, 14):
@overload
@@ -1775,7 +1775,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
@@ -1784,7 +1784,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
quit: _sitebuiltins.Quitter

@disjoint_base
Expand All @@ -75,7 +75,7 @@ index 044e264d2..6d813f172 100644
@overload
def __new__(cls, sequence: Reversible[_T], /) -> Iterator[_T]: ... # type: ignore[misc]
@overload
@@ -1839,7 +1839,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
@@ -1848,7 +1848,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
@overload
def vars(object: Any = ..., /) -> dict[str, Any]: ...
@disjoint_base
Expand Down Expand Up @@ -107,7 +107,7 @@ index 2c8e7109c..4ed0ab1d8 100644
restkey: _T | None
restval: str | Any | None
diff --git a/mypy/typeshed/stdlib/fileinput.pyi b/mypy/typeshed/stdlib/fileinput.pyi
index 910d63814..eb942bc55 100644
index 6778b7648..95164de2f 100644
--- a/mypy/typeshed/stdlib/fileinput.pyi
+++ b/mypy/typeshed/stdlib/fileinput.pyi
@@ -1,8 +1,8 @@
Expand All @@ -118,7 +118,7 @@ index 910d63814..eb942bc55 100644
from types import GenericAlias, TracebackType
-from typing import IO, Any, AnyStr, Generic, Literal, Protocol, overload, type_check_only
+from typing import IO, Any, AnyStr, Literal, Protocol, overload, type_check_only
from typing_extensions import Self, TypeAlias
from typing_extensions import Self, TypeAlias, deprecated

__all__ = [
@@ -105,7 +105,7 @@ def fileno() -> int: ...
Expand All @@ -131,7 +131,7 @@ index 910d63814..eb942bc55 100644
# encoding and errors are added
@overload
diff --git a/mypy/typeshed/stdlib/itertools.pyi b/mypy/typeshed/stdlib/itertools.pyi
index fe4ccbdf8..73745fe92 100644
index 8a924ad8b..5c2bf7f83 100644
--- a/mypy/typeshed/stdlib/itertools.pyi
+++ b/mypy/typeshed/stdlib/itertools.pyi
@@ -28,7 +28,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
Expand Down Expand Up @@ -166,7 +166,7 @@ index fe4ccbdf8..73745fe92 100644
-class accumulate(Generic[_T]):
+class accumulate(Iterator[_T]):
@overload
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ...
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = None) -> Self: ...
@overload
@@ -64,7 +64,7 @@ class accumulate(Generic[_T]):
def __next__(self) -> _T: ...
Expand Down Expand Up @@ -239,7 +239,7 @@ index fe4ccbdf8..73745fe92 100644
+class zip_longest(Iterator[_T_co]):
# one iterable (fillvalue doesn't matter)
@overload
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = ...) -> zip_longest[tuple[_T1]]: ...
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = None) -> zip_longest[tuple[_T1]]: ...
@@ -202,7 +202,7 @@ class zip_longest(Generic[_T_co]):
def __next__(self) -> _T_co: ...

Expand Down Expand Up @@ -291,8 +291,8 @@ index fe4ccbdf8..73745fe92 100644
- class batched(Generic[_T_co]):
+ class batched(Iterator[tuple[_T_co, ...]], Generic[_T_co]):
if sys.version_info >= (3, 13):
def __new__(cls, iterable: Iterable[_T_co], n: int, *, strict: bool = False) -> Self: ...
else:
@overload
def __new__(cls, iterable: Iterable[_T], n: Literal[1], *, strict: Literal[True]) -> batched[tuple[_T]]: ...
diff --git a/mypy/typeshed/stdlib/multiprocessing/pool.pyi b/mypy/typeshed/stdlib/multiprocessing/pool.pyi
index b79f9e773..f276372d0 100644
--- a/mypy/typeshed/stdlib/multiprocessing/pool.pyi
Expand All @@ -313,10 +313,10 @@ index b79f9e773..f276372d0 100644
def __iter__(self) -> Self: ...
def next(self, timeout: float | None = None) -> _T: ...
diff --git a/mypy/typeshed/stdlib/sqlite3/__init__.pyi b/mypy/typeshed/stdlib/sqlite3/__init__.pyi
index 6b0f1ba94..882cd143c 100644
index 04b978b1b..e4604144f 100644
--- a/mypy/typeshed/stdlib/sqlite3/__init__.pyi
+++ b/mypy/typeshed/stdlib/sqlite3/__init__.pyi
@@ -407,7 +407,7 @@ class Connection:
@@ -408,7 +408,7 @@ class Connection:
) -> Literal[False]: ...

@disjoint_base
Expand All @@ -326,5 +326,5 @@ index 6b0f1ba94..882cd143c 100644
@property
def connection(self) -> Connection: ...
--
2.51.1
2.52.0

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 16b0b50ec77e470f24145071acde5274a1de53a0 Mon Sep 17 00:00:00 2001
From 0e30b762e8335f02e19977c055ac7b98e707991c Mon Sep 17 00:00:00 2001
From: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Date: Sat, 29 Oct 2022 12:47:21 -0700
Subject: [PATCH] Revert sum literal integer change (#13961)
Expand All @@ -19,10 +19,10 @@ within mypy, I might pursue upstreaming this in typeshed.
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi
index 900c4c93f..d874edd8f 100644
index 5a3bb5908..0f2196070 100644
--- a/mypy/typeshed/stdlib/builtins.pyi
+++ b/mypy/typeshed/stdlib/builtins.pyi
@@ -1782,7 +1782,7 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
@@ -1835,7 +1835,7 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
# without creating many false-positive errors (see #7578).
# Instead, we special-case the most common examples of this: bool and literal integers.
@overload
Expand All @@ -32,5 +32,5 @@ index 900c4c93f..d874edd8f 100644
def sum(iterable: Iterable[_SupportsSumNoDefaultT], /) -> _SupportsSumNoDefaultT | Literal[0]: ...
@overload
--
2.49.0
2.52.0

16 changes: 8 additions & 8 deletions misc/typeshed_patches/0001-Revert-typeshed-ctypes-change.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
From 85c0cfb55c6211c2a47c3f45d2ff28fa76f8204b Mon Sep 17 00:00:00 2001
From 80a710e0e2c09612c6fc30c644f2052450e69ccd Mon Sep 17 00:00:00 2001
From: AlexWaygood <alex.waygood@gmail.com>
Date: Mon, 1 May 2023 20:34:55 +0100
Subject: [PATCH] Revert typeshed ctypes change Since the plugin provides
superior type checking:
https://github.com/python/mypy/pull/13987#issuecomment-1310863427 A manual
cherry-pick of e437cdf.
Subject: [PATCH] Revert typeshed ctypes change

The plugin provides superior type checking:
https://github.com/python/mypy/pull/13987#issuecomment-1310863427
A manual cherry-pick of e437cdf.
---
mypy/typeshed/stdlib/_ctypes.pyi | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mypy/typeshed/stdlib/_ctypes.pyi b/mypy/typeshed/stdlib/_ctypes.pyi
index 944685646..dc8c7b2ca 100644
index be7792818..b7a3fb104 100644
--- a/mypy/typeshed/stdlib/_ctypes.pyi
+++ b/mypy/typeshed/stdlib/_ctypes.pyi
@@ -289,11 +289,7 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
@@ -320,11 +320,7 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
def _type_(self) -> type[_CT]: ...
@_type_.setter
def _type_(self, value: type[_CT]) -> None: ...
Expand All @@ -28,5 +28,5 @@ index 944685646..dc8c7b2ca 100644
# TODO: These methods cannot be annotated correctly at the moment.
# All of these "Any"s stand for the array's element type, but it's not possible to use _CT
--
2.49.0
2.52.0

10 changes: 8 additions & 2 deletions mypy/typeshed/stdlib/_frozen_importlib_external.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from _typeshed.importlib import LoaderProtocol
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableSequence, Sequence
from importlib.machinery import ModuleSpec
from importlib.metadata import DistributionFinder, PathDistribution
from typing import Any, Final, Literal
from typing import Any, Final, Literal, overload
from typing_extensions import Self, deprecated

if sys.version_info >= (3, 10):
Expand All @@ -26,7 +26,13 @@ else:

MAGIC_NUMBER: Final[bytes]

def cache_from_source(path: StrPath, debug_override: bool | None = None, *, optimization: Any | None = None) -> str: ...
@overload
@deprecated(
"The `debug_override` parameter is deprecated since Python 3.5; will be removed in Python 3.15. Use `optimization` instead."
)
def cache_from_source(path: StrPath, debug_override: bool, *, optimization: None = None) -> str: ...
@overload
def cache_from_source(path: StrPath, debug_override: None = None, *, optimization: Any | None = None) -> str: ...
def source_from_cache(path: StrPath) -> str: ...
def decode_source(source_bytes: ReadableBuffer) -> str: ...
def spec_from_file_location(
Expand Down
48 changes: 29 additions & 19 deletions mypy/typeshed/stdlib/_tkinter.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
from _typeshed import FileDescriptorLike, Incomplete
from collections.abc import Callable
from typing import Any, ClassVar, Final, final
from typing import Any, ClassVar, Final, Literal, final, overload
from typing_extensions import TypeAlias, deprecated

# _tkinter is meant to be only used internally by tkinter, but some tkinter
Expand Down Expand Up @@ -54,22 +55,23 @@ _TkinterTraceFunc: TypeAlias = Callable[[tuple[str, ...]], object]
@final
class TkappType:
# Please keep in sync with tkinter.Tk
def adderrorinfo(self, msg: str, /): ...
def adderrorinfo(self, msg: str, /) -> None: ...
def call(self, command: Any, /, *args: Any) -> Any: ...
def createcommand(self, name: str, func, /): ...
# TODO: Figure out what arguments the following `func` callbacks should accept
def createcommand(self, name: str, func: Callable[..., object], /) -> None: ...
if sys.platform != "win32":
def createfilehandler(self, file, mask: int, func, /): ...
def deletefilehandler(self, file, /) -> None: ...
def createfilehandler(self, file: FileDescriptorLike, mask: int, func: Callable[..., object], /) -> None: ...
def deletefilehandler(self, file: FileDescriptorLike, /) -> None: ...

def createtimerhandler(self, milliseconds: int, func, /): ...
def deletecommand(self, name: str, /): ...
def dooneevent(self, flags: int = 0, /): ...
def createtimerhandler(self, milliseconds: int, func: Callable[..., object], /): ...
def deletecommand(self, name: str, /) -> None: ...
def dooneevent(self, flags: int = 0, /) -> int: ...
def eval(self, script: str, /) -> str: ...
def evalfile(self, fileName: str, /): ...
def exprboolean(self, s: str, /): ...
def exprdouble(self, s: str, /): ...
def exprlong(self, s: str, /): ...
def exprstring(self, s: str, /): ...
def evalfile(self, fileName: str, /) -> str: ...
def exprboolean(self, s: str, /) -> Literal[0, 1]: ...
def exprdouble(self, s: str, /) -> float: ...
def exprlong(self, s: str, /) -> int: ...
def exprstring(self, s: str, /) -> str: ...
def getboolean(self, arg, /) -> bool: ...
def getdouble(self, arg, /) -> float: ...
def getint(self, arg, /) -> int: ...
Expand All @@ -81,15 +83,23 @@ class TkappType:
def loadtk(self) -> None: ...
def mainloop(self, threshold: int = 0, /) -> None: ...
def quit(self) -> None: ...
def record(self, script: str, /): ...
def record(self, script: str, /) -> str: ...
def setvar(self, *ags, **kwargs): ...
if sys.version_info < (3, 11):
@deprecated("Deprecated since Python 3.9; removed in Python 3.11. Use `splitlist()` instead.")
def split(self, arg, /): ...

def splitlist(self, arg, /): ...
def splitlist(self, arg, /) -> tuple[Incomplete, ...]: ...
def unsetvar(self, *args, **kwargs): ...
def wantobjects(self, *args, **kwargs): ...
if sys.version_info >= (3, 14):
@overload
def wantobjects(self) -> Literal[0, 1]: ...
else:
@overload
def wantobjects(self) -> bool: ...

@overload
def wantobjects(self, wantobjects: Literal[0, 1] | bool, /) -> None: ...
def willdispatch(self) -> None: ...
if sys.version_info >= (3, 12):
def gettrace(self, /) -> _TkinterTraceFunc | None: ...
Expand All @@ -112,7 +122,7 @@ TK_VERSION: Final[str]

@final
class TkttType:
def deletetimerhandler(self): ...
def deletetimerhandler(self) -> None: ...

if sys.version_info >= (3, 13):
def create(
Expand All @@ -125,7 +135,7 @@ if sys.version_info >= (3, 13):
sync: bool = False,
use: str | None = None,
/,
): ...
) -> TkappType: ...

else:
def create(
Expand All @@ -138,7 +148,7 @@ else:
sync: bool = False,
use: str | None = None,
/,
): ...
) -> TkappType: ...

def getbusywaitinterval() -> int: ...
def setbusywaitinterval(new_val: int, /) -> None: ...
Loading