Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 74ecdd8

Browse filesBrowse files
Sync typeshed (#21612)
Source commit: python/typeshed@feeb9aa
1 parent 0cd1541 commit 74ecdd8
Copy full SHA for 74ecdd8

8 files changed

+165-13Lines changed: 165 additions & 13 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎mypy/typeshed/stdlib/_socket.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/_socket.pyi
+72-1Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ _CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
1111
# Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
1212
# AF_NETLINK, AF_TIPC) or strings/buffers (AF_UNIX).
1313
# See getsockaddrarg() in socketmodule.c.
14-
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer
14+
if sys.version_info >= (3, 14):
15+
# A bare int is accepted for Bluetooth HCI device IDs.
16+
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer | int
17+
else:
18+
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer
1519
_RetAddress: TypeAlias = Any
1620

1721
# ===== Constants =====
@@ -250,8 +254,75 @@ if sys.version_info >= (3, 14):
250254
TCP_QUICKACK: Final[int]
251255

252256
if sys.platform == "linux":
257+
BDADDR_BREDR: Final[int]
258+
BDADDR_LE_PUBLIC: Final[int]
259+
BDADDR_LE_RANDOM: Final[int]
260+
BT_CHANNEL_POLICY: Final[int]
261+
BT_CHANNEL_POLICY_BREDR_ONLY: Final[int]
262+
BT_CHANNEL_POLICY_BREDR_PREFERRED: Final[int]
263+
BT_CODEC: Final[int]
264+
BT_DEFER_SETUP: Final[int]
265+
BT_FLUSHABLE: Final[int]
266+
BT_FLUSHABLE_OFF: Final[int]
267+
BT_FLUSHABLE_ON: Final[int]
268+
BT_ISO_QOS: Final[int]
269+
BT_MODE: Final[int]
270+
BT_MODE_BASIC: Final[int]
271+
BT_MODE_ERTM: Final[int]
272+
BT_MODE_EXT_FLOWCTL: Final[int]
273+
BT_MODE_LE_FLOWCTL: Final[int]
274+
BT_MODE_STREAMING: Final[int]
275+
BT_PHY: Final[int]
276+
BT_PHY_BR_1M_1SLOT: Final[int]
277+
BT_PHY_BR_1M_3SLOT: Final[int]
278+
BT_PHY_BR_1M_5SLOT: Final[int]
279+
BT_PHY_EDR_2M_1SLOT: Final[int]
280+
BT_PHY_EDR_2M_3SLOT: Final[int]
281+
BT_PHY_EDR_2M_5SLOT: Final[int]
282+
BT_PHY_EDR_3M_1SLOT: Final[int]
283+
BT_PHY_EDR_3M_3SLOT: Final[int]
284+
BT_PHY_EDR_3M_5SLOT: Final[int]
285+
BT_PHY_LE_1M_RX: Final[int]
286+
BT_PHY_LE_1M_TX: Final[int]
287+
BT_PHY_LE_2M_RX: Final[int]
288+
BT_PHY_LE_2M_TX: Final[int]
289+
BT_PHY_LE_CODED_RX: Final[int]
290+
BT_PHY_LE_CODED_TX: Final[int]
291+
BT_PKT_STATUS: Final[int]
292+
BT_POWER: Final[int]
293+
BT_POWER_FORCE_ACTIVE_OFF: Final[int]
294+
BT_POWER_FORCE_ACTIVE_ON: Final[int]
295+
BT_RCVMTU: Final[int]
296+
BT_SECURITY: Final[int]
297+
BT_SECURITY_FIPS: Final[int]
298+
BT_SECURITY_HIGH: Final[int]
299+
BT_SECURITY_LOW: Final[int]
300+
BT_SECURITY_MEDIUM: Final[int]
301+
BT_SECURITY_SDP: Final[int]
302+
BT_SNDMTU: Final[int]
303+
BT_VOICE: Final[int]
304+
BT_VOICE_CVSD_16BIT: Final[int]
305+
BT_VOICE_TRANSPARENT: Final[int]
306+
BT_VOICE_TRANSPARENT_16BIT: Final[int]
307+
HCI_CHANNEL_CONTROL: Final[int]
308+
HCI_CHANNEL_LOGGING: Final[int]
309+
HCI_CHANNEL_MONITOR: Final[int]
310+
HCI_CHANNEL_RAW: Final[int]
311+
HCI_CHANNEL_USER: Final[int]
312+
HCI_DEV_NONE: Final[int]
253313
IP_FREEBIND: Final[int]
254314
IP_RECVORIGDSTADDR: Final[int]
315+
L2CAP_LM: Final[int]
316+
L2CAP_LM_AUTH: Final[int]
317+
L2CAP_LM_ENCRYPT: Final[int]
318+
L2CAP_LM_MASTER: Final[int]
319+
L2CAP_LM_RELIABLE: Final[int]
320+
L2CAP_LM_SECURE: Final[int]
321+
L2CAP_LM_TRUSTED: Final[int]
322+
SOL_BLUETOOTH: Final[int]
323+
SOL_L2CAP: Final[int]
324+
SOL_RFCOMM: Final[int]
325+
SOL_SCO: Final[int]
255326
VMADDR_CID_LOCAL: Final[int]
256327

257328
if sys.platform != "win32" and sys.platform != "darwin":
Collapse file

‎mypy/typeshed/stdlib/_typeshed/_type_checker_internals.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/_typeshed/_type_checker_internals.pyi
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sys
66
import typing_extensions
77
from _collections_abc import dict_items, dict_keys, dict_values
8+
from _typeshed import AnnotationForm
89
from abc import ABCMeta
910
from collections.abc import Awaitable, Generator, Iterable, Mapping
1011
from typing import Any, ClassVar, Generic, TypeVar, overload
@@ -28,6 +29,10 @@ class TypedDictFallback(Mapping[str, object], metaclass=ABCMeta):
2829
if sys.version_info >= (3, 13):
2930
__readonly_keys__: ClassVar[frozenset[str]]
3031
__mutable_keys__: ClassVar[frozenset[str]]
32+
if sys.version_info >= (3, 15):
33+
# PEP 728
34+
__closed__: ClassVar[bool | None]
35+
__extra_items__: ClassVar[AnnotationForm]
3136

3237
def copy(self) -> typing_extensions.Self: ...
3338
# Using Never so that only calls using mypy plugin hook that specialize the signature
@@ -58,6 +63,7 @@ class TypedDictFallback(Mapping[str, object], metaclass=ABCMeta):
5863
class NamedTupleFallback(tuple[Any, ...]):
5964
_field_defaults: ClassVar[dict[str, Any]]
6065
_fields: ClassVar[tuple[str, ...]]
66+
__match_args__: ClassVar[tuple[str, ...]] = ...
6167
# __orig_bases__ sometimes exists on <3.12, but not consistently
6268
# So we only add it to the stub on 3.12+.
6369
if sys.version_info >= (3, 12):
Collapse file

‎mypy/typeshed/stdlib/base64.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/base64.pyi
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import sys
2-
from _typeshed import ReadableBuffer
3-
from typing import IO
2+
from _typeshed import ReadableBuffer, SupportsNoArgReadline, SupportsRead, SupportsWrite
43

54
__all__ = [
65
"encode",
@@ -111,8 +110,8 @@ else:
111110
def b85encode(b: ReadableBuffer, pad: bool = False) -> bytes: ...
112111
def b85decode(b: str | ReadableBuffer) -> bytes: ...
113112

114-
def decode(input: IO[bytes], output: IO[bytes]) -> None: ...
115-
def encode(input: IO[bytes], output: IO[bytes]) -> None: ...
113+
def decode(input: SupportsNoArgReadline[bytes], output: SupportsWrite[bytes]) -> None: ...
114+
def encode(input: SupportsRead[bytes], output: SupportsWrite[bytes]) -> None: ...
116115
def encodebytes(s: ReadableBuffer) -> bytes: ...
117116
def decodebytes(s: ReadableBuffer) -> bytes: ...
118117

Collapse file

‎mypy/typeshed/stdlib/calendar.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/calendar.pyi
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ class Calendar:
8080
def __init__(self, firstweekday: int = 0) -> None: ...
8181
def getfirstweekday(self) -> int: ...
8282
def setfirstweekday(self, firstweekday: int) -> None: ...
83-
def iterweekdays(self) -> Iterable[int]: ...
84-
def itermonthdates(self, year: int, month: int) -> Iterable[datetime.date]: ...
85-
def itermonthdays2(self, year: int, month: int) -> Iterable[tuple[int, int]]: ...
86-
def itermonthdays(self, year: int, month: int) -> Iterable[int]: ...
83+
def iterweekdays(self) -> Iterator[int]: ...
84+
def itermonthdates(self, year: int, month: int) -> Iterator[datetime.date]: ...
85+
def itermonthdays2(self, year: int, month: int) -> Iterator[tuple[int, int]]: ...
86+
def itermonthdays(self, year: int, month: int) -> Iterator[int]: ...
8787
def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: ...
8888
def monthdays2calendar(self, year: int, month: int) -> list[list[tuple[int, int]]]: ...
8989
def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: ...
9090
def yeardatescalendar(self, year: int, width: int = 3) -> list[list[list[list[datetime.date]]]]: ...
9191
def yeardays2calendar(self, year: int, width: int = 3) -> list[list[list[list[tuple[int, int]]]]]: ...
9292
def yeardayscalendar(self, year: int, width: int = 3) -> list[list[list[list[int]]]]: ...
93-
def itermonthdays3(self, year: int, month: int) -> Iterable[tuple[int, int, int]]: ...
94-
def itermonthdays4(self, year: int, month: int) -> Iterable[tuple[int, int, int, int]]: ...
93+
def itermonthdays3(self, year: int, month: int) -> Iterator[tuple[int, int, int]]: ...
94+
def itermonthdays4(self, year: int, month: int) -> Iterator[tuple[int, int, int, int]]: ...
9595

9696
class TextCalendar(Calendar):
9797
def prweek(self, theweek: Iterable[tuple[int, int]], width: int) -> None: ...
Collapse file

‎mypy/typeshed/stdlib/pyexpat/__init__.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/pyexpat/__init__.pyi
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class XMLParserType:
3333
# Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1
3434
def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None: ...
3535
def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None: ...
36-
if sys.version_info >= (3, 15):
36+
if sys.version_info >= (3, 13):
37+
# Added in Python 3.13.4, 3.14.6
3738
def SetBillionLaughsAttackProtectionActivationThreshold(self, threshold: int, /) -> None: ...
3839
def SetBillionLaughsAttackProtectionMaximumAmplification(self, max_factor: float, /) -> None: ...
3940

Collapse file

‎mypy/typeshed/stdlib/socket.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/socket.pyi
+67Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,8 +1133,75 @@ if sys.version_info >= (3, 14):
11331133

11341134
if sys.platform == "linux":
11351135
from _socket import (
1136+
BDADDR_BREDR as BDADDR_BREDR,
1137+
BDADDR_LE_PUBLIC as BDADDR_LE_PUBLIC,
1138+
BDADDR_LE_RANDOM as BDADDR_LE_RANDOM,
1139+
BT_CHANNEL_POLICY as BT_CHANNEL_POLICY,
1140+
BT_CHANNEL_POLICY_BREDR_ONLY as BT_CHANNEL_POLICY_BREDR_ONLY,
1141+
BT_CHANNEL_POLICY_BREDR_PREFERRED as BT_CHANNEL_POLICY_BREDR_PREFERRED,
1142+
BT_CODEC as BT_CODEC,
1143+
BT_DEFER_SETUP as BT_DEFER_SETUP,
1144+
BT_FLUSHABLE as BT_FLUSHABLE,
1145+
BT_FLUSHABLE_OFF as BT_FLUSHABLE_OFF,
1146+
BT_FLUSHABLE_ON as BT_FLUSHABLE_ON,
1147+
BT_ISO_QOS as BT_ISO_QOS,
1148+
BT_MODE as BT_MODE,
1149+
BT_MODE_BASIC as BT_MODE_BASIC,
1150+
BT_MODE_ERTM as BT_MODE_ERTM,
1151+
BT_MODE_EXT_FLOWCTL as BT_MODE_EXT_FLOWCTL,
1152+
BT_MODE_LE_FLOWCTL as BT_MODE_LE_FLOWCTL,
1153+
BT_MODE_STREAMING as BT_MODE_STREAMING,
1154+
BT_PHY as BT_PHY,
1155+
BT_PHY_BR_1M_1SLOT as BT_PHY_BR_1M_1SLOT,
1156+
BT_PHY_BR_1M_3SLOT as BT_PHY_BR_1M_3SLOT,
1157+
BT_PHY_BR_1M_5SLOT as BT_PHY_BR_1M_5SLOT,
1158+
BT_PHY_EDR_2M_1SLOT as BT_PHY_EDR_2M_1SLOT,
1159+
BT_PHY_EDR_2M_3SLOT as BT_PHY_EDR_2M_3SLOT,
1160+
BT_PHY_EDR_2M_5SLOT as BT_PHY_EDR_2M_5SLOT,
1161+
BT_PHY_EDR_3M_1SLOT as BT_PHY_EDR_3M_1SLOT,
1162+
BT_PHY_EDR_3M_3SLOT as BT_PHY_EDR_3M_3SLOT,
1163+
BT_PHY_EDR_3M_5SLOT as BT_PHY_EDR_3M_5SLOT,
1164+
BT_PHY_LE_1M_RX as BT_PHY_LE_1M_RX,
1165+
BT_PHY_LE_1M_TX as BT_PHY_LE_1M_TX,
1166+
BT_PHY_LE_2M_RX as BT_PHY_LE_2M_RX,
1167+
BT_PHY_LE_2M_TX as BT_PHY_LE_2M_TX,
1168+
BT_PHY_LE_CODED_RX as BT_PHY_LE_CODED_RX,
1169+
BT_PHY_LE_CODED_TX as BT_PHY_LE_CODED_TX,
1170+
BT_PKT_STATUS as BT_PKT_STATUS,
1171+
BT_POWER as BT_POWER,
1172+
BT_POWER_FORCE_ACTIVE_OFF as BT_POWER_FORCE_ACTIVE_OFF,
1173+
BT_POWER_FORCE_ACTIVE_ON as BT_POWER_FORCE_ACTIVE_ON,
1174+
BT_RCVMTU as BT_RCVMTU,
1175+
BT_SECURITY as BT_SECURITY,
1176+
BT_SECURITY_FIPS as BT_SECURITY_FIPS,
1177+
BT_SECURITY_HIGH as BT_SECURITY_HIGH,
1178+
BT_SECURITY_LOW as BT_SECURITY_LOW,
1179+
BT_SECURITY_MEDIUM as BT_SECURITY_MEDIUM,
1180+
BT_SECURITY_SDP as BT_SECURITY_SDP,
1181+
BT_SNDMTU as BT_SNDMTU,
1182+
BT_VOICE as BT_VOICE,
1183+
BT_VOICE_CVSD_16BIT as BT_VOICE_CVSD_16BIT,
1184+
BT_VOICE_TRANSPARENT as BT_VOICE_TRANSPARENT,
1185+
BT_VOICE_TRANSPARENT_16BIT as BT_VOICE_TRANSPARENT_16BIT,
1186+
HCI_CHANNEL_CONTROL as HCI_CHANNEL_CONTROL,
1187+
HCI_CHANNEL_LOGGING as HCI_CHANNEL_LOGGING,
1188+
HCI_CHANNEL_MONITOR as HCI_CHANNEL_MONITOR,
1189+
HCI_CHANNEL_RAW as HCI_CHANNEL_RAW,
1190+
HCI_CHANNEL_USER as HCI_CHANNEL_USER,
1191+
HCI_DEV_NONE as HCI_DEV_NONE,
11361192
IP_FREEBIND as IP_FREEBIND,
11371193
IP_RECVORIGDSTADDR as IP_RECVORIGDSTADDR,
1194+
L2CAP_LM as L2CAP_LM,
1195+
L2CAP_LM_AUTH as L2CAP_LM_AUTH,
1196+
L2CAP_LM_ENCRYPT as L2CAP_LM_ENCRYPT,
1197+
L2CAP_LM_MASTER as L2CAP_LM_MASTER,
1198+
L2CAP_LM_RELIABLE as L2CAP_LM_RELIABLE,
1199+
L2CAP_LM_SECURE as L2CAP_LM_SECURE,
1200+
L2CAP_LM_TRUSTED as L2CAP_LM_TRUSTED,
1201+
SOL_BLUETOOTH as SOL_BLUETOOTH,
1202+
SOL_L2CAP as SOL_L2CAP,
1203+
SOL_RFCOMM as SOL_RFCOMM,
1204+
SOL_SCO as SOL_SCO,
11381205
VMADDR_CID_LOCAL as VMADDR_CID_LOCAL,
11391206
)
11401207

Collapse file

‎mypy/typeshed/stdlib/sys/__init__.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/sys/__init__.pyi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from typing_extensions import LiteralString, deprecated
1010

1111
_T = TypeVar("_T")
1212
_LazyImportMode: TypeAlias = Literal["normal", "all", "none"]
13-
_LazyImportFilter: TypeAlias = Callable[[str, str, tuple[str, ...] | None], bool]
13+
_LazyImportFilter: TypeAlias = Callable[[str | None, str, tuple[str, ...] | None], bool]
1414

1515
# see https://github.com/python/typeshed/issues/8513#issue-1333671093 for the rationale behind this alias
1616
_ExitCode: TypeAlias = str | int | None
Collapse file

‎mypy/typeshed/stdlib/typing.pyi‎

Copy file name to clipboardExpand all lines: mypy/typeshed/stdlib/typing.pyi
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ if sys.version_info >= (3, 11):
10461046
class NamedTuple(tuple[Any, ...]):
10471047
_field_defaults: ClassVar[dict[str, Any]]
10481048
_fields: ClassVar[tuple[str, ...]]
1049+
__match_args__: ClassVar[tuple[str, ...]] = ...
10491050
# __orig_bases__ sometimes exists on <3.12, but not consistently
10501051
# So we only add it to the stub on 3.12+.
10511052
if sys.version_info >= (3, 12):
@@ -1057,9 +1058,12 @@ class NamedTuple(tuple[Any, ...]):
10571058
@deprecated("Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15")
10581059
def __init__(self, typename: str, fields: None = None, /, **kwargs: Any) -> None: ...
10591060

1061+
@final
10601062
@classmethod
10611063
def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...
1064+
@final
10621065
def _asdict(self) -> dict[str, Any]: ...
1066+
@final
10631067
def _replace(self, **kwargs: Any) -> typing_extensions.Self: ...
10641068
if sys.version_info >= (3, 13):
10651069
def __replace__(self, **kwargs: Any) -> typing_extensions.Self: ...
@@ -1079,6 +1083,10 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
10791083
if sys.version_info >= (3, 13):
10801084
__readonly_keys__: ClassVar[frozenset[str]]
10811085
__mutable_keys__: ClassVar[frozenset[str]]
1086+
if sys.version_info >= (3, 15):
1087+
# PEP 728
1088+
__closed__: ClassVar[bool | None]
1089+
__extra_items__: ClassVar[Any] # AnnotationForm
10821090

10831091
def copy(self) -> typing_extensions.Self: ...
10841092
# Using Never so that only calls using mypy plugin hook that specialize the signature

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.