Skip to content

Commit

Permalink
Updated typeshed stubs to the latest version.
Browse files Browse the repository at this point in the history
  • Loading branch information
erictraut committed Jan 19, 2025
1 parent 951983a commit 3089c82
Show file tree
Hide file tree
Showing 441 changed files with 7,577 additions and 8,087 deletions.
6 changes: 2 additions & 4 deletions packages/pyright-internal/src/tests/samples/coroutines2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from typing import Any, Coroutine


async def inspector(coro: Coroutine[Any, Any, Any]):
assert coro.cr_frame is not None
print(coro.cr_frame.f_locals)
return await coro
async def inspector(cr: Coroutine[Any, Any, Any]):
return await cr


async def inner(sleep: int, message: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion packages/pyright-internal/typeshed-fallback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ the project the stubs are for, but instead report them here to typeshed.**
Further documentation on stub files, typeshed, and Python's typing system in
general, can also be found at https://typing.readthedocs.io/en/latest/.

Typeshed supports Python versions 3.8 to 3.13.
Typeshed supports Python versions 3.9 to 3.13.

## Using

Expand Down
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 @@
2ccc53bb6716463680fcf1d204642c46299b7f88
c2e4ef3ae495272f902071dcf4a0f7701c00c4a2
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ _msi: 3.0-3.12
_multibytecodec: 3.0-
_operator: 3.4-
_osx_support: 3.0-
_pickle: 3.0-
_posixsubprocess: 3.2-
_py_abc: 3.7-
_pydecimal: 3.5-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
self,
coro: _TaskCompatibleCoro[_T_co],
*,
loop: AbstractEventLoop = ...,
loop: AbstractEventLoop | None = None,
name: str | None = ...,
context: Context | None = None,
eager_start: bool = False,
Expand All @@ -75,13 +75,13 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
self,
coro: _TaskCompatibleCoro[_T_co],
*,
loop: AbstractEventLoop = ...,
loop: AbstractEventLoop | None = None,
name: str | None = ...,
context: Context | None = None,
) -> None: ...
else:
def __init__(
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop = ..., name: str | None = ...
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = ...
) -> None: ...

if sys.version_info >= (3, 12):
Expand Down
24 changes: 12 additions & 12 deletions packages/pyright-internal/typeshed-fallback/stdlib/_blake2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class blake2b:
digest_size: int
name: str
if sys.version_info >= (3, 9):
def __init__(
self,
def __new__(
cls,
data: ReadableBuffer = b"",
/,
*,
Expand All @@ -39,10 +39,10 @@ class blake2b:
inner_size: int = 0,
last_node: bool = False,
usedforsecurity: bool = True,
) -> None: ...
) -> Self: ...
else:
def __init__(
self,
def __new__(
cls,
data: ReadableBuffer = b"",
/,
*,
Expand All @@ -57,7 +57,7 @@ class blake2b:
node_depth: int = 0,
inner_size: int = 0,
last_node: bool = False,
) -> None: ...
) -> Self: ...

def copy(self) -> Self: ...
def digest(self) -> bytes: ...
Expand All @@ -74,8 +74,8 @@ class blake2s:
digest_size: int
name: str
if sys.version_info >= (3, 9):
def __init__(
self,
def __new__(
cls,
data: ReadableBuffer = b"",
/,
*,
Expand All @@ -91,10 +91,10 @@ class blake2s:
inner_size: int = 0,
last_node: bool = False,
usedforsecurity: bool = True,
) -> None: ...
) -> Self: ...
else:
def __init__(
self,
def __new__(
cls,
data: ReadableBuffer = b"",
/,
*,
Expand All @@ -109,7 +109,7 @@ class blake2s:
node_depth: int = 0,
inner_size: int = 0,
last_node: bool = False,
) -> None: ...
) -> Self: ...

def copy(self) -> Self: ...
def digest(self) -> bytes: ...
Expand Down
8 changes: 7 additions & 1 deletion packages/pyright-internal/typeshed-fallback/stdlib/_bz2.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import sys
from _typeshed import ReadableBuffer
from typing import final
from typing_extensions import Self

@final
class BZ2Compressor:
def __init__(self, compresslevel: int = 9) -> None: ...
if sys.version_info >= (3, 12):
def __new__(cls, compresslevel: int = 9, /) -> Self: ...
else:
def __init__(self, compresslevel: int = 9, /) -> None: ...

