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

Function child_towards

src/black/nodes.py:485–490  ·  view source on GitHub ↗

Return the child of `ancestor` that contains `descendant`.

(ancestor: Node, descendant: LN)

Source from the content-addressed store, hash-verified

483
484
485def child_towards(ancestor: Node, descendant: LN) -> LN | None:
486 """Return the child of `ancestor` that contains `descendant`."""
487 node: LN | None = descendant
488 while node and node.parent != ancestor:
489 node = node.parent
490 return node
491
492
493def replace_child(old_child: LN, new_child: LN) -> None:

Callers 1

is_complex_subscriptMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected