153153 removal_version ,
154154)
155155
156+ clearRestraints_deprecation_msg = build_deprecation_message (
157+ recipeorganizer_base ,
158+ "clearRestraints" ,
159+ "clear_all_restraints" ,
160+ removal_version ,
161+ )
162+
156163
157164class RecipeContainer (Observable , Configurable , Validatable ):
158165 """Base class for organizing pieces of a FitRecipe.
@@ -1243,7 +1250,7 @@ def remove_restraint(self, *ress):
12431250
12441251 Attributes
12451252 ----------
1246- *ress :
1253+ *ress : Restraint
12471254 The Restraints returned from the 'add_restraint' method or added
12481255 with the 'register_restraint' method.
12491256 """
@@ -1272,7 +1279,7 @@ def unrestrain(self, *ress):
12721279 self .remove_restraint (* ress )
12731280 return
12741281
1275- def clearRestraints (self , recurse = False ):
1282+ def clear_all_restraints (self , recurse = False ):
12761283 """Clear all restraints.
12771284
12781285 Attributes
@@ -1284,7 +1291,19 @@ def clearRestraints(self, recurse=False):
12841291 self .remove_restraint (* self ._restraints )
12851292 if recurse :
12861293 for msg in filter (_has_clear_restraints , self ._iter_managed ()):
1287- msg .clearRestraints (recurse )
1294+ msg .clear_all_restraints (recurse )
1295+ return
1296+
1297+ @deprecated (clearRestraints_deprecation_msg )
1298+ def clearRestraints (self , recurse = False ):
1299+ """This function has been deprecated and will be removed in
1300+ version 4.0.0.
1301+
1302+ Please use
1303+ diffpy.srfit.fitbase.recipeorganizer.RecipeOrganizer.clear_all_restraints
1304+ instead.
1305+ """
1306+ self .clear_all_restraints (recurse = recurse )
12881307 return
12891308
12901309 def _get_constraints (self , recurse = True ):
@@ -1528,7 +1547,7 @@ def _has_clear_constraints(msg):
15281547
15291548
15301549def _has_clear_restraints (msg ):
1531- return hasattr (msg , "clearRestraints " )
1550+ return hasattr (msg , "clear_all_restraints " )
15321551
15331552
15341553def _has_get_restraints (msg ):
0 commit comments