mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
Implement PEP 604 annotation rewrites (#369)
This commit is contained in:
parent
806f3fd4f6
commit
7fe5945541
13 changed files with 324 additions and 18 deletions
9
src/ast/helpers.rs
Normal file
9
src/ast/helpers.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
use rustpython_ast::{Expr, ExprKind};
|
||||
|
||||
pub fn match_name_or_attr(expr: &Expr, target: &str) -> bool {
|
||||
match &expr.node {
|
||||
ExprKind::Attribute { attr, .. } => target == attr,
|
||||
ExprKind::Name { id, .. } => target == id,
|
||||
_ => false,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue