judgevet.domain.policy_checks

Status: draft.

judgevet.domain.policy_checks

Shared scalar checks for pure policy construction.

Examples:

from judgevet.domain.policy_checks import finite_number

assert finite_number(0.5)
assert not finite_number(True)
See Also

check_bound(value, label, maximum)

Validate and normalize an optional nonnegative bound.

Parameters:

Name Type Description Default
value float | None

Candidate bound.

required
label str

Fixed diagnostic label.

required
maximum float | None

Optional upper bound.

required

Returns:

Type Description
float | None

A finite float or None.

Raises:

Type Description
PolicyDefinitionError

If the bound is invalid.

check_name(name)

Require a nonempty question name.

Parameters:

Name Type Description Default
name str

Candidate name.

required

Raises:

Type Description
PolicyDefinitionError

If the name is invalid.

check_range(minimum, maximum)

Require at least one bound and ordered endpoints.

Parameters:

Name Type Description Default
minimum float | None

Lower bound.

required
maximum float | None

Upper bound.

required

Raises:

Type Description
PolicyDefinitionError

If bounds are absent or inverted.

finite_number(value)

Check finite numeric values without treating bool as a number.

Parameters:

Name Type Description Default
value object

Candidate number.

required

Returns:

Type Description
bool

Whether the value is an int or finite float, excluding bool.