get_tag is behaving differently from get or getattr in python. Usually they return default value provided if key is missing. In skbase, it fails even when default value is provided, unless one specifically pass an additional argument to control error behaviour.
This is not really a bug, but a behaviour that is probably not very intuitive to python users.
>>>
>>> from skbase.base import BaseObject
>>>
>>> BaseObject().get_tag("abcd")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/anirban/conda-environments/sktime/lib/python3.10/site-packages/skbase/base/_base.py", line 578, in get_tag
return self._get_flag(
File "/home/anirban/conda-environments/sktime/lib/python3.10/site-packages/skbase/base/_tagmanager.py", line 147, in _get_flag
raise ValueError(f"Tag with name {flag_name} could not be found.")
ValueError: Tag with name abcd could not be found.
>>>
>>> BaseObject().get_tag("abcd", tag_value_default="pqrs")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/anirban/conda-environments/sktime/lib/python3.10/site-packages/skbase/base/_base.py", line 578, in get_tag
return self._get_flag(
File "/home/anirban/conda-environments/sktime/lib/python3.10/site-packages/skbase/base/_tagmanager.py", line 147, in _get_flag
raise ValueError(f"Tag with name {flag_name} could not be found.")
ValueError: Tag with name abcd could not be found.
>>>
>>> ARIMA().get_tag("abcd", tag_value_default="pqrs", raise_error=False)
'pqrs'
>>>
get_tagis behaving differently fromgetorgetattrin python. Usually they return default value provided if key is missing. Inskbase, it fails even when default value is provided, unless one specifically pass an additional argument to control error behaviour.This is not really a bug, but a behaviour that is probably not very intuitive to python users.