in src/tools/azure-cli-extension/cleanroom/azext_cleanroom/custom.py [0:0]
def merge_specs(this: Any, that: Any):
for k in that.model_fields.keys():
this_attr = getattr(this, k)
that_attr = getattr(that, k)
if that_attr is None:
continue
if this_attr is None:
setattr(this, k, that_attr)
continue
if this_attr == that_attr:
continue
if isinstance(this_attr, list) and isinstance(that_attr, list):
for i in that_attr:
if i not in this_attr:
this_attr.append(i)
else:
index = ((j for j, x in enumerate(this_attr) if x == i), None)
assert index is not None
else:
this_attr = merge_specs(this_attr, that_attr)
return this