Skip to content

Commit e5d5969

Browse files
authored
Merge branch 'main' into rm-mypy-hack
2 parents f10fcb4 + 3ee1e5b commit e5d5969

40 files changed

+459
-324
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -436,28 +436,24 @@ following criteria is met:
436436
* the upstream package was declared or appears to be unmaintained, and
437437
retaining the stubs causes maintenance issues in typeshed.
438438

439-
If a package ships its own `py.typed` file, please follow these steps:
439+
Case 1: If a package ships its own `py.typed` file, please follow these steps:
440440

441-
1. Open an issue with the earliest month of removal in the subject.
442-
2. A maintainer will add the
443-
["stubs: removal" label](https://github.com/python/typeshed/labels/%22stubs%3A%20removal%22).
444-
3. Open a PR that sets the `obsolete_since` field in the `METADATA.toml`
445-
file to the first version of the package that shipped `py.typed`.
446-
4. After at least six months, open a PR to remove the stubs.
441+
1. Make sure **stubsabot** open a PR that sets the `obsolete_since` field in the
442+
`METADATA.toml` file to the first version of the package that shipped `py.typed`.
443+
2. After at least six months, make sure **stubsabot** open a PR to remove the stubs.
447444

448-
If third-party stubs should be removed for other reasons, please follow these
449-
steps:
445+
Case 2: If third-party stubs should be removed for other reasons, please follow
446+
these steps:
450447

451448
1. Open an issue explaining why the stubs should be removed.
452449
2. A maintainer will add the
453450
["stubs: removal" label](https://github.com/python/typeshed/labels/%22stubs%3A%20removal%22).
454451
3. Open a PR that sets the `no_longer_updated` field in the `METADATA.toml`
455452
file to `true`.
456-
4. When a new version of the package was automatically uploaded to PyPI
457-
(which can take up to a day), open a PR to remove the stubs.
453+
4. When a new version of the package was automatically uploaded to PyPI (which
454+
can take up to a day), make sure **stubsabot** open a PR to remove the stubs.
458455

459-
Don't forget to make sure the library is not in the [`pyrightconfig.stricter.json`](./pyrightconfig.stricter.json)
460-
exclusion list. If feeling kindly, please update [mypy](https://github.com/python/mypy/blob/master/mypy/stubinfo.py)
456+
If feeling kindly, please update [mypy](https://github.com/python/mypy/blob/master/mypy/stubinfo.py)
461457
for any stub obsoletions or removals.
462458

463459
### Marking PRs as "deferred"

stdlib/_csv.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ else:
9292
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
9393

9494
def writer(
95-
csvfile: SupportsWrite[str],
95+
fileobj: SupportsWrite[str],
9696
/,
9797
dialect: _DialectLike = "excel",
9898
*,
@@ -106,7 +106,7 @@ def writer(
106106
strict: bool = False,
107107
) -> _writer: ...
108108
def reader(
109-
csvfile: Iterable[str],
109+
iterable: Iterable[str],
110110
/,
111111
dialect: _DialectLike = "excel",
112112
*,
@@ -121,7 +121,8 @@ def reader(
121121
) -> _reader: ...
122122
def register_dialect(
123123
name: str,
124-
dialect: type[Dialect | csv.Dialect] = ...,
124+
/,
125+
dialect: type[Dialect | csv.Dialect] | str = "excel",
125126
*,
126127
delimiter: str = ",",
127128
quotechar: str | None = '"',

stdlib/_frozen_importlib_external.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class SourceLoader(_LoaderBasics):
100100
def get_source(self, fullname: str) -> str | None: ...
101101
def path_stats(self, path: str) -> Mapping[str, Any]: ...
102102
def source_to_code(
103-
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath
103+
self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath
104104
) -> types.CodeType: ...
105105
def get_code(self, fullname: str) -> types.CodeType | None: ...
106106

@@ -126,7 +126,7 @@ class SourceFileLoader(importlib.abc.FileLoader, FileLoader, importlib.abc.Sourc
126126
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
127127
self,
128128
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
129-
path: ReadableBuffer | StrPath,
129+
path: bytes | StrPath,
130130
*,
131131
_optimize: int = -1,
132132
) -> types.CodeType: ...

stdlib/ast.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ if sys.version_info >= (3, 13):
17471747
@overload
17481748
def parse(
17491749
source: _T,
1750-
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
1750+
filename: str | bytes | os.PathLike[Any] = "<unknown>",
17511751
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
17521752
*,
17531753
type_comments: bool = False,
@@ -1757,7 +1757,7 @@ if sys.version_info >= (3, 13):
17571757
@overload
17581758
def parse(
17591759
source: str | ReadableBuffer,
1760-
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
1760+
filename: str | bytes | os.PathLike[Any] = "<unknown>",
17611761
mode: Literal["exec"] = "exec",
17621762
*,
17631763
type_comments: bool = False,
@@ -1767,7 +1767,7 @@ if sys.version_info >= (3, 13):
17671767
@overload
17681768
def parse(
17691769
source: str | ReadableBuffer,
1770-
filename: str | ReadableBuffer | os.PathLike[Any],
1770+
filename: str | bytes | os.PathLike[Any],
17711771
mode: Literal["eval"],
17721772
*,
17731773
type_comments: bool = False,
@@ -1777,7 +1777,7 @@ if sys.version_info >= (3, 13):
17771777
@overload
17781778
def parse(
17791779
source: str | ReadableBuffer,
1780-
filename: str | ReadableBuffer | os.PathLike[Any],
1780+
filename: str | bytes | os.PathLike[Any],
17811781
mode: Literal["func_type"],
17821782
*,
17831783
type_comments: bool = False,
@@ -1787,7 +1787,7 @@ if sys.version_info >= (3, 13):
17871787
@overload
17881788
def parse(
17891789
source: str | ReadableBuffer,
1790-
filename: str | ReadableBuffer | os.PathLike[Any],
1790+
filename: str | bytes | os.PathLike[Any],
17911791
mode: Literal["single"],
17921792
*,
17931793
type_comments: bool = False,
@@ -1824,7 +1824,7 @@ if sys.version_info >= (3, 13):
18241824
@overload
18251825
def parse(
18261826
source: str | ReadableBuffer,
1827-
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
1827+
filename: str | bytes | os.PathLike[Any] = "<unknown>",
18281828
mode: str = "exec",
18291829
*,
18301830
type_comments: bool = False,
@@ -1836,7 +1836,7 @@ else:
18361836
@overload
18371837
def parse(
18381838
source: _T,
1839-
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
1839+
filename: str | bytes | os.PathLike[Any] = "<unknown>",
18401840
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
18411841
*,
18421842
type_comments: bool = False,
@@ -1845,7 +1845,7 @@ else:
18451845
@overload
18461846
def parse(
18471847
source: str | ReadableBuffer,
1848-
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
1848+
filename: str | bytes | os.PathLike[Any] = "<unknown>",
18491849
mode: Literal["exec"] = "exec",
18501850
*,
18511851
type_comments: bool = False,
@@ -1854,7 +1854,7 @@ else:
18541854
@overload
18551855
def parse(
18561856
source: str | ReadableBuffer,
1857-
filename: str | ReadableBuffer | os.PathLike[Any],
1857+
filename: str | bytes | os.PathLike[Any],
18581858
mode: Literal["eval"],
18591859
*,
18601860
type_comments: bool = False,
@@ -1863,7 +1863,7 @@ else:
18631863
@overload
18641864
def parse(
18651865
source: str | ReadableBuffer,
1866-
filename: str | ReadableBuffer | os.PathLike[Any],
1866+
filename: str | bytes | os.PathLike[Any],
18671867
mode: Literal["func_type"],
18681868
*,
18691869
type_comments: bool = False,
@@ -1872,7 +1872,7 @@ else:
18721872
@overload
18731873
def parse(
18741874
source: str | ReadableBuffer,
1875-
filename: str | ReadableBuffer | os.PathLike[Any],
1875+
filename: str | bytes | os.PathLike[Any],
18761876
mode: Literal["single"],
18771877
*,
18781878
type_comments: bool = False,
@@ -1905,7 +1905,7 @@ else:
19051905
@overload
19061906
def parse(
19071907
source: str | ReadableBuffer,
1908-
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
1908+
filename: str | bytes | os.PathLike[Any] = "<unknown>",
19091909
mode: str = "exec",
19101910
*,
19111911
type_comments: bool = False,

stdlib/builtins.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,7 @@ if sys.version_info >= (3, 10):
14011401
@overload
14021402
def compile(
14031403
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1404-
filename: str | ReadableBuffer | PathLike[Any],
1404+
filename: str | bytes | PathLike[Any],
14051405
mode: str,
14061406
flags: Literal[0],
14071407
dont_inherit: bool = False,
@@ -1412,7 +1412,7 @@ def compile(
14121412
@overload
14131413
def compile(
14141414
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1415-
filename: str | ReadableBuffer | PathLike[Any],
1415+
filename: str | bytes | PathLike[Any],
14161416
mode: str,
14171417
*,
14181418
dont_inherit: bool = False,
@@ -1422,7 +1422,7 @@ def compile(
14221422
@overload
14231423
def compile(
14241424
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1425-
filename: str | ReadableBuffer | PathLike[Any],
1425+
filename: str | bytes | PathLike[Any],
14261426
mode: str,
14271427
flags: Literal[1024],
14281428
dont_inherit: bool = False,
@@ -1433,7 +1433,7 @@ def compile(
14331433
@overload
14341434
def compile(
14351435
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
1436-
filename: str | ReadableBuffer | PathLike[Any],
1436+
filename: str | bytes | PathLike[Any],
14371437
mode: str,
14381438
flags: int,
14391439
dont_inherit: bool = False,

stdlib/importlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class InspectLoader(Loader):
5353
def exec_module(self, module: types.ModuleType) -> None: ...
5454
@staticmethod
5555
def source_to_code(
56-
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath = "<string>"
56+
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: bytes | StrPath = "<string>"
5757
) -> types.CodeType: ...
5858

5959
class ExecutionLoader(InspectLoader):

stdlib/pdb.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from cmd import Cmd
55
from collections.abc import Callable, Iterable, Mapping, Sequence
66
from inspect import _SourceObjectType
77
from linecache import _ModuleGlobals
8+
from rlcompleter import Completer
89
from types import CodeType, FrameType, TracebackType
910
from typing import IO, Any, ClassVar, Final, Literal, TypeVar
1011
from typing_extensions import ParamSpec, Self, TypeAlias
@@ -200,6 +201,10 @@ class Pdb(Bdb, Cmd):
200201
def completenames(self, text: str, line: str, begidx: int, endidx: int) -> list[str]: ... # type: ignore[override]
201202
if sys.version_info >= (3, 12):
202203
def set_convenience_variable(self, frame: FrameType, name: str, value: Any) -> None: ...
204+
if sys.version_info >= (3, 13) and sys.version_info < (3, 14):
205+
# Added in 3.13.8.
206+
@property
207+
def rlcompleter(self) -> type[Completer]: ...
203208

204209
def _select_frame(self, number: int) -> None: ...
205210
def _getval_except(self, arg: str, frame: FrameType | None = None) -> object: ...

stdlib/types.pyi

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if sys.version_info >= (3, 13):
6565

6666
_T1 = TypeVar("_T1")
6767
_T2 = TypeVar("_T2")
68-
_KT = TypeVar("_KT")
68+
_KT_co = TypeVar("_KT_co", covariant=True)
6969
_VT_co = TypeVar("_VT_co", covariant=True)
7070

7171
# Make sure this class definition stays roughly in line with `builtins.function`
@@ -309,27 +309,27 @@ class CodeType:
309309
__replace__ = replace
310310

311311
@final
312-
class MappingProxyType(Mapping[_KT, _VT_co]):
312+
class MappingProxyType(Mapping[_KT_co, _VT_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments]
313313
__hash__: ClassVar[None] # type: ignore[assignment]
314-
def __new__(cls, mapping: SupportsKeysAndGetItem[_KT, _VT_co]) -> Self: ...
315-
def __getitem__(self, key: _KT, /) -> _VT_co: ...
316-
def __iter__(self) -> Iterator[_KT]: ...
314+
def __new__(cls, mapping: SupportsKeysAndGetItem[_KT_co, _VT_co]) -> Self: ...
315+
def __getitem__(self, key: _KT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
316+
def __iter__(self) -> Iterator[_KT_co]: ...
317317
def __len__(self) -> int: ...
318318
def __eq__(self, value: object, /) -> bool: ...
319-
def copy(self) -> dict[_KT, _VT_co]: ...
320-
def keys(self) -> KeysView[_KT]: ...
319+
def copy(self) -> dict[_KT_co, _VT_co]: ...
320+
def keys(self) -> KeysView[_KT_co]: ...
321321
def values(self) -> ValuesView[_VT_co]: ...
322-
def items(self) -> ItemsView[_KT, _VT_co]: ...
322+
def items(self) -> ItemsView[_KT_co, _VT_co]: ...
323323
@overload
324-
def get(self, key: _KT, /) -> _VT_co | None: ...
324+
def get(self, key: _KT_co, /) -> _VT_co | None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
325325
@overload
326-
def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
326+
def get(self, key: _KT_co, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
327327
@overload
328-
def get(self, key: _KT, default: _T2, /) -> _VT_co | _T2: ...
328+
def get(self, key: _KT_co, default: _T2, /) -> _VT_co | _T2: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
329329
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
330-
def __reversed__(self) -> Iterator[_KT]: ...
331-
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
332-
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...
330+
def __reversed__(self) -> Iterator[_KT_co]: ...
331+
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]: ...
332+
def __ror__(self, value: Mapping[_T1, _T2], /) -> dict[_KT_co | _T1, _VT_co | _T2]: ...
333333

334334
if sys.version_info >= (3, 12):
335335
@disjoint_base

0 commit comments

Comments
 (0)