waft.configuration.config_file.config_base module

class waft.configuration.config_file.config_base.ConfigBase(config_file_path: Path | str | None = None, auto_create: bool | None = None)

Bases: object

Base class for configuration handling.

property config_data: ConfigInfo

Retrieve the configuration data.

Returns:

The loaded configuration data.

Return type:

ConfigInfo

hostname_exists(hostname: str) bool

Check if a hostname exists in the configuration.

Parameters:

hostname (str) – The hostname to search for.

Returns:

True if the hostname exists, False otherwise.

Return type:

bool

static item_exists(items: list[dict], key: str, value: str) bool

Check if an item with a specific key-value pair exists.

Parameters:
  • items (List[Dict]) – A list of dictionaries to search.

  • key (str) – The key to search for.

  • value (str) – The value to match.

Returns:

True if the item exists, False otherwise.

Return type:

bool

proxy_hostname_exists(hostname: str) bool

Check if a proxy hostname exists in the configuration.

Parameters:

hostname (str) – The hostname to search for.

Returns:

True if the proxy hostname exists, False otherwise.

Return type:

bool

proxy_name_exists(proxy_name: str) bool

Check if a proxy system name exists in the configuration.

Parameters:

proxy_name (str) – The proxy system name to search for.

Returns:

True if the proxy system name exists, False otherwise.

Return type:

bool

system_name_exists(system_name: str) bool

Check if a system name exists in the configuration.

Parameters:

system_name (str) – The system name to search for.

Returns:

True if the system name exists, False otherwise.

Return type:

bool

class waft.configuration.config_file.config_base.ConfigInfo(systems: list[dict] = <factory>, proxies: list[dict] = <factory>, groups: dict[str, list[str]] = <factory>)

Bases: object

Definition of the configuration dictionary.

systems

A list of system configurations.

Type:

List[Dict]

proxies

A list of proxy system configurations.

Type:

List[Dict]

groups

A dictionary mapping group names to system names.

Type:

Dict[str, List[str]]

groups: dict[str, list[str]]
proxies: list[dict]
systems: list[dict]
to_dict() dict

Convert the ConfigInfo instance to a dictionary.

Returns:

Dictionary representation of the configuration data.

Return type:

dict