bind_default_kwarg_mixin_safe

halotools.empirical_models.bind_default_kwarg_mixin_safe(obj, keyword_argument, constructor_kwargs, default_value)[source] [edit on github]

Function used to ensure that a keyword argument passed to the constructor of an orthogonal mix-in class is not already an attribute bound to self. If it is safe to bind the keyword_argument to the object, bind_default_kwarg_mixin_safe will do so.

Parameters:

obj : class instance

Instance of the class to which we want to bind the input keyword_argument.

keyword_argument : string

name of the attribute that will be bound to the object if the action is deemed mix-in safe.

constructor_kwargs : dict

keyword argument dictionary passed to the constructor of the input obj.

default_value : object

Whatever the default value for the attribute should be if keyword_argument does not appear in kwargs nor is it already bound to the obj.