ra2ce.configuration package#
Submodules#
ra2ce.configuration.config_factory module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class ConfigFactory[source]#
Bases:
object
- static get_analysis_config_data(analysis_ini, network_config)[source]#
- Return type:
Optional
[AnalysisConfigWrapper
]- Parameters:
analysis_ini (Path | None)
network_config (NetworkConfigWrapper | None)
- static get_analysis_config_with_network(analysis_ini, config_data, network_config)[source]#
- Parameters:
analysis_ini (Path)
config_data (AnalysisConfigData)
network_config (NetworkConfigWrapper)
- static get_analysis_config_without_network(analysis_ini, config_data)[source]#
- Parameters:
analysis_ini (Path)
config_data (AnalysisConfigData)
- static get_config_wrapper(network_ini, analysis_ini)[source]#
Generates a ConfigWrapper containing the DataObjectModel representations of the given network and analysis ini files.
- Return type:
- Parameters:
network_ini (Path | None)
analysis_ini (Path | None)
- Args:
network_ini (Path): Path to the network.ini file. analysis_ini (Path): Path to the analysis.ini file.
- Returns:
ConfigWrapper: Instantiated ConfigWrapper.
ra2ce.configuration.config_wrapper module#
- GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Risk Assessment and Adaptation for Critical Infrastructure (RA2CE). Copyright (C) 2023 Stichting Deltares
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
- class ConfigWrapper[source]#
Bases:
object
-
analysis_config:
Optional
[AnalysisConfigWrapper
]#
- is_valid_input()[source]#
Validates whether the input is valid. This require that at least the analysis ini file is given. TODO: Very unclear what a valid input is, needs to be better specified.
- Return type:
bool
- Returns:
bool: Input parameters are valid for a ra2ce run.
-
network_config:
Optional
[NetworkConfigWrapper
]#
-
analysis_config:
ra2ce.configuration.ra2ce_enum_base module#
- class Ra2ceEnumBase(value)[source]#
Bases:
Enum
Base class for enums defined within Ra2ce. NONE = 0: Optional entry (config is optional and missing) INVALID = 99: Mandatory entry (config contains invalid value)
- property config_value: str | None#
Reconstruct the name as it is known in the config. This could entail replacement of “ “ by “_” and lower() operations.
- Returns:
str: Value as known in the config.
- classmethod get_enum(input_str)[source]#
Create an enum from a given input string.
- Return type:
- Parameters:
input_str (str | None)
- Args:
input (str): Value from config.
- Returns:
Ra2ceEnumBase: Enumeration instance. NONE: This entry is used if the config is missing. INVALID: This entry is used if the config value is invalid.
- is_valid()[source]#
Check if given value is valid.
- Return type:
bool
- Args:
key (str): Enum key (name)
- Returns:
bool: If the given key is not a valid key
- classmethod list_valid_options()[source]#
List the enum options as allowed in the config.
- Return type:
list
[Ra2ceEnumBase
]
- Returns:
list[str | None]: Concatenated options, separated by “, “