From 0bc0e91688b6ca068d5c38395bf4a6769e9b282d Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:50:31 +0700 Subject: [PATCH] refactor: merge `isinstance` calls (#302) You can pass a tuple of types you want to check as the second argument to `isinstance`. If the object matches with any of the types, it will return `True` else `False`. Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- misskaty/helper/localization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misskaty/helper/localization.py b/misskaty/helper/localization.py index 3891755f..7e09898e 100644 --- a/misskaty/helper/localization.py +++ b/misskaty/helper/localization.py @@ -54,7 +54,7 @@ def get_locale_string( async def get_lang(message) -> str: if isinstance(message, CallbackQuery): chat = message.message.chat - elif isinstance(message, Message) or isinstance(message, ChatMemberUpdated): + elif isinstance(message, (Message, ChatMemberUpdated)): chat = message.chat elif isinstance(message, InlineQuery): chat, chat.type = message.from_user, ChatType.PRIVATE