mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
Format class
definitions (#5289)
This commit is contained in:
parent
7d4f8e59da
commit
f7e1cf4b51
27 changed files with 914 additions and 541 deletions
|
@ -1,5 +1,6 @@
|
|||
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
|
||||
use ruff_formatter::{write, Buffer, FormatResult};
|
||||
use crate::prelude::*;
|
||||
use crate::FormatNodeRule;
|
||||
use ruff_formatter::write;
|
||||
use rustpython_parser::ast::Keyword;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -7,6 +8,15 @@ pub struct FormatKeyword;
|
|||
|
||||
impl FormatNodeRule<Keyword> for FormatKeyword {
|
||||
fn fmt_fields(&self, item: &Keyword, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
write!(f, [not_yet_implemented(item)])
|
||||
let Keyword {
|
||||
range: _,
|
||||
arg,
|
||||
value,
|
||||
} = item;
|
||||
if let Some(argument) = arg {
|
||||
write!(f, [argument.format(), text("=")])?;
|
||||
}
|
||||
|
||||
value.format().fmt(f)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue