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

Method indent

crates/ruff_python_formatter/src/string/docstring.rs:854–860  ·  view source on GitHub ↗

The indent of the entire code block relative to the start of the line. For example: ```python def test(): """Docstring Example: >>> 1 + 1 ``` The `>>> ` block has an indent of 8 columns: The shared indent with the docstring and the 4 spaces inside the docstring.

(&self)

Source from the content-addressed store, hash-verified

852 /// The `>>> ` block has an indent of 8 columns: The shared indent with the docstring and the 4 spaces
853 /// inside the docstring.
854 fn indent(&self) -> Indentation {
855 match self {
856 CodeExampleKind::Doctest(doctest) => Indentation::from_str(doctest.ps1_indent),
857 CodeExampleKind::Rst(rst) => rst.min_indent.unwrap_or(rst.opening_indent),
858 CodeExampleKind::Markdown(markdown) => markdown.opening_fence_indent,
859 }
860 }
861}
862
863/// State corresponding to a single doctest code example found in a docstring.

Callers 1

formatMethod · 0.45

Calls 1

unwrap_orMethod · 0.80

Tested by

no test coverage detected