Skip to content

Commit 5c623c8

Browse files
Update bundled typeshed, prepare release (#82)
1 parent 4f707aa commit 5c623c8

File tree

333 files changed

+8669
-7087
lines changed

Some content is hidden

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

333 files changed

+8669
-7087
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Changelog
8383

8484
Version 2.3.0 (April 30, 2023)
8585

86+
- Update bundled typeshed
8687
- Support ``__all__.append`` and ``__all__.extend``
8788

8889
Version 2.2.0 (January 24, 2023)

typeshed_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from .resolver import ImportedInfo, Resolver
2424

2525

26-
__version__ = "2.2.0"
26+
__version__ = "2.3.0"
2727

2828

2929
__all__ = [

typeshed_client/typeshed/VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ importlib: 2.7-
152152
importlib.metadata: 3.8-
153153
importlib.metadata._meta: 3.10-
154154
importlib.resources: 3.7-
155+
importlib.resources.abc: 3.11-
155156
inspect: 2.7-
156157
io: 2.7-
157158
ipaddress: 3.3-

typeshed_client/typeshed/_bisect.pyi

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,84 @@
11
import sys
2-
from _typeshed import SupportsRichComparisonT
3-
from collections.abc import Callable, MutableSequence, Sequence
2+
from _typeshed import SupportsLenAndGetItem, SupportsRichComparisonT
3+
from collections.abc import Callable, MutableSequence
44
from typing import TypeVar, overload
55

66
_T = TypeVar("_T")
77

88
if sys.version_info >= (3, 10):
99
@overload
1010
def bisect_left(
11-
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ..., *, key: None = ...
11+
a: SupportsLenAndGetItem[SupportsRichComparisonT],
12+
x: SupportsRichComparisonT,
13+
lo: int = 0,
14+
hi: int | None = None,
15+
*,
16+
key: None = None,
1217
) -> int: ...
1318
@overload
1419
def bisect_left(
15-
a: Sequence[_T],
20+
a: SupportsLenAndGetItem[_T],
1621
x: SupportsRichComparisonT,
17-
lo: int = ...,
18-
hi: int | None = ...,
22+
lo: int = 0,
23+
hi: int | None = None,
1924
*,
20-
key: Callable[[_T], SupportsRichComparisonT] = ...,
25+
key: Callable[[_T], SupportsRichComparisonT],
2126
) -> int: ...
2227
@overload
2328
def bisect_right(
24-
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ..., *, key: None = ...
29+
a: SupportsLenAndGetItem[SupportsRichComparisonT],
30+
x: SupportsRichComparisonT,
31+
lo: int = 0,
32+
hi: int | None = None,
33+
*,
34+
key: None = None,
2535
) -> int: ...
2636
@overload
2737
def bisect_right(
28-
a: Sequence[_T],
38+
a: SupportsLenAndGetItem[_T],
2939
x: SupportsRichComparisonT,
30-
lo: int = ...,
31-
hi: int | None = ...,
40+
lo: int = 0,
41+
hi: int | None = None,
3242
*,
33-
key: Callable[[_T], SupportsRichComparisonT] = ...,
43+
key: Callable[[_T], SupportsRichComparisonT],
3444
) -> int: ...
3545
@overload
3646
def insort_left(
3747
a: MutableSequence[SupportsRichComparisonT],
3848
x: SupportsRichComparisonT,
39-
lo: int = ...,
40-
hi: int | None = ...,
49+
lo: int = 0,
50+
hi: int | None = None,
4151
*,
42-
key: None = ...,
52+
key: None = None,
4353
) -> None: ...
4454
@overload
4555
def insort_left(
46-
a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsRichComparisonT] = ...
56+
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
4757
) -> None: ...
4858
@overload
4959
def insort_right(
5060
a: MutableSequence[SupportsRichComparisonT],
5161
x: SupportsRichComparisonT,
52-
lo: int = ...,
53-
hi: int | None = ...,
62+
lo: int = 0,
63+
hi: int | None = None,
5464
*,
55-
key: None = ...,
65+
key: None = None,
5666
) -> None: ...
5767
@overload
5868
def insort_right(
59-
a: MutableSequence[_T], x: _T, lo: int = ..., hi: int | None = ..., *, key: Callable[[_T], SupportsRichComparisonT] = ...
69+
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
6070
) -> None: ...
6171

6272
else:
6373
def bisect_left(
64-
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
74+
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
6575
) -> int: ...
6676
def bisect_right(
67-
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
77+
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
6878
) -> int: ...
6979
def insort_left(
70-
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
80+
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
7181
) -> None: ...
7282
def insort_right(
73-
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ...
83+
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
7484
) -> None: ...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
def getpreferredencoding(do_setlocale: bool = ...) -> str: ...
1+
def getpreferredencoding(do_setlocale: bool = True) -> str: ...

typeshed_client/typeshed/_codecs.pyi

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -45,92 +45,94 @@ _BytesToBytesEncoding: TypeAlias = Literal[
4545
_StrToStrEncoding: TypeAlias = Literal["rot13", "rot_13"]
4646

4747
@overload
48-
def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ...
48+
def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ...
4949
@overload
50-
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ... # type: ignore[misc]
50+
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[misc]
5151
@overload
52-
def encode(obj: str, encoding: str = ..., errors: str = ...) -> bytes: ...
52+
def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
5353
@overload
54-
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = ...) -> bytes: ... # type: ignore[misc]
54+
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[misc]
5555
@overload
56-
def decode(obj: str, encoding: _StrToStrEncoding, errors: str = ...) -> str: ...
56+
def decode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ...
5757

5858
# these are documented as text encodings but in practice they also accept str as input
5959
@overload
6060
def decode(
61-
obj: str, encoding: Literal["unicode_escape", "unicode-escape", "raw_unicode_escape", "raw-unicode-escape"], errors: str = ...
61+
obj: str,
62+
encoding: Literal["unicode_escape", "unicode-escape", "raw_unicode_escape", "raw-unicode-escape"],
63+
errors: str = "strict",
6264
) -> str: ...
6365

6466
# hex is officially documented as a bytes to bytes encoding, but it appears to also work with str
6567
@overload
66-
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = ...) -> bytes: ...
68+
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ...
6769
@overload
68-
def decode(obj: ReadableBuffer, encoding: str = ..., errors: str = ...) -> str: ...
70+
def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...
6971
def lookup(__encoding: str) -> codecs.CodecInfo: ...
7072
def charmap_build(__map: str) -> _CharMap: ...
71-
def ascii_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
72-
def ascii_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
73-
def charmap_decode(__data: ReadableBuffer, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[str, int]: ...
74-
def charmap_encode(__str: str, __errors: str | None = ..., __mapping: _CharMap | None = ...) -> tuple[bytes, int]: ...
75-
def escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
76-
def escape_encode(__data: bytes, __errors: str | None = ...) -> tuple[bytes, int]: ...
77-
def latin_1_decode(__data: ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
78-
def latin_1_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
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]: ...
7981

8082
if sys.version_info >= (3, 9):
8183
def raw_unicode_escape_decode(
82-
__data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ...
84+
__data: str | ReadableBuffer, __errors: str | None = None, __final: bool = True
8385
) -> tuple[str, int]: ...
8486

8587
else:
86-
def raw_unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
88+
def raw_unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
8789

88-
def raw_unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
89-
def readbuffer_encode(__data: str | ReadableBuffer, __errors: str | 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]: ...
9092

9193
if sys.version_info >= (3, 9):
9294
def unicode_escape_decode(
93-
__data: str | ReadableBuffer, __errors: str | None = ..., __final: bool = ...
95+
__data: str | ReadableBuffer, __errors: str | None = None, __final: bool = True
9496
) -> tuple[str, int]: ...
9597

9698
else:
97-
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = ...) -> tuple[str, int]: ...
99+
def unicode_escape_decode(__data: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
98100

99-
def unicode_escape_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
101+
def unicode_escape_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
100102

101103
if sys.version_info < (3, 8):
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]: ...
104+
def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ...
105+
def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ...
104106

105-
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
106-
def utf_16_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
107-
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
108-
def utf_16_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ...
107+
def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
108+
def utf_16_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
109+
def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
110+
def utf_16_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ...
109111
def utf_16_ex_decode(
110-
__data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
112+
__data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: bool = False
111113
) -> tuple[str, int, int]: ...
112-
def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
113-
def utf_16_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
114-
def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
115-
def utf_32_be_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
116-
def utf_32_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
117-
def utf_32_encode(__str: str, __errors: str | None = ..., __byteorder: int = ...) -> tuple[bytes, int]: ...
114+
def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
115+
def utf_16_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
116+
def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
117+
def utf_32_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
118+
def utf_32_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
119+
def utf_32_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ...
118120
def utf_32_ex_decode(
119-
__data: ReadableBuffer, __errors: str | None = ..., __byteorder: int = ..., __final: int = ...
121+
__data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: bool = False
120122
) -> tuple[str, int, int]: ...
121-
def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
122-
def utf_32_le_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
123-
def utf_7_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
124-
def utf_7_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
125-
def utf_8_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
126-
def utf_8_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
123+
def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
124+
def utf_32_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
125+
def utf_7_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
126+
def utf_7_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
127+
def utf_8_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
128+
def utf_8_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
127129

128130
if sys.platform == "win32":
129-
def mbcs_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
130-
def mbcs_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
131+
def mbcs_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
132+
def mbcs_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
131133
def code_page_decode(
132-
__codepage: int, __data: ReadableBuffer, __errors: str | None = ..., __final: int = ...
134+
__codepage: int, __data: ReadableBuffer, __errors: str | None = None, __final: bool = False
133135
) -> tuple[str, int]: ...
134-
def code_page_encode(__code_page: int, __str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
135-
def oem_decode(__data: ReadableBuffer, __errors: str | None = ..., __final: int = ...) -> tuple[str, int]: ...
136-
def oem_encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ...
136+
def code_page_encode(__code_page: int, __str: str, __errors: str | None = None) -> tuple[bytes, int]: ...
137+
def oem_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ...
138+
def oem_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ...

typeshed_client/typeshed/_compression.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DecompressReader(RawIOBase):
1717
self,
1818
fp: _Reader,
1919
decomp_factory: Callable[..., object],
20-
trailing_error: type[Exception] | tuple[type[Exception], ...] = ...,
20+
trailing_error: type[Exception] | tuple[type[Exception], ...] = (),
2121
**decomp_args: Any,
2222
) -> None: ...
2323
def readinto(self, b: WriteableBuffer) -> int: ...

typeshed_client/typeshed/_csv.pyi

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from _typeshed import SupportsWrite
22
from collections.abc import Iterable, Iterator
3-
from typing import Any, Union
4-
from typing_extensions import Literal, TypeAlias
3+
from typing import Any
4+
from typing_extensions import Final, Literal, TypeAlias
55

6-
__version__: str
6+
__version__: Final[str]
77

88
QUOTE_ALL: Literal[1]
99
QUOTE_MINIMAL: Literal[0]
@@ -27,7 +27,7 @@ class Dialect:
2727
strict: bool
2828
def __init__(self) -> None: ...
2929

30-
_DialectLike: TypeAlias = Union[str, Dialect, type[Dialect]]
30+
_DialectLike: TypeAlias = str | Dialect | type[Dialect]
3131

3232
class _reader(Iterator[list[str]]):
3333
@property
@@ -43,42 +43,42 @@ class _writer:
4343

4444
def writer(
4545
csvfile: SupportsWrite[str],
46-
dialect: _DialectLike = ...,
46+
dialect: _DialectLike = "excel",
4747
*,
48-
delimiter: str = ...,
49-
quotechar: str | None = ...,
50-
escapechar: str | None = ...,
51-
doublequote: bool = ...,
52-
skipinitialspace: bool = ...,
53-
lineterminator: str = ...,
54-
quoting: _QuotingType = ...,
55-
strict: bool = ...,
48+
delimiter: str = ",",
49+
quotechar: str | None = '"',
50+
escapechar: str | None = None,
51+
doublequote: bool = True,
52+
skipinitialspace: bool = False,
53+
lineterminator: str = "\r\n",
54+
quoting: _QuotingType = 0,
55+
strict: bool = False,
5656
) -> _writer: ...
5757
def reader(
5858
csvfile: Iterable[str],
59-
dialect: _DialectLike = ...,
59+
dialect: _DialectLike = "excel",
6060
*,
61-
delimiter: str = ...,
62-
quotechar: str | None = ...,
63-
escapechar: str | None = ...,
64-
doublequote: bool = ...,
65-
skipinitialspace: bool = ...,
66-
lineterminator: str = ...,
67-
quoting: _QuotingType = ...,
68-
strict: bool = ...,
61+
delimiter: str = ",",
62+
quotechar: str | None = '"',
63+
escapechar: str | None = None,
64+
doublequote: bool = True,
65+
skipinitialspace: bool = False,
66+
lineterminator: str = "\r\n",
67+
quoting: _QuotingType = 0,
68+
strict: bool = False,
6969
) -> _reader: ...
7070
def register_dialect(
7171
name: str,
72-
dialect: Any = ...,
72+
dialect: type[Dialect] = ...,
7373
*,
74-
delimiter: str = ...,
75-
quotechar: str | None = ...,
76-
escapechar: str | None = ...,
77-
doublequote: bool = ...,
78-
skipinitialspace: bool = ...,
79-
lineterminator: str = ...,
80-
quoting: _QuotingType = ...,
81-
strict: bool = ...,
74+
delimiter: str = ",",
75+
quotechar: str | None = '"',
76+
escapechar: str | None = None,
77+
doublequote: bool = True,
78+
skipinitialspace: bool = False,
79+
lineterminator: str = "\r\n",
80+
quoting: _QuotingType = 0,
81+
strict: bool = False,
8282
) -> None: ...
8383
def unregister_dialect(name: str) -> None: ...
8484
def get_dialect(name: str) -> Dialect: ...

0 commit comments

Comments
 (0)