mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-23 03:45:14 +00:00
Refactor the ExprDict
node (#11267)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
de270154a1
commit
6774f27f4b
52 changed files with 2425 additions and 2240 deletions
|
@ -1059,8 +1059,8 @@ pub(crate) fn has_own_parentheses(
|
|||
}
|
||||
}
|
||||
|
||||
Expr::Dict(ast::ExprDict { keys, .. }) => {
|
||||
if !keys.is_empty() || context.comments().has_dangling(AnyNodeRef::from(expr)) {
|
||||
Expr::Dict(ast::ExprDict { items, .. }) => {
|
||||
if !items.is_empty() || context.comments().has_dangling(AnyNodeRef::from(expr)) {
|
||||
Some(OwnParentheses::NonEmpty)
|
||||
} else {
|
||||
Some(OwnParentheses::Empty)
|
||||
|
@ -1217,7 +1217,7 @@ pub(crate) fn is_splittable_expression(expr: &Expr, context: &PyFormatContext) -
|
|||
|
||||
// Sequence types can split if they contain at least one element.
|
||||
Expr::Tuple(tuple) => !tuple.elts.is_empty(),
|
||||
Expr::Dict(dict) => !dict.values.is_empty(),
|
||||
Expr::Dict(dict) => !dict.items.is_empty(),
|
||||
Expr::Set(set) => !set.elts.is_empty(),
|
||||
Expr::List(list) => !list.elts.is_empty(),
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue