[ty] Assign lower completions ranking to deprecated functions and classes by Glyphack · Pull Request #23089 · astral-sh/ruff (original) (raw)
added the ty
Multi-file analysis & type inference
label
AlexWaygood changed the title
[ty] Assign lower rank to deprecated functions and classes [ty] Assign lower completions ranking to deprecated functions and classes
Glyphack marked this pull request as ready for review
This makes the completion rank deprecated functions and classes lower
than non deprecated ones. It relies on the @deprecated decorator on the definition.
Fixes astral-sh/ty#2654
carljm added a commit to Hugo-Polloli/ruff that referenced this pull request
- main: (45 commits)
[ty] Fix wrong inlay hints for overloaded function arguments (astral-sh#23179)
[ty] Respect
@no_type_checkwhen combined with other decorators (astral-sh#23177) [ty] Use type context when inferring constructor argument types (astral-sh#23139) [airflow] Add ruff rules to catch deprecated attribute access from context key for Airflow 3.0 (AIR301) (astral-sh#22850) Support formattingpyconmarkdown code blocks (astral-sh#23112) Markdown formatting in LSP (astral-sh#23063) Instruct Claude to use comments more sparingly (astral-sh#23181) [flake8-gettext] Fix false negatives for plural argument of ngettext (INT001,INT002,INT003) (astral-sh#21078) [ty] Invoking goto-def on parentheses of a class constructor call takes you too constructor method [ty] Make goto definition on class constructor always go to class definition [ty] Assign lower completions ranking to deprecated functions and classes (astral-sh#23089) [ty] Fix parameter references across files via keyword args (astral-sh#23012) [ty] Exclude enclosing class for base completions (astral-sh#23141) [pyupgrade] Fix syntax error on string with newline escape and comment (UP037) (astral-sh#22968) [ty] Improve documentation forexpect_single_definitionmethod (astral-sh#23175) [ty] Configure check mode for all projects Addhome-assistantto ecosystem projects (astral-sh#23132) Add tabbed shell completion documentation (astral-sh#23169) Bump typing conformance-suite pin (astral-sh#23174) [ty] Fix invalid diagnostic location for a sub-call to a specialized ParamSpec (astral-sh#23036) ...
BurntSushi pushed a commit that referenced this pull request
Summary
Follow up to #23089 this PR
assigns lower completion ranking to deprecated names in auto import
suggestions.
The implementation relies on finding a decorator named deprecated in
the source code ton consider that name deprecated.
Fixes astral-sh/ty#2654 for real :)
Test Plan
Added another test case for this.
I could not find an
Here's how the behavior changed:
Before:
abstractc
AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractChildWatcher (module: asyncio)
AbstractContextManager (module: contextlib)
AbstractEventLoopPolicy (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)After:
AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractContextManager (module: contextlib) (*, 3/7)
AbstractEventLoopPolicy (module: asyncio)
AbstractChildWatcher (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)
KotlinIsland pushed a commit to KotlinIsland/basedpython that referenced this pull request
…23188)
Summary
Follow up to astral-sh/ruff#23089 this PR
assigns lower completion ranking to deprecated names in auto import
suggestions.
The implementation relies on finding a decorator named deprecated in
the source code ton consider that name deprecated.
Fixes astral-sh/ty#2654 for real :)
Test Plan
Added another test case for this.
I could not find an
Here's how the behavior changed:
Before:
abstractc
AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractChildWatcher (module: asyncio)
AbstractContextManager (module: contextlib)
AbstractEventLoopPolicy (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)After:
AbstractAsyncContextManager (module: contextlib)
AbstractBasicAuthHandler (module: urllib.request)
AbstractContextManager (module: contextlib) (*, 3/7)
AbstractEventLoopPolicy (module: asyncio)
AbstractChildWatcher (module: asyncio)
abstractclassmethod (module: abc)
abstractstaticmethod (module: abc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})