progfiguration.progfigsite_validator

Validate progfigsite modules

Progfigsite modules must follow a certain API. This module validates compliance.

Classes

ProgfigsiteProperty

A property of a progfigsite module.

ValidationResult

The result of validating a module

Functions

validate(→ ValidationResult)

Validate a progfigsite module

Module Contents

class progfiguration.progfigsite_validator.ProgfigsiteProperty

A property of a progfigsite module.

submodule: str

The name of the submodule that the attribute is in.

An empty string for the root module.

attribute: str

The string name of the attribute in the module to check for.

If this is empty, we just check if the module exists.

type: Any

The type of the attribute.

required: bool = True

Whether the attribute is required.

property errstr: str

A string describing the error

class progfiguration.progfigsite_validator.ValidationResult(path: str)

The result of validating a module

valid_properties

A list of attributes that a progfigsite module must have

path

The path to the module (must already be present in Python module path)

errors: List[ProgfigsiteProperty] = []

A list of errors that were found

property is_valid: bool

True if the module is valid, False otherwise

progfiguration.progfigsite_validator.validate(module_path: str) ValidationResult

Validate a progfigsite module

Return a ValidationResult object.