waft.configuration.config_file.config_reader module

class waft.configuration.config_file.config_reader.ConfigReader(config_file_path: str | Path | None = None)

Bases: object

Class for reading configuration data.

property config_data: ConfigInfo

Retrieve the configuration data.

Returns:

The loaded configuration data.

Return type:

ConfigInfo

find_systems_by_group_or_system_name(name: str) list[str]

Find systems by the name of a group or a system.

Parameters:

name (str) – The name of the group or system to retrieve.

Returns:

A list of system names.

Return type:

list[str]

Raises:

ValueError – If the group or system with the specified name does not exist.

get_group_by_name(name: str) list[str] | None

Retrieve systems by group name.

Parameters:

name (str) – The name of the group to retrieve.

Returns:

List of system names if found, or None.

Return type:

Optional[list[str]]

get_group_names() list[str]

Retrieve a list of group names from the configuration.

Returns:

A list of group names.

Return type:

List[str]

get_groups() dict[str, list[str]]

Retrieve a dictionary of groups from the configuration.

Returns:

A dictionary mapping group names to system names.

Return type:

UserConfiguredGroups

get_json_data() dict

Retrieve the configuration data as a JSON object.

get_proxies() list[UserConfiguredProxy]

Retrieve proxy systems from the configuration.

Returns:

A list of configured proxy systems.

Return type:

List[UserConfiguredProxy]

get_proxy_by_name(name: str) UserConfiguredProxy | None

Retrieve a proxy system by its name.

Parameters:

name (str) – The name of the proxy system to retrieve.

Returns:

The proxy system object if found, or None if no matching proxy system exists.

Return type:

Optional[UserConfiguredProxy]

get_system_by_name(name: str) UserConfiguredSystem | UserConfiguredLocalSystem | None

Retrieve a system configuration by its name.

Parameters:

name (str) – The name of the system to retrieve.

Returns:

The system configuration object if found, or None if no matching system is found.

Return type:

Optional[UserConfiguredSystem | UserConfiguredLocalSystem]

Raises:

ValueError – If the proxy for the system is specified but not found in the proxy systems.

get_system_names() list[str]

Retrieve a list of system names from the configuration.

Returns:

A list of system names.

Return type:

List[str]

get_systems() list[UserConfiguredSystem]

Retrieve a list of systems without resolving proxy details.

Returns:

A list of UserConfiguredSystem instances.

Return type:

List[UserConfiguredSystem]

static item_exists(items: list, attr: str, value: str) bool

Check if an item with a specific attribute value exists.

Parameters:
  • items (list) – A list of objects to search.

  • attr (str) – The attribute to search for.

  • value (str) – The value to match.

Returns:

True if the item exists, False otherwise.

Return type:

bool

validate_file_path() bool

Validate that the configuration file exists.

Returns:

True if the configuration file exists, False otherwise.

Return type:

bool