Format class definitions (#5289)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user