aeat.domain.calculations.registry._toml_helpers module

Shared TOML-table narrowing helper for the registry loader family.

Extracted so both _loader and _loader_locales can narrow a parsed TOML value to a string-keyed table without importing each other (avoiding a runtime import cycle between the compiler and the locale-merge submodule).

as_toml_table(value)[source]

Narrow a parsed TOML value to a string-keyed table, or None.

tomllib and freeze_toml() always emit str keys, so a parsed-TOML dict is genuinely dict[str, object]. The runtime isinstance check loses the key type because TOML payloads flow through object; the annotation below re-attaches the known str key type at this single TOML deserialization boundary.

Return type:

dict[str, object] | None

Parameters:

value (object)