5353> # sin is defined in this module as an OperatorBuilder
5454> sin = getBuilder("sin")
5555> beq = A*sin(a*x)
56- > eq = beq.getEquation ()
56+ > eq = beq.get_equation ()
5757
5858The equation builder can also handle scalar constants. Staring with the above
5959setup:
6060> beq2 = A*sin(a*x) + 3
61- > eq2 = beq2.getEquation ()
61+ > eq2 = beq2.get_equation ()
6262Here, we didn't have to wrap '3' in an ArgumentBuilder. Non scalars, constant
6363or otherwise, must be wrapped as ArgumentBuilders in order to be used in this
6464way.
8686import diffpy .srfit .equation .literals as literals
8787from diffpy .srfit .equation .equationmod import Equation
8888from diffpy .srfit .equation .literals .literal import Literal
89+ from diffpy .utils ._deprecator import build_deprecation_message , deprecated
8990
9091__all__ = [
9192 "EquationFactory" ,
@@ -172,7 +173,7 @@ def makeEquation(
172173 lit = literals .Argument (value = beq , const = True )
173174 eq = Equation (name = "" , root = lit )
174175 else :
175- eq = beq .getEquation ()
176+ eq = beq .get_equation ()
176177 self .equations .add (eq )
177178 return eq
178179
@@ -404,6 +405,16 @@ def _get_undefined_args(self, eqstr):
404405
405406# End class EquationFactory
406407
408+ base_basebuilder = "diffpy.srfit.equation.builder.BaseBuilder"
409+ removal_version = "4.0.0"
410+
411+ getequation_dep_msg = build_deprecation_message (
412+ base_basebuilder ,
413+ "getEquation" ,
414+ "get_equation" ,
415+ removal_version ,
416+ )
417+
407418
408419class BaseBuilder (object ):
409420 """Class for building equations.
@@ -430,7 +441,7 @@ def __call__(self, *args):
430441 )
431442 raise TypeError (m )
432443
433- def getEquation (self ):
444+ def get_equation (self ):
434445 """Get the equation built by this object.
435446
436447 The equation will given the name "_eq_<root>" where "<root>" is
@@ -441,6 +452,16 @@ def getEquation(self):
441452 eq = Equation (name , self .literal )
442453 return eq
443454
455+ @deprecated (getequation_dep_msg )
456+ def getEquation (self ):
457+ """This function has been deprecated and will be removed in version
458+ 4.0.0.
459+
460+ Please use diffpy.srfit.equation.builder.BaseBuilder.get_equation
461+ instead.
462+ """
463+ return self .get_equation ()
464+
444465 def __eval_binary (self , other , OperatorClass , onleft = True ):
445466 """Evaluate a binary function.
446467
0 commit comments