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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/ty_ide/src/goto_type_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ mod tests {

assert_snapshot!(test.goto_type_definition(), @r"
info[goto-type-definition]: Type definition
--> stdlib/typing.pyi:770:1
--> stdlib/typing.pyi:781:1
|
768 | def __class_getitem__(cls, args: TypeVar | tuple[TypeVar, ...]) -> _Final: ...
769 |
770 | Generic: type[_Generic]
779 | def __class_getitem__(cls, args: TypeVar | tuple[TypeVar, ...]) -> _Final: ...
780 |
781 | Generic: type[_Generic]
| ^^^^^^^
771 |
772 | class _ProtocolMeta(ABCMeta):
782 |
783 | class _ProtocolMeta(ABCMeta):
|
info: Source
--> main.py:4:1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ error[missing-argument]: No argument provided for required parameter `arg` of bo
7 | from typing_extensions import deprecated
|
info: Parameter declared here
--> stdlib/typing_extensions.pyi:1000:28
--> stdlib/typing_extensions.pyi:1001:28
|
998 | stacklevel: int
999 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
1000 | def __call__(self, arg: _T, /) -> _T: ...
999 | stacklevel: int
1000 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
1001 | def __call__(self, arg: _T, /) -> _T: ...
| ^^^^^^^
1001 |
1002 | @final
1002 |
1003 | @final
|
info: rule `missing-argument` is enabled by default
Expand Down
2 changes: 1 addition & 1 deletion crates/ty_vendored/vendor/typeshed/source_commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f8cdc0bd526301e873cd952eb0d457bdf2554e57
ef2b90c67e5c668b91b3ae121baf00ee5165c30b
11 changes: 7 additions & 4 deletions crates/ty_vendored/vendor/typeshed/stdlib/asyncio/runners.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from _typeshed import Unused
from collections.abc import Callable, Coroutine
from collections.abc import Awaitable, Callable, Coroutine
from contextvars import Context
from typing import Any, TypeVar, final
from typing_extensions import Self
Expand Down Expand Up @@ -50,9 +50,12 @@ if sys.version_info >= (3, 11):

def get_loop(self) -> AbstractEventLoop:
"""Return embedded event loop."""

def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T:
"""Run code in the embedded event loop."""
if sys.version_info >= (3, 14):
def run(self, coro: Awaitable[_T], *, context: Context | None = None) -> _T:
"""Run code in the embedded event loop."""
else:
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T:
"""Run a coroutine inside the embedded event loop."""

if sys.version_info >= (3, 12):
def run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TransportSocket:
def listen(self, backlog: int = ..., /) -> None: ...
@deprecated("Removed in Python 3.11")
def makefile(self) -> BinaryIO: ...
@deprecated("Rmoved in Python 3.11")
@deprecated("Removed in Python 3.11")
def sendfile(self, file: BinaryIO, offset: int = 0, count: int | None = None) -> int: ...
@deprecated("Removed in Python 3.11")
def close(self) -> None: ...
Expand Down
4 changes: 3 additions & 1 deletion crates/ty_vendored/vendor/typeshed/stdlib/calendar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ if sys.version_info >= (3, 12):

_LocaleType: TypeAlias = tuple[str | None, str | None]

class IllegalMonthError(ValueError):
class IllegalMonthError(ValueError, IndexError):
month: int
def __init__(self, month: int) -> None: ...

class IllegalWeekdayError(ValueError):
weekday: int
def __init__(self, weekday: int) -> None: ...

def isleap(year: int) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion crates/ty_vendored/vendor/typeshed/stdlib/ipaddress.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]):

"""

def hosts(self) -> Iterator[_A] | list[_A]:
def hosts(self) -> Iterator[_A]:
"""Generate Iterator over usable hosts in a network.

This is like __iter__ except it doesn't return the network
Expand Down
12 changes: 6 additions & 6 deletions crates/ty_vendored/vendor/typeshed/stdlib/mimetypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ read_mime_types(file) -- parse one file, return a dictionary or None

import sys
from _typeshed import StrPath
from collections.abc import Sequence
from collections.abc import Iterable
from typing import IO

