From 3f462c98df4e83b229a3fd26fed8fef5db765a89 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:20:44 -0400 Subject: [PATCH] breaking change: remove retro-compatibility of indicator __getitem__ --- xclim/core/indicator.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xclim/core/indicator.py b/xclim/core/indicator.py index db0968de2..fd52c7f47 100644 --- a/xclim/core/indicator.py +++ b/xclim/core/indicator.py @@ -218,12 +218,12 @@ def is_parameter_dict(cls, other: dict) -> bool: cls.__dataclass_fields__.keys() # pylint: disable=no-member ) - def __getitem__(self, key) -> str: - """Return an item in retro-compatible fashion.""" - try: - return str(getattr(self, key)) - except AttributeError as err: - raise KeyError(key) from err + # def __getitem__(self, key) -> str: + # """Return an item in retro-compatible fashion.""" + # try: + # return str(getattr(self, key)) + # except AttributeError as err: + # raise KeyError(key) from err def __contains__(self, key) -> bool: """Imitate previous behaviour where "units" and "choices" were missing, instead of being "_empty".""" @@ -455,7 +455,7 @@ def __new__(cls, **kwds): # noqa: C901 # parameters has already been update above. kwds["compute"] = declare_units( **{ - inv_var_map[k]: m["units"] + inv_var_map[k]: m.units for k, m in parameters.items() if "units" in m and k in inv_var_map }