Skip to content

Commit 1946d0e

Browse files
yangdanny97meta-codesync[bot]
authored andcommitted
update bundled typeshed
Summary: run pyrefly_bundled/update.py Reviewed By: kinto0 Differential Revision: D85078567 fbshipit-source-id: 2d30a8acc5fb2fcb83f16ad59d20c55203eb9e7c
1 parent 7e31ba2 commit 1946d0e

File tree

268 files changed

+7273
-5440
lines changed

Some content is hidden

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

268 files changed

+7273
-5440
lines changed

crates/pyrefly_bundled/third_party/typeshed/stdlib/_ast.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ from ast import (
108108
unaryop as unaryop,
109109
withitem as withitem,
110110
)
111-
from typing import Literal
111+
from typing import Final
112112

113113
if sys.version_info >= (3, 12):
114114
from ast import (
@@ -137,9 +137,9 @@ if sys.version_info >= (3, 10):
137137
pattern as pattern,
138138
)
139139

140-
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
141-
PyCF_ONLY_AST: Literal[1024]
142-
PyCF_TYPE_COMMENTS: Literal[4096]
140+
PyCF_ALLOW_TOP_LEVEL_AWAIT: Final = 8192
141+
PyCF_ONLY_AST: Final = 1024
142+
PyCF_TYPE_COMMENTS: Final = 4096
143143

144144
if sys.version_info >= (3, 13):
145-
PyCF_OPTIMIZED_AST: Literal[33792]
145+
PyCF_OPTIMIZED_AST: Final = 33792

crates/pyrefly_bundled/third_party/typeshed/stdlib/_asyncio.pyi

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ from collections.abc import Awaitable, Callable, Coroutine, Generator
44
from contextvars import Context
55
from types import FrameType, GenericAlias
66
from typing import Any, Literal, TextIO, TypeVar
7-
from typing_extensions import Self, TypeAlias
7+
from typing_extensions import Self, TypeAlias, disjoint_base
88

99
_T = TypeVar("_T")
1010
_T_co = TypeVar("_T_co", covariant=True)
1111
_TaskYieldType: TypeAlias = Future[object] | None
1212

13+
@disjoint_base
1314
class Future(Awaitable[_T]):
1415
_state: str
1516
@property
@@ -20,7 +21,7 @@ class Future(Awaitable[_T]):
2021
@_log_traceback.setter
2122
def _log_traceback(self, val: Literal[False]) -> None: ...
2223
_asyncio_future_blocking: bool # is a part of duck-typing contract for `Future`
23-
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
24+
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
2425
def __del__(self) -> None: ...
2526
def get_loop(self) -> AbstractEventLoop: ...
2627
@property
@@ -49,14 +50,15 @@ else:
4950
# While this is true in general, here it's sort-of okay to have a covariant subclass,
5051
# since the only reason why `asyncio.Future` is invariant is the `set_result()` method,
5152
# and `asyncio.Task.set_result()` always raises.
53+
@disjoint_base
5254
class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments]
5355
if sys.version_info >= (3, 12):
5456
def __init__(
5557
self,
5658
coro: _TaskCompatibleCoro[_T_co],
5759
*,
5860
loop: AbstractEventLoop | None = None,
59-
name: str | None = ...,
61+
name: str | None = None,
6062
context: Context | None = None,
6163
eager_start: bool = False,
6264
) -> None: ...
@@ -66,12 +68,12 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
6668
coro: _TaskCompatibleCoro[_T_co],
6769
*,
6870
loop: AbstractEventLoop | None = None,
69-
name: str | None = ...,
71+
name: str | None = None,
7072
context: Context | None = None,
7173
) -> None: ...
7274
else:
7375
def __init__(
74-
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = ...
76+
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = None
7577
) -> None: ...
7678

7779
if sys.version_info >= (3, 12):

crates/pyrefly_bundled/third_party/typeshed/stdlib/_blake2.pyi

Lines changed: 88 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
import sys
12
from _typeshed import ReadableBuffer
2-
from typing import ClassVar, final
3+
from typing import ClassVar, Final, final
34
from typing_extensions import Self
45

