Skip to main content

python_is_bare_string

Function python_is_bare_string 

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

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.

The one definition of “a string whose value is discarded” for both walks that care: the Halstead getter drops its operands (#695) and the LOC walk bills its rows as comment rows (#415). Whether those rows are also documentation is narrower and positional — see python_documentation_string_run (#1597).