in lib/metric-config-parser/metric_config_parser/population.py [0:0]
def merge(self, other: "PopulationSpec") -> None:
"""
Merge another population spec into the current one.
The `other` PopulationSpec overwrites existing keys.
"""
for key in attr.fields_dict(type(self)):
if key == "branches":
self.branches = self.branches if self.branches is not None else other.branches
elif key == "dimensions":
self.dimensions += other.dimensions
else:
setattr(self, key, getattr(other, key) or getattr(self, key))