flasc.utilities.tuner_utilities.nested_set

Contents

flasc.utilities.tuner_utilities.nested_set#

flasc.utilities.tuner_utilities.nested_set(dic: Dict[str, Any], keys: List[str], value: Any, idx: None | int = None) None[source]#

Set a value in a nested dictionary using a list of keys.

Based on: stackoverflow.com/questions/14692690/access-nested-dictionary-items-via-a-list-of-keys

Parameters:
  • dic (Dict[str, Any]) -- The dictionary to set the value in.

  • keys (List[str]) -- A list of keys to traverse the dictionary.

  • value (Any) -- The value to set.

  • idx (Optional[int], optional) -- If the value is an list, the index to change. Defaults to None.

Return type:

None