From a1e48b56e6594ad0164ef7446fda9e75b320b2b2 Mon Sep 17 00:00:00 2001 From: taizan-hokuto <55448286+taizan-hokuto@users.noreply.github.com> Date: Fri, 3 Jan 2020 23:45:08 +0900 Subject: [PATCH] Add warning for deprecating replaychat --- pytchat/core_async/replaychat.py | 17 ++++++++++++++++- pytchat/core_multithread/replaychat.py | 19 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/pytchat/core_async/replaychat.py b/pytchat/core_async/replaychat.py index 45f0c6e..adfa811 100644 --- a/pytchat/core_async/replaychat.py +++ b/pytchat/core_async/replaychat.py @@ -6,6 +6,7 @@ import signal import time import traceback import urllib.parse +import warnings from aiohttp.client_exceptions import ClientConnectorError from concurrent.futures import CancelledError from asyncio import Queue @@ -25,7 +26,15 @@ MAX_RETRY = 10 class ReplayChatAsync: - '''asyncio(aiohttp)を利用してYouTubeのチャットデータを取得する。 + ''' + ### ----------------------------------------------------------- + ### [Warning] ReplayChatAsync is integrated into LiveChatAsync. + ### This class is deprecated and will be removed at v0.0.5.0. + ### ReplayChatAsyncはLiveChatAsyncに統合しました。 + ### このクラスはv0.0.5.0で廃止予定です。 + ### ----------------------------------------------------------- + + asyncio(aiohttp)を利用してYouTubeのチャットデータを取得する。 Parameter --------- @@ -77,6 +86,12 @@ class ReplayChatAsync: done_callback = None, exception_handler = None, direct_mode = False): + + warnings.warn("" + f"\n{'-'*60}\n[WARNING] ReplayChatAsync is integrated " + f"into LiveChatAsync.\n{' '*5} This is deprecated and will" + f" be removed at v0.0.5.0.\n{'-'*60}\n" + ) self.video_id = video_id self.seektime = seektime if isinstance(processor, tuple): diff --git a/pytchat/core_multithread/replaychat.py b/pytchat/core_multithread/replaychat.py index 10106ca..2256828 100644 --- a/pytchat/core_multithread/replaychat.py +++ b/pytchat/core_multithread/replaychat.py @@ -6,6 +6,7 @@ import signal import time import traceback import urllib.parse +import warnings from concurrent.futures import CancelledError, ThreadPoolExecutor from queue import Queue from .buffer import Buffer @@ -22,7 +23,15 @@ MAX_RETRY = 10 class ReplayChat: - ''' スレッドプールを利用してYouTubeのライブ配信のチャットデータを取得する + ''' + ### ----------------------------------------------------------- + ### [Warning] ReplayChat is integrated into LiveChat. + ### This class is deprecated and will be removed at v0.0.5.0. + ### ReplayChatはLiveChatに統合しました。 + ### このクラスはv0.0.5.0で廃止予定です。 + ### ----------------------------------------------------------- + + スレッドプールを利用してYouTubeのライブ配信のチャットデータを取得する Parameter --------- @@ -64,8 +73,10 @@ class ReplayChat: ''' _setup_finished = False + #チャット監視中のListenerのリスト _listeners= [] + def __init__(self, video_id, seektime = 0, processor = DefaultProcessor(), @@ -75,6 +86,12 @@ class ReplayChat: done_callback = None, direct_mode = False ): + + warnings.warn("" + f"\n{'-'*60}\n[WARNING] ReplayChat is integrated into LiveChat.\n" + f"{' '*5}This is deprecated and will be removed at v0.0.5.0.\n" + f"{'-'*60}\n" + ) self.video_id = video_id self.seektime = seektime if isinstance(processor, tuple):