pub fn python_sphinx_doc_comment<'a>(
comment: &Node<'a>,
code: &[u8],
ancestors: Ancestors<'a, '_>,
credit: impl FnMut(usize, usize),
)Expand description
Credits the rows of a Sphinx doc comment that comment completes
(#1597). Sphinx autodoc reads a comment starting #: as an
attribute’s documentation when it sits on the line of an assignment,
after the code, or on the consecutive lines directly above one —
every one of them #:; a plain # line breaks the block. The
assignment must be one an attribute docstring may follow
(module or class level, or self.<attr> at the top of __init__).
A block is decided once, at its last #: line, which walks back
over the block to credit it: credit(first_row, last_row) per line.
The grammar places a comment that precedes a body’s first statement
outside that body, as a child of the class or function, so the
statement after it is the body block’s first statement.