Skip to content

Commit

Permalink
🎨 refactor: put docstring into a single line (#20)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
deepsource-autofix[bot] authored Jan 9, 2024
1 parent ceeace6 commit b58c865
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 26 deletions.
4 changes: 1 addition & 3 deletions src/plugins/nonebot_plugin_charpic/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ async def text2img(text: str):


async def char_gif(gif: Image.Image):
"""
合成 gif 字符画
"""
"""合成 gif 字符画"""
frame_list: List[str] = []
with contextlib.suppress(EOFError):
while True:
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/nonebot_plugin_wordcloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" 词云
"""
"""词云"""
from .utils import (
admin_permission,
ensure_group,
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/today_yunshi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
这是一个今日运势插件,可以查看今日运势。
"""
"""这是一个今日运势插件,可以查看今日运势。"""

import time
import random
Expand Down
8 changes: 2 additions & 6 deletions src/plugins/waifu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ async def reset_record():


async def waifu_rule(bot: Bot, event: GroupMessageEvent, state: T_State) -> bool:
"""
规则:娶群友
"""
"""规则:娶群友"""
msg = event.message.extract_plain_text()
if not msg.startswith("娶群友"):
return False
Expand Down Expand Up @@ -389,9 +387,7 @@ async def _(bot: Bot, event: GroupMessageEvent):

# 透群友
async def yinpa_rule(bot: Bot, event: GroupMessageEvent, state: T_State) -> bool:
"""
规则:透群友
"""
"""规则:透群友"""
msg = event.message.extract_plain_text()
if not msg.startswith("透群友"):
return False
Expand Down
16 changes: 4 additions & 12 deletions src/plugins/waifu/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ async def download_user_img(user_id: int):


async def user_img(user_id: int) -> bytes:
"""
获取用户头像url
"""
"""获取用户头像url"""
url = f"https://q1.qlogo.cn/g?b=qq&nk={user_id}&s=640"
data = await download_url(url)
if hashlib.md5(data).hexdigest() == "acef72340ac0e914090bd35799f5594e":
Expand All @@ -45,9 +43,7 @@ async def user_img(user_id: int) -> bytes:


def text_to_png(msg):
"""
文字转png
"""
"""文字转png"""
output = io.BytesIO()
Text2Image.from_text(msg, 50, spacing=10).to_image("white", (20, 20)).save(
output, format="png"
Expand All @@ -56,9 +52,7 @@ def text_to_png(msg):


def bbcode_to_png(msg, spacing: int = 10):
"""
bbcode文字转png
"""
"""bbcode文字转png"""
output = io.BytesIO()
Text2Image.from_bbcode_text(msg, 50, spacing=spacing).to_image(
"white", (20, 20)
Expand All @@ -67,7 +61,5 @@ def bbcode_to_png(msg, spacing: int = 10):


def get_message_at(message: Message) -> list:
"""
获取at列表
"""
"""获取at列表"""
return [int(msg.data["qq"]) for msg in message if msg.type == "at"]

0 comments on commit b58c865

Please sign in to comment.