core.settings module¶
This module provides auxiliary functions to handle settings and files writing and loading.
-
core.settings.settings¶ A shared dictionary of settings accross the framework.
Type: dict
-
core.settings.ask_to_overwrite(path, id_current, text)¶ Parameters: - path (str) – Path to the already defined results folder.
- id_current (int) – ID of the problem to be solved.
- text (str) – Reason for everwriting.
-
core.settings.check_valid_settings()¶ Check if valid settings are used.
-
core.settings.dump_json(file, data)¶ Writes a JSON file.
Parameters: - file (str) – Path and name of the file to be written.
- data (dict) – The data to be saved.
-
core.settings.dump_object(name, *args)¶ Pickle dumps the given objects.
Parameters: - name (str) – Path and name of the target file.
- args (any) – Any object to be pickle dumped.
-
core.settings.get_input_from_id(problem_id, problem_folder)¶ Get filename from problem ID.
Parameters: - problem_id (int) – ID of the problem to be solved.
- problem_folder (str) – Directory which contains the input files.
Returns: Path to the input file of the requested ID.
Return type: file (str)
-
core.settings.get_results_folders()¶ Retrieves all current results folders.
Returns: Path to the directory with result folders. all_result_folder (list): List of all results folders. Return type: data_folder (str)
-
core.settings.load_json(file)¶ Read a JSON file.
Parameters: file (str) – Path and name of the file to be loaded. Returns: The loaded data. Return type: data (dict)
-
core.settings.load_object(name)¶ Loads the pickled object.
Parameters: name (str) – Path and name of the file to load. Returns: The loaded object. Return type: obj (any)
-
core.settings.make_workfolder(file, fresh)¶ Initialize the workdirectory.
Parameters: - file (str) – Path and name of the current input file.
- fresh (bool) – Whether this is a new problem to be solved.
Returns: Path to the current results data folder.
Return type: folder_path (str)
-
core.settings.restart_check(id_current, file)¶ Parameters: - id_current (int) – ID of the problem to be solved.
- file (str) – Path and name of the current input file.
Notes
For load_surrogate, only checking that the problem name is the same.
-
core.settings.update_settings(problem_id)¶ Updates the shared settings dictionary with the settings specified in the input file.
Parameters: problem_id (int) – ID of the problem to be solved.