Skip to content

Commit

Permalink
Sync typeshed
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Mar 1, 2023
1 parent a618110 commit a995642
Show file tree
Hide file tree
Showing 47 changed files with 1,962 additions and 1,676 deletions.
26 changes: 18 additions & 8 deletions mypy/typeshed/stdlib/_bisect.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import sys
from _typeshed import SupportsRichComparisonT
from collections.abc import Callable, MutableSequence, Sequence
from _typeshed import SupportsLenAndGetItem, SupportsRichComparisonT
from collections.abc import Callable, MutableSequence
from typing import TypeVar, overload

_T = TypeVar("_T")

if sys.version_info >= (3, 10):
@overload
def bisect_left(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None, *, key: None = None
a: SupportsLenAndGetItem[SupportsRichComparisonT],
x: SupportsRichComparisonT,
lo: int = 0,
hi: int | None = None,
*,
key: None = None,
) -> int: ...
@overload
def bisect_left(
a: Sequence[_T],
a: SupportsLenAndGetItem[_T],
x: SupportsRichComparisonT,
lo: int = 0,
hi: int | None = None,
Expand All @@ -21,11 +26,16 @@ if sys.version_info >= (3, 10):
) -> int: ...
@overload
def bisect_right(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None, *, key: None = None
a: SupportsLenAndGetItem[SupportsRichComparisonT],
x: SupportsRichComparisonT,
lo: int = 0,
hi: int | None = None,
*,
key: None = None,
) -> int: ...
@overload
def bisect_right(
a: Sequence[_T],
a: SupportsLenAndGetItem[_T],
x: SupportsRichComparisonT,
lo: int = 0,
hi: int | None = None,
Expand Down Expand Up @@ -61,10 +71,10 @@ if sys.version_info >= (3, 10):

else:
def bisect_left(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> int: ...
def bisect_right(
a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> int: ...
def insort_left(
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
Expand Down
54 changes: 27 additions & 27 deletions mypy/typeshed/stdlib/_csv.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,42 @@ class _writer:

def writer(
csvfile: SupportsWrite[str],
dialect: _DialectLike = ...,
dialect: _DialectLike = "excel",
*,
delimiter: str = ...,
quotechar: str | None = ...,
escapechar: str | None = ...,
doublequote: bool = ...,
skipinitialspace: bool = ...,
lineterminator: str = ...,
quoting: _QuotingType = ...,
strict: bool = ...,
delimiter: str = ",",
quotechar: str | None = '"',
escapechar: str | None = None,
doublequote: bool = True,
skipinitialspace: bool = False,
lineterminator: str = "\r\n",
quoting: _QuotingType = 0,
strict: bool = False,
) -> _writer: ...
def reader(
csvfile: Iterable[str],
dialect: _DialectLike = ...,
dialect: _DialectLike = "excel",
*,
delimiter: str = ...,
quotechar: str | None = ...,
escapechar: str | None = ...,
doublequote: bool = ...,
skipinitialspace: bool = ...,
lineterminator: str = ...,
quoting: _QuotingType = ...,
strict: bool = ...,
delimiter: str = ",",
quotechar: str | None = '"',
escapechar: str | None = None,
doublequote: bool = True,
skipinitialspace: bool = False,
lineterminator: str = "\r\n",
quoting: _QuotingType = 0,
strict: bool = False,
) -> _reader: ...
def register_dialect(
name: str,
dialect: Any = ...,
dialect: type[Dialect] = ...,
*,
delimiter: str = ...,
quotechar: str | None = ...,
escapechar: str | None = ...,
doublequote: bool = ...,
skipinitialspace: bool = ...,
lineterminator: str = ...,
quoting: _QuotingType = ...,
strict: bool = ...,
delimiter: str = ",",
quotechar: str | None = '"',
escapechar: str | None = None,
doublequote: bool = True,
skipinitialspace: bool = False,
lineterminator: str = "\r\n",
quoting: _QuotingType = 0,
strict: bool = False,
) -> None: ...
def unregister_dialect(name: str) -> None: ...
def get_dialect(name: str) -> Dialect: ...
Expand Down
42 changes: 21 additions & 21 deletions mypy/typeshed/stdlib/_decimal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,28 @@ class Decimal:
def as_integer_ratio(self) -> tuple[int, int]: ...
def to_eng_string(self, context: Context | None = None) -> str: ...
def __abs__(self) -> Decimal: ...
def __add__(self, __other: _Decimal) -> Decimal: ...
def __divmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ...
def __eq__(self, __other: object) -> bool: ...
def __floordiv__(self, __other: _Decimal) -> Decimal: ...
def __ge__(self, __other: _ComparableNum) -> bool: ...
def __gt__(self, __other: _ComparableNum) -> bool: ...
def __le__(self, __other: _ComparableNum) -> bool: ...
def __lt__(self, __other: _ComparableNum) -> bool: ...
def __mod__(self, __other: _Decimal) -> Decimal: ...
def __mul__(self, __other: _Decimal) -> Decimal: ...
def __add__(self, __value: _Decimal) -> Decimal: ...
def __divmod__(self, __value: _Decimal) -> tuple[Decimal, Decimal]: ...
def __eq__(self, __value: object) -> bool: ...
def __floordiv__(self, __value: _Decimal) -> Decimal: ...
def __ge__(self, __value: _ComparableNum) -> bool: ...
def __gt__(self, __value: _ComparableNum) -> bool: ...
def __le__(self, __value: _ComparableNum) -> bool: ...
def __lt__(self, __value: _ComparableNum) -> bool: ...
def __mod__(self, __value: _Decimal) -> Decimal: ...
def __mul__(self, __value: _Decimal) -> Decimal: ...
def __neg__(self) -> Decimal: ...
def __pos__(self) -> Decimal: ...
def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ...
def __radd__(self, __other: _Decimal) -> Decimal: ...
def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, __other: _Decimal) -> Decimal: ...
def __rmod__(self, __other: _Decimal) -> Decimal: ...
def __rmul__(self, __other: _Decimal) -> Decimal: ...
def __rsub__(self, __other: _Decimal) -> Decimal: ...
def __rtruediv__(self, __other: _Decimal) -> Decimal: ...
def __sub__(self, __other: _Decimal) -> Decimal: ...
def __truediv__(self, __other: _Decimal) -> Decimal: ...
def __pow__(self, __value: _Decimal, __mod: _Decimal | None = None) -> Decimal: ...
def __radd__(self, __value: _Decimal) -> Decimal: ...
def __rdivmod__(self, __value: _Decimal) -> tuple[Decimal, Decimal]: ...
def __rfloordiv__(self, __value: _Decimal) -> Decimal: ...
def __rmod__(self, __value: _Decimal) -> Decimal: ...
def __rmul__(self, __value: _Decimal) -> Decimal: ...
def __rsub__(self, __value: _Decimal) -> Decimal: ...
def __rtruediv__(self, __value: _Decimal) -> Decimal: ...
def __sub__(self, __value: _Decimal) -> Decimal: ...
def __truediv__(self, __value: _Decimal) -> Decimal: ...
def remainder_near(self, other: _Decimal, context: Context | None = None) -> Decimal: ...
def __float__(self) -> float: ...
def __int__(self) -> int: ...
Expand All @@ -116,7 +116,7 @@ class Decimal:
def __floor__(self) -> int: ...
def __ceil__(self) -> int: ...
def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ...
def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ...
def __rpow__(self, __value: _Decimal, __mod: Context | None = None) -> Decimal: ...
def normalize(self, context: Context | None = None) -> Decimal: ...
def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ...
def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ...
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/_typeshed/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class structseq(Generic[_T_co]):
# https://github.com/python/typeshed/pull/6560#discussion_r767149830
def __new__(cls: type[Self], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> Self: ...

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

# Represents when str or LiteralStr is acceptable. Useful for string processing
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/_weakref.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ProxyType(Generic[_T]): # "weakproxy"

class ReferenceType(Generic[_T]):
__callback__: Callable[[ReferenceType[_T]], Any]
def __new__(cls, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
def __new__(cls, __o: _T, __callback: Callable[[ReferenceType[_T]], Any] | None = ...) -> Self: ...
def __call__(self) -> _T | None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
Expand Down
9 changes: 2 additions & 7 deletions mypy/typeshed/stdlib/argparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
add_help: bool = True,
allow_abbrev: bool = True,
) -> None: ...
# The type-ignores in these overloads should be temporary. See:
# https://github.com/python/typeshed/pull/2643#issuecomment-442280277
# Ignore errors about overlapping overloads
@overload
def parse_args(self, args: Sequence[str] | None = None) -> Namespace: ...
@overload
def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore[misc]
def parse_args(self, args: Sequence[str] | None = None, namespace: None = None) -> Namespace: ... # type: ignore[misc]
@overload
def parse_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ...
@overload
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore[misc]
@overload
def parse_args(self, *, namespace: _N) -> _N: ...
@overload
def add_subparsers(
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/asyncio/base_subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
def get_pid(self) -> int | None: ... # type: ignore[override]
def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore[override]
def _check_proc(self) -> None: ... # undocumented
def send_signal(self, signal: int) -> None: ... # type: ignore[override]
def send_signal(self, signal: int) -> None: ...
async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented
def _call(self, cb: Callable[..., object], *data: Any) -> None: ... # undocumented
def _pipe_connection_lost(self, fd: int, exc: BaseException | None) -> None: ... # undocumented
Expand Down

0 comments on commit a995642

Please sign in to comment.