-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for simple generic type variables to UP040 #6314
Conversation
1834445
to
382e0f1
Compare
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
We don't remove unused variables in the module scope, since they could be imported from other modules (i.e., they are part of the module's public API). (We only remove unused variables within function scopes.) |
Ah that makes sense. We're pretty unlikely to ever remove these then. I don't think we should either, I've definitely imported them :D |
2fffafb
to
bae9097
Compare
fn visit_expr(&mut self, expr: &'a Expr) { | ||
match expr { | ||
Expr::Name(name) if name.ctx.is_load() => { | ||
let Some(Stmt::Assign(StmtAssign { value, .. })) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to match AnnAssign
too? No, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. At least, Pyright complains about
from typing import TypeVar
T: TypeVar = TypeVar("T")
Extends astral-sh#6289 to support moving type variable usage in type aliases to use PEP-695. Does not remove the possibly unused type variable declaration. Presumably this is handled by other rules, but is not working for me. Does not handle type variables with bounds or variance declarations yet. Part of astral-sh#4617
Extends #6289 to support moving type variable usage in type aliases to use PEP-695.
Does not remove the possibly unused type variable declaration.
Presumably this is handled by other rules, but is not working for me.We cannot remove module level declarations safely.Does not handle type variables with bounds or variance declarations yet.
Part of #4617