Skip to main content

Module python

Module python 

Source
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 an expression_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 node is a bare string statement’s string: 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 the concatenated_string node.
python_is_bare_string_parenthesis
Whether node is a parenthesized_expression around 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 block kind_ids.
python_is_lambda
Whether node is a Python lambda expression, under either of the grammar’s two aliased kind_ids: Lambda (196, the concrete production emitted today) and Lambda2 (197, the currently-unseen hidden alias). Lambda3 (73) is the lambda keyword token, not a closure node, and is intentionally excluded.
python_sphinx_doc_comment
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__).