check_registry()#

check_registry(
category: str,
registry: Mapping[str, DriverEntry],
driver_config: type[BaseModel],
) → None[source]#

Verify every pattern in registry can produce a valid config block for category.

config_block() emits num_channels exactly when the matched IdnPattern carries one, and each category’s driver config either requires that field or forbids it (extra="forbid"). So a pattern must carry a count when the model requires one and must not when the model has no such field. The requirement is read from the model so the registry and the schema cannot drift apart.

Run by the registry tests for every category rather than at import time: a bad pattern is a contributor mistake, and an import-time failure in one category would take match_idn() and instro discover down for all of them.

Parameters:
  • category – Category name, used in the error message (e.g. "psu").

  • registry – The category’s <CAT>_VENDOR_REGISTRY mapping.

  • driver_config – The category’s driver config Pydantic model; whether its num_channels field is required decides which direction is enforced.

Raises:

ValueError – a pattern lacks num_channels where the config requires it, or carries one where the config has no such field.