Added deprecation warnings for assigning a dict or dict-like mapping to service.options
@@ -276,6 +276,8 @@ class TomodachiServiceMeta(type):
elif bases and result.options and not isinstance(result.options, Options):
if not isinstance(result.options, dict): # type: ignore
raise ValueError("Invalid value for 'options' attribute")
+ import warnings # isort:skip
+ warnings.warn("Assigning a dict or dict-like mapping to 'service.options' is deprecated. Use the 'tomodachi.Options' class instead.", DeprecationWarning)
result.options = Options(**result.options)
# Removing the CLASS_ATTRIBUTE for classes that were used as bases for inheritance to other classes
@@ -308,6 +310,8 @@ class Service(metaclass=TomodachiServiceMeta):
if item == "options" and not isinstance(value, Options):
if not isinstance(value, dict):
raise ValueError("Invalid value for 'options' attribute")
+ import warnings # isort:skip
+ warnings.warn("Assigning a dict or dict-like mapping to 'service.options' is deprecated. Use the 'tomodachi.Options' class instead.", DeprecationWarning)
value = Options(**value)
super().__setattr__(item, value)
