Skip to content

Commit 4677456

Browse files
author
mypybot
committed
Sync typeshed
Source commit: python/typeshed@0a2da01
1 parent c00f82f commit 4677456

File tree

195 files changed

+5267
-619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+5267
-619
lines changed

mypy/typeshed/stdlib/VERSIONS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ _contextvars: 3.7-
3333
_csv: 3.0-
3434
_ctypes: 3.0-
3535
_curses: 3.0-
36+
_curses_panel: 3.0-
3637
_dbm: 3.0-
3738
_decimal: 3.3-
3839
_dummy_thread: 3.0-3.8
3940
_dummy_threading: 3.0-3.8
4041
_frozen_importlib: 3.0-
4142
_frozen_importlib_external: 3.5-
4243
_gdbm: 3.0-
44+
_hashlib: 3.0-
4345
_heapq: 3.0-
4446
_imp: 3.0-
4547
_interpchannels: 3.13-
@@ -52,6 +54,7 @@ _lsprof: 3.0-
5254
_lzma: 3.3-
5355
_markupbase: 3.0-
5456
_msi: 3.0-3.12
57+
_multibytecodec: 3.0-
5558
_operator: 3.4-
5659
_osx_support: 3.0-
5760
_posixsubprocess: 3.2-
@@ -139,6 +142,12 @@ doctest: 3.0-
139142
dummy_threading: 3.0-3.8
140143
email: 3.0-
141144
encodings: 3.0-
145+
encodings.cp1125: 3.4-
146+
encodings.cp273: 3.4-
147+
encodings.cp858: 3.2-
148+
encodings.koi8_t: 3.5-
149+
encodings.kz1048: 3.5-
150+
encodings.mac_centeuro: 3.0-3.8
142151
ensurepip: 3.0-
143152
enum: 3.4-
144153
errno: 3.0-

mypy/typeshed/stdlib/_codecs.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import codecs
22
import sys
33
from _typeshed import ReadableBuffer
44
from collections.abc import Callable
5-
from typing import Literal, overload
5+
from typing import Literal, final, overload, type_check_only
66
from typing_extensions import TypeAlias
77

88
# This type is not exposed; it is defined in unicodeobject.c
9+
# At runtime it calls itself builtins.EncodingMap
10+
@final
11+
@type_check_only
912
class _EncodingMap:
1013
def size(self) -> int: ...
1114

mypy/typeshed/stdlib/_collections_abc.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
7373
@final
7474
class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented
7575
def __eq__(self, value: object, /) -> bool: ...
76+
def __reversed__(self) -> Iterator[_KT_co]: ...
7677
if sys.version_info >= (3, 13):
7778
def isdisjoint(self, other: Iterable[_KT_co], /) -> bool: ...
7879
if sys.version_info >= (3, 10):
@@ -81,13 +82,15 @@ class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented
8182

8283
@final
8384
class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented
85+
def __reversed__(self) -> Iterator[_VT_co]: ...
8486
if sys.version_info >= (3, 10):
8587
@property
8688
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ...
8789

8890
@final
8991
class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
9092
def __eq__(self, value: object, /) -> bool: ...
93+
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
9194
if sys.version_info >= (3, 13):
9295
def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool: ...
9396
if sys.version_info >= (3, 10):

mypy/typeshed/stdlib/_csv.pyi

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import csv
22
import sys
33
from _typeshed import SupportsWrite
4-
from collections.abc import Iterable, Iterator
5-
from typing import Any, Final
6-
from typing_extensions import TypeAlias
4+
from collections.abc import Iterable
5+
from typing import Any, Final, type_check_only
6+
from typing_extensions import Self, TypeAlias
77

88
__version__: Final[str]
99

@@ -45,17 +45,47 @@ class Dialect:
4545
strict: bool = False,
4646
) -> None: ...
4747

48-
class _reader(Iterator[list[str]]):
49-
@property
50-
def dialect(self) -> Dialect: ...
51-
line_num: int
52-
def __next__(self) -> list[str]: ...
48+
if sys.version_info >= (3, 10):
49+
# This class calls itself _csv.reader.
50+
class Reader:
51+
@property
52+
def dialect(self) -> Dialect: ...
53+
line_num: int
54+
def __iter__(self) -> Self: ...
55+
def __next__(self) -> list[str]: ...
5356

54-
class _writer:
55-
@property
56-
def dialect(self) -> Dialect: ...
57-
def writerow(self, row: Iterable[Any]) -> Any: ...
58-
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
57+
# This class calls itself _csv.writer.
58+
class Writer:
59+
@property
60+
def dialect(self) -> Dialect: ...
61+
if sys.version_info >= (3, 13):
62+
def writerow(self, row: Iterable[Any], /) -> Any: ...
63+
def writerows(self, rows: Iterable[Iterable[Any]], /) -> None: ...
64+
else:
65+
def writerow(self, row: Iterable[Any]) -> Any: ...
66+
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
67+
68+
# For the return types below.
69+
# These aliases can be removed when typeshed drops support for 3.9.
70+
_reader = Reader
71+
_writer = Writer
72+
else:
73+
# This class is not exposed. It calls itself _csv.reader.
74+
@type_check_only
75+
class _reader:
76+
@property
77+
def dialect(self) -> Dialect: ...
78+
line_num: int
79+
def __iter__(self) -> Self: ...
80+
def __next__(self) -> list[str]: ...
81+
82+
# This class is not exposed. It calls itself _csv.writer.
83+
@type_check_only
84+
class _writer:
85+
@property
86+
def dialect(self) -> Dialect: ...
87+
def writerow(self, row: Iterable[Any]) -> Any: ...
88+
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
5989

6090
def writer(
6191
csvfile: SupportsWrite[str],

0 commit comments

Comments
 (0)