nvflare.fuel_opt.utils.omegaconf_loader module¶
- class OmegaConfConfig(conf, file_path: str | None = None)[source]¶
Bases:
Config
- to_dict(resolve: bool | None = True) Dict [source]¶
Converts underline config object to dictionary.
- Parameters:
resolve – optional argument to indicate if the variable need to be resolved when convert to dictionary not all underline configuration format support this. If not supported, it is treated default valueTrue.
- Returns:
A converted configuration as dict
- to_str(element: Dict | None = None) str [source]¶
- Converts dict element to the str representation of the underline configuration, if element is not None
For example, for JsonFormat, the method return json string for PyhoconFormat, the method return pyhocon string for OmegaconfFormat, the method returns YAML string representation
If the element is None, return the underline config to string presentation
- Parameters:
element – Optional[Dict]. default to None. dictionary representation of config
- Returns:
string representation of the configuration in given format for the element or config
- class OmegaConfLoader[source]¶
Bases:
ConfigLoader
- load_config(file_path: str) Config [source]¶
Load configuration from config file.
- Parameters:
file_path (str) – file path for configuration to be loaded
- Returns:
A Config
- load_config_from_dict(config_dict: dict) Config [source]¶
Load Configuration based on a given config dict.
- Parameters:
config_dict (dict) – dict for configuration to be loaded
- Returns:
A Config
- load_config_from_str(config_str: str) Config [source]¶
Load Configuration based on the string representation of the underline configuration.
For example, Json String for Jsonformat. python conf string or yaml string presentation
- Parameters:
config_str (str) – string for configuration to be loaded
- Returns:
A Config