浏览代码

Make CoreEventConsumerBase deprecated (#2650)

* Make CoreEventConsumerBase deprecated

* Add import for compatibility

* Update taipy/core/notification/core_event_consumer.py

Co-authored-by: Đỗ Trường Giang <do.giang@avaiga.com>

* Update taipy/core/notification/core_event_consumer.py

Co-authored-by: Đỗ Trường Giang <do.giang@avaiga.com>

---------

Co-authored-by: Đỗ Trường Giang <do.giang@avaiga.com>
Jean-Robin 6 天之前
父节点
当前提交
21807a0626
共有 2 个文件被更改,包括 31 次插入0 次删除
  1. 1 0
      taipy/core/notification/__init__.py
  2. 30 0
      taipy/core/notification/core_event_consumer.py

+ 1 - 0
taipy/core/notification/__init__.py

@@ -25,6 +25,7 @@ object) must be instantiated with an associated event queue.
 
 from ._registration import _Registration
 from ._topic import _Topic
+from .core_event_consumer import CoreEventConsumerBase
 from .event import _ENTITY_TO_EVENT_ENTITY_TYPE, Event, EventEntityType, EventOperation, _make_event
 from .notifier import Notifier, _publish_event
 from .registration_id import RegistrationId

+ 30 - 0
taipy/core/notification/core_event_consumer.py

@@ -0,0 +1,30 @@
+# Copyright 2021-2025 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations under the License.
+from queue import SimpleQueue
+
+from ...common.logger._taipy_logger import _TaipyLogger
+from ..common._warnings import _warn_deprecated
+from ._core_event_consumer import _CoreEventConsumerBase
+
+
+class CoreEventConsumerBase(_CoreEventConsumerBase):
+    """NOT DOCUMENTED"""
+
+    __logger = _TaipyLogger._get_logger()
+
+    def __init__(self, registration_id: str, queue: SimpleQueue) -> None:
+        _warn_deprecated(deprecated="CoreEventConsumerBase",
+                         suggest="The 'taipy.event.event_consumer.GuiEventConsumer' class")
+        self.__logger.warning(
+            "The `CoreEventConsumerBase` class is deprecated since taipy 4.1.0. "
+            "Please use the `GuiEventConsumer` class instead."
+        )
+        super().__init__(registration_id, queue)