Skip to content

Commit e28b1f6

Browse files
author
mypybot
committed
Sync typeshed
Source commit: python/typeshed@263427f
1 parent dd0503e commit e28b1f6

Some content is hidden

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

113 files changed

+854
-578
lines changed

mypy/typeshed/stdlib/_ast.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class JoinedStr(expr):
329329

330330
if sys.version_info < (3, 8):
331331
class Num(expr): # Deprecated in 3.8; use Constant
332-
n: complex
332+
n: int | float | complex
333333

334334
class Str(expr): # Deprecated in 3.8; use Constant
335335
s: str
@@ -349,7 +349,7 @@ class Constant(expr):
349349
kind: str | None
350350
# Aliases for value, for backwards compatibility
351351
s: Any
352-
n: complex
352+
n: int | float | complex
353353

354354
if sys.version_info >= (3, 8):
355355
class NamedExpr(expr):

mypy/typeshed/stdlib/_codecs.pyi

+34-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import codecs
22
import sys
3+
from _typeshed import ReadableBuffer
34
from collections.abc import Callable
45
from typing import overload
56
from typing_extensions import Literal, TypeAlias
@@ -44,13 +45,13 @@ _BytesToBytesEncoding: TypeAlias = Literal[
4445
_StrToStrEncoding: TypeAlias = Literal["rot13", "rot_13"]
4546

4647
@overload
47-
def encode(obj: bytes, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ...
48+
def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ...
4849
@overload
4950
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ... # type: ignore[misc]
5051
@overload
5152
def encode(obj: str, encoding: str = ..., errors: str = ...) -> bytes: ...
5253
@overload
53-
def decode(obj: bytes, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ... # type: ignore[misc]
54+
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ... # type: ignore[misc]
5455
@overload
5556
def decode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ...
5657

@@ -64,66 +65,72 @@ def decode(
6465
@overload
6566
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = ...) -> bytes: ...
6667
@overload
67-
def decode(obj: bytes, encoding: str = ..., errors: str = ...) -> str: ...
68+
def decode(obj: ReadableBuffer, encoding: str = ..., errors: str = ...) -> str: ...
6869
def lookup(__encoding: str) -> codecs.CodecInfo: ...
6970
def charmap_build(__map: str) -> _CharMap: ...
70-
def ascii_decode(__data: bytes, __errors: str | None = ...) -> tuple[str, int]: ...
71+
def ascii_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
7172
def ascii_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
72-
def charmap_decode(__data: bytes, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[str, int]: ...
73+
def charmap_decode(__data: ReadableBuffer, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[str, int]: ...
7374
def charmap_encode(__str: str, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[bytes, int]: ...
74-
def escape_decode(__data: str | bytes, __errors: str | None = ...) -> tuple[str, int]: ...
75+
def escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
7576
def escape_encode(__data: bytes, __errors: str | None = ...) -> tuple[bytes, int]: ...
76-
def latin_1_decode(__data: bytes, __errors: str | None = ...) -> tuple[str, int]: ...
77+
def latin_1_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
7778
def latin_1_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
7879

7980
if sys.version_info >= (3, 9):
80-
def raw_unicode_escape_decode(__data: str | bytes, __errors: str | None = ..., __final: bool = ...) -> tuple[str, int]: ...
81+
def raw_unicode_escape_decode(
82+
__data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ...
83+
) -> tuple[str, int]: ...
8184

8285
else:
83-
def raw_unicode_escape_decode(__data: str | bytes, __errors: str | None = ...) -> tuple[str, int]: ...
86+
def raw_unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
8487

8588
def raw_unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
86-
def readbuffer_encode(__data: str | bytes, __errors: str | None = ...) -> tuple[bytes, int]: ...
89+
def readbuffer_encode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[bytes, int]: ...
8790

8891
if sys.version_info >= (3, 9):
89-
def unicode_escape_decode(__data: str | bytes, __errors: str | None = ..., __final: bool = ...) -> tuple[str, int]: ...
92+
def unicode_escape_decode(
93+
__data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ...
94+
) -> tuple[str, int]: ...
9095

9196
else:
92-
def unicode_escape_decode(__data: str | bytes, __errors: str | None = ...) -> tuple[str, int]: ...
97+
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
9398

9499
def unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
95100

96101
if sys.version_info < (3, 8):
97-
def unicode_internal_decode(__obj: str | bytes, __errors: str | None = ...) -> tuple[str, int]: ...
98-
def unicode_internal_encode(__obj: str | bytes, __errors: str | None = ...) -> tuple[bytes, int]: ...
102+
def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
103+
def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = ...) -> tuple[bytes, int]: ...
99104

100-
def utf_16_be_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
105+
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
101106
def utf_16_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
102-
def utf_16_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
107+
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
103108
def utf_16_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ...
104109
def utf_16_ex_decode(
105-
__data: bytes, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
110+
__data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
106111
) -> tuple[str, int, int]: ...
107-
def utf_16_le_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
112+
def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
108113
def utf_16_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
109-
def utf_32_be_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
114+
def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
110115
def utf_32_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
111-
def utf_32_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
116+
def utf_32_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
112117
def utf_32_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ...
113118
def utf_32_ex_decode(
114-
__data: bytes, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
119+
__data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
115120
) -> tuple[str, int, int]: ...
116-
def utf_32_le_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
121+
def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
117122
def utf_32_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
118-
def utf_7_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
123+
def utf_7_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
119124
def utf_7_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
120-
def utf_8_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
125+
def utf_8_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
121126
def utf_8_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
122127

123128
if sys.platform == "win32":
124-
def mbcs_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
129+
def mbcs_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
125130
def mbcs_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
126-
def code_page_decode(__codepage: int, __data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
131+
def code_page_decode(
132+
__codepage: int, __data: ReadableBuffer, __errors: str | None = ..., __final: int = ...
133+
) -> tuple[str, int]: ...
127134
def code_page_encode(__code_page: int, __str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
128-
def oem_decode(__data: bytes, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
135+
def oem_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
129136
def oem_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...

mypy/typeshed/stdlib/_curses.pyi

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import sys
2-
from _typeshed import SupportsRead
2+
from _typeshed import ReadOnlyBuffer, SupportsRead
33
from typing import IO, Any, NamedTuple, overload
44
from typing_extensions import TypeAlias, final
55

66
if sys.platform != "win32":
7+
# Handled by PyCurses_ConvertToChtype in _cursesmodule.c.
78
_ChType: TypeAlias = str | bytes | int
89

910
# ACS codes are only initialized after initscr is called
@@ -330,7 +331,7 @@ if sys.platform != "win32":
330331
def noraw() -> None: ...
331332
def pair_content(__pair_number: int) -> tuple[int, int]: ...
332333
def pair_number(__attr: int) -> int: ...
333-
def putp(__string: bytes) -> None: ...
334+
def putp(__string: ReadOnlyBuffer) -> None: ...
334335
def qiflush(__flag: bool = ...) -> None: ...
335336
def raw(__flag: bool = ...) -> None: ...
336337
def reset_prog_mode() -> None: ...
@@ -352,7 +353,7 @@ if sys.platform != "win32":
352353
def tigetnum(__capname: str) -> int: ...
353354
def tigetstr(__capname: str) -> bytes | None: ...
354355
def tparm(
355-
__str: bytes,
356+
__str: ReadOnlyBuffer,
356357
__i1: int = ...,
357358
__i2: int = ...,
358359
__i3: int = ...,

mypy/typeshed/stdlib/_decimal.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from _typeshed import Self
44
from collections.abc import Container, Sequence
55
from types import TracebackType
66
from typing import Any, ClassVar, NamedTuple, Union, overload
7-
from typing_extensions import TypeAlias
7+
from typing_extensions import Literal, TypeAlias
88

99
_Decimal: TypeAlias = Decimal | int
1010
_DecimalNew: TypeAlias = Union[Decimal, float, str, tuple[int, Sequence[int], int]]
@@ -16,7 +16,7 @@ __libmpdec_version__: str
1616
class DecimalTuple(NamedTuple):
1717
sign: int
1818
digits: tuple[int, ...]
19-
exponent: int
19+
exponent: int | Literal["n", "N", "F"]
2020

2121
ROUND_DOWN: str
2222
ROUND_HALF_UP: str

mypy/typeshed/stdlib/_msi.pyi

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ if sys.platform == "win32":
1212
# Don't exist at runtime
1313
__new__: None # type: ignore[assignment]
1414
__init__: None # type: ignore[assignment]
15-
# Actual typename Summary, not exposed by the implementation
16-
class _Summary:
17-
def GetProperty(self, propid: int) -> str | bytes | None: ...
15+
# Actual typename SummaryInformation, not exposed by the implementation
16+
class _SummaryInformation:
17+
def GetProperty(self, field: int) -> int | bytes | None: ...
1818
def GetPropertyCount(self) -> int: ...
19-
def SetProperty(self, propid: int, value: str | bytes) -> None: ...
19+
def SetProperty(self, field: int, value: int | str) -> None: ...
2020
def Persist(self) -> None: ...
2121
# Don't exist at runtime
2222
__new__: None # type: ignore[assignment]
@@ -25,7 +25,7 @@ if sys.platform == "win32":
2525
class _Database:
2626
def OpenView(self, sql: str) -> _View: ...
2727
def Commit(self) -> None: ...
28-
def GetSummaryInformation(self, updateCount: int) -> _Summary: ...
28+
def GetSummaryInformation(self, updateCount: int) -> _SummaryInformation: ...
2929
def Close(self) -> None: ...
3030
# Don't exist at runtime
3131
__new__: None # type: ignore[assignment]

mypy/typeshed/stdlib/_operator.pyi

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
2-
from collections.abc import Callable, Container, Iterable, Mapping, MutableMapping, MutableSequence, Sequence
2+
from _typeshed import SupportsGetItem
3+
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
34
from typing import Any, AnyStr, Generic, Protocol, SupportsAbs, TypeVar, overload
45
from typing_extensions import ParamSpec, SupportsIndex, TypeAlias, final
56

@@ -77,11 +78,9 @@ def delitem(__a: MutableSequence[Any], __b: slice) -> None: ...
7778
@overload
7879
def delitem(__a: MutableMapping[_K, Any], __b: _K) -> None: ...
7980
@overload
80-
def getitem(__a: Sequence[_T], __b: SupportsIndex) -> _T: ...
81-
@overload
8281
def getitem(__a: Sequence[_T], __b: slice) -> Sequence[_T]: ...
8382
@overload
84-
def getitem(__a: Mapping[_K, _V], __b: _K) -> _V: ...
83+
def getitem(__a: SupportsGetItem[_K, _V], __b: _K) -> _V: ...
8584
def indexOf(__a: Iterable[_T], __b: _T) -> int: ...
8685
@overload
8786
def setitem(__a: MutableSequence[_T], __b: SupportsIndex, __c: _T) -> None: ...
@@ -106,17 +105,30 @@ class attrgetter(Generic[_T_co]):
106105

107106
@final
108107
class itemgetter(Generic[_T_co]):
108+
# mypy lacks support for PEP 646 https://github.com/python/mypy/issues/12280
109+
# So we have to define all of these overloads to simulate unpacking the arguments
109110
@overload
110-
def __new__(cls, item: Any) -> itemgetter[Any]: ...
111+
def __new__(cls, item: _T_co) -> itemgetter[_T_co]: ...
111112
@overload
112-
def __new__(cls, item: Any, __item2: Any) -> itemgetter[tuple[Any, Any]]: ...
113+
def __new__(cls, item: _T_co, __item2: _T_co) -> itemgetter[tuple[_T_co, _T_co]]: ...
113114
@overload
114-
def __new__(cls, item: Any, __item2: Any, __item3: Any) -> itemgetter[tuple[Any, Any, Any]]: ...
115+
def __new__(cls, item: _T_co, __item2: _T_co, __item3: _T_co) -> itemgetter[tuple[_T_co, _T_co, _T_co]]: ...
115116
@overload
116-
def __new__(cls, item: Any, __item2: Any, __item3: Any, __item4: Any) -> itemgetter[tuple[Any, Any, Any, Any]]: ...
117+
def __new__(
118+
cls, item: _T_co, __item2: _T_co, __item3: _T_co, __item4: _T_co
119+
) -> itemgetter[tuple[_T_co, _T_co, _T_co, _T_co]]: ...
117120
@overload
118-
def __new__(cls, item: Any, *items: Any) -> itemgetter[tuple[Any, ...]]: ...
119-
def __call__(self, obj: Any) -> _T_co: ...
121+
def __new__(
122+
cls, item: _T_co, __item2: _T_co, __item3: _T_co, __item4: _T_co, *items: _T_co
123+
) -> itemgetter[tuple[_T_co, ...]]: ...
124+
# __key: _KT_contra in SupportsGetItem seems to be causing variance issues, ie:
125+
# TypeVar "_KT_contra@SupportsGetItem" is contravariant
126+
# "tuple[int, int]" is incompatible with protocol "SupportsIndex"
127+
# preventing [_T_co, ...] instead of [Any, ...]
128+
#
129+
# A suspected mypy issue prevents using [..., _T] instead of [..., Any] here.
130+
# https://github.com/python/mypy/issues/14032
131+
def __call__(self, obj: SupportsGetItem[Any, Any]) -> Any: ...
120132

121133
@final
122134
class methodcaller:
+25-17
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
import sys
2+
from _typeshed import StrOrBytesPath
23
from collections.abc import Callable, Sequence
4+
from typing_extensions import SupportsIndex
35

46
if sys.platform != "win32":
57
def cloexec_pipe() -> tuple[int, int]: ...
68
def fork_exec(
7-
args: Sequence[str],
8-
executable_list: Sequence[bytes],
9-
close_fds: bool,
10-
fds_to_keep: Sequence[int],
11-
cwd: str,
12-
env_list: Sequence[bytes],
13-
p2cread: int,
14-
p2cwrite: int,
15-
c2pred: int,
16-
c2pwrite: int,
17-
errread: int,
18-
errwrite: int,
19-
errpipe_read: int,
20-
errpipe_write: int,
21-
restore_signals: int,
22-
start_new_session: int,
23-
preexec_fn: Callable[[], None],
9+
__process_args: Sequence[StrOrBytesPath] | None,
10+
__executable_list: Sequence[bytes],
11+
__close_fds: bool,
12+
__fds_to_keep: tuple[int, ...],
13+
__cwd_obj: str,
14+
__env_list: Sequence[bytes] | None,
15+
__p2cread: int,
16+
__p2cwrite: int,
17+
__c2pred: int,
18+
__c2pwrite: int,
19+
__errread: int,
20+
__errwrite: int,
21+
__errpipe_read: int,
22+
__errpipe_write: int,
23+
__restore_signals: int,
24+
__call_setsid: int,
25+
__pgid_to_set: int,
26+
__gid_object: SupportsIndex | None,
27+
__groups_list: list[int] | None,
28+
__uid_object: SupportsIndex | None,
29+
__child_umask: int,
30+
__preexec_fn: Callable[[], None],
31+
__allow_vfork: bool,
2432
) -> int: ...

mypy/typeshed/stdlib/_socket.pyi

+14-10
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ _CMSG: TypeAlias = tuple[int, int, bytes]
1515
_CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
1616

1717
# Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
18-
# AF_NETLINK, AF_TIPC) or strings (AF_UNIX).
19-
_Address: TypeAlias = tuple[Any, ...] | str
18+
# AF_NETLINK, AF_TIPC) or strings/buffers (AF_UNIX).
19+
# See getsockaddrarg() in socketmodule.c.
20+
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer
2021
_RetAddress: TypeAlias = Any
21-
# TODO Most methods allow bytes as address objects
2222

2323
# ----- Constants -----
2424
# Some socket families are listed in the "Socket families" section of the docs,
@@ -583,11 +583,15 @@ class socket:
583583
def proto(self) -> int: ...
584584
@property
585585
def timeout(self) -> float | None: ...
586-
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ...
587-
def bind(self, __address: _Address | bytes) -> None: ...
586+
if sys.platform == "win32":
587+
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | bytes | None = ...) -> None: ...
588+
else:
589+
def __init__(self, family: int = ..., type: int = ..., proto: int = ..., fileno: _FD | None = ...) -> None: ...
590+
591+
def bind(self, __address: _Address) -> None: ...
588592
def close(self) -> None: ...
589-
def connect(self, __address: _Address | bytes) -> None: ...
590-
def connect_ex(self, __address: _Address | bytes) -> int: ...
593+
def connect(self, __address: _Address) -> None: ...
594+
def connect_ex(self, __address: _Address) -> int: ...
591595
def detach(self) -> int: ...
592596
def fileno(self) -> int: ...
593597
def getpeername(self) -> _RetAddress: ...
@@ -634,7 +638,7 @@ class socket:
634638
def setblocking(self, __flag: bool) -> None: ...
635639
def settimeout(self, __value: float | None) -> None: ...
636640
@overload
637-
def setsockopt(self, __level: int, __optname: int, __value: int | bytes) -> None: ...
641+
def setsockopt(self, __level: int, __optname: int, __value: int | ReadableBuffer) -> None: ...
638642
@overload
639643
def setsockopt(self, __level: int, __optname: int, __value: None, __optlen: int) -> None: ...
640644
if sys.platform == "win32":
@@ -671,9 +675,9 @@ def ntohs(__x: int) -> int: ... # param & ret val are 16-bit ints
671675
def htonl(__x: int) -> int: ... # param & ret val are 32-bit ints
672676
def htons(__x: int) -> int: ... # param & ret val are 16-bit ints
673677
def inet_aton(__ip_string: str) -> bytes: ... # ret val 4 bytes in length
674-
def inet_ntoa(__packed_ip: bytes) -> str: ...
678+
def inet_ntoa(__packed_ip: ReadableBuffer) -> str: ...
675679
def inet_pton(__address_family: int, __ip_string: str) -> bytes: ...
676-
def inet_ntop(__address_family: int, __packed_ip: bytes) -> str: ...
680+
def inet_ntop(__address_family: int, __packed_ip: ReadableBuffer) -> str: ...
677681
def getdefaulttimeout() -> float | None: ...
678682
def setdefaulttimeout(__timeout: float | None) -> None: ...
679683

mypy/typeshed/stdlib/_tkinter.pyi

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ from typing_extensions import Literal, final
1717
# (<textindex object: '1.0'>, <textindex object: '2.0'>)
1818
@final
1919
class Tcl_Obj:
20-
string: str | bytes
21-
typename: str
20+
@property
21+
def string(self) -> str: ...
22+
@property
23+
def typename(self) -> str: ...
2224
__hash__: ClassVar[None] # type: ignore[assignment]
2325
def __eq__(self, __other): ...
2426
def __ge__(self, __other): ...

0 commit comments

Comments
 (0)