From 856142a21e316371b944e9983541596c4903331e Mon Sep 17 00:00:00 2001
From: rf_tar_railt <3165388245@qq.com>
Date: Fri, 26 Apr 2024 15:22:29 +0800
Subject: [PATCH] :art: fix version 0.11.1
---
nonebot/adapters/satori/bot.py | 4 ++--
nonebot/adapters/satori/compat.py | 16 +++++++---------
nonebot/adapters/satori/event.py | 2 +-
nonebot/adapters/satori/models.py | 2 +-
tests/test_message.py | 4 +++-
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/nonebot/adapters/satori/bot.py b/nonebot/adapters/satori/bot.py
index 2285055..4d944e7 100644
--- a/nonebot/adapters/satori/bot.py
+++ b/nonebot/adapters/satori/bot.py
@@ -5,7 +5,7 @@
from nonebot.message import handle_event
from nonebot.drivers import Request, Response
-from nonebot.compat import type_validate_python, model_dump
+from nonebot.compat import model_dump, type_validate_python
from nonebot.adapters import Bot as BaseBot
@@ -15,7 +15,7 @@
from .event import Event, MessageEvent
from .models import InnerMessage as SatoriMessage
from .message import Author, Message, RenderMessage, MessageSegment
-from .models import Role, User, Guild, Login, Channel, PageResult, Member
+from .models import Role, User, Guild, Login, Member, Channel, PageResult
from .exception import (
ActionFailed,
NetworkError,
diff --git a/nonebot/adapters/satori/compat.py b/nonebot/adapters/satori/compat.py
index 5d7c4e2..9809436 100644
--- a/nonebot/adapters/satori/compat.py
+++ b/nonebot/adapters/satori/compat.py
@@ -6,33 +6,31 @@
if PYDANTIC_V2:
- from pydantic import model_validator as model_validator
from pydantic import field_validator as field_validator
+ from pydantic import model_validator as model_validator
else:
- from pydantic import root_validator, validator
+ from pydantic import validator, root_validator
@overload
def field_validator(
__field: str,
*fields: str,
- mode: Literal['before'],
+ mode: Literal["before"],
check_fields: Optional[bool] = None,
- ):
- ...
+ ): ...
@overload
def field_validator(
__field: str,
*fields: str,
- mode: Literal['after'],
+ mode: Literal["after"],
check_fields: Optional[bool] = None,
- ):
- ...
+ ): ...
def field_validator(
__field: str,
*fields: str,
- mode: Literal['before', 'after'],
+ mode: Literal["before", "after"],
check_fields: Optional[bool] = None,
):
if mode == "before":
diff --git a/nonebot/adapters/satori/event.py b/nonebot/adapters/satori/event.py
index ff294c7..8f2d41b 100644
--- a/nonebot/adapters/satori/event.py
+++ b/nonebot/adapters/satori/event.py
@@ -15,7 +15,7 @@
from .message import Message, RenderMessage
from .models import InnerMessage as SatoriMessage
from .models import ArgvInteraction, ButtonInteraction
-from .models import Guild, Login, Channel, ChannelType, Member
+from .models import Guild, Login, Member, Channel, ChannelType
E = TypeVar("E", bound="Event")
diff --git a/nonebot/adapters/satori/models.py b/nonebot/adapters/satori/models.py
index 57436a8..5c55b9a 100644
--- a/nonebot/adapters/satori/models.py
+++ b/nonebot/adapters/satori/models.py
@@ -6,7 +6,7 @@
from nonebot.compat import PYDANTIC_V2, ConfigDict
from .utils import log
-from .compat import model_validator, field_validator
+from .compat import field_validator, model_validator
class ChannelType(IntEnum):
diff --git a/tests/test_message.py b/tests/test_message.py
index e10105c..dcfc779 100644
--- a/tests/test_message.py
+++ b/tests/test_message.py
@@ -54,6 +54,8 @@ def test_message_fallback():
"""
msg = Message.from_satori_element(parse(code))
- assert str(msg[0].children) == '当前平台不支持发送视频,请在这里观看视频!'
+ assert (
+ str(msg[0].children) == '当前平台不支持发送视频,请在这里观看视频!'
+ )
assert msg.extract_plain_text() == "当前平台不支持发送视频,请在这里观看视频!"
assert list(msg.query("link"))[0].data["text"] == "http://aa.com/a.mp4"