File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1223,6 +1223,24 @@ def minimisation_constraints(self):
12231223 @minimisation_constraints .setter
12241224 def minimisation_constraints (self , minimisation_constraints ):
12251225 if minimisation_constraints is not None :
1226+ if isinstance (minimisation_constraints , str ):
1227+ # Strip whitespace and convert to lower case.
1228+ minimisation_constraints = minimisation_constraints .lower ().replace (
1229+ " " , ""
1230+ )
1231+ # Handle special case of "none"
1232+ if minimisation_constraints == "none" :
1233+ self ._minimisation_constraints = None
1234+ return
1235+ # Convert to bool.
1236+ elif minimisation_constraints == "true" :
1237+ minimisation_constraints = True
1238+ elif minimisation_constraints == "false" :
1239+ minimisation_constraints = False
1240+ else :
1241+ raise ValueError (
1242+ "'minimisation_constraints' string must be 'true', 'false', or 'none'"
1243+ )
12261244 if not isinstance (minimisation_constraints , bool ):
12271245 raise ValueError ("'minimisation_constraints' must be of type 'bool'" )
12281246 self ._minimisation_constraints = minimisation_constraints
You can’t perform that action at this time.
0 commit comments