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: 2 additions & 0 deletions crates/ty_ide/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,8 @@ Answer.<CURSOR>
__text_signature__ :: str | None
__type_params__ :: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
__weakrefoffset__ :: int
_add_alias_ :: def _add_alias_(self, name: str) -> None
_add_value_alias_ :: def _add_value_alias_(self, value: Any) -> None
_generate_next_value_ :: def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any
_ignore_ :: str | list[str]
_member_map_ :: dict[str, Enum]
Expand Down
106 changes: 53 additions & 53 deletions crates/ty_ide/src/goto_type_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ mod tests {

assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:4:13
Expand All @@ -227,14 +227,14 @@ mod tests {

assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:2:22
Expand Down Expand Up @@ -343,14 +343,14 @@ mod tests {

assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:4:18
Expand Down Expand Up @@ -378,14 +378,14 @@ mod tests {
// is an int. Navigating to `str` would match pyright's behavior.
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:338:7
--> stdlib/builtins.pyi:337:7
|
336 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
337 |
338 | class int:
335 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
336 |
337 | class int:
| ^^^
339 | """int([x]) -> integer
340 | int(x, base=10) -> integer
338 | """int([x]) -> integer
339 | int(x, base=10) -> integer
|
info: Source
--> main.py:4:18
Expand All @@ -412,14 +412,14 @@ f(**kwargs<CURSOR>)

assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:2892:7
--> stdlib/builtins.pyi:2888:7
|
2890 | """See PEP 585"""
2891 |
2892 | class dict(MutableMapping[_KT, _VT]):
2886 | """See PEP 585"""
2887 |
2888 | class dict(MutableMapping[_KT, _VT]):
| ^^^^
2893 | """dict() -> new empty dictionary
2894 | dict(mapping) -> new dictionary initialized from a mapping object's
2889 | """dict() -> new empty dictionary
2890 | dict(mapping) -> new dictionary initialized from a mapping object's
|
info: Source
--> main.py:6:5
Expand All @@ -443,14 +443,14 @@ f(**kwargs<CURSOR>)

assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:3:17
Expand Down Expand Up @@ -536,14 +536,14 @@ f(**kwargs<CURSOR>)

assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:4:27
Expand All @@ -567,13 +567,13 @@ f(**kwargs<CURSOR>)

assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/types.pyi:922:11
--> stdlib/types.pyi:921:11
|
920 | if sys.version_info >= (3, 10):
921 | @final
922 | class NoneType:
919 | if sys.version_info >= (3, 10):
920 | @final
921 | class NoneType:
| ^^^^^^^^
923 | """The type of the None singleton."""
922 | """The type of the None singleton."""
|
info: Source
--> main.py:3:17
Expand All @@ -584,14 +584,14 @@ f(**kwargs<CURSOR>)
|

info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:3:17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ error[invalid-argument-type]: Argument to function `loads` is incorrect
| ^ Expected `str | bytes | bytearray`, found `Literal[5]`
|
info: Function defined here
--> stdlib/json/__init__.pyi:219:5
--> stdlib/json/__init__.pyi:218:5
|
217 | """
218 |
219 | def loads(
216 | """
217 |
218 | def loads(
| ^^^^^
220 | s: str | bytes | bytearray,
219 | s: str | bytes | bytearray,
| -------------------------- Parameter declared here
221 | *,
222 | cls: type[JSONDecoder] | None = None,
220 | *,
221 | cls: type[JSONDecoder] | None = None,
|
info: rule `invalid-argument-type` 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 @@
84e41f2853d7af3d651d620f093031cba849bd1d
08225953c98cfd375d80bc88865e5aae77d2c07f
3 changes: 1 addition & 2 deletions crates/ty_vendored/vendor/typeshed/stdlib/__future__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Record of phased-in incompatible language changes.
"""Record of phased-in incompatible language changes.

Each line is of the form:

Expand Down
4 changes: 1 addition & 3 deletions crates/ty_vendored/vendor/typeshed/stdlib/_asyncio.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Accelerator module for asyncio
"""
"""Accelerator module for asyncio"""

import sys
from asyncio.events import AbstractEventLoop
Expand Down
3 changes: 1 addition & 2 deletions crates/ty_vendored/vendor/typeshed/stdlib/_bisect.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Bisection algorithms.
"""Bisection algorithms.

This module provides support for maintaining a list in sorted order without
having to sort the list after each insertion. For long lists of items with
Expand Down
4 changes: 1 addition & 3 deletions crates/ty_vendored/vendor/typeshed/stdlib/_blake2.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
_blake2b provides BLAKE2b for hashlib
"""
"""_blake2b provides BLAKE2b for hashlib"""

from _typeshed import ReadableBuffer
from typing import ClassVar, final
Expand Down
6 changes: 6 additions & 0 deletions crates/ty_vendored/vendor/typeshed/stdlib/_bootlocale.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
"""A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.

Don't import directly from third-party code; use the `locale` module instead!
"""

def getpreferredencoding(do_setlocale: bool = True) -> str: ...
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Abstract Base Classes (ABCs) for collections, according to PEP 3119.
"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.

Unit tests are in test_collections.
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Internal classes used by the gzip, lzma and bz2 modules
"""
"""Internal classes used by the gzip, lzma and bz2 modules"""

# _compression is replaced by compression._common._streams on Python 3.14+ (PEP-784)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Context Variables
"""
"""Context Variables"""

import sys
from collections.abc import Callable, Iterator, Mapping
Expand Down
4 changes: 1 addition & 3 deletions crates/ty_vendored/vendor/typeshed/stdlib/_csv.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
CSV parsing and writing.
"""
"""CSV parsing and writing."""

import csv
import sys
Expand Down
4 changes: 1 addition & 3 deletions crates/ty_vendored/vendor/typeshed/stdlib/_ctypes.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Create and manipulate C compatible data types in Python.
"""
"""Create and manipulate C compatible data types in Python."""

import _typeshed
import sys
Expand Down
4 changes: 1 addition & 3 deletions crates/ty_vendored/vendor/typeshed/stdlib/_decimal.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
C decimal arithmetic module
"""
"""C decimal arithmetic module"""

import sys
from decimal import (
Expand Down
32 changes: 25 additions & 7 deletions crates/ty_vendored/vendor/typeshed/stdlib/_frozen_importlib.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Core implementation of import.
"""Core implementation of import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

"""

import importlib.abc
Expand Down Expand Up @@ -114,7 +114,13 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# MetaPathFinder
if sys.version_info < (3, 12):
@classmethod
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None:
"""Find the built-in module.

If 'path' is ever specified then the search is considered a failure.

This method is deprecated. Use find_spec() instead.
"""

@classmethod
def find_spec(
Expand Down Expand Up @@ -142,7 +148,11 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# Loader
if sys.version_info < (3, 12):
@staticmethod
def module_repr(module: types.ModuleType) -> str: ...
def module_repr(module: types.ModuleType) -> str:
"""Return repr for the module.

The method is deprecated. The import machinery does the job itself.
"""
if sys.version_info >= (3, 10):
@staticmethod
def create_module(spec: ModuleSpec) -> types.ModuleType | None:
Expand Down Expand Up @@ -170,7 +180,11 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# MetaPathFinder
if sys.version_info < (3, 12):
@classmethod
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None:
"""Find a frozen module.

This method is deprecated. Use find_spec() instead.
"""

@classmethod
def find_spec(
Expand Down Expand Up @@ -198,15 +212,19 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# Loader
if sys.version_info < (3, 12):
@staticmethod
def module_repr(m: types.ModuleType) -> str: ...
def module_repr(m: types.ModuleType) -> str:
"""Return repr for the module.

The method is deprecated. The import machinery does the job itself.
"""
if sys.version_info >= (3, 10):
@staticmethod
def create_module(spec: ModuleSpec) -> types.ModuleType | None:
"""Set __file__, if able."""
else:
@classmethod
def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None:
"""Set __file__, if able."""
"""Use default semantics for module creation."""

@staticmethod
def exec_module(module: types.ModuleType) -> None: ...
Loading
Loading