5-
BLAKE2B_MAX_DIGEST_SIZE: int = 64
6-
BLAKE2B_MAX_KEY_SIZE: int = 64
7-
BLAKE2B_PERSON_SIZE: int = 16
8-
BLAKE2B_SALT_SIZE: int = 16
9-
BLAKE2S_MAX_DIGEST_SIZE: int = 32
10-
BLAKE2S_MAX_KEY_SIZE: int = 32
11-
BLAKE2S_PERSON_SIZE: int = 8
12-
BLAKE2S_SALT_SIZE: int = 8
6+
BLAKE2B_MAX_DIGEST_SIZE: Final = 64
7+
BLAKE2B_MAX_KEY_SIZE: Final = 64
8+
BLAKE2B_PERSON_SIZE: Final = 16
9+
BLAKE2B_SALT_SIZE: Final = 16
10+
BLAKE2S_MAX_DIGEST_SIZE: Final = 32
11+
BLAKE2S_MAX_KEY_SIZE: Final = 32
12+
BLAKE2S_PERSON_SIZE: Final = 8
13+
BLAKE2S_SALT_SIZE: Final = 8
1314

1415
@final
1516
class blake2b:
@@ -20,24 +21,45 @@ class blake2b:
2021
block_size: int
2122
digest_size: int
2223
name: str
23-
def __new__(
24-
cls,
25-
data: ReadableBuffer = b"",
26-
/,
27-
*,
28-
digest_size: int = 64,
29-
key: ReadableBuffer = b"",
30-
salt: ReadableBuffer = b"",
31-
person: ReadableBuffer = b"",
32-
fanout: int = 1,
33-
depth: int = 1,
34-
leaf_size: int = 0,
35-
node_offset: int = 0,
36-
node_depth: int = 0,
37-
inner_size: int = 0,
38-
last_node: bool = False,
39-
usedforsecurity: bool = True,
40-
) -> Self: ...
24+
if sys.version_info >= (3, 13):
25+
def __new__(
26+
cls,
27+
data: ReadableBuffer = b"",
28+
*,
29+
digest_size: int = 64,
30+
key: ReadableBuffer = b"",
31+
salt: ReadableBuffer = b"",
32+
person: ReadableBuffer = b"",
33+
fanout: int = 1,
34+
depth: int = 1,
35+
leaf_size: int = 0,
36+
node_offset: int = 0,
37+
node_depth: int = 0,
38+
inner_size: int = 0,
39+
last_node: bool = False,
40+
usedforsecurity: bool = True,
41+
string: ReadableBuffer | None = None,
42+
) -> Self: ...
43+
else:
44+
def __new__(
45+
cls,
46+
data: ReadableBuffer = b"",
47+
/,
48+
*,
49+
digest_size: int = 64,
50+
key: ReadableBuffer = b"",
51+
salt: ReadableBuffer = b"",
52+
person: ReadableBuffer = b"",
53+
fanout: int = 1,
54+
depth: int = 1,
55+
leaf_size: int = 0,
56+
node_offset: int = 0,
57+
node_depth: int = 0,
58+
inner_size: int = 0,
59+
last_node: bool = False,
60+
usedforsecurity: bool = True,
61+
) -> Self: ...
62+
4163
def copy(self) -> Self: ...
4264
def digest(self) -> bytes: ...
4365
def hexdigest(self) -> str: ...
@@ -52,24 +74,45 @@ class blake2s:
5274
block_size: int
5375
digest_size: int
5476
name: str
55-
def __new__(
56-
cls,
57-
data: ReadableBuffer = b"",
58-
/,
59-
*,
60-
digest_size: int = 32,
61-
key: ReadableBuffer = b"",
62-
salt: ReadableBuffer = b"",
63-
person: ReadableBuffer = b"",
64-
fanout: int = 1,
65-
depth: int = 1,
66-
leaf_size: int = 0,
67-
node_offset: int = 0,
68-
node_depth: int = 0,
69-
inner_size: int = 0,
70-
last_node: bool = False,
71-
usedforsecurity: bool = True,
72-
) -> Self: ...
77+
if sys.version_info >= (3, 13):
78+
def __new__(
79+
cls,
80+
data: ReadableBuffer = b"",
81+
*,
82+
digest_size: int = 32,
83+
key: ReadableBuffer = b"",
84+
salt: ReadableBuffer = b"",
85+
person: ReadableBuffer = b"",
86+
fanout: int = 1,
87+
depth: int = 1,
88+
leaf_size: int = 0,
89+
node_offset: int = 0,
90+
node_depth: int = 0,
91+
inner_size: int = 0,
92+
last_node: bool = False,
93+
usedforsecurity: bool = True,
94+
string: ReadableBuffer | None = None,
95+
) -> Self: ...
96+
else:
97+
def __new__(
98+
cls,
99+
data: ReadableBuffer = b"",
100+
/,
101+
*,
102+
digest_size: int = 32,
103+
key: ReadableBuffer = b"",
104+
salt: ReadableBuffer = b"",
105+
person: ReadableBuffer = b"",
106+
fanout: int = 1,
107+
depth: int = 1,
108+
leaf_size: int = 0,
109+
node_offset: int = 0,
110+
node_depth: int = 0,
111+
inner_size: int = 0,
112+
last_node: bool = False,
113+
usedforsecurity: bool = True,
114+
) -> Self: ...
115+
73116
def copy(self) -> Self: ...
74117
def digest(self) -> bytes: ...
75118
def hexdigest(self) -> str: ...

crates/pyrefly_bundled/third_party/typeshed/stdlib/_collections_abc.pyi

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import sys
22
from abc import abstractmethod
33
from types import MappingProxyType
4-
from typing import ( # noqa: Y022,Y038,UP035
4+
from typing import ( # noqa: Y022,Y038,UP035,Y057
55
AbstractSet as Set,
66
AsyncGenerator as AsyncGenerator,
77
AsyncIterable as AsyncIterable,
88
AsyncIterator as AsyncIterator,
99
Awaitable as Awaitable,
10+
ByteString as ByteString,
1011
Callable as Callable,
1112
ClassVar,
1213
Collection as Collection,
@@ -59,12 +60,8 @@ __all__ = [
5960
"ValuesView",
6061
"Sequence",
6162
"MutableSequence",
63+
"ByteString",
6264
]
63-
if sys.version_info < (3, 14):
64-
from typing import ByteString as ByteString # noqa: Y057,UP035
65-
66-
__all__ += ["ByteString"]
67-
6865
if sys.version_info >= (3, 12):
6966
__all__ += ["Buffer"]
7067

@@ -103,5 +100,6 @@ class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
103100
if sys.version_info >= (3, 12):
104101
@runtime_checkable
105102
class Buffer(Protocol):
103+
__slots__ = ()
106104
@abstractmethod
107105
def __buffer__(self, flags: int, /) -> memoryview: ...
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
IMPORT_MAPPING: dict[str, str]
2-
NAME_MAPPING: dict[tuple[str, str], tuple[str, str]]
3-
PYTHON2_EXCEPTIONS: tuple[str, ...]
4-
MULTIPROCESSING_EXCEPTIONS: tuple[str, ...]
5-
REVERSE_IMPORT_MAPPING: dict[str, str]
6-
REVERSE_NAME_MAPPING: dict[tuple[str, str], tuple[str, str]]
7-
PYTHON3_OSERROR_EXCEPTIONS: tuple[str, ...]
8-
PYTHON3_IMPORTERROR_EXCEPTIONS: tuple[str, ...]
1+
from typing import Final
2+
3+
IMPORT_MAPPING: Final[dict[str, str]]
4+
NAME_MAPPING: Final[dict[tuple[str, str], tuple[str, str]]]
5+
PYTHON2_EXCEPTIONS: Final[tuple[str, ...]]
6+
MULTIPROCESSING_EXCEPTIONS: Final[tuple[str, ...]]
7+
REVERSE_IMPORT_MAPPING: Final[dict[str, str]]
8+
REVERSE_NAME_MAPPING: Final[dict[tuple[str, str], tuple[str, str]]]
9+
PYTHON3_OSERROR_EXCEPTIONS: Final[tuple[str, ...]]
10+
PYTHON3_IMPORTERROR_EXCEPTIONS: Final[tuple[str, ...]]

crates/pyrefly_bundled/third_party/typeshed/stdlib/_compression.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
from _typeshed import Incomplete, WriteableBuffer
44
from collections.abc import Callable
55
from io import DEFAULT_BUFFER_SIZE, BufferedIOBase, RawIOBase
6-
from typing import Any, Protocol
6+
from typing import Any, Protocol, type_check_only
77

88
BUFFER_SIZE = DEFAULT_BUFFER_SIZE
99

10+
@type_check_only
1011
class _Reader(Protocol):
1112
def read(self, n: int, /) -> bytes: ...
1213
def seekable(self) -> bool: ...

crates/pyrefly_bundled/third_party/typeshed/stdlib/_contextvars.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Token(Generic[_T]):
3939
if sys.version_info >= (3, 14):
4040
def __enter__(self) -> Self: ...
4141
def __exit__(
42-
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
42+
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
4343
) -> None: ...
4444

4545
def copy_context() -> Context: ...

crates/pyrefly_bundled/third_party/typeshed/stdlib/_csv.pyi

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import sys
33
from _typeshed import SupportsWrite
44
from collections.abc import Iterable
55
from typing import Any, Final, Literal, type_check_only
6-
from typing_extensions import Self, TypeAlias
6+
from typing_extensions import Self, TypeAlias, disjoint_base
77

88
__version__: Final[str]
99

@@ -24,6 +24,7 @@ class Error(Exception): ...
2424

2525
_DialectLike: TypeAlias = str | Dialect | csv.Dialect | type[Dialect | csv.Dialect]
2626

27+
@disjoint_base
2728
class Dialect:
2829
delimiter: str
2930
quotechar: str | None
@@ -35,7 +36,7 @@ class Dialect:
3536
strict: bool
3637
def __new__(
3738
cls,
38-
dialect: _DialectLike | None = ...,
39+
dialect: _DialectLike | None = None,
3940
delimiter: str = ",",
4041
doublequote: bool = True,
4142
escapechar: str | None = None,
@@ -48,6 +49,7 @@ class Dialect:
4849

4950
if sys.version_info >= (3, 10):
5051
# This class calls itself _csv.reader.
52+
@disjoint_base
5153
class Reader:
5254
@property
5355
def dialect(self) -> Dialect: ...
@@ -56,6 +58,7 @@ if sys.version_info >= (3, 10):
5658
def __next__(self) -> list[str]: ...
5759

5860
# This class calls itself _csv.writer.
61+
@disjoint_base
5962
class Writer:
6063
@property
6164
def dialect(self) -> Dialect: ...
@@ -89,7 +92,7 @@ else:
8992
def writerows(self, rows: Iterable[Iterable[Any]]) -> None: ...
9093

9194
def writer(
92-
csvfile: SupportsWrite[str],
95+
fileobj: SupportsWrite[str],
9396
/,
9497
dialect: _DialectLike = "excel",
9598
*,
@@ -103,7 +106,7 @@ def writer(
103106
strict: bool = False,
104107
) -> _writer: ...
105108
def reader(
106-
csvfile: Iterable[str],
109+
iterable: Iterable[str],
107110
/,
108111
dialect: _DialectLike = "excel",
109112
*,
@@ -118,7 +121,8 @@ def reader(
118121
) -> _reader: ...
119122
def register_dialect(
120123
name: str,
121-
dialect: type[Dialect | csv.Dialect] = ...,
124+
/,
125+
dialect: type[Dialect | csv.Dialect] | str = "excel",
122126
*,
123127
delimiter: str = ",",
124128
quotechar: str | None = '"',

0 commit comments

Comments
 (0)