From f0a362e64848db55cb98b509025b7afd8969b067 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 05:15:02 +0800 Subject: [PATCH 1/2] refactor: remove unnecessary parentheses after keyword (#39) Extra parentheses in code can be removed for improved readability. In the examples below, the first example is more readable than the second one. Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- src/plugins/nonebot_plugin_githubcard/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/nonebot_plugin_githubcard/__init__.py b/src/plugins/nonebot_plugin_githubcard/__init__.py index 0c70848..877db33 100644 --- a/src/plugins/nonebot_plugin_githubcard/__init__.py +++ b/src/plugins/nonebot_plugin_githubcard/__init__.py @@ -28,6 +28,6 @@ def match_link_parts(link): async def github_handle(bot: Bot, event: GroupMessageEvent, state: T_State): url = match_link_parts(event.get_plaintext()) imageUrl = await get_github_reposity_information(url) - if (imageUrl == "获取信息失败"): + if imageUrl == "获取信息失败": raise AssertionError await github.send(MessageSegment.image(imageUrl)) From 3ecad595d2250467191125ee085631f1aac00f08 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 05:17:15 +0800 Subject: [PATCH 2/2] refactor: put docstring into a single line (#40) If a docstring fits in a single line (72 characters according to PEP8), it is recommended to have the quotes on the same line. Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- src/plugins/ncm/data_source.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/ncm/data_source.py b/src/plugins/ncm/data_source.py index 99dc65a..043b1e9 100644 --- a/src/plugins/ncm/data_source.py +++ b/src/plugins/ncm/data_source.py @@ -297,8 +297,7 @@ async def upload(self, data: dict, fr: str, event: Union[GroupMessageEvent, Priv await self.upload_data_file(event=event, data=cf) async def start_upload(self, ids: List[int], event: Union[GroupMessageEvent, PrivateMessageEvent]): - """一般地 320k及以上即 flac, 320k及以下即 mp3,96k及以下即 m4a - """ + """一般地 320k及以上即 flac, 320k及以下即 mp3,96k及以下即 m4a""" data: list = self.get_detail(ids) for i in range(len(ids)): await self.upload(data[i], "song" if len(ids) == 1 else "list", event)