Skip to content

trudag.config.config

GeneralConfig

GeneralConfig(content: dict[str, Any])

Bases: TrustableConfig

Given a custom configuration list, validates it. Given no configuration, uses the default configuration in trudag.

get

get(
    keys: list[str],
    config_content: dict[str, Any] | None = None,
) -> Any | None

Provides a way to search for values in the sub-sections of the configuration by recursively searching for the value of a given keys list. For example: get(["reports", "TSF", "enable_figures"]) will return the value for enable figures under the TSF report (.i.e. False).

override_config

override_config(custom_config: dict[str, Any])

Overrides the configuration content with the given custom_config content.

safe_get

safe_get(
    keys: list[str],
    config_content: dict[str, Any] | None = None,
) -> Any

Provides a safe way to search for values in the sub-sections of the configuration by recursively searching for the value of a given keys list. If given keys don't exist in the configuration, we fallback on the default general config. For example: get(["reports", "TSF", "enable_figures"]) will return the value for enable figures under the TSF report (.i.e. False).

TrustableConfig

Bases: Protocol

Protocol to support different kinds of configuration to be used in the trustable project. It has a basic requirement to support schema accessor, version of configuration, and configuration content.

schema property

schema: Schema

Getter method to be implemented for returning the schema used in the configuration. Returns: trudag.config.schema.Schema of the configuration that validates the configuration content.

version property

version: str

Method to implemented to access the version of configuration