Coverage for python/gsfit/database_writers/workflow_names.py: 40%

5 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-14 15:25 +0000

1import typing 

2 

3 

4def workflow_names_from_settings(settings: dict[str, typing.Any]) -> list[str]: 

5 """ 

6 The names of the input codes ("workflow") which the selected `database_reader` reads from, 

7 for example `["elmag", "mag", "psu2coil"]`. 

8 

9 These are the names which `map_results_to_database` stores under `INPUT.WORKFLOW`, and which 

10 the MDSplus `INPUT.WORKFLOW` nodes have to be created for. They come from the settings alone, 

11 so they are known before GSFit has read a single byte from the database. 

12 

13 :param settings: Dictionary containing the JSON settings read from the `settings` directory 

14 """ 

15 

16 database_reader_method = settings["GSFIT_code_settings.json"]["database_reader"]["method"] 

17 database_reader_settings = settings["GSFIT_code_settings.json"]["database_reader"][database_reader_method] 

18 

19 # Not every database_reader reads from other codes, e.g. `freegs` and `freegsnke` do not 

20 return list(database_reader_settings.get("workflow", {}).keys())