Expand description
Python: the aliased block and lambda kind sets, and the shape
of a docstring.
Functions§
- python_
documentation_ string_ run - Credits a consecutive run of documentation strings at its last string. Comments between statements do not break the run. Deciding once keeps additional-docstring recognition linear in the number of statements.
- python_
is_ bare_ statement_ value - Whether
node, past any parentheses around it, is the sole child of anexpression_statement: the discarded-value shape a docstring takes. CPython drops the parentheses, so("""doc""")is a docstring (#1610)."a", "b"has two children, so it is a discarded tuple, not documentation. - python_
is_ bare_ string - Whether
nodeis a bare string statement’sstring: the statement’s sole value itself, or one fragment of an implicitly concatenated literal ("""doc""" "more") that is — CPython joins the fragments into one string, and so does theconcatenated_stringnode. - python_
is_ bare_ string_ parenthesis - Whether
nodeis aparenthesized_expressionaround a bare string statement’s string, or one of its(and). The parentheses belong to the docstring they wrap (#1610): neither code rows nor operators. - python_
is_ block - Single normalization point for Python’s aliased
blockkind_ids. - python_
is_ lambda - Whether
nodeis a Pythonlambdaexpression, under either of the grammar’s two aliased kind_ids:Lambda(196, the concrete production emitted today) andLambda2(197, the currently-unseen hidden alias).Lambda3(73) is thelambdakeyword token, not a closure node, and is intentionally excluded. - python_
sphinx_ doc_ comment - Credits the rows of a Sphinx doc comment that
commentcompletes (#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, orself.<attr>at the top of__init__).