check_registry()#
- check_registry(
- category: str,
- registry: Mapping[str, DriverEntry],
- driver_config: type[BaseModel],
Verify every pattern in
registrycan produce a valid config block forcategory.config_block()emitsnum_channelsexactly when the matchedIdnPatterncarries 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()andinstro discoverdown for all of them.- Parameters:
category – Category name, used in the error message (e.g.
"psu").registry – The category’s
<CAT>_VENDOR_REGISTRYmapping.driver_config – The category’s driver config Pydantic model; whether its
num_channelsfield is required decides which direction is enforced.
- Raises:
ValueError – a pattern lacks
num_channelswhere the config requires it, or carries one where the config has no such field.