-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Add deprecation warnings to these getters
Lines 399 to 408 in 6f3f20a
| # Set up shortcuts so old code will work | |
| # TODO: add to HSSMBase | |
| self.response = self.model_config.response[:] | |
| self.list_params = self.model_config.list_params | |
| self.choices = self.model_config.choices | |
| self.model_name = self.model_config.model_name | |
| self.loglik = self.model_config.loglik | |
| self.loglik_kind = self.model_config.loglik_kind | |
| self.extra_fields = self.model_config.extra_fields | |
and instead access these from the config objects.
Examples:
def _deprecation_warn(self, name: str) -> None:
"""Emit a DeprecationWarning advising to use the typed config.
Parameters
----------
name
Attribute name being deprecated.
"""
warnings.warn(
f"`{name}` is deprecated; use `self.model_config.{name}` instead.",
DeprecationWarning,
stacklevel=2,
)
@property
def response(self):
"""Deprecated proxy for `self.model_config.response`.
Returns the list of observed response column names or None.
"""
self._deprecation_warn("response")
return (
list(self.model_config.response)
if self.model_config.response is not None
else None
)
@response.setter
def response(self, value):
"""Set the model_config.response value (deprecated).
Converts the assigned value to a list or None before assignment.
"""
self._deprecation_warn("response")
self.model_config.response = list(value) if value is not None else None
@property
def list_params(self):
"""Deprecated proxy for `self.model_config.list_params`.
Returns the parameter name list used by the likelihood.
"""
self._deprecation_warn("list_params")
return self.model_config.list_params
@list_params.setter
def list_params(self, value):
"""Set the model_config.list_params value (deprecated)."""
self._deprecation_warn("list_params")
self.model_config.list_params = valueReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels