flasc.utilities.tuner_utilities.nested_set

Contents

flasc.utilities.tuner_utilities.nested_set#

flasc.utilities.tuner_utilities.nested_set(dic, keys, value, idx=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

Return type:

None

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.