Enable --document-private-items for ruff_python_formatter (#21903)

This commit is contained in:
Brent Westbrook
2025-12-11 08:23:10 -05:00
committed by GitHub
parent 27912d46b1
commit c51727708a
18 changed files with 70 additions and 53 deletions

View File

@@ -1095,9 +1095,9 @@ impl OperandIndex {
}
}
/// Returns the index of the operand's right operator. The method always returns an index
/// even if the operand has no right operator. Use [`BinaryCallChain::get_operator`] to test if
/// the operand has a right operator.
/// Returns the index of the operand's right operator. The method always returns an index even
/// if the operand has no right operator. Use [`FlatBinaryExpressionSlice::get_operator`] to
/// test if the operand has a right operator.
fn right_operator(self) -> OperatorIndex {
OperatorIndex::new(self.0 + 1)
}

View File

@@ -56,18 +56,20 @@ pub(crate) enum Parenthesize {
/// Adding parentheses is desired to prevent the comments from wandering.
IfRequired,
/// Same as [`Self::IfBreaks`] except that it uses [`parenthesize_if_expands`] for expressions
/// with the layout [`NeedsParentheses::BestFit`] which is used by non-splittable
/// expressions like literals, name, and strings.
/// Same as [`Self::IfBreaks`] except that it uses
/// [`parenthesize_if_expands`](crate::builders::parenthesize_if_expands) for expressions with
/// the layout [`OptionalParentheses::BestFit`] which is used by non-splittable expressions like
/// literals, name, and strings.
///
/// Use this layout over `IfBreaks` when there's a sequence of `maybe_parenthesize_expression`
/// in a single logical-line and you want to break from right-to-left. Use `IfBreaks` for the
/// first expression and `IfBreaksParenthesized` for the rest.
IfBreaksParenthesized,
/// Same as [`Self::IfBreaksParenthesized`] but uses [`parenthesize_if_expands`] for nested
/// [`maybe_parenthesized_expression`] calls unlike other layouts that always omit parentheses
/// when outer parentheses are present.
/// Same as [`Self::IfBreaksParenthesized`] but uses
/// [`parenthesize_if_expands`](crate::builders::parenthesize_if_expands) for nested
/// [`maybe_parenthesized_expression`](crate::expression::maybe_parenthesize_expression) calls
/// unlike other layouts that always omit parentheses when outer parentheses are present.
IfBreaksParenthesizedNested,
}