dgs.utils.config.insert_into_config

dgs.utils.config.insert_into_config(path: list[str], value: dict[str, any], original: dict[str, any], copy: bool = True) dict[str, any][source]

Insert a sub-configuration at the given path into the original or a copy of it, possibly overwriting existing values.

Parameters:
  • path – path to the place of the insertion as a list of strings.

  • value – A sub-configuration to be inserted at the given path.

  • original – The original configuration to be extended. This config will be copied if copy is true, and modified otherwise.

  • copy – Whether to create a (deep-)copy of the original config or modify it inplace. Default True, creates and returns a copy.

Returns:

A modified (copy) of the original with the given value inserted at the path.