MCPcopy Create free account
hub / github.com/astral-sh/ruff / fmt

Method fmt

crates/ruff_python_formatter/src/string/normalize.rs:652–661  ·  view source on GitHub ↗
(&self, f: &mut Formatter<PyFormatContext<'_>>)

Source from the content-addressed store, hash-verified

650
651impl Format<PyFormatContext<'_>> for NormalizedString<'_> {
652 fn fmt(&self, f: &mut Formatter<PyFormatContext<'_>>) -> FormatResult<()> {
653 let quotes = StringQuotes::from(self.flags);
654 ruff_formatter::write!(f, [self.flags.prefix(), quotes])?;
655 match &self.text {
656 Cow::Borrowed(_) => source_text_slice(self.range()).fmt(f)?,
657 Cow::Owned(normalized) => text(normalized).fmt(f)?,
658 }
659
660 quotes.fmt(f)
661 }
662}
663
664pub(crate) fn normalize_string(

Callers

nothing calls this directly

Calls 3

source_text_sliceFunction · 0.85
textFunction · 0.85
rangeMethod · 0.45

Tested by

no test coverage detected