From f8c59c6a307b882e6e6f4a64c034356563857310 Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:40:37 +0100 Subject: [PATCH] Rename `display_arguments_help` to `supports_help` --- packages/jupyter-ai/jupyter_ai/chat_handlers/base.py | 6 +++--- packages/jupyter-ai/jupyter_ai/chat_handlers/default.py | 2 +- packages/jupyter-ai/jupyter_ai/chat_handlers/help.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py index 637d6402a..d3c4e497d 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/base.py @@ -97,7 +97,7 @@ class BaseChatHandler: specified by the config. Subclasses should define this. Should be set to `False` for handlers like `/help`.""" - display_arguments_help: ClassVar[bool] = True + supports_help: ClassVar[bool] = True """Class attribute specifying whether this chat handler should parse the arguments and display help when user queries with `-h` or `--help`""" @@ -126,7 +126,7 @@ def __init__( add_help=False, description=self.help, formatter_class=MarkdownHelpFormatter ) # the default help would exit; instead implement a custom help - if self.__class__.display_arguments_help: + if self.__class__.supports_help: self.parser.add_argument( "-h", "--help", action="store_true", help="Show this help message" ) @@ -171,7 +171,7 @@ async def on_message(self, message: HumanChatMessage): BaseChatHandler._requests_count += 1 - if self.__class__.display_arguments_help: + if self.__class__.supports_help: args = self.parse_args(message, silent=True) if args and args.help: self.reply(self.parser.format_help(), message) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py index 8c576fda7..e0d923e77 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/default.py @@ -22,7 +22,7 @@ class DefaultChatHandler(BaseChatHandler): routing_type = SlashCommandRoutingType(slash_id=None) uses_llm = True - display_arguments_help = False + supports_help = False def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py index c74f1cddd..0e82be13d 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/help.py @@ -54,7 +54,7 @@ class HelpChatHandler(BaseChatHandler): name = "Help" help = "Display this help message" routing_type = SlashCommandRoutingType(slash_id="help") - display_arguments_help = False + supports_help = False uses_llm = False