itacart.hierarchy.contains

itacart.hierarchy.contains(region, cell)[source]

Whether a compositional region covers a cell.

Complements is_ancestor(), which only tests the vertical relation between two single cells. A region covers a cell when any of its terminal cells is that cell or an ancestor of it.

Like is_ancestor(), a predicate over index strings only.

Parameters:
  • region (str) – Compositional index string denoting the region.

  • cell (str) – Compositional index string to test.

Return type:

bool | list[bool]

Returns:

A boolean for a single test cell, or a positionally aligned list.