Skip to content

Commit 7a44ea6

Browse files
[ty] Sync vendored typeshed stubs (#20031)
Co-authored-by: typeshedbot <> Co-authored-by: Alex Waygood <[email protected]>
1 parent f82025d commit 7a44ea6

File tree

147 files changed

+2491
-2044
lines changed

Some content is hidden

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

147 files changed

+2491
-2044
lines changed

crates/ty_python_semantic/resources/mdtest/snapshots/deprecated.md_-_Tests_for_the_`@depr…_-_Syntax_(142fa2948c3c6cf1).snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ error[missing-argument]: No argument provided for required parameter `arg` of bo
9191
7 | from typing_extensions import deprecated
9292
|
9393
info: Parameter declared here
94-
--> stdlib/typing_extensions.pyi:967:28
94+
--> stdlib/typing_extensions.pyi:973:28
9595
|
96-
965 | stacklevel: int
97-
966 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
98-
967 | def __call__(self, arg: _T, /) -> _T: ...
96+
971 | stacklevel: int
97+
972 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
98+
973 | def __call__(self, arg: _T, /) -> _T: ...
9999
| ^^^^^^^
100-
968 |
101-
969 | @final
100+
974 |
101+
975 | @final
102102
|
103103
info: rule `missing-argument` is enabled by default
104104

crates/ty_python_semantic/src/types/infer.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4680,20 +4680,11 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
46804680
}
46814681

46824682
// Handle various singletons.
4683-
if let Type::NominalInstance(instance) = declared.inner_type() {
4684-
if instance
4685-
.class(self.db())
4686-
.is_known(self.db(), KnownClass::SpecialForm)
4683+
if let Some(name_expr) = target.as_name_expr() {
4684+
if let Some(special_form) =
4685+
SpecialFormType::try_from_file_and_name(self.db(), self.file(), &name_expr.id)
46874686
{
4688-
if let Some(name_expr) = target.as_name_expr() {
4689-
if let Some(special_form) = SpecialFormType::try_from_file_and_name(
4690-
self.db(),
4691-
self.file(),
4692-
&name_expr.id,
4693-
) {
4694-
declared.inner = Type::SpecialForm(special_form);
4695-
}
4696-
}
4687+
declared.inner = Type::SpecialForm(special_form);
46974688
}
46984689
}
46994690

crates/ty_python_semantic/src/types/special_form.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ impl SpecialFormType {
154154
| Self::Intersection
155155
| Self::CallableTypeOf
156156
| Self::Protocol // actually `_ProtocolMeta` at runtime but this is what typeshed says
157-
| Self::Generic // actually `type` at runtime but this is what typeshed says
158157
| Self::ReadOnly => KnownClass::SpecialForm,
159158

159+
Self::Generic => KnownClass::Type,
160+
160161
Self::List
161162
| Self::Dict
162163
| Self::DefaultDict
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
893b9a760deb3be64d13c748318e95a752230961
1+
f32d9f08bde8e42a3a35c050839d0275979eb3af

crates/ty_vendored/vendor/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/ty_vendored/vendor/typeshed/stdlib/_blake2.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"""_blake2b provides BLAKE2b for hashlib"""
22

33
from _typeshed import ReadableBuffer
4-
from typing import ClassVar, final
4+
from typing import ClassVar, Final, final
55
from typing_extensions import Self
66

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

1616
@final
1717
class blake2b:

crates/ty_vendored/vendor/typeshed/stdlib/_collections_abc.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,6 @@ class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
116116
if sys.version_info >= (3, 12):
117117
@runtime_checkable
118118
class Buffer(Protocol):
119+
__slots__ = ()
119120
@abstractmethod
120121
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/ty_vendored/vendor/typeshed/stdlib/_ctypes.pyi

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ from abc import abstractmethod
77
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
88
from ctypes import CDLL, ArgumentError as ArgumentError, c_void_p
99
from types import GenericAlias
10-
from typing import Any, ClassVar, Generic, TypeVar, final, overload, type_check_only
10+
from typing import Any, ClassVar, Final, Generic, TypeVar, final, overload, type_check_only
1111
from typing_extensions import Self, TypeAlias
1212

1313
_T = TypeVar("_T")
1414
_CT = TypeVar("_CT", bound=_CData)
1515

16-
FUNCFLAG_CDECL: int
17-
FUNCFLAG_PYTHONAPI: int
18-
FUNCFLAG_USE_ERRNO: int
19-
FUNCFLAG_USE_LASTERROR: int
20-
RTLD_GLOBAL: int
21-
RTLD_LOCAL: int
16+
FUNCFLAG_CDECL: Final = 0x1
17+
FUNCFLAG_PYTHONAPI: Final = 0x4
18+
FUNCFLAG_USE_ERRNO: Final = 0x8
19+
FUNCFLAG_USE_LASTERROR: Final = 0x10
20+
RTLD_GLOBAL: Final[int]
21+
RTLD_LOCAL: Final[int]
2222

2323
if sys.version_info >= (3, 11):
24-
CTYPES_MAX_ARGCOUNT: int
24+
CTYPES_MAX_ARGCOUNT: Final[int]
2525

2626
if sys.version_info >= (3, 12):
27-
SIZEOF_TIME_T: int
27+
SIZEOF_TIME_T: Final[int]
2828

2929
if sys.platform == "win32":
3030
# Description, Source, HelpFile, HelpContext, scode
@@ -41,8 +41,8 @@ if sys.platform == "win32":
4141

4242
def CopyComPointer(src: _PointerLike, dst: _PointerLike | _CArgObject) -> int:
4343
"""CopyComPointer(src, dst) -> HRESULT value"""
44-
FUNCFLAG_HRESULT: int
45-
FUNCFLAG_STDCALL: int
44+
FUNCFLAG_HRESULT: Final = 0x2
45+
FUNCFLAG_STDCALL: Final = 0x0
4646

4747
def FormatError(code: int = ...) -> str:
4848
"""FormatError([integer]) -> string

0 commit comments

Comments
 (0)