__all__ = [
Expand Down Expand Up @@ -93,8 +93,8 @@ def guess_extension(type: str, strict: bool = True) -> str | None:
but non-standard types.
"""

def init(files: Sequence[str] | None = None) -> None: ...
def read_mime_types(file: str) -> dict[str, str] | None: ...
def init(files: Iterable[StrPath] | None = None) -> None: ...
def read_mime_types(file: StrPath) -> dict[str, str] | None: ...
def add_type(type: str, ext: str, strict: bool = True) -> None:
"""Add a mapping between a type and an extension.

Expand All @@ -116,7 +116,7 @@ if sys.version_info >= (3, 13):
"""

inited: bool
knownfiles: list[str]
knownfiles: list[StrPath]
suffix_map: dict[str, str]
encodings_map: dict[str, str]
types_map: dict[str, str]
Expand All @@ -134,7 +134,7 @@ class MimeTypes:
encodings_map: dict[str, str]
types_map: tuple[dict[str, str], dict[str, str]]
types_map_inv: tuple[dict[str, str], dict[str, str]]
def __init__(self, filenames: tuple[str, ...] = (), strict: bool = True) -> None: ...
def __init__(self, filenames: Iterable[StrPath] = (), strict: bool = True) -> None: ...
def add_type(self, type: str, ext: str, strict: bool = True) -> None:
"""Add a mapping between a type and an extension.

Expand Down Expand Up @@ -196,7 +196,7 @@ class MimeTypes:
but non-standard types.
"""

def read(self, filename: str, strict: bool = True) -> None:
def read(self, filename: StrPath, strict: bool = True) -> None:
"""
Read a single mime.types-format file, specified by pathname.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
def count(self, value: _T, /) -> int: ...
def insert(self, index: SupportsIndex, object: _T, /) -> None: ...
def remove(self, value: _T, /) -> None: ...
if sys.version_info >= (3, 14):
def copy(self) -> list[_T]: ...
# Use BaseListProxy[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison]
# to work around invariance
@overload
Expand Down Expand Up @@ -429,8 +431,9 @@ class SyncManager(BaseManager):
def dict(self, iterable: Iterable[list[str]], /) -> DictProxy[str, str]: ...
@overload
def dict(self, iterable: Iterable[list[bytes]], /) -> DictProxy[bytes, bytes]: ...
# Overloads are copied from builtins.list.__init__
@overload
def list(self, sequence: Sequence[_T], /) -> ListProxy[_T]: ...
def list(self, iterable: Iterable[_T], /) -> ListProxy[_T]: ...
@overload
def list(self) -> ListProxy[Any]: ...
if sys.version_info >= (3, 14):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from collections.abc import Callable, Iterable, Mapping
from typing import Any

Expand Down Expand Up @@ -33,6 +34,11 @@ class BaseProcess:
"""
Start child process
"""
if sys.version_info >= (3, 14):
def interrupt(self) -> None:
"""
Terminate process; sends SIGINT signal
"""

def terminate(self) -> None:
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import threading
from collections.abc import Callable
from multiprocessing.context import BaseContext
Expand Down Expand Up @@ -45,6 +46,8 @@ class SemLock:
# These methods are copied from the wrapped _multiprocessing.SemLock object
def acquire(self, block: bool = True, timeout: float | None = None) -> bool: ...
def release(self) -> None: ...
if sys.version_info >= (3, 14):
def locked(self) -> bool: ...

class Lock(SemLock):
def __init__(self, *, ctx: BaseContext) -> None: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ _AdaptedInputData: TypeAlias = _SqliteData | Any
_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData]
# Controls the legacy transaction handling mode of sqlite3.
_IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None
_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, Row], object] | None

@type_check_only
class _AnyParamWindowAggregateClass(Protocol):
Expand Down Expand Up @@ -336,7 +337,7 @@ class Connection:
def autocommit(self) -> int: ...
@autocommit.setter
def autocommit(self, val: int) -> None: ...
row_factory: Any
row_factory: _RowFactoryOptions
text_factory: Any
if sys.version_info >= (3, 12):
def __init__(
Expand Down Expand Up @@ -623,7 +624,7 @@ class Cursor:
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | MaybeNone: ...
@property
def lastrowid(self) -> int | None: ...
row_factory: Callable[[Cursor, Row], object] | None
row_factory: _RowFactoryOptions
@property
def rowcount(self) -> int: ...
def __init__(self, cursor: Connection, /) -> None: ...
Expand Down
1 change: 0 additions & 1 deletion crates/ty_vendored/vendor/typeshed/stdlib/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,6 @@ elif sys.version_info >= (3, 10):
) -> CompletedProcess[Any]: ...

