From df3d67a4ed628d7c258a0d3633011c7fccb90ca6 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 2 Mar 2025 12:57:24 +0900 Subject: [PATCH] Replace deprecated abc.abstractproperty It was deprecated in Python 3.3 [1]. [1] https://docs.python.org/3.13/whatsnew/3.3.html#abc Change-Id: Ibd98cb93f697a6da6a6bc5a5030640a262c7a66b --- watcher/applier/actions/base.py | 3 ++- watcher/common/service_manager.py | 21 ++++++++++++------- .../goal/efficacy/indicators.py | 3 ++- .../decision_engine/model/collector/base.py | 3 ++- .../model/notification/base.py | 3 ++- watcher/decision_engine/solution/base.py | 3 ++- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/watcher/applier/actions/base.py b/watcher/applier/actions/base.py index 114f3a2e4..738f124e8 100644 --- a/watcher/applier/actions/base.py +++ b/watcher/applier/actions/base.py @@ -118,7 +118,8 @@ class BaseAction(loadable.Loadable, metaclass=abc.ABCMeta): """ raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def schema(self): """Defines a Schema that the input parameters shall comply to diff --git a/watcher/common/service_manager.py b/watcher/common/service_manager.py index db126d8e0..f3d770080 100644 --- a/watcher/common/service_manager.py +++ b/watcher/common/service_manager.py @@ -19,30 +19,37 @@ import abc class ServiceManager(object, metaclass=abc.ABCMeta): - @abc.abstractproperty + @property + @abc.abstractmethod def service_name(self): raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def api_version(self): raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def publisher_id(self): raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def conductor_topic(self): raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def notification_topics(self): raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def conductor_endpoints(self): raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def notification_endpoints(self): raise NotImplementedError() diff --git a/watcher/decision_engine/goal/efficacy/indicators.py b/watcher/decision_engine/goal/efficacy/indicators.py index 3f6631dae..7d44bb98a 100644 --- a/watcher/decision_engine/goal/efficacy/indicators.py +++ b/watcher/decision_engine/goal/efficacy/indicators.py @@ -36,7 +36,8 @@ class IndicatorSpecification(object, metaclass=abc.ABCMeta): self.unit = unit self.required = required - @abc.abstractproperty + @property + @abc.abstractmethod def schema(self): """JsonSchema used to validate the indicator value diff --git a/watcher/decision_engine/model/collector/base.py b/watcher/decision_engine/model/collector/base.py index 758aa1ccd..5c20a8de0 100644 --- a/watcher/decision_engine/model/collector/base.py +++ b/watcher/decision_engine/model/collector/base.py @@ -147,7 +147,8 @@ class BaseClusterDataModelCollector(loadable.LoadableSingleton, self._cluster_data_model = model self.lock.release() - @abc.abstractproperty + @property + @abc.abstractmethod def notification_endpoints(self): """Associated notification endpoints diff --git a/watcher/decision_engine/model/notification/base.py b/watcher/decision_engine/model/notification/base.py index 26a01ac87..e7fc29e25 100644 --- a/watcher/decision_engine/model/notification/base.py +++ b/watcher/decision_engine/model/notification/base.py @@ -26,7 +26,8 @@ class NotificationEndpoint(object, metaclass=abc.ABCMeta): self.collector = collector self._notifier = None - @abc.abstractproperty + @property + @abc.abstractmethod def filter_rule(self): """Notification Filter""" raise NotImplementedError() diff --git a/watcher/decision_engine/solution/base.py b/watcher/decision_engine/solution/base.py index f150b0076..af07f6a5b 100644 --- a/watcher/decision_engine/solution/base.py +++ b/watcher/decision_engine/solution/base.py @@ -114,6 +114,7 @@ class BaseSolution(object, metaclass=abc.ABCMeta): """ raise NotImplementedError() - @abc.abstractproperty + @property + @abc.abstractmethod def actions(self): raise NotImplementedError()