Ruff 2024.2 style (#9639)

This commit is contained in:
Micha Reiser 2024-02-29 09:30:54 +01:00 committed by GitHub
parent 0293908b71
commit a6f32ddc5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 835 additions and 2362 deletions

View file

@ -10,7 +10,6 @@ use ruff_text_size::{Ranged, TextLen, TextRange};
use crate::comments::SourceComment;
use crate::context::NodeLevel;
use crate::prelude::*;
use crate::preview::is_blank_line_after_nested_stub_class_enabled;
use crate::statement::suite::should_insert_blank_line_after_class_in_stub_file;
/// Formats the leading comments of a node.
@ -544,10 +543,7 @@ pub(crate) fn empty_lines_before_trailing_comments<'a>(
// Black has different rules for stub vs. non-stub and top level vs. indented
let empty_lines = match (f.options().source_type(), f.context().node_level()) {
(PySourceType::Stub, NodeLevel::TopLevel(_)) => 1,
(PySourceType::Stub, _) => u32::from(
is_blank_line_after_nested_stub_class_enabled(f.context())
&& node_kind == NodeKind::StmtClassDef,
),
(PySourceType::Stub, _) => u32::from(node_kind == NodeKind::StmtClassDef),
(_, NodeLevel::TopLevel(_)) => 2,
(_, _) => 1,
};