mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:34:57 +00:00
[ruff
] Fix false positive for t-strings in default-factory-kwarg
(RUF026
) (#20032)
Closes #19993 ## Summary Recognize t strings as never being callable to avoid false positives on RUF026.
This commit is contained in:
parent
11f521c768
commit
c22395dbc6
2 changed files with 9 additions and 1 deletions
|
@ -118,3 +118,10 @@ def func():
|
|||
return lambda: value
|
||||
|
||||
defaultdict(constant_factory("<missing>"))
|
||||
|
||||
def func():
|
||||
defaultdict(default_factory=t"") # OK
|
||||
|
||||
|
||||
def func():
|
||||
defaultdict(default_factory=t"hello") # OK
|
||||
|
|
|
@ -123,7 +123,8 @@ fn is_non_callable_value(value: &Expr) -> bool {
|
|||
| Expr::SetComp(_)
|
||||
| Expr::DictComp(_)
|
||||
| Expr::Generator(_)
|
||||
| Expr::FString(_))
|
||||
| Expr::FString(_)
|
||||
| Expr::TString(_))
|
||||
}
|
||||
|
||||
/// Generate an [`Expr`] to replace `defaultdict(default_factory=callable)` with
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue