From 1de20b2dafad3b400ebe9d69f4cc8ee54044348a Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 11 May 2024 18:00:33 +0200 Subject: Mark get_variable_indices_from_variable as deprecated --- polymatrix/expression/utils/getvariableindices.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/polymatrix/expression/utils/getvariableindices.py b/polymatrix/expression/utils/getvariableindices.py index aebdeb0..d87f82e 100644 --- a/polymatrix/expression/utils/getvariableindices.py +++ b/polymatrix/expression/utils/getvariableindices.py @@ -3,15 +3,17 @@ import typing from polymatrix.expressionstate.abc import ExpressionState from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin +from polymatrix.utils.deprecation import deprecated # NP: very confusing name without explaination / context # NP: why is this not a feature of expressionstate? -# FIXME: typing, especially return type +@deprecated("Replaced by helper methods in ExpressionState") def get_variable_indices_from_variable( state: ExpressionState, variable: ExpressionBaseMixin | int | typing.Any, ) -> tuple[int, ...] | None: + if isinstance(variable, ExpressionBaseMixin): state, variable_polynomial = variable.apply(state) @@ -50,7 +52,7 @@ def get_variable_indices_from_variable( return state, variable_indices -# not used, remove? +@deprecated("Replaced by helper methods in ExpressionState") def get_variable_indices(state, variables): if not isinstance(variables, tuple): variables = (variables,) -- cgit v1.2.1