itacart.integer_index.cell_to_int

itacart.integer_index.cell_to_int(cell)[source]

The integer of a cell.

Parameters:

cell (str) – Compositional index string.

Return type:

int | list[int]

Returns:

The integer for a single cell, or a list aligned with itacart.decompose() when the index holds several.

Raises:
  • InvalidIndexError – If the index is malformed.

  • NonExistentCellError – If any cell of the index names no cell. The box has integers for addresses that are not cells, and none of them is handed out for a spelling the predicate denies.

Example

>>> cell_to_int("NE")
0
>>> cell_to_int("NE(0000/0000)")
4
>>> cell_to_int("NE(0625/0451(1,2))") == [
...     cell_to_int("NE(0625/0451(1))"), cell_to_int("NE(0625/0451(2))")]
True