Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion packages/pyright-internal/typeshed-fallback/commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b0401bc7dfbaa8eb0c989c0916d7783dfba7a194
bd18cc640cba4dadc51ac9a5157b79ff6adf5de3
58 changes: 57 additions & 1 deletion packages/pyright-internal/typeshed-fallback/stdlib/_bisect.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from _typeshed import SupportsLenAndGetItem, SupportsRichComparisonT
from _typeshed import SupportsGetItem, SupportsLenAndGetItem, SupportsRichComparisonT
from collections.abc import Callable, MutableSequence
from typing import TypeVar, overload

Expand All @@ -16,6 +16,14 @@ if sys.version_info >= (3, 10):
key: None = None,
) -> int: ...
@overload
def bisect_left(
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int, *, key: None = None
) -> int: ...
@overload
def bisect_left(
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: None = None
) -> int: ...
@overload
def bisect_left(
a: SupportsLenAndGetItem[_T],
x: SupportsRichComparisonT,
Expand All @@ -25,6 +33,19 @@ if sys.version_info >= (3, 10):
key: Callable[[_T], SupportsRichComparisonT],
) -> int: ...
@overload
def bisect_left(
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int, hi: int, *, key: Callable[[_T], SupportsRichComparisonT]
) -> int: ...
@overload
def bisect_left(
a: SupportsGetItem[int, _T],
x: SupportsRichComparisonT,
lo: int = 0,
*,
hi: int,
key: Callable[[_T], SupportsRichComparisonT],
) -> int: ...
@overload
def bisect_right(
a: SupportsLenAndGetItem[SupportsRichComparisonT],
x: SupportsRichComparisonT,
Expand All @@ -34,6 +55,14 @@ if sys.version_info >= (3, 10):
key: None = None,
) -> int: ...
@overload
def bisect_right(
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int, *, key: None = None
) -> int: ...
@overload
def bisect_right(
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: None = None
) -> int: ...
@overload
def bisect_right(
a: SupportsLenAndGetItem[_T],
x: SupportsRichComparisonT,
Expand All @@ -43,6 +72,19 @@ if sys.version_info >= (3, 10):
key: Callable[[_T], SupportsRichComparisonT],
) -> int: ...
@overload
def bisect_right(
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int, hi: int, *, key: Callable[[_T], SupportsRichComparisonT]
) -> int: ...
@overload
def bisect_right(
a: SupportsGetItem[int, _T],
x: SupportsRichComparisonT,
lo: int = 0,
*,
hi: int,
key: Callable[[_T], SupportsRichComparisonT],
) -> int: ...
@overload
def insort_left(
a: MutableSequence[SupportsRichComparisonT],
x: SupportsRichComparisonT,
Expand Down Expand Up @@ -70,12 +112,26 @@ if sys.version_info >= (3, 10):
) -> None: ...

else:
@overload
def bisect_left(
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> int: ...
@overload
def bisect_left(a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int) -> int: ...
@overload
def bisect_left(
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int
) -> int: ...
@overload
def bisect_right(
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> int: ...
@overload
def bisect_right(a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int) -> int: ...
@overload
def bisect_right(
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int
) -> int: ...
def insort_left(
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
) -> None: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def ascii_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[st
def ascii_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
def charmap_decode(data: ReadableBuffer, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[str, int]: ...
def charmap_encode(str: str, errors: str | None = None, mapping: _CharMap | None = None, /) -> tuple[bytes, int]: ...
def escape_decode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...

# Docs say this accepts a bytes-like object, but in practice it also accepts str.
def escape_decode(data: str | ReadableBuffer, errors: str | None = None, /) -> tuple[bytes, int]: ...
def escape_encode(data: bytes, errors: str | None = None, /) -> tuple[bytes, int]: ...
def latin_1_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
def latin_1_encode(str: str, errors: str | None = None, /) -> tuple[bytes, int]: ...
Expand Down
79 changes: 51 additions & 28 deletions packages/pyright-internal/typeshed-fallback/stdlib/_operator.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import sys
from _typeshed import SupportsGetItem
from _typeshed import (
SupportsAdd,
SupportsGetItem,
SupportsMod,
SupportsMul,
SupportsRAdd,
SupportsRMod,
SupportsRMul,
SupportsRSub,
SupportsSub,
)
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
from operator import attrgetter as attrgetter, itemgetter as itemgetter, methodcaller as methodcaller
from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only
Expand All @@ -8,6 +18,7 @@ from typing_extensions import ParamSpec, TypeAlias, TypeIs
_R = TypeVar("_R")
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_T_contra = TypeVar("_T_contra", contravariant=True)
_K = TypeVar("_K")
_V = TypeVar("_V")
_P = ParamSpec("_P")
Expand Down Expand Up @@ -58,24 +69,36 @@ def truth(a: object, /) -> bool: ...
def is_(a: object, b: object, /) -> bool: ...
def is_not(a: object, b: object, /) -> bool: ...
def abs(a: SupportsAbs[_T], /) -> _T: ...
def add(a: Any, b: Any, /) -> Any: ...
def and_(a: Any, b: Any, /) -> Any: ...
def floordiv(a: Any, b: Any, /) -> Any: ...
@overload
def add(a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
@overload
def add(a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co: ...
def and_(a, b, /): ...
def floordiv(a, b, /): ...
def index(a: SupportsIndex, /) -> int: ...
def inv(a: _SupportsInversion[_T_co], /) -> _T_co: ...
def invert(a: _SupportsInversion[_T_co], /) -> _T_co: ...
def lshift(a: Any, b: Any, /) -> Any: ...
def mod(a: Any, b: Any, /) -> Any: ...
def mul(a: Any, b: Any, /) -> Any: ...
def matmul(a: Any, b: Any, /) -> Any: ...
def lshift(a, b, /): ...
@overload
def mod(a: SupportsMod[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
@overload
def mod(a: _T_contra, b: SupportsRMod[_T_contra, _T_co], /) -> _T_co: ...
@overload
def mul(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
@overload
def mul(a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co: ...
def matmul(a, b, /): ...
def neg(a: _SupportsNeg[_T_co], /) -> _T_co: ...
def or_(a: Any, b: Any, /) -> Any: ...
def or_(a, b, /): ...
def pos(a: _SupportsPos[_T_co], /) -> _T_co: ...
def pow(a: Any, b: Any, /) -> Any: ...
def rshift(a: Any, b: Any, /) -> Any: ...
def sub(a: Any, b: Any, /) -> Any: ...
def truediv(a: Any, b: Any, /) -> Any: ...
def xor(a: Any, b: Any, /) -> Any: ...
def pow(a, b, /): ...
def rshift(a, b, /): ...
@overload
def sub(a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
@overload
def sub(a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co: ...
def truediv(a, b, /): ...
def xor(a, b, /): ...
def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]: ...
def contains(a: Container[object], b: object, /) -> bool: ...
def countOf(a: Iterable[object], b: object, /) -> int: ...
Expand All @@ -97,20 +120,20 @@ def setitem(a: MutableSequence[_T], b: slice[int | None], c: Sequence[_T], /) ->
@overload
def setitem(a: MutableMapping[_K, _V], b: _K, c: _V, /) -> None: ...
def length_hint(obj: object, default: int = 0, /) -> int: ...
def iadd(a: Any, b: Any, /) -> Any: ...
def iand(a: Any, b: Any, /) -> Any: ...
def iconcat(a: Any, b: Any, /) -> Any: ...
def ifloordiv(a: Any, b: Any, /) -> Any: ...
def ilshift(a: Any, b: Any, /) -> Any: ...
def imod(a: Any, b: Any, /) -> Any: ...
def imul(a: Any, b: Any, /) -> Any: ...
def imatmul(a: Any, b: Any, /) -> Any: ...
def ior(a: Any, b: Any, /) -> Any: ...
def ipow(a: Any, b: Any, /) -> Any: ...
def irshift(a: Any, b: Any, /) -> Any: ...
def isub(a: Any, b: Any, /) -> Any: ...
def itruediv(a: Any, b: Any, /) -> Any: ...
def ixor(a: Any, b: Any, /) -> Any: ...
def iadd(a, b, /): ...
def iand(a, b, /): ...
def iconcat(a, b, /): ...
def ifloordiv(a, b, /): ...
def ilshift(a, b, /): ...
def imod(a, b, /): ...
def imul(a, b, /): ...
def imatmul(a, b, /): ...
def ior(a, b, /): ...
def ipow(a, b, /): ...
def irshift(a, b, /): ...
def isub(a, b, /): ...
def itruediv(a, b, /): ...
def ixor(a, b, /): ...

if sys.version_info >= (3, 11):
def call(obj: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class PicklerMemoProxy:
class Pickler:
fast: bool
dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
reducer_override: Callable[[Any], Any]
bin: bool # undocumented
def __init__(
self,
Expand All @@ -79,6 +78,10 @@ class Pickler:

# this method has no default implementation for Python < 3.13
def persistent_id(self, obj: Any, /) -> Any: ...
# The following method is not defined on _Pickler, but can be defined on
# sub-classes. Should return `NotImplemented` if pickling the supplied
# object is not supported and returns the same types as `__reduce__()`.
def reducer_override(self, obj: object, /) -> _ReducedType: ...

@type_check_only
class UnpicklerMemoProxy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ class socket:
def proto(self) -> int: ...
# F811: "Redefinition of unused `timeout`"
@property
def timeout(self) -> float | None: ... # noqa: F811
def timeout(self) -> float | None: ...
if sys.platform == "win32":
def __init__(
self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | bytes | None = None
Expand Down Expand Up @@ -838,7 +838,7 @@ def inet_ntop(address_family: int, packed_ip: ReadableBuffer, /) -> str: ...
def getdefaulttimeout() -> float | None: ...

# F811: "Redefinition of unused `timeout`"
def setdefaulttimeout(timeout: float | None, /) -> None: ... # noqa: F811
def setdefaulttimeout(timeout: float | None, /) -> None: ...

if sys.platform != "win32":
def sethostname(name: str, /) -> None: ...
Expand Down
12 changes: 8 additions & 4 deletions packages/pyright-internal/typeshed-fallback/stdlib/_sqlite3.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ from sqlite3 import (
_IsolationLevel,
)
from typing import Any, Final, Literal, TypeVar, overload
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, deprecated

if sys.version_info >= (3, 11):
from sqlite3 import Blob as Blob
Expand Down Expand Up @@ -171,7 +171,7 @@ if sys.version_info >= (3, 11):
SQLITE_IOERR_VNODE: Final = 6922
SQLITE_IOERR_WRITE: Final = 778
SQLITE_LIMIT_ATTACHED: Final = 7
SQLITE_LIMIT_COLUMN: Final = 22
SQLITE_LIMIT_COLUMN: Final = 2
SQLITE_LIMIT_COMPOUND_SELECT: Final = 4
SQLITE_LIMIT_EXPR_DEPTH: Final = 3
SQLITE_LIMIT_FUNCTION_ARG: Final = 6
Expand Down Expand Up @@ -299,7 +299,11 @@ def enable_callback_tracebacks(enable: bool, /) -> None: ...

if sys.version_info < (3, 12):
# takes a pos-or-keyword argument because there is a C wrapper
def enable_shared_cache(do_enable: int) -> None: ...
@deprecated(
"Deprecated since Python 3.10; removed in Python 3.12. "
"Open database in URI mode using `cache=shared` parameter instead."
)
def enable_shared_cache(do_enable: int) -> None: ... # undocumented

if sys.version_info >= (3, 10):
def register_adapter(type: type[_T], adapter: _Adapter[_T], /) -> None: ...
Expand All @@ -310,4 +314,4 @@ else:
def register_converter(name: str, converter: _Converter, /) -> None: ...

if sys.version_info < (3, 10):
OptimizedUnicode = str
OptimizedUnicode = str # undocumented
7 changes: 4 additions & 3 deletions packages/pyright-internal/typeshed-fallback/stdlib/_ssl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ if sys.version_info < (3, 12):
def RAND_pseudo_bytes(n: int, /) -> tuple[bytes, bool]: ...

if sys.version_info < (3, 10):
@deprecated("Unsupported by OpenSSL since 1.1.1; removed in Python 3.10.")
def RAND_egd(path: str) -> None: ...

def RAND_status() -> bool: ...
Expand Down Expand Up @@ -182,8 +183,8 @@ CERT_REQUIRED: Final = 2

# verify flags
VERIFY_DEFAULT: Final = 0
VERIFY_CRL_CHECK_LEAF: Final = 0x4
VERIFY_CRL_CHECK_CHAIN: Final = 0x8
VERIFY_CRL_CHECK_LEAF: Final = 0x04
VERIFY_CRL_CHECK_CHAIN: Final = 0x0C
VERIFY_X509_STRICT: Final = 0x20
VERIFY_X509_TRUSTED_FIRST: Final = 0x8000
if sys.version_info >= (3, 10):
Expand Down Expand Up @@ -229,7 +230,7 @@ PROTOCOL_TLSv1_1: Final = 4
PROTOCOL_TLSv1_2: Final = 5

# protocol options
OP_ALL: Final = 0x80000050
OP_ALL: Final[int]
OP_NO_SSLv2: Final = 0x0
OP_NO_SSLv3: Final = 0x2000000
OP_NO_TLSv1: Final = 0x4000000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ class SupportsMul(Protocol[_T_contra, _T_co]):
class SupportsRMul(Protocol[_T_contra, _T_co]):
def __rmul__(self, x: _T_contra, /) -> _T_co: ...

class SupportsMod(Protocol[_T_contra, _T_co]):
def __mod__(self, other: _T_contra, /) -> _T_co: ...

class SupportsRMod(Protocol[_T_contra, _T_co]):
def __rmod__(self, other: _T_contra, /) -> _T_co: ...

class SupportsDivMod(Protocol[_T_contra, _T_co]):
def __divmod__(self, other: _T_contra, /) -> _T_co: ...

Expand Down
Loading
Loading