mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-10 21:58:30 +00:00
Implement flake8-future-annotations
FA100 (#3979)
This commit is contained in:
parent
cd2e7fa72a
commit
01b372a75c
34 changed files with 375 additions and 15 deletions
|
@ -70,6 +70,15 @@ pub fn is_pep585_builtin(expr: &Expr, context: &Context) -> bool {
|
|||
})
|
||||
}
|
||||
|
||||
/// Returns `true` if `Expr` represents a reference to a typing object with a
|
||||
/// PEP 603 built-in.
|
||||
pub fn is_pep604_builtin(expr: &Expr, context: &Context) -> bool {
|
||||
context.resolve_call_path(expr).map_or(false, |call_path| {
|
||||
context.match_typing_call_path(&call_path, "Optional")
|
||||
|| context.match_typing_call_path(&call_path, "Union")
|
||||
})
|
||||
}
|
||||
|
||||
pub fn is_immutable_annotation(context: &Context, expr: &Expr) -> bool {
|
||||
match &expr.node {
|
||||
ExprKind::Name(_) | ExprKind::Attribute(_) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue