def __add__(self, other: Incar) -> "ViseIncar": """ Add all the values of another INCAR object to this object. """ params = {k: v for k, v in self.items()} for k, v in other.items(): if k in self and v != self[k]: raise ValueError("Incars have conflicting values!") else: params[k] = v return ViseIncar(params)
def __add__(self, other: Incar) -> "ViseIncar": """Add all the values of another INCAR object to this object. """ original_settings = {k: v for k, v in self.items()} for key, value in other.items(): if key in self and value != self[key]: raise ValueError("INCARs have conflicting values!") else: original_settings[key] = value return ViseIncar(original_settings)