else:
# 3.9 adds arguments "user", "group", "extra_groups" and "umask"
@overload
def run(
args: _CMD,
Expand Down
14 changes: 9 additions & 5 deletions crates/ty_vendored/vendor/typeshed/stdlib/sys/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ from builtins import object as _object
from collections.abc import AsyncGenerator, Callable, Sequence
from io import TextIOWrapper
from types import FrameType, ModuleType, TracebackType
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, overload, type_check_only
from typing_extensions import LiteralString, TypeAlias, deprecated

_T = TypeVar("_T")
Expand Down Expand Up @@ -648,7 +648,7 @@ if sys.platform == "android": # noqa: Y008
def getallocatedblocks() -> int:
"""Return the number of memory blocks currently allocated."""

def getdefaultencoding() -> str:
def getdefaultencoding() -> Literal["utf-8"]:
"""Return the current default encoding used by the Unicode implementation."""

if sys.platform != "win32":
Expand All @@ -658,10 +658,10 @@ if sys.platform != "win32":
The flag constants are defined in the os module.
"""

def getfilesystemencoding() -> str:
def getfilesystemencoding() -> LiteralString:
"""Return the encoding used to convert Unicode filenames to OS filenames."""

def getfilesystemencodeerrors() -> str:
def getfilesystemencodeerrors() -> LiteralString:
"""Return the error mode used Unicode to OS filename conversion."""

def getrefcount(object: Any, /) -> int:
Expand Down Expand Up @@ -755,14 +755,18 @@ if sys.platform == "win32":
intended for identifying the OS rather than feature detection.
"""

def intern(string: str, /) -> str:
@overload
def intern(string: LiteralString, /) -> LiteralString:
"""``Intern'' the given string.

This enters the string in the (global) table of interned strings whose
purpose is to speed up dictionary lookups. Return the string itself or
the previously interned string object with the same value.
"""

@overload
def intern(string: str, /) -> str: ... # type: ignore[misc]

__interactivehook__: Callable[[], object]

if sys.version_info >= (3, 13):
Expand Down
3 changes: 3 additions & 0 deletions crates/ty_vendored/vendor/typeshed/stdlib/threading.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ class Condition:
) -> None: ...
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
def release(self) -> None: ...
if sys.version_info >= (3, 14):
def locked(self) -> bool: ...

def wait(self, timeout: float | None = None) -> bool:
"""Wait until notified or until a timeout occurs.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Final

# These are not actually bools. See #4669
NO: Final[bool]
YES: Final[bool]
TRUE: Final[bool]
FALSE: Final[bool]
ON: Final[bool]
OFF: Final[bool]
YES: Final = True
NO: Final = False
TRUE: Final = True
FALSE: Final = False
ON: Final = True
OFF: Final = False
N: Final = "n"
S: Final = "s"
W: Final = "w"
Expand Down
25 changes: 17 additions & 8 deletions crates/ty_vendored/vendor/typeshed/stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
__supertype__: type | NewType
__name__: str

else:
def NewType(name: str, tp: Any) -> Any:
Expand Down Expand Up @@ -722,12 +723,22 @@ def no_type_check(arg: _F) -> _F:
This mutates the function(s) or class(es) in place.
"""

def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]:
"""Decorator to give another decorator the @no_type_check effect.
if sys.version_info >= (3, 13):
@deprecated("Deprecated since Python 3.13; removed in Python 3.15.")
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]:
"""Decorator to give another decorator the @no_type_check effect.

This wraps the decorator with something that wraps the decorated
function in @no_type_check.
"""
This wraps the decorator with something that wraps the decorated
function in @no_type_check.
"""

else:
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]:
"""Decorator to give another decorator the @no_type_check effect.

This wraps the decorator with something that wraps the decorated
function in @no_type_check.
"""

# This itself is only available during type checking
def type_check_only(func_or_cls: _FT) -> _FT: ...
Expand Down Expand Up @@ -1784,9 +1795,7 @@ class NamedTuple(tuple[Any, ...]):
@overload
def __init__(self, typename: str, fields: Iterable[tuple[str, Any]], /) -> None: ...
@overload
@typing_extensions.deprecated(
"Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15"
)
@deprecated("Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15")
def __init__(self, typename: str, fields: None = None, /, **kwargs: Any) -> None: ...
@classmethod
def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ else:
def __init__(self, name: str, tp: AnnotationForm) -> None: ...
def __call__(self, obj: _T, /) -> _T: ...
__supertype__: type | NewType
__name__: str
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class NonCallableMock(Base, Any):
call_count: int
call_args: _Call | MaybeNone
call_args_list: _CallList
method_calls: _CallList
mock_calls: _CallList
def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ...
def _call_matcher(self, _call: tuple[_Call, ...]) -> _Call:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ if sys.version_info < (3, 14):
__all__ += ["URLopener", "FancyURLopener"]

_T = TypeVar("_T")

# The actual type is `addinfourl | HTTPResponse`, but users would need to use `typing.cast` or `isinstance` to narrow the type,
# so we use `Any` instead.
# See
# - https://github.com/python/typeshed/pull/15042
# - https://github.com/python/typing/issues/566
_UrlopenRet: TypeAlias = Any

_DataType: TypeAlias = ReadableBuffer | SupportsRead[bytes] | Iterable[bytes] | None

if sys.version_info >= (3, 13):
Expand Down
Loading
Loading