def compress(self, data: ReadableBuffer, /) -> bytes: ...
def flush(self) -> bytes: ...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from typing import ( # noqa: Y022,Y038
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
Callable as Callable,
ClassVar,
Collection as Collection,
Container as Container,
Coroutine as Coroutine,
Expand Down Expand Up @@ -74,6 +75,7 @@ _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented
def __eq__(self, value: object, /) -> bool: ...
def __reversed__(self) -> Iterator[_KT_co]: ...
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 13):
def isdisjoint(self, other: Iterable[_KT_co], /) -> bool: ...
if sys.version_info >= (3, 10):
Expand All @@ -91,6 +93,7 @@ class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented
class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
def __eq__(self, value: object, /) -> bool: ...
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 13):
def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool: ...
if sys.version_info >= (3, 10):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from collections.abc import Callable, Iterator, Mapping
from typing import Any, ClassVar, Generic, TypeVar, final, overload
from typing_extensions import ParamSpec
from typing_extensions import ParamSpec, Self

if sys.version_info >= (3, 9):
from types import GenericAlias
Expand All @@ -13,9 +13,9 @@ _P = ParamSpec("_P")
@final
class ContextVar(Generic[_T]):
@overload
def __init__(self, name: str) -> None: ...
def __new__(cls, name: str) -> Self: ...
@overload
def __init__(self, name: str, *, default: _T) -> None: ...
def __new__(cls, name: str, *, default: _T) -> Self: ...
def __hash__(self) -> int: ...
@property
def name(self) -> str: ...
Expand All @@ -37,6 +37,7 @@ class Token(Generic[_T]):
@property
def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express
MISSING: ClassVar[object]
__hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

Expand All @@ -55,6 +56,7 @@ class Context(Mapping[ContextVar[Any], Any]):
def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ...
def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
def copy(self) -> Context: ...
__hash__: ClassVar[None] # type: ignore[assignment]
def __getitem__(self, key: ContextVar[_T], /) -> _T: ...
def __iter__(self) -> Iterator[ContextVar[Any]]: ...
def __len__(self) -> int: ...
Expand Down
8 changes: 4 additions & 4 deletions packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Dialect:
lineterminator: str
quoting: _QuotingType
strict: bool
def __init__(
self,
def __new__(
cls,
dialect: _DialectLike | None = ...,
delimiter: str = ",",
doublequote: bool = True,
Expand All @@ -43,7 +43,7 @@ class Dialect:
quoting: _QuotingType = 0,
skipinitialspace: bool = False,
strict: bool = False,
) -> None: ...
) -> Self: ...

if sys.version_info >= (3, 10):
# This class calls itself _csv.reader.
Expand Down Expand Up @@ -115,7 +115,7 @@ def reader(
) -> _reader: ...
def register_dialect(
name: str,
dialect: type[Dialect] = ...,
dialect: type[Dialect | csv.Dialect] = ...,
*,
delimiter: str = ",",
quotechar: str | None = '"',
Expand Down
14 changes: 7 additions & 7 deletions packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,18 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType):
# Abstract attribute that must be defined on subclasses
_flags_: ClassVar[int]
@overload
def __init__(self) -> None: ...
def __new__(cls) -> Self: ...
@overload
def __init__(self, address: int, /) -> None: ...
def __new__(cls, address: int, /) -> Self: ...
@overload
def __init__(self, callable: Callable[..., Any], /) -> None: ...
def __new__(cls, callable: Callable[..., Any], /) -> Self: ...
@overload
def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> None: ...
def __new__(cls, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> Self: ...
if sys.platform == "win32":
@overload
def __init__(
self, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., /
) -> None: ...
def __new__(
cls, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., /
) -> Self: ...

def __call__(self, *args: Any, **kwargs: Any) -> Any: ...

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from _typeshed import ReadOnlyBuffer, SupportsRead
from _typeshed import ReadOnlyBuffer, SupportsRead, SupportsWrite
from curses import _ncurses_version
from typing import IO, Any, final, overload
from typing import Any, final, overload
from typing_extensions import TypeAlias

# NOTE: This module is ordinarily only available on Unix, but the windows-curses
Expand Down Expand Up @@ -517,7 +517,7 @@ class window: # undocumented
def overwrite(
self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int
) -> None: ...
def putwin(self, file: IO[Any], /) -> None: ...
def putwin(self, file: SupportsWrite[bytes], /) -> None: ...
def redrawln(self, beg: int, num: int, /) -> None: ...
def redrawwin(self) -> None: ...
@overload
Expand Down
Loading

0 comments on commit 3089c82

Please sign in to comment.