Skip to content

Commit 38a67cb

Browse files
Update bundled typeshed (#107)
1 parent c55a3b4 commit 38a67cb

File tree

190 files changed

+4588
-4000
lines changed

Some content is hidden

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

190 files changed

+4588
-4000
lines changed

typeshed_client/typeshed/_codecs.pyi

+45-45
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ _CharMap: TypeAlias = dict[int, int] | _EncodingMap
1313
_Handler: TypeAlias = Callable[[UnicodeError], tuple[str | bytes, int]]
1414
_SearchFunction: TypeAlias = Callable[[str], codecs.CodecInfo | None]
1515

16-
def register(__search_function: _SearchFunction) -> None: ...
16+
def register(search_function: _SearchFunction, /) -> None: ...
1717

1818
if sys.version_info >= (3, 10):
19-
def unregister(__search_function: _SearchFunction) -> None: ...
19+
def unregister(search_function: _SearchFunction, /) -> None: ...
2020

21-
def register_error(__errors: str, __handler: _Handler) -> None: ...
22-
def lookup_error(__name: str) -> _Handler: ...
21+
def register_error(errors: str, handler: _Handler, /) -> None: ...
22+
def lookup_error(name: str, /) -> _Handler: ...
2323

2424
# The type ignore on `encode` and `decode` is to avoid issues with overlapping overloads, for more details, see #300
2525
# https://docs.python.org/3/library/codecs.html#binary-transforms
@@ -68,66 +68,66 @@ def decode(
6868
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ...
6969
@overload
7070
def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...
71-
def lookup(__encoding: str) -> codecs.CodecInfo: ...
72-
def charmap_build(__map: str) -> _CharMap: ...
73-
def ascii_decode(__data: ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
74-
def ascii_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
75-
def charmap_decode(__data: ReadableBuffer, __errors: str | None = None, __mapping: _CharMap | None = None) -> tuple[str, int]: ...
76-
def charmap_encode(__str: str, __errors: str | None = None, __mapping: _CharMap | None = None) -> tuple[bytes, int]: ...
77-
def escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
78-
def escape_encode(__data: bytes, __errors: str | None = None) -> tuple[bytes, int]: ...
79-
def latin_1_decode(__data: ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
80-
def latin_1_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
71+
def lookup(encoding: str, /) -> codecs.CodecInfo: ...
72+
def charmap_build(map: str, /) -> _CharMap: ...
73+
def ascii_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
74+
def ascii_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
75+
def charmap_decode(data: ReadableBuffer, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[str, int]: ...
76+
def charmap_encode(str: str, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[bytes, int]: ...
77+
def escape_decode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
78+
def escape_encode(data: bytes, errors: str | None = None, /) -> tuple[bytes, int]: ...
79+
def latin_1_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
80+
def latin_1_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
8181

8282
if sys.version_info >= (3, 9):
8383
def raw_unicode_escape_decode(
84-
__data: str | ReadableBuffer, __errors: str | None = None, __final: bool = True
84+
data: str | ReadableBuffer, errors: str | None = None, final: bool = True, /
8585
) -> tuple[str, int]: ...
8686

8787
else:
88-
def raw_unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
88+
def raw_unicode_escape_decode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
8989

90-
def raw_unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
91-
def readbuffer_encode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ...
90+
def raw_unicode_escape_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
91+
def readbuffer_encode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[bytes, int]: ...
9292

9393
if sys.version_info >= (3, 9):
9494
def unicode_escape_decode(
95-
__data: str | ReadableBuffer, __errors: str | None = None, __final: bool = True
95+
data: str | ReadableBuffer, errors: str | None = None, final: bool = True, /
9696
) -> tuple[str, int]: ...
9797

9898
else:
99-
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
99+
def unicode_escape_decode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
100100

101-
def unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
102-
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
103-
def utf_16_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
104-
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
105-
def utf_16_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ...
101+
def unicode_escape_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
102+
def utf_16_be_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
103+
def utf_16_be_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
104+
def utf_16_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
105+
def utf_16_encode(str: str, errors: str | None = None, byteorder: int = 0, /) -> tuple[bytes, int]: ...
106106
def utf_16_ex_decode(
107-
__data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: bool = False
107+
data: ReadableBuffer, errors: str | None = None, byteorder: int = 0, final: bool = False, /
108108
) -> tuple[str, int, int]: ...
109-
def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
110-
def utf_16_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
111-
def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
112-
def utf_32_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
113-
def utf_32_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
114-
def utf_32_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ...
109+
def utf_16_le_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
110+
def utf_16_le_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
111+
def utf_32_be_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
112+
def utf_32_be_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
113+
def utf_32_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
114+
def utf_32_encode(str: str, errors: str | None = None, byteorder: int = 0, /) -> tuple[bytes, int]: ...
115115
def utf_32_ex_decode(
116-
__data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: bool = False
116+
data: ReadableBuffer, errors: str | None = None, byteorder: int = 0, final: bool = False, /
117117
) -> tuple[str, int, int]: ...
118-
def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
119-
def utf_32_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
120-
def utf_7_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
121-
def utf_7_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
122-
def utf_8_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
123-
def utf_8_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
118+
def utf_32_le_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
119+
def utf_32_le_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
120+
def utf_7_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
121+
def utf_7_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
122+
def utf_8_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
123+
def utf_8_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
124124

125125
if sys.platform == "win32":
126-
def mbcs_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
127-
def mbcs_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
126+
def mbcs_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
127+
def mbcs_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
128128
def code_page_decode(
129-
__codepage: int, __data: ReadableBuffer, __errors: str | None = None, __final: bool = False
129+
codepage: int, data: ReadableBuffer, errors: str | None = None, final: bool = False, /
130130
) -> tuple[str, int]: ...
131-
def code_page_encode(__code_page: int, __str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
132-
def oem_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
133-
def oem_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
131+
def code_page_encode(code_page: int, str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
132+
def oem_decode(data: ReadableBuffer, errors: str | None = None, final: bool = False, /) -> tuple[str, int]: ...
133+
def oem_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...

typeshed_client/typeshed/_collections_abc.pyi

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
6969

7070
@final
7171
class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented
72-
def __eq__(self, __value: object) -> bool: ...
72+
def __eq__(self, value: object, /) -> bool: ...
7373
if sys.version_info >= (3, 10):
7474
@property
7575
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ...
@@ -82,7 +82,7 @@ class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented
8282

8383
@final
8484
class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
85-
def __eq__(self, __value: object) -> bool: ...
85+
def __eq__(self, value: object, /) -> bool: ...
8686
if sys.version_info >= (3, 10):
8787
@property
8888
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ...
@@ -91,4 +91,4 @@ if sys.version_info >= (3, 12):
9191
@runtime_checkable
9292
class Buffer(Protocol):
9393
@abstractmethod
94-
def __buffer__(self, __flags: int) -> memoryview: ...
94+
def __buffer__(self, flags: int, /) -> memoryview: ...

typeshed_client/typeshed/_compression.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ from typing import Any, Protocol
66
BUFFER_SIZE = DEFAULT_BUFFER_SIZE
77

88
class _Reader(Protocol):
9-
def read(self, __n: int) -> bytes: ...
9+
def read(self, n: int, /) -> bytes: ...
1010
def seekable(self) -> bool: ...
11-
def seek(self, __n: int) -> Any: ...
11+
def seek(self, n: int, /) -> Any: ...
1212

1313
class BaseStream(BufferedIOBase): ...
1414

typeshed_client/typeshed/_ctypes.pyi

+23-21
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ if sys.platform == "win32":
4444
def FormatError(code: int = ...) -> str: ...
4545
def get_last_error() -> int: ...
4646
def set_last_error(value: int) -> int: ...
47-
def LoadLibrary(__name: str, __load_flags: int = 0) -> int: ...
48-
def FreeLibrary(__handle: int) -> None: ...
47+
def LoadLibrary(name: str, load_flags: int = 0, /) -> int: ...
48+
def FreeLibrary(handle: int, /) -> None: ...
4949

5050
class _CDataMeta(type):
5151
# By default mypy complains about the following two methods, because strictly speaking cls
@@ -64,6 +64,7 @@ class _CData(metaclass=_CDataMeta):
6464
# Structure.from_buffer(...) # valid at runtime
6565
# Structure(...).from_buffer(...) # invalid at runtime
6666
#
67+
6768
@classmethod
6869
def from_buffer(cls, source: WriteableBuffer, offset: int = ...) -> Self: ...
6970
@classmethod
@@ -74,8 +75,8 @@ class _CData(metaclass=_CDataMeta):
7475
def from_param(cls, obj: Any) -> Self | _CArgObject: ...
7576
@classmethod
7677
def in_dll(cls, library: CDLL, name: str) -> Self: ...
77-
def __buffer__(self, __flags: int) -> memoryview: ...
78-
def __release_buffer__(self, __buffer: memoryview) -> None: ...
78+
def __buffer__(self, flags: int, /) -> memoryview: ...
79+
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
7980

8081
class _SimpleCData(_CData, Generic[_T]):
8182
value: _T
@@ -94,38 +95,39 @@ class _Pointer(_PointerLike, _CData, Generic[_CT]):
9495
@overload
9596
def __init__(self, arg: _CT) -> None: ...
9697
@overload
97-
def __getitem__(self, __key: int) -> Any: ...
98+
def __getitem__(self, key: int, /) -> Any: ...
9899
@overload
99-
def __getitem__(self, __key: slice) -> list[Any]: ...
100-
def __setitem__(self, __key: int, __value: Any) -> None: ...
100+
def __getitem__(self, key: slice, /) -> list[Any]: ...
101+
def __setitem__(self, key: int, value: Any, /) -> None: ...
101102

102103
def POINTER(type: type[_CT]) -> type[_Pointer[_CT]]: ...
103-
def pointer(__arg: _CT) -> _Pointer[_CT]: ...
104+
def pointer(arg: _CT, /) -> _Pointer[_CT]: ...
104105

105106
class _CArgObject: ...
106107

107108
def byref(obj: _CData, offset: int = ...) -> _CArgObject: ...
108109

109-
_ECT: TypeAlias = Callable[[type[_CData] | None, CFuncPtr, tuple[_CData, ...]], _CData]
110+
_ECT: TypeAlias = Callable[[_CData | None, CFuncPtr, tuple[_CData, ...]], _CData]
110111
_PF: TypeAlias = tuple[int] | tuple[int, str | None] | tuple[int, str | None, Any]
111112

112113
class CFuncPtr(_PointerLike, _CData):
113114
restype: type[_CData] | Callable[[int], Any] | None
114115
argtypes: Sequence[type[_CData]]
115116
errcheck: _ECT
116-
_flags_: ClassVar[int] # Abstract attribute that must be defined on subclasses
117+
# Abstract attribute that must be defined on subclasses
118+
_flags_: ClassVar[int]
117119
@overload
118120
def __init__(self) -> None: ...
119121
@overload
120-
def __init__(self, __address: int) -> None: ...
122+
def __init__(self, address: int, /) -> None: ...
121123
@overload
122-
def __init__(self, __callable: Callable[..., Any]) -> None: ...
124+
def __init__(self, callable: Callable[..., Any], /) -> None: ...
123125
@overload
124-
def __init__(self, __func_spec: tuple[str | int, CDLL], __paramflags: tuple[_PF, ...] | None = ...) -> None: ...
126+
def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> None: ...
125127
if sys.platform == "win32":
126128
@overload
127129
def __init__(
128-
self, __vtbl_index: int, __name: str, __paramflags: tuple[_PF, ...] | None = ..., __iid: _CData | None = ...
130+
self, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | None = ..., /
129131
) -> None: ...
130132

131133
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
@@ -137,10 +139,10 @@ class _CField(Generic[_CT, _GetT, _SetT]):
137139
offset: int
138140
size: int
139141
@overload
140-
def __get__(self, __instance: None, __owner: type[Any] | None) -> Self: ...
142+
def __get__(self, instance: None, owner: type[Any] | None, /) -> Self: ...
141143
@overload
142-
def __get__(self, __instance: Any, __owner: type[Any] | None) -> _GetT: ...
143-
def __set__(self, __instance: Any, __value: _SetT) -> None: ...
144+
def __get__(self, instance: Any, owner: type[Any] | None, /) -> _GetT: ...
145+
def __set__(self, instance: Any, value: _SetT, /) -> None: ...
144146

145147
class _StructUnionMeta(_CDataMeta):
146148
_fields_: Sequence[tuple[str, type[_CData]] | tuple[str, type[_CData], int]]
@@ -187,13 +189,13 @@ class Array(_CData, Generic[_CT]):
187189
# the array element type would belong are annotated with Any instead.
188190
def __init__(self, *args: Any) -> None: ...
189191
@overload
190-
def __getitem__(self, __key: int) -> Any: ...
192+
def __getitem__(self, key: int, /) -> Any: ...
191193
@overload
192-
def __getitem__(self, __key: slice) -> list[Any]: ...
194+
def __getitem__(self, key: slice, /) -> list[Any]: ...
193195
@overload
194-
def __setitem__(self, __key: int, __value: Any) -> None: ...
196+
def __setitem__(self, key: int, value: Any, /) -> None: ...
195197
@overload
196-
def __setitem__(self, __key: slice, __value: Iterable[Any]) -> None: ...
198+
def __setitem__(self, key: slice, value: Iterable[Any], /) -> None: ...
197199
def __iter__(self) -> Iterator[Any]: ...
198200
# Can't inherit from Sized because the metaclass conflict between
199201
# Sized and _CData prevents using _CDataMeta.

0 commit comments

Comments
 (0)