Skip to main content

python_is_bare_string_parenthesis

Function python_is_bare_string_parenthesis 

Source
pub fn python_is_bare_string_parenthesis(
    node: &Node<'_>,
    ancestors: Ancestors<'_, '_>,
) -> bool
Expand description

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.

Decided from the statement down, as the string’s own climb is, so a string nested past CPython’s 200-parenthesis cap keeps every one of its parentheses as code rather than only the outermost. Every parenthesis of a chain asks, and a climb and a descent per parenthesis made a statement d deep cost O(d²): a walk that lent a FoldCache reads the answer off a memoised fold of the ancestry instead, which unwraps each statement’s value once. Any other caller climbs, which the cap bounds where a fold without its memo would run from the root.