unilab.base.registry.apply_cfg_overrides

unilab.base.registry.apply_cfg_overrides(target_obj, overrides)[source]

Apply a (possibly nested) dict of overrides to target_obj in place.

Behavior:
  • For each key, value in overrides, target_obj.key must exist (otherwise ValueError).

  • If value is a dict and target_obj.key is already a dataclass instance, recurse into it (deep merge — preserves fields not present in value). This is what lets Hydra-style partial overrides like env.scene.terrain.generator.num_rows=4 keep sub_terrains and other defaults intact.

  • If value is a dict and target_obj.key is currently None, instantiate the field’s annotated dataclass type from the dict (full-construction path).

  • Otherwise setattr the value directly (scalar / list / non-dataclass).

Parameters:
Return type:

None