MCPcopy
hub / github.com/psf/black / is_multiline_string

Function is_multiline_string

src/black/nodes.py:826–835  ·  view source on GitHub ↗

Return True if `leaf` is a multiline string that actually spans many lines.

(node: LN)

Source from the content-addressed store, hash-verified

824
825
826def is_multiline_string(node: LN) -> bool:
827 """Return True if `leaf` is a multiline string that actually spans many lines."""
828 if isinstance(node, Node) and is_fstring(node):
829 leaf = fstring_tstring_to_string(node)
830 elif isinstance(node, Leaf):
831 leaf = node
832 else:
833 return False
834
835 return has_triple_quotes(leaf.value) and "\n" in leaf.value
836
837
838def is_parent_function_or_class(node: Node) -> bool:

Callers 5

is_line_short_enoughFunction · 0.90
visit_STRINGMethod · 0.90

Calls 3

has_triple_quotesFunction · 0.90
is_fstringFunction · 0.85

Tested by

no test coverage detected