"""Single source of truth for the wafer sensor-count partition."""
from __future__ import annotations

from pygui.backend.wafer.wafer_layouts import load_layout_for_wafer_id


def sensor_count_for(family_code: str) -> int:
    """Real sensor count for a wafer family code, from its YAML layout.

    0 for an unknown/empty family code."""
    try:
        return len(load_layout_for_wafer_id(family_code))
    except KeyError:
        return 0
