Skip to content

Commit a995642

Browse files
committed
Sync typeshed
Source commit: python/typeshed@45f0a5e
1 parent a618110 commit a995642

Some content is hidden

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

47 files changed

+1962
-1676
lines changed

mypy/typeshed/stdlib/_bisect.pyi

+18-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
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 = 0, hi: int | None = None, *, key: None = 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,
1722
lo: int = 0,
1823
hi: int | None = None,
@@ -21,11 +26,16 @@ if sys.version_info >= (3, 10):
2126
) -> int: ...
2227
@overload
2328
def bisect_right(
24-
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None, *, key: None = 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,
3040
lo: int = 0,
3141
hi: int | None = None,
@@ -61,10 +71,10 @@ if sys.version_info >= (3, 10):
6171

6272
else:
6373
def bisect_left(
64-
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = 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 = 0, hi: int | None = None
77+
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
6878
) -> int: ...
6979
def insort_left(
7080
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None

mypy/typeshed/stdlib/_csv.pyi

+27-27
Original file line numberDiff line numberDiff line change
@@ -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: ...

mypy/typeshed/stdlib/_decimal.pyi

+21-21
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,28 @@ class Decimal:
7777
def as_integer_ratio(self) -> tuple[int, int]: ...
7878
def to_eng_string(self, context: Context | None = None) -> str: ...
7979
def __abs__(self) -> Decimal: ...
80-
def __add__(self, __other: _Decimal) -> Decimal: ...
81-
def __divmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ...
82-
def __eq__(self, __other: object) -> bool: ...
83-
def __floordiv__(self, __other: _Decimal) -> Decimal: ...
84-
def __ge__(self, __other: _ComparableNum) -> bool: ...
85-
def __gt__(self, __other: _ComparableNum) -> bool: ...
86-
def __le__(self, __other: _ComparableNum) -> bool: ...
87-
def __lt__(self, __other: _ComparableNum) -> bool: ...
88-
def __mod__(self, __other: _Decimal) -> Decimal: ...
89-
def __mul__(self, __other: _Decimal) -> Decimal: ...
80+
def __add__(self, __value: _Decimal) -> Decimal: ...
81+
def __divmod__(self, __value: _Decimal) -> tuple[Decimal, Decimal]: ...
82+
def __eq__(self, __value: object) -> bool: ...
83+
def __floordiv__(self, __value: _Decimal) -> Decimal: ...
84+
def __ge__(self, __value: _ComparableNum) -> bool: ...
85+
def __gt__(self, __value: _ComparableNum) -> bool: ...
86+
def __le__(self, __value: _ComparableNum) -> bool: ...
87+
def __lt__(self, __value: _ComparableNum) -> bool: ...
88+
def __mod__(self, __value: _Decimal) -> Decimal: ...
89+
def __mul__(self, __value: _Decimal) -> Decimal: ...
9090
def __neg__(self) -> Decimal: ...
9191
def __pos__(self) -> Decimal: ...
92-
def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ...
93-
def __radd__(self, __other: _Decimal) -> Decimal: ...
94-
def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ...
95-
def __rfloordiv__(self, __other: _Decimal) -> Decimal: ...
96-
def __rmod__(self, __other: _Decimal) -> Decimal: ...
97-
def __rmul__(self, __other: _Decimal) -> Decimal: ...
98-
def __rsub__(self, __other: _Decimal) -> Decimal: ...
99-
def __rtruediv__(self, __other: _Decimal) -> Decimal: ...
100-
def __sub__(self, __other: _Decimal) -> Decimal: ...
101-
def __truediv__(self, __other: _Decimal) -> Decimal: ...
92+
def __pow__(self, __value: _Decimal, __mod: _Decimal | None = None) -> Decimal: ...
93+
def __radd__(self, __value: _Decimal) -> Decimal: ...
94+
def __rdivmod__(self, __value: _Decimal) -> tuple[Decimal, Decimal]: ...
95+
def __rfloordiv__(self, __value: _Decimal) -> Decimal: ...
96+
def __rmod__(self, __value: _Decimal) -> Decimal: ...
97+
def __rmul__(self, __value: _Decimal) -> Decimal: ...
98+
def __rsub__(self, __value: _Decimal) -> Decimal: ...
99+
def __rtruediv__(self, __value: _Decimal) -> Decimal: ...
100+
def __sub__(self, __value: _Decimal) -> Decimal: ...
101+
def __truediv__(self, __value: _Decimal) -> Decimal: ...
102102
def remainder_near(self, other: _Decimal, context: Context | None = None) -> Decimal: ...
103103
def __float__(self) -> float: ...
104104
def __int__(self) -> int: ...
@@ -116,7 +116,7 @@ class Decimal:
116116
def __floor__(self) -> int: ...
117117
def __ceil__(self) -> int: ...
118118
def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ...
119-
def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ...
119+
def __rpow__(self, __value: _Decimal, __mod: Context | None = None) -> Decimal: ...
120120
def normalize(self, context: Context | None = None) -> Decimal: ...
121121
def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ...
122122
def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ...

mypy/typeshed/stdlib/_typeshed/__init__.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class structseq(Generic[_T_co]):
293293
# https://github.com/python/typeshed/pull/6560#discussion_r767149830
294294
def __new__(cls: type[Self], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> Self: ...
295295

296-
# Superset of typing.AnyStr that also inclues LiteralString
296+
# Superset of typing.AnyStr that also includes LiteralString
297297
AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa: Y001
298298

299299
# Represents when str or LiteralStr is acceptable. Useful for string processing

mypy/typeshed/stdlib/_weakref.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ProxyType(Generic[_T]): # "weakproxy"
2020

2121
class ReferenceType(Generic[_T]):
2222
__callback__: Callable[[ReferenceType[_T]], Any]
23-
def __new__(cls, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
23+
def __new__(cls, __o: _T, __callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
2424
def __call__(self) -> _T | None: ...
2525
if sys.version_info >= (3, 9):
2626
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

mypy/typeshed/stdlib/argparse.pyi

+2-7
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
161161
add_help: bool = True,
162162
allow_abbrev: bool = True,
163163
) -> None: ...
164-
# The type-ignores in these overloads should be temporary. See:
165-
# https://github.com/python/typeshed/pull/2643#issuecomment-442280277
164+
# Ignore errors about overlapping overloads
166165
@overload
167-
def parse_args(self, args: Sequence[str] | None = None) -> Namespace: ...
168-
@overload
169-
def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore[misc]
166+
def parse_args(self, args: Sequence[str] | None = None, namespace: None = None) -> Namespace: ... # type: ignore[misc]
170167
@overload
171168
def parse_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ...
172169
@overload
173-
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore[misc]
174-
@overload
175170
def parse_args(self, *, namespace: _N) -> _N: ...
176171
@overload
177172
def add_subparsers(

mypy/typeshed/stdlib/asyncio/base_subprocess.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
4646
def get_pid(self) -> int | None: ... # type: ignore[override]
4747
def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore[override]
4848
def _check_proc(self) -> None: ... # undocumented
49-
def send_signal(self, signal: int) -> None: ... # type: ignore[override]
49+
def send_signal(self, signal: int) -> None: ...
5050
async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented
5151
def _call(self, cb: Callable[..., object], *data: Any) -> None: ... # undocumented
5252
def _pipe_connection_lost(self, fd: int, exc: BaseException | None) -> None: ... # undocumented

0 commit comments

Comments
 (0)