cadrumo.application.modelo._decimal_parsing module¶
Shared finite-Decimal parser for borrador-sourced modelo bindings.
This module is a parsing helper, not a binding:
decimal_from_string() coerces a finite raw string or
Decimal into a Decimal for a registry
binding identifier. It is named for what it does (parsing) rather than the
pipeline that consumes it, so “binding” stays reserved for the
registry-data-input concept.
The borrador-binding path accepts live snapshot values as either
Decimal or str. Its resolver keeps that boundary
local and delegates the canonical finite coercion here. Profile-sourced bindings
use typed profile facts directly and keep their Decimal-channel refusal in the
profile resolver instead of reusing this helper.
See also
cadrumo.application.modelo.borrador_binding.resolve_modelo_100_borrador_bindings()Consumes this helper after registry eligibility and caller-precedence checks decide that a borrador snapshot may supply the value.
cadrumo.application.modelo.profile_binding.resolve_profile_sourced_bindings()Resolves the same registry binding channels from typed profile facts, without raw string parsing.
The caller supplies the pipeline-specific error factory so the operator-facing refusal keeps the boundary context of the surface that found the bad value.
- decimal_from_string(binding_id, value, *, error_factory, pipeline_label='value')[source]¶
Parse a finite decimal value or raise the pipeline-specific error.
- Parameters:
binding_id (
TypeAliasType) – Registry binding identifier being resolved; appears in the error message so the operator can locate the offending value.value (
Decimal|str) – Decimal or free string from a source pipeline such as a live borrador snapshot. Strings use the canonical finite European decimal contract, and Decimal instances must also be finite.error_factory (
Callable[[str],Exception]) – Callable invoked with the formatted message when the value does not resolve to a finite decimal. Each pipeline supplies its own boundary error class so refusals carry the right context; the factory may use the message directly or translate it into structured context.pipeline_label (
str) – Operator-facing label that prefixes the refusal message (for example,"borrador value"); defaults to the generic"value".
- Return type:
- Returns:
The parsed
Decimal.- Raises:
Exception – Whatever
error_factoryproduced.
See also
cadrumo.application.modelo.borrador_binding.resolve_modelo_100_borrador_bindings()Resolver that validates the borrador snapshot and calls this helper for Decimal-channel snapshot values.