Skip to content

trudag.dotstop.core.validator

yaml module-attribute

yaml: TypeAlias = (
    str
    | int
    | float
    | bool
    | list["yaml"]
    | dict[str, "yaml"]
)

Type alias for loaded yaml data stored as a nested dict/list data structure.

Validator

Validator()

Find, store and provide access to validator functions that are not known until runtime.

On construction, the Validator object will collect all functions with the signature:

(configuration: dict[str, yaml]) -> Generator(Exception | Warning, None, float)

that are available in the directory .dotstop_extensions/validators.py, or are available in module entry points belonging to the group trustable.validator.plugins.

Build a Validator instance.

is_validator_function staticmethod

is_validator_function(anything: Any) -> bool

True if the provided object is a validator function.

validate

validate(
    type: str, configuration: yaml
) -> tuple[float, list, str | None]

Call the validator function type with argument configuration.

Log all reported Exceptions and Warnings. Returns: tuple[float, list, str | None]: Returns a tuple of score, Exceptions, and the validator docstring