From 9bf84d91b7f42a20ee707efeefb94d692f78c155 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:15:57 +0000 Subject: [PATCH] :arrow_up: auto update by pre-commit hooks (#38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :arrow_up: auto update by pre-commit hooks updates: - [github.com/psf/black: 24.1.1 → 24.4.2](https://github.com/psf/black/compare/24.1.1...24.4.2) * :rotating_light: auto fix by pre-commit hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- nonebot_plugin_all4one/middlewares/base.py | 4 +--- nonebot_plugin_all4one/middlewares/qqguild.py | 6 +++--- nonebot_plugin_all4one/middlewares/telegram.py | 4 +--- nonebot_plugin_all4one/onebotimpl/__init__.py | 11 ++--------- nonebot_plugin_all4one/onebotimpl/utils.py | 2 +- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c0c92e0..9f8e2d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: stages: [commit] - repo: https://github.com/psf/black - rev: 24.1.1 + rev: 24.4.2 hooks: - id: black stages: [commit] diff --git a/nonebot_plugin_all4one/middlewares/base.py b/nonebot_plugin_all4one/middlewares/base.py index 54761da..d0ec626 100644 --- a/nonebot_plugin_all4one/middlewares/base.py +++ b/nonebot_plugin_all4one/middlewares/base.py @@ -131,9 +131,7 @@ async def get_self_info( """获取机器人自身信息""" raise NotImplementedError - async def get_user_info( - self, *, user_id: str, **kwargs: Any - ) -> dict[ + async def get_user_info(self, *, user_id: str, **kwargs: Any) -> dict[ Union[Literal["user_id", "user_name", "user_displayname", "user_remark"], str], str, ]: diff --git a/nonebot_plugin_all4one/middlewares/qqguild.py b/nonebot_plugin_all4one/middlewares/qqguild.py index 797abd2..3b132e5 100644 --- a/nonebot_plugin_all4one/middlewares/qqguild.py +++ b/nonebot_plugin_all4one/middlewares/qqguild.py @@ -392,9 +392,9 @@ async def get_guild_member_list( "user_id": str(member.user.id) if member.user.id else "", "user_name": member.user.username or "", "user_displayname": member.nick or "", - "qqguild.user": member.user.model_dump() - if member.user - else None, + "qqguild.user": ( + member.user.model_dump() if member.user else None + ), "qqguild.roles": member.roles, "qqguild.joined_at": ( member.joined_at.timestamp() if member.joined_at else None diff --git a/nonebot_plugin_all4one/middlewares/telegram.py b/nonebot_plugin_all4one/middlewares/telegram.py index ea7c9fb..18b0d71 100644 --- a/nonebot_plugin_all4one/middlewares/telegram.py +++ b/nonebot_plugin_all4one/middlewares/telegram.py @@ -221,9 +221,7 @@ async def get_self_info( } @supported_action - async def get_user_info( - self, *, user_id: str, **kwargs: Any - ) -> dict[ + async def get_user_info(self, *, user_id: str, **kwargs: Any) -> dict[ Union[Literal["user_id", "user_name", "user_displayname", "user_remark"], str], str, ]: diff --git a/nonebot_plugin_all4one/onebotimpl/__init__.py b/nonebot_plugin_all4one/onebotimpl/__init__.py index 12025c5..ae4ed6e 100644 --- a/nonebot_plugin_all4one/onebotimpl/__init__.py +++ b/nonebot_plugin_all4one/onebotimpl/__init__.py @@ -3,16 +3,9 @@ import asyncio from datetime import datetime from functools import partial -from contextlib import asynccontextmanager -from typing import ( - Any, - Union, - Literal, - TypeVar, - Optional, - cast, -) from collections.abc import AsyncGenerator +from contextlib import asynccontextmanager +from typing import Any, Union, Literal, TypeVar, Optional, cast import msgpack from nonebot.log import logger diff --git a/nonebot_plugin_all4one/onebotimpl/utils.py b/nonebot_plugin_all4one/onebotimpl/utils.py index 6610ec3..89e36c5 100644 --- a/nonebot_plugin_all4one/onebotimpl/utils.py +++ b/nonebot_plugin_all4one/onebotimpl/utils.py @@ -1,8 +1,8 @@ import json import datetime +from typing import Union from base64 import b64encode from functools import partial -from typing import Union import msgpack from pydantic.json import custom_pydantic_encoder