flame.io.find_dataset_config¶
- flame.io.find_dataset_config(input_direc: str, this_id: str, key: str | List[str] = ['FLAME_Dataset', 'id'], file_ext: str = 'json', fail_ok: bool = False) None | Tuple[str, dict][source]¶
Searches through all files with extension ‘file_ext’ in provided ‘input_direc’ for a value of ‘id’. Assumes files will be in json format, and will be opened using the builtin json I/O. Will use ‘key’ to search the dict. If key is a list of strings, each successive string will identify the nested sub-dictionary for search. Outcomes:
If a match is found, return the entire dict stored by the associated .json.
If no match is found, return None if ‘fail_ok’ is True. Otherwise throw FLAMEIOError.
If multiple matches are found, throw FLAMEIOError
- Returns:
None IF no matches found and ‘fail_ok’ is True
tuple(output_hit (str), output_dict (dict)) IF a single match is found. String is path to json and dict is associated dictionary.