@@ -221,25 +221,25 @@ def update_model_from_suffix(suffix_obj: pyo.Suffix, values):
221221
222222 Notes
223223 -----
224- Measurement error is a special case: instead of updating the value of the
224+ The measurement_error suffix is a special case: instead of updating the value of the
225225 keys (variables/parameters), it updates the value stored in the suffix itself.
226226 """
227227 # Check that the length of values matches the suffix length
228- items = list (suffix_obj .items ())
229- if len (items ) != len (values ):
228+ comps = list (suffix_obj .keys ())
229+ if len (comps ) != len (values ):
230230 raise ValueError ("values length does not match suffix length" )
231231
232232 # Add a check for measurement error suffix
233233 is_me_err = "measurement_error" in suffix_obj .name
234- # Iterate through the items in the suffix and update their values
234+ # Iterate through the keys in the suffix and update their values
235235 # First loop: check all values are the right type
236- for comp , _ in items :
236+ for comp in comps :
237237 if not isinstance (comp , (VarData , ParamData )):
238238 raise TypeError (
239239 f"Unsupported component type { type (comp )} ; expected VarData or ParamData."
240240 )
241241 # Second loop: adjust the values
242- for ( comp , _ ), new_val in zip (items , values ):
242+ for comp , new_val in zip (comps , values ):
243243 if is_me_err :
244244 suffix_obj [comp ] = float (new_val )
245245 else :
0 commit comments