From 7d8f4cad2eb2e0624d78b2de91bb8cab86677367 Mon Sep 17 00:00:00 2001 From: uy_sun Date: Mon, 19 Feb 2024 10:16:33 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E9=80=82=E9=85=8D=20Pydantic=20V2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_saa/adapters/dodo.py | 3 +- nonebot_plugin_saa/adapters/onebot_v12.py | 5 +- nonebot_plugin_saa/auto_select_bot.py | 3 +- nonebot_plugin_saa/config.py | 4 +- nonebot_plugin_saa/registries/meta.py | 34 ++- .../registries/platform_send_target.py | 14 +- poetry.lock | 258 ++++++++++++------ pyproject.toml | 17 +- tests/test_aggreated_send.py | 8 +- tests/test_dodo.py | 7 +- tests/test_feishu.py | 6 +- tests/test_onebot_v12.py | 18 +- tests/test_platform_target.py | 14 +- tests/test_qq.py | 35 ++- tests/test_red.py | 7 +- tests/test_send.py | 2 +- 16 files changed, 279 insertions(+), 156 deletions(-) diff --git a/nonebot_plugin_saa/adapters/dodo.py b/nonebot_plugin_saa/adapters/dodo.py index 7fdb0ea8..446b0f3b 100644 --- a/nonebot_plugin_saa/adapters/dodo.py +++ b/nonebot_plugin_saa/adapters/dodo.py @@ -5,6 +5,7 @@ from nonebot import logger from nonebot.adapters import Event from nonebot.drivers import Request +from nonebot.compat import model_dump from nonebot.adapters import Bot as BaseBot from ..types import Text, Image, Reply, Mention @@ -86,7 +87,7 @@ async def _image(image: Image, bot: BaseBot) -> MessageSegment: file=file, file_name=image.data["name"] + ".png" # 上传是文件名必须携带有效后缀 ) logger.debug(f"Uploaded result: {upload_result}") - return MessageSegment.picture(**upload_result.dict()) + return MessageSegment.picture(**model_dump(upload_result)) @register_dodo(Reply) def _reply(reply: Reply) -> MessageSegment: diff --git a/nonebot_plugin_saa/adapters/onebot_v12.py b/nonebot_plugin_saa/adapters/onebot_v12.py index 0189bcc9..d51fc681 100644 --- a/nonebot_plugin_saa/adapters/onebot_v12.py +++ b/nonebot_plugin_saa/adapters/onebot_v12.py @@ -4,6 +4,7 @@ from typing import List, Literal from nonebot.adapters import Event +from nonebot.compat import model_dump from nonebot.adapters import Bot as BaseBot from ..types import Text, Image, Reply, Mention @@ -105,7 +106,7 @@ def _extract_private_msg_event(event: Event) -> PlatformTarget: if event.self.platform == "qq": return TargetQQPrivate(user_id=int(event.user_id)) if event.self.platform == "qqguild": - event_dict = event.dict() + event_dict = model_dump(event) return TargetQQGuildDirect( recipient_id=int(event.user_id), source_guild_id=event_dict["qqguild"]["src_guild_id"], @@ -240,7 +241,7 @@ async def _qqguild_dms(target: TargetQQGuildDirect, bot: BaseBot) -> int: @register_convert_to_arg(adapter, SupportedPlatform.unknown_ob12) def _to_unknow(target: PlatformTarget): assert isinstance(target, TargetOB12Unknow) - return target.dict(exclude={"platform", "platform_type"}) + return model_dump(target, exclude={"platform", "platform_type"}) class OB12Receipt(Receipt): message_id: str diff --git a/nonebot_plugin_saa/auto_select_bot.py b/nonebot_plugin_saa/auto_select_bot.py index ba5bd12d..fd6c124a 100644 --- a/nonebot_plugin_saa/auto_select_bot.py +++ b/nonebot_plugin_saa/auto_select_bot.py @@ -7,6 +7,7 @@ import nonebot from nonebot.adapters import Bot from nonebot import logger, get_bots +from nonebot.compat import model_dump from .registries import BotSpecifier, PlatformTarget, TargetQQGuildDirect from .utils import ( @@ -133,5 +134,5 @@ def get_bot(target: PlatformTarget) -> Bot: def _info_current(): log_info = {} for bot, platform_target_set in BOT_CACHE.items(): - log_info[str(bot)] = [target.dict() for target in platform_target_set] + log_info[str(bot)] = [model_dump(target) for target in platform_target_set] logger.trace(f"current bot-platform_target: {json.dumps(log_info)}") diff --git a/nonebot_plugin_saa/config.py b/nonebot_plugin_saa/config.py index 0bd04d46..a82e3cd3 100644 --- a/nonebot_plugin_saa/config.py +++ b/nonebot_plugin_saa/config.py @@ -1,4 +1,4 @@ -from nonebot import get_driver +from nonebot import get_plugin_config from pydantic import Field, BaseModel @@ -17,4 +17,4 @@ class Config(BaseModel): """峯驰物流插件配置""" -plugin_config = Config.parse_obj(get_driver().config).saa +plugin_config = get_plugin_config(Config).saa diff --git a/nonebot_plugin_saa/registries/meta.py b/nonebot_plugin_saa/registries/meta.py index 3f714b2f..e0691a24 100644 --- a/nonebot_plugin_saa/registries/meta.py +++ b/nonebot_plugin_saa/registries/meta.py @@ -5,6 +5,7 @@ from typing import Any, Dict, ClassVar from pydantic import BaseModel +from nonebot.compat import PYDANTIC_V2, ConfigDict, type_validate_python class Level(Enum): @@ -18,24 +19,41 @@ class SerializationMeta(BaseModel, ABC): _deserializer_dict: ClassVar[Dict] _level: ClassVar[Level] = Level.MetaBase - class Config: - frozen = True - orm_mode = True + if PYDANTIC_V2: + model_config = ConfigDict( + frozen=True, + from_attributes=True, + ) - def __init_subclass__(cls, *args, **kwargs) -> None: + @classmethod + def __pydantic_init_subclass__(cls, *args, **kwargs) -> None: + cls._register_subclass(cls.model_fields) + + else: + + class Config: + frozen = True + orm_mode = True + + @classmethod + def __init_subclass__(cls, *args, **kwargs) -> None: + cls._register_subclass(cls.__fields__) + + super().__init_subclass__(*args, **kwargs) + + @classmethod + def _register_subclass(cls, fields) -> None: if cls._level == Level.MetaBase: cls._level = Level.Base cls._deserializer_dict = {} elif cls._level == Level.Base: cls._level = Level.Normal - cls._deserializer_dict[cls.__fields__[cls._index_key].default] = cls + cls._deserializer_dict[fields[cls._index_key].default] = cls elif cls._level == Level.Normal: pass else: raise RuntimeError("SerializationMeta init error") - super().__init_subclass__(*args, **kwargs) - @classmethod def deserialize(cls, source: Any) -> Self: if isinstance(source, str): @@ -45,4 +63,4 @@ def deserialize(cls, source: Any) -> Self: key = raw_obj.get(cls._index_key) assert key - return cls._deserializer_dict[key].parse_obj(raw_obj) + return type_validate_python(cls._deserializer_dict[key], raw_obj) diff --git a/nonebot_plugin_saa/registries/platform_send_target.py b/nonebot_plugin_saa/registries/platform_send_target.py index 138cca7a..79064243 100644 --- a/nonebot_plugin_saa/registries/platform_send_target.py +++ b/nonebot_plugin_saa/registries/platform_send_target.py @@ -17,6 +17,7 @@ from pydantic import BaseModel from nonebot.params import Depends from nonebot.adapters import Bot, Event +from nonebot.compat import PYDANTIC_V2, ConfigDict from .meta import SerializationMeta from ..utils import SupportedAdapters, SupportedPlatform, extract_adapter_type @@ -31,9 +32,16 @@ class PlatformTarget(SerializationMeta): platform_type: SupportedPlatform - class Config: - frozen = True - orm_mode = True + if PYDANTIC_V2: + model_config = ConfigDict( + frozen=True, + from_attributes=True, + ) + else: + + class Config: + frozen = True + orm_mode = True def arg_dict(self, bot: Bot): adapter_type = extract_adapter_type(bot) diff --git a/poetry.lock b/poetry.lock index a32950f9..2e29f7f7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,25 +1,40 @@ # This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +[[package]] +name = "annotated-types" +version = "0.6.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.8" +files = [ + {file = "annotated_types-0.6.0-py3-none-any.whl", hash = "sha256:0641064de18ba7a25dee8f96403ebc39113d0cb953a01429249d5c7564666a43"}, + {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} + [[package]] name = "anyio" -version = "3.7.1" +version = "4.2.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, - {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, + {file = "anyio-4.2.0-py3-none-any.whl", hash = "sha256:745843b39e829e108e518c489b31dc757de7d2131d53fac32bd8df268227bfee"}, + {file = "anyio-4.2.0.tar.gz", hash = "sha256:e1875bb4b4e2de1669f4bc7869b6d3f54231cdced71605e6e64c9be77e3be50f"}, ] [package.dependencies] -exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} +exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" +typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] -doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-jquery"] -test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (<0.22)"] +doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] +trio = ["trio (>=0.23)"] [[package]] name = "appnope" @@ -94,13 +109,13 @@ files = [ [[package]] name = "cashews" -version = "6.4.0" +version = "7.0.0" description = "cache tools with async power" optional = false python-versions = ">=3.8" files = [ - {file = "cashews-6.4.0-py3-none-any.whl", hash = "sha256:6b7121a0629a17aa72d22bf4007462a9fbcdcd418b8ec1083f2806950c265e58"}, - {file = "cashews-6.4.0.tar.gz", hash = "sha256:0f5ec89b4e8d2944e9403c5fc24fb2947003d279e338de40f2fd3ebc9145c4e3"}, + {file = "cashews-7.0.0-py3-none-any.whl", hash = "sha256:0a54b6ed5f718da2f74509f67770e8741350e5e8bdff7f1ffba9e950451613fa"}, + {file = "cashews-7.0.0.tar.gz", hash = "sha256:43bf2b0a1acf89206a0f8166657dbafcaa948b2c8e00471746e9a647c21d9fd6"}, ] [package.dependencies] @@ -413,13 +428,13 @@ files = [ [[package]] name = "httpcore" -version = "1.0.2" +version = "1.0.3" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpcore-1.0.2-py3-none-any.whl", hash = "sha256:096cc05bca73b8e459a1fc3dcf585148f63e534eae4339559c9b8a8d6399acc7"}, - {file = "httpcore-1.0.2.tar.gz", hash = "sha256:9fc092e4799b26174648e54b74ed5f683132a464e95643b226e00c2ed2fa6535"}, + {file = "httpcore-1.0.3-py3-none-any.whl", hash = "sha256:9a6a501c3099307d9fd76ac244e08503427679b1e81ceb1d922485e2f2462ad2"}, + {file = "httpcore-1.0.3.tar.gz", hash = "sha256:5c0f9546ad17dac4d0772b0808856eb616eb8b48ce94f49ed819fd6982a8a544"}, ] [package.dependencies] @@ -430,7 +445,7 @@ h11 = ">=0.13,<0.15" asyncio = ["anyio (>=4.0,<5.0)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] -trio = ["trio (>=0.22.0,<0.23.0)"] +trio = ["trio (>=0.22.0,<0.24.0)"] [[package]] name = "httptools" @@ -810,58 +825,58 @@ files = [ [[package]] name = "nonebot-adapter-dodo" -version = "0.1.4" +version = "0.2.0" description = "Dodo adapter for nonebot2" optional = false python-versions = ">=3.8,<4.0" files = [ - {file = "nonebot_adapter_dodo-0.1.4-py3-none-any.whl", hash = "sha256:3bbe8ce1d686923dc7347d49e9e7164a93bc87e79626d6067e77b7c3d41d6861"}, - {file = "nonebot_adapter_dodo-0.1.4.tar.gz", hash = "sha256:21375ee712e97fe546ef24654dcb479f51e972335f13b4208af9ef53cc5fca29"}, + {file = "nonebot_adapter_dodo-0.2.0-py3-none-any.whl", hash = "sha256:c82804e00b556ca246a83bf6b2281e7227983ec5a3c24d92329479e2473017fd"}, + {file = "nonebot_adapter_dodo-0.2.0.tar.gz", hash = "sha256:14948b0c4d43509b7b72f3789a71b41b603244d346b5a5a7de6d6ef52866d0ea"}, ] [package.dependencies] -nonebot2 = ">=2.0.0,<3.0.0" +nonebot2 = ">=2.2.0,<3.0.0" [[package]] name = "nonebot-adapter-feishu" -version = "2.4.0" +version = "2.4.1" description = "feishu(larksuite) adapter for nonebot2" optional = false python-versions = ">=3.8,<4.0" files = [ - {file = "nonebot_adapter_feishu-2.4.0-py3-none-any.whl", hash = "sha256:b7fdbecbf545231d106299df38617568f8ebf1094f545e4cce22ceaef71af89c"}, - {file = "nonebot_adapter_feishu-2.4.0.tar.gz", hash = "sha256:ebfdd23257282f5717f6d42df28f4c44a2bb139ea1fefd61d49ea9c0975b0e9b"}, + {file = "nonebot_adapter_feishu-2.4.1-py3-none-any.whl", hash = "sha256:4b4e38c92903518eba2e7c69e0bb319d9169303a78dd2ff92b2549209a25ea75"}, + {file = "nonebot_adapter_feishu-2.4.1.tar.gz", hash = "sha256:387af65195e4800a6c91bf7a4f85914dd07a22ecca289b166787b24f0b5919de"}, ] [package.dependencies] -cashews = ">=6.0.0,<7.0.0" +cashews = ">=7.0.0,<8.0.0" nonebot2 = ">=2.2.0,<3.0.0" pycryptodome = ">=3.18.0,<4.0.0" [[package]] name = "nonebot-adapter-kaiheila" -version = "0.3.0" +version = "0.3.1" description = "kaiheila adapter for nonebot2" optional = false python-versions = ">=3.8,<4.0" files = [ - {file = "nonebot_adapter_kaiheila-0.3.0-py3-none-any.whl", hash = "sha256:8868f57f9ac591dff46d5cf711c419aa76ece22a5dd2380abc33d337132b5157"}, - {file = "nonebot_adapter_kaiheila-0.3.0.tar.gz", hash = "sha256:b32b4e9d911b98ae0270540ed7fa414e94f74b228363b6b012ae2f2d54ed4e21"}, + {file = "nonebot_adapter_kaiheila-0.3.1-py3-none-any.whl", hash = "sha256:7acaa39d6c7479ae925b8d171fbae23fedf8bb3a81ded98c5b1e1214faad6aae"}, + {file = "nonebot_adapter_kaiheila-0.3.1.tar.gz", hash = "sha256:1c14c22133ce84edc72de298e922f980d4e3b09febe4dcfeededc9603936daec"}, ] [package.dependencies] -nonebot2 = ">=2.0.0,<3.0.0" +nonebot2 = ">=2.2.0,<3.0.0" typing-extensions = ">=4.8.0,<5.0.0" [[package]] name = "nonebot-adapter-onebot" -version = "2.4.0" +version = "2.4.1" description = "OneBot(CQHTTP) adapter for nonebot2" optional = false python-versions = ">=3.8,<4.0" files = [ - {file = "nonebot_adapter_onebot-2.4.0-py3-none-any.whl", hash = "sha256:4a51da1913c8ab6008e8ef8a2877af7acc32eac82d6773ff443f743dda380e14"}, - {file = "nonebot_adapter_onebot-2.4.0.tar.gz", hash = "sha256:27a29de8137ce60f0ea328c6fac63571ba7efef7619d0cc74c0dff42c3034b12"}, + {file = "nonebot_adapter_onebot-2.4.1-py3-none-any.whl", hash = "sha256:67fb0ebaec0265708cc1005a5f45a3408fa8d7b78c835d70d97bd0831d5d5a44"}, + {file = "nonebot_adapter_onebot-2.4.1.tar.gz", hash = "sha256:632e5ea84ba0553d54773a1a6283985d028647eadb07ff8940ea32e8aebe79bc"}, ] [package.dependencies] @@ -872,34 +887,34 @@ typing-extensions = ">=4.0.0,<5.0.0" [[package]] name = "nonebot-adapter-qq" -version = "1.3.5" +version = "1.4.1" description = "QQ adapter for nonebot2" optional = false python-versions = ">=3.8,<4.0" files = [ - {file = "nonebot_adapter_qq-1.3.5-py3-none-any.whl", hash = "sha256:ebd34601d58939bd7453dc05e1e890179ed83072c6c65c5624e9c36df2139212"}, - {file = "nonebot_adapter_qq-1.3.5.tar.gz", hash = "sha256:c8b1f8a3b4ecaf822e970bf7a59bcc5e64ff628de9e85d59c98a953d2e57f197"}, + {file = "nonebot_adapter_qq-1.4.1-py3-none-any.whl", hash = "sha256:dbe59b9559943cb7940f0ff9190ec7428db75be9bc4ba1dbe2cba7ff6e249c23"}, + {file = "nonebot_adapter_qq-1.4.1.tar.gz", hash = "sha256:45e99d8caaf7e52857cbd2661d07fd1451bf56d63ef49e80b833933a222dcb26"}, ] [package.dependencies] -nonebot2 = ">=2.1.0,<3.0.0" -pydantic = ">=1.9.0,<2.0.0" +nonebot2 = ">=2.2.0,<3.0.0" +pydantic = ">=1.10.0,<2.5.0 || >2.5.0,<2.5.1 || >2.5.1,<3.0.0" typing-extensions = ">=4.4.0,<5.0.0" yarl = ">=1.9.0,<2.0.0" [[package]] name = "nonebot-adapter-red" -version = "0.8.0" +version = "0.9.0" description = "Red Protocol Adapter for Nonebot2" optional = false python-versions = ">=3.8" files = [ - {file = "nonebot_adapter_red-0.8.0-py3-none-any.whl", hash = "sha256:9bce0810e67a2754ba68d8c942bec12deeacb55459329f8e7a4f0b6416641180"}, - {file = "nonebot_adapter_red-0.8.0.tar.gz", hash = "sha256:577c0a286ed1f924339eb398ce1c5efd2cf727029116aff176b8715ab463c234"}, + {file = "nonebot_adapter_red-0.9.0-py3-none-any.whl", hash = "sha256:8dd5cd0a5d964faa23823b7c37fa8c64fa3ed8f67fa66515fe44a2708ee438ec"}, + {file = "nonebot_adapter_red-0.9.0.tar.gz", hash = "sha256:a657c5ffb071c91deb4109bb94ac8046dcbea5cbb584437995c30ffb2d184954"}, ] [package.dependencies] -nonebot2 = ">=2.0.1" +nonebot2 = ">=2.2.0" packaging = ">=23.1" [package.extras] @@ -911,14 +926,19 @@ version = "0.1.0b16" description = "Telegram Adapter for NoneBot2" optional = false python-versions = ">=3.8,<4.0" -files = [ - {file = "nonebot-adapter-telegram-0.1.0b16.tar.gz", hash = "sha256:04cc84a68efaf2e48682104bb988d6f257eef2557106ca2dfb173abc010112b8"}, - {file = "nonebot_adapter_telegram-0.1.0b16-py3-none-any.whl", hash = "sha256:f15036d6200aceb8a3a00d122dd3dd1641ea1da8970b6953fd42173e82eb6ce9"}, -] +files = [] +develop = false [package.dependencies] -anyio = ">=3.6.2,<4.0.0" +anyio = ">=4.2.0,<5.0.0" nonebot2 = ">=2.1.3,<3.0.0" +pydantic = ">=2.0.3,<2.5.0 || >2.5.0,<2.5.1 || >2.5.1,<3.0.0" + +[package.source] +type = "git" +url = "https://github.com/nonebot/adapter-telegram.git" +reference = "HEAD" +resolved_reference = "76d371dfd19444d66f541ad75adb84b0a51083ae" [[package]] name = "nonebot2" @@ -1129,55 +1149,113 @@ files = [ [[package]] name = "pydantic" -version = "1.10.14" -description = "Data validation and settings management using python type hints" +version = "2.6.1" +description = "Data validation using Python type hints" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pydantic-1.10.14-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7f4fcec873f90537c382840f330b90f4715eebc2bc9925f04cb92de593eae054"}, - {file = "pydantic-1.10.14-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e3a76f571970fcd3c43ad982daf936ae39b3e90b8a2e96c04113a369869dc87"}, - {file = "pydantic-1.10.14-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:82d886bd3c3fbeaa963692ef6b643159ccb4b4cefaf7ff1617720cbead04fd1d"}, - {file = "pydantic-1.10.14-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:798a3d05ee3b71967844a1164fd5bdb8c22c6d674f26274e78b9f29d81770c4e"}, - {file = "pydantic-1.10.14-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:23d47a4b57a38e8652bcab15a658fdb13c785b9ce217cc3a729504ab4e1d6bc9"}, - {file = "pydantic-1.10.14-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f9f674b5c3bebc2eba401de64f29948ae1e646ba2735f884d1594c5f675d6f2a"}, - {file = "pydantic-1.10.14-cp310-cp310-win_amd64.whl", hash = "sha256:24a7679fab2e0eeedb5a8924fc4a694b3bcaac7d305aeeac72dd7d4e05ecbebf"}, - {file = "pydantic-1.10.14-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:9d578ac4bf7fdf10ce14caba6f734c178379bd35c486c6deb6f49006e1ba78a7"}, - {file = "pydantic-1.10.14-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:fa7790e94c60f809c95602a26d906eba01a0abee9cc24150e4ce2189352deb1b"}, - {file = "pydantic-1.10.14-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aad4e10efa5474ed1a611b6d7f0d130f4aafadceb73c11d9e72823e8f508e663"}, - {file = "pydantic-1.10.14-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1245f4f61f467cb3dfeced2b119afef3db386aec3d24a22a1de08c65038b255f"}, - {file = "pydantic-1.10.14-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:21efacc678a11114c765eb52ec0db62edffa89e9a562a94cbf8fa10b5db5c046"}, - {file = "pydantic-1.10.14-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:412ab4a3f6dbd2bf18aefa9f79c7cca23744846b31f1d6555c2ee2b05a2e14ca"}, - {file = "pydantic-1.10.14-cp311-cp311-win_amd64.whl", hash = "sha256:e897c9f35281f7889873a3e6d6b69aa1447ceb024e8495a5f0d02ecd17742a7f"}, - {file = "pydantic-1.10.14-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d604be0f0b44d473e54fdcb12302495fe0467c56509a2f80483476f3ba92b33c"}, - {file = "pydantic-1.10.14-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a42c7d17706911199798d4c464b352e640cab4351efe69c2267823d619a937e5"}, - {file = "pydantic-1.10.14-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:596f12a1085e38dbda5cbb874d0973303e34227b400b6414782bf205cc14940c"}, - {file = "pydantic-1.10.14-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:bfb113860e9288d0886e3b9e49d9cf4a9d48b441f52ded7d96db7819028514cc"}, - {file = "pydantic-1.10.14-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:bc3ed06ab13660b565eed80887fcfbc0070f0aa0691fbb351657041d3e874efe"}, - {file = "pydantic-1.10.14-cp37-cp37m-win_amd64.whl", hash = "sha256:ad8c2bc677ae5f6dbd3cf92f2c7dc613507eafe8f71719727cbc0a7dec9a8c01"}, - {file = "pydantic-1.10.14-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c37c28449752bb1f47975d22ef2882d70513c546f8f37201e0fec3a97b816eee"}, - {file = "pydantic-1.10.14-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:49a46a0994dd551ec051986806122767cf144b9702e31d47f6d493c336462597"}, - {file = "pydantic-1.10.14-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53e3819bd20a42470d6dd0fe7fc1c121c92247bca104ce608e609b59bc7a77ee"}, - {file = "pydantic-1.10.14-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0fbb503bbbbab0c588ed3cd21975a1d0d4163b87e360fec17a792f7d8c4ff29f"}, - {file = "pydantic-1.10.14-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:336709883c15c050b9c55a63d6c7ff09be883dbc17805d2b063395dd9d9d0022"}, - {file = "pydantic-1.10.14-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:4ae57b4d8e3312d486e2498d42aed3ece7b51848336964e43abbf9671584e67f"}, - {file = "pydantic-1.10.14-cp38-cp38-win_amd64.whl", hash = "sha256:dba49d52500c35cfec0b28aa8b3ea5c37c9df183ffc7210b10ff2a415c125c4a"}, - {file = "pydantic-1.10.14-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c66609e138c31cba607d8e2a7b6a5dc38979a06c900815495b2d90ce6ded35b4"}, - {file = "pydantic-1.10.14-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d986e115e0b39604b9eee3507987368ff8148222da213cd38c359f6f57b3b347"}, - {file = "pydantic-1.10.14-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:646b2b12df4295b4c3148850c85bff29ef6d0d9621a8d091e98094871a62e5c7"}, - {file = "pydantic-1.10.14-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:282613a5969c47c83a8710cc8bfd1e70c9223feb76566f74683af889faadc0ea"}, - {file = "pydantic-1.10.14-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:466669501d08ad8eb3c4fecd991c5e793c4e0bbd62299d05111d4f827cded64f"}, - {file = "pydantic-1.10.14-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:13e86a19dca96373dcf3190fcb8797d40a6f12f154a244a8d1e8e03b8f280593"}, - {file = "pydantic-1.10.14-cp39-cp39-win_amd64.whl", hash = "sha256:08b6ec0917c30861e3fe71a93be1648a2aa4f62f866142ba21670b24444d7fd8"}, - {file = "pydantic-1.10.14-py3-none-any.whl", hash = "sha256:8ee853cd12ac2ddbf0ecbac1c289f95882b2d4482258048079d13be700aa114c"}, - {file = "pydantic-1.10.14.tar.gz", hash = "sha256:46f17b832fe27de7850896f3afee50ea682220dd218f7e9c88d436788419dca6"}, + {file = "pydantic-2.6.1-py3-none-any.whl", hash = "sha256:0b6a909df3192245cb736509a92ff69e4fef76116feffec68e93a567347bae6f"}, + {file = "pydantic-2.6.1.tar.gz", hash = "sha256:4fd5c182a2488dc63e6d32737ff19937888001e2a6d86e94b3f233104a5d1fa9"}, ] [package.dependencies] -typing-extensions = ">=4.2.0" +annotated-types = ">=0.4.0" +pydantic-core = "2.16.2" +typing-extensions = ">=4.6.1" [package.extras] -dotenv = ["python-dotenv (>=0.10.4)"] -email = ["email-validator (>=1.0.3)"] +email = ["email-validator (>=2.0.0)"] + +[[package]] +name = "pydantic-core" +version = "2.16.2" +description = "" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic_core-2.16.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3fab4e75b8c525a4776e7630b9ee48aea50107fea6ca9f593c98da3f4d11bf7c"}, + {file = "pydantic_core-2.16.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8bde5b48c65b8e807409e6f20baee5d2cd880e0fad00b1a811ebc43e39a00ab2"}, + {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2924b89b16420712e9bb8192396026a8fbd6d8726224f918353ac19c4c043d2a"}, + {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:16aa02e7a0f539098e215fc193c8926c897175d64c7926d00a36188917717a05"}, + {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:936a787f83db1f2115ee829dd615c4f684ee48ac4de5779ab4300994d8af325b"}, + {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:459d6be6134ce3b38e0ef76f8a672924460c455d45f1ad8fdade36796df1ddc8"}, + {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9ee4febb249c591d07b2d4dd36ebcad0ccd128962aaa1801508320896575ef"}, + {file = "pydantic_core-2.16.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:40a0bd0bed96dae5712dab2aba7d334a6c67cbcac2ddfca7dbcc4a8176445990"}, + {file = "pydantic_core-2.16.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:870dbfa94de9b8866b37b867a2cb37a60c401d9deb4a9ea392abf11a1f98037b"}, + {file = "pydantic_core-2.16.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:308974fdf98046db28440eb3377abba274808bf66262e042c412eb2adf852731"}, + {file = "pydantic_core-2.16.2-cp310-none-win32.whl", hash = "sha256:a477932664d9611d7a0816cc3c0eb1f8856f8a42435488280dfbf4395e141485"}, + {file = "pydantic_core-2.16.2-cp310-none-win_amd64.whl", hash = "sha256:8f9142a6ed83d90c94a3efd7af8873bf7cefed2d3d44387bf848888482e2d25f"}, + {file = "pydantic_core-2.16.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:406fac1d09edc613020ce9cf3f2ccf1a1b2f57ab00552b4c18e3d5276c67eb11"}, + {file = "pydantic_core-2.16.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ce232a6170dd6532096cadbf6185271e4e8c70fc9217ebe105923ac105da9978"}, + {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a90fec23b4b05a09ad988e7a4f4e081711a90eb2a55b9c984d8b74597599180f"}, + {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8aafeedb6597a163a9c9727d8a8bd363a93277701b7bfd2749fbefee2396469e"}, + {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9957433c3a1b67bdd4c63717eaf174ebb749510d5ea612cd4e83f2d9142f3fc8"}, + {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b0d7a9165167269758145756db43a133608a531b1e5bb6a626b9ee24bc38a8f7"}, + {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dffaf740fe2e147fedcb6b561353a16243e654f7fe8e701b1b9db148242e1272"}, + {file = "pydantic_core-2.16.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f8ed79883b4328b7f0bd142733d99c8e6b22703e908ec63d930b06be3a0e7113"}, + {file = "pydantic_core-2.16.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:cf903310a34e14651c9de056fcc12ce090560864d5a2bb0174b971685684e1d8"}, + {file = "pydantic_core-2.16.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:46b0d5520dbcafea9a8645a8164658777686c5c524d381d983317d29687cce97"}, + {file = "pydantic_core-2.16.2-cp311-none-win32.whl", hash = "sha256:70651ff6e663428cea902dac297066d5c6e5423fda345a4ca62430575364d62b"}, + {file = "pydantic_core-2.16.2-cp311-none-win_amd64.whl", hash = "sha256:98dc6f4f2095fc7ad277782a7c2c88296badcad92316b5a6e530930b1d475ebc"}, + {file = "pydantic_core-2.16.2-cp311-none-win_arm64.whl", hash = "sha256:ef6113cd31411eaf9b39fc5a8848e71c72656fd418882488598758b2c8c6dfa0"}, + {file = "pydantic_core-2.16.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:88646cae28eb1dd5cd1e09605680c2b043b64d7481cdad7f5003ebef401a3039"}, + {file = "pydantic_core-2.16.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7b883af50eaa6bb3299780651e5be921e88050ccf00e3e583b1e92020333304b"}, + {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7bf26c2e2ea59d32807081ad51968133af3025c4ba5753e6a794683d2c91bf6e"}, + {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:99af961d72ac731aae2a1b55ccbdae0733d816f8bfb97b41909e143de735f522"}, + {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:02906e7306cb8c5901a1feb61f9ab5e5c690dbbeaa04d84c1b9ae2a01ebe9379"}, + {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d5362d099c244a2d2f9659fb3c9db7c735f0004765bbe06b99be69fbd87c3f15"}, + {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ac426704840877a285d03a445e162eb258924f014e2f074e209d9b4ff7bf380"}, + {file = "pydantic_core-2.16.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b94cbda27267423411c928208e89adddf2ea5dd5f74b9528513f0358bba019cb"}, + {file = "pydantic_core-2.16.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:6db58c22ac6c81aeac33912fb1af0e930bc9774166cdd56eade913d5f2fff35e"}, + {file = "pydantic_core-2.16.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:396fdf88b1b503c9c59c84a08b6833ec0c3b5ad1a83230252a9e17b7dfb4cffc"}, + {file = "pydantic_core-2.16.2-cp312-none-win32.whl", hash = "sha256:7c31669e0c8cc68400ef0c730c3a1e11317ba76b892deeefaf52dcb41d56ed5d"}, + {file = "pydantic_core-2.16.2-cp312-none-win_amd64.whl", hash = "sha256:a3b7352b48fbc8b446b75f3069124e87f599d25afb8baa96a550256c031bb890"}, + {file = "pydantic_core-2.16.2-cp312-none-win_arm64.whl", hash = "sha256:a9e523474998fb33f7c1a4d55f5504c908d57add624599e095c20fa575b8d943"}, + {file = "pydantic_core-2.16.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:ae34418b6b389d601b31153b84dce480351a352e0bb763684a1b993d6be30f17"}, + {file = "pydantic_core-2.16.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:732bd062c9e5d9582a30e8751461c1917dd1ccbdd6cafb032f02c86b20d2e7ec"}, + {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e4b52776a2e3230f4854907a1e0946eec04d41b1fc64069ee774876bbe0eab55"}, + {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ef551c053692b1e39e3f7950ce2296536728871110e7d75c4e7753fb30ca87f4"}, + {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ebb892ed8599b23fa8f1799e13a12c87a97a6c9d0f497525ce9858564c4575a4"}, + {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aa6c8c582036275997a733427b88031a32ffa5dfc3124dc25a730658c47a572f"}, + {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4ba0884a91f1aecce75202473ab138724aa4fb26d7707f2e1fa6c3e68c84fbf"}, + {file = "pydantic_core-2.16.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7924e54f7ce5d253d6160090ddc6df25ed2feea25bfb3339b424a9dd591688bc"}, + {file = "pydantic_core-2.16.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:69a7b96b59322a81c2203be537957313b07dd333105b73db0b69212c7d867b4b"}, + {file = "pydantic_core-2.16.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7e6231aa5bdacda78e96ad7b07d0c312f34ba35d717115f4b4bff6cb87224f0f"}, + {file = "pydantic_core-2.16.2-cp38-none-win32.whl", hash = "sha256:41dac3b9fce187a25c6253ec79a3f9e2a7e761eb08690e90415069ea4a68ff7a"}, + {file = "pydantic_core-2.16.2-cp38-none-win_amd64.whl", hash = "sha256:f685dbc1fdadb1dcd5b5e51e0a378d4685a891b2ddaf8e2bba89bd3a7144e44a"}, + {file = "pydantic_core-2.16.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:55749f745ebf154c0d63d46c8c58594d8894b161928aa41adbb0709c1fe78b77"}, + {file = "pydantic_core-2.16.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b30b0dd58a4509c3bd7eefddf6338565c4905406aee0c6e4a5293841411a1286"}, + {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:18de31781cdc7e7b28678df7c2d7882f9692ad060bc6ee3c94eb15a5d733f8f7"}, + {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5864b0242f74b9dd0b78fd39db1768bc3f00d1ffc14e596fd3e3f2ce43436a33"}, + {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8f9186ca45aee030dc8234118b9c0784ad91a0bb27fc4e7d9d6608a5e3d386c"}, + {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cc6f6c9be0ab6da37bc77c2dda5f14b1d532d5dbef00311ee6e13357a418e646"}, + {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa057095f621dad24a1e906747179a69780ef45cc8f69e97463692adbcdae878"}, + {file = "pydantic_core-2.16.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6ad84731a26bcfb299f9eab56c7932d46f9cad51c52768cace09e92a19e4cf55"}, + {file = "pydantic_core-2.16.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:3b052c753c4babf2d1edc034c97851f867c87d6f3ea63a12e2700f159f5c41c3"}, + {file = "pydantic_core-2.16.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:e0f686549e32ccdb02ae6f25eee40cc33900910085de6aa3790effd391ae10c2"}, + {file = "pydantic_core-2.16.2-cp39-none-win32.whl", hash = "sha256:7afb844041e707ac9ad9acad2188a90bffce2c770e6dc2318be0c9916aef1469"}, + {file = "pydantic_core-2.16.2-cp39-none-win_amd64.whl", hash = "sha256:9da90d393a8227d717c19f5397688a38635afec89f2e2d7af0df037f3249c39a"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5f60f920691a620b03082692c378661947d09415743e437a7478c309eb0e4f82"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:47924039e785a04d4a4fa49455e51b4eb3422d6eaacfde9fc9abf8fdef164e8a"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e6294e76b0380bb7a61eb8a39273c40b20beb35e8c87ee101062834ced19c545"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fe56851c3f1d6f5384b3051c536cc81b3a93a73faf931f404fef95217cf1e10d"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9d776d30cde7e541b8180103c3f294ef7c1862fd45d81738d156d00551005784"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:72f7919af5de5ecfaf1eba47bf9a5d8aa089a3340277276e5636d16ee97614d7"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:4bfcbde6e06c56b30668a0c872d75a7ef3025dc3c1823a13cf29a0e9b33f67e8"}, + {file = "pydantic_core-2.16.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:ff7c97eb7a29aba230389a2661edf2e9e06ce616c7e35aa764879b6894a44b25"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:9b5f13857da99325dcabe1cc4e9e6a3d7b2e2c726248ba5dd4be3e8e4a0b6d0e"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:a7e41e3ada4cca5f22b478c08e973c930e5e6c7ba3588fb8e35f2398cdcc1545"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60eb8ceaa40a41540b9acae6ae7c1f0a67d233c40dc4359c256ad2ad85bdf5e5"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7beec26729d496a12fd23cf8da9944ee338c8b8a17035a560b585c36fe81af20"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:22c5f022799f3cd6741e24f0443ead92ef42be93ffda0d29b2597208c94c3753"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:eca58e319f4fd6df004762419612122b2c7e7d95ffafc37e890252f869f3fb2a"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ed957db4c33bc99895f3a1672eca7e80e8cda8bd1e29a80536b4ec2153fa9804"}, + {file = "pydantic_core-2.16.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:459c0d338cc55d099798618f714b21b7ece17eb1a87879f2da20a3ff4c7628e2"}, + {file = "pydantic_core-2.16.2.tar.gz", hash = "sha256:0ba503850d8b8dcc18391f10de896ae51d37fe5fe43dbfb6a35c5c5cad271a06"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pygments" @@ -1518,13 +1596,13 @@ files = [ [[package]] name = "urllib3" -version = "2.2.0" +version = "2.2.1" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.0-py3-none-any.whl", hash = "sha256:ce3711610ddce217e6d113a2732fafad960a03fd0318c91faa79481e35c11224"}, - {file = "urllib3-2.2.0.tar.gz", hash = "sha256:051d961ad0c62a94e50ecf1af379c3aba230c66c710493493560c0c223c49f20"}, + {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, + {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, ] [package.extras] @@ -1902,4 +1980,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "568bc6405656b4906e297a1370a651ca12e22207231d872c602b195fa151aabd" +content-hash = "ba7e8b8c403c42a8af58096e1582733a4e758958b8b82c1f3f0e2f7fbeb2a130" diff --git a/pyproject.toml b/pyproject.toml index 01b0fcbf..0cd54ddc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,8 +22,8 @@ classifiers = [ python = "^3.8" nonebot2 = "^2.0.0" strenum = "^0.4.8" -pydantic = "^1.10.5" -anyio = ">=3.3.0,<=4" +pydantic = ">=1.10.0,<3.0.0,!=2.5.0,!=2.5.1" +anyio = ">=3.3.0,<5.0.0" [tool.poetry.group.dev.dependencies] pytest-asyncio = "^0.20.2" @@ -44,13 +44,13 @@ respx = "^0.20.2" optional = true [tool.poetry.group.adapters.dependencies] -nonebot-adapter-onebot = "^2.2.2" -nonebot-adapter-kaiheila = "^0.3.0" -nonebot-adapter-telegram = ">=0.1.0b16" +nonebot-adapter-onebot = "^2.4.0" +nonebot-adapter-kaiheila = "^0.3.1" +nonebot-adapter-telegram = { git = "https://github.com/nonebot/adapter-telegram.git" } nonebot-adapter-feishu = "^2.4.0" -nonebot-adapter-red = ">=0.4.1" -nonebot-adapter-dodo = "^0.1.2" -nonebot-adapter-qq = "^1.3.0" +nonebot-adapter-red = "^0.9.0" +nonebot-adapter-dodo = "^0.2.0" +nonebot-adapter-qq = "^1.4.1" [tool.black] line-length = 88 @@ -77,6 +77,7 @@ asyncio_mode = "auto" [tool.pyright] pythonVersion = "3.8" pythonPlatform = "All" +defineConstant = { PYDANTIC_V2 = true } [tool.coverage.report] exclude_also = [ diff --git a/tests/test_aggreated_send.py b/tests/test_aggreated_send.py index baf06be6..1a55c7a0 100644 --- a/tests/test_aggreated_send.py +++ b/tests/test_aggreated_send.py @@ -29,7 +29,7 @@ async def process(msg: PrivateMessageEvent): "user_id": "2233", "detail_type": "private", }, - result={"message_id": 12451}, + result={"message_id": "12451"}, ) ctx.should_call_api( "send_message", @@ -38,7 +38,7 @@ async def process(msg: PrivateMessageEvent): "user_id": "2233", "detail_type": "private", }, - result={"message_id": 1235112}, + result={"message_id": "1235112"}, ) @@ -69,7 +69,7 @@ async def test_send_active(app: App): "guild_id": None, "detail_type": "private", }, - result={"message_id": 12451}, + result={"message_id": "12451"}, ) ctx.should_call_api( "send_message", @@ -81,7 +81,7 @@ async def test_send_active(app: App): "guild_id": None, "detail_type": "private", }, - result={"message_id": 12451}, + result={"message_id": "12451"}, ) target = TargetOB12Unknow( platform="banana", detail_type="private", user_id="2233" diff --git a/tests/test_dodo.py b/tests/test_dodo.py index d69c9b1c..a58d646f 100644 --- a/tests/test_dodo.py +++ b/tests/test_dodo.py @@ -5,6 +5,7 @@ import pytest from nonebug import App from httpx import Response +from nonebot.compat import model_dump from pytest_mock import MockerFixture from nonebot.exception import ActionFailed from nonebot import get_driver, get_adapter @@ -56,9 +57,9 @@ async def test_image(app: App): upload_route.mock( return_value=Response( 200, - json=PictureInfo( - url="https://im.dodo.com/amiya.png", width=191, height=223 - ).dict(), + json=model_dump( + PictureInfo(url="https://im.dodo.com/amiya.png", width=191, height=223) + ), ) ) async with app.test_api() as ctx: diff --git a/tests/test_feishu.py b/tests/test_feishu.py index c9301049..8b114b39 100644 --- a/tests/test_feishu.py +++ b/tests/test_feishu.py @@ -7,6 +7,7 @@ from nonebug import App from httpx import Response from nonebot import get_driver +from nonebot.compat import type_validate_python from nonebot.adapters.feishu import Bot, Message from nonebot.adapters.feishu.models import BotInfo from nonebot.adapters.feishu.config import BotConfig @@ -14,14 +15,15 @@ from .utils import assert_ms BOT_CONFIG = BotConfig(app_id="114", app_secret="514", verification_token="1919810") -BOT_INFO = BotInfo.parse_obj( +BOT_INFO = type_validate_python( + BotInfo, { "activate_status": 2, "app_name": "name", "avatar_url": "https://s1-imfile.feishucdn.com/test.jpg", "ip_white_list": [], "open_id": "ou_123456", - } + }, ) feishu_kwargs = { "self_id": "123456", diff --git a/tests/test_onebot_v12.py b/tests/test_onebot_v12.py index a484f00b..d3fdf0c5 100644 --- a/tests/test_onebot_v12.py +++ b/tests/test_onebot_v12.py @@ -168,7 +168,7 @@ async def handle(): "detail_type": "private", "user_id": message_event.user_id, }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) async with app.test_matcher(matcher) as ctx: @@ -194,7 +194,7 @@ async def handle(): "guild_id": "3333", "event_id": "1111", }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) message_event = mock_obv12_message_event(message, detail_type="qqguild_channel") @@ -207,7 +207,7 @@ async def handle(): "channel_id": "6677", "event_id": "1111", }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) @@ -240,7 +240,7 @@ async def handle(): "detail_type": "private", "user_id": message_event.user_id, }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) @@ -269,7 +269,7 @@ async def test_send_active(app: App): "detail_type": "group", "group_id": "2233", }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) await MessageFactory("123").send_to(target, bot) @@ -281,7 +281,7 @@ async def test_send_active(app: App): "detail_type": "private", "user_id": "1122", }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) await MessageFactory("123").send_to(target, bot) @@ -298,7 +298,7 @@ async def test_send_active(app: App): "user_id": None, "group_id": None, }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) await MessageFactory("123").send_to(target, bot) @@ -319,7 +319,7 @@ async def test_send_active(app: App): "guild_id": "3333", "detail_type": "private", }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) await MessageFactory("123").send_to(target, bot) @@ -331,7 +331,7 @@ async def test_send_active(app: App): "detail_type": "channel", "channel_id": "4444", }, - result={"message_id": 12355223}, + result={"message_id": "12355223"}, ) await MessageFactory("123").send_to(target, bot) diff --git a/tests/test_platform_target.py b/tests/test_platform_target.py index f4dc0f53..1550863e 100644 --- a/tests/test_platform_target.py +++ b/tests/test_platform_target.py @@ -1,8 +1,10 @@ +import json from typing import Literal import pytest from nonebug import App from pydantic import BaseModel +from nonebot.compat import model_dump, type_validate_python def test_register_deserializer(): @@ -14,13 +16,13 @@ class MySendTarget(PlatformTarget): my_field: int send_target = MySendTarget(my_field=123) - serialized_target = send_target.json() + serialized_target = json.dumps(model_dump(send_target)) deserialized_target = PlatformTarget.deserialize(serialized_target) assert isinstance(deserialized_target, MySendTarget) assert deserialized_target == send_target - serialized_target = send_target.dict() + serialized_target = model_dump(send_target) deserialized_target = PlatformTarget.deserialize(serialized_target) assert isinstance(deserialized_target, MySendTarget) @@ -38,13 +40,13 @@ class CustomModel(BaseModel): data: AllSupportedPlatformTarget model = CustomModel(data=TargetQQGroup(group_id=123)) - serialized_model = model.dict() - deserialized_model = CustomModel.parse_obj(serialized_model) + serialized_model = model_dump(model) + deserialized_model = type_validate_python(CustomModel, serialized_model) assert model == deserialized_model model = CustomModel(data=TargetQQPrivate(user_id=456)) - serialized_model = model.dict() - deserialized_model = CustomModel.parse_obj(serialized_model) + serialized_model = model_dump(model) + deserialized_model = type_validate_python(CustomModel, serialized_model) assert model == deserialized_model diff --git a/tests/test_qq.py b/tests/test_qq.py index 718afa7a..253deb96 100644 --- a/tests/test_qq.py +++ b/tests/test_qq.py @@ -5,6 +5,7 @@ import pytest from nonebug import App from nonebot import get_adapter +from nonebot.compat import model_dump from pytest_mock import MockerFixture from nonebot.adapters.qq import Bot, Adapter from nonebot.adapters.qq.config import BotInfo @@ -127,7 +128,9 @@ async def _(): ctx.should_call_send( event, Message("123"), - result=MockQQGuildMessage(id="1234871", channel_id=event.channel_id), + result=model_dump( + MockQQGuildMessage(id="1234871", channel_id=event.channel_id) + ), ) event = mock_qq_guild_message_event(Message("322"), direct=True) @@ -135,7 +138,9 @@ async def _(): ctx.should_call_send( event, Message("123"), - result=MockQQGuildMessage(id="1234871", channel_id=event.channel_id), + result=model_dump( + MockQQGuildMessage(id="1234871", channel_id=event.channel_id) + ), ) event = mock_qq_message_event(Message("323")) @@ -143,7 +148,7 @@ async def _(): ctx.should_call_send( event, Message("123"), - result=MockQQMessage(id="1234871", content="123"), + result=model_dump(MockQQMessage(id="1234871", content="123")), ) event = mock_qq_message_event(Message("323"), direct=True) @@ -151,7 +156,7 @@ async def _(): ctx.should_call_send( event, Message("123"), - result=MockQQMessage(id="1234871", content="123"), + result=model_dump(MockQQMessage(id="1234871", content="123")), ) @@ -184,7 +189,9 @@ async def _(): ctx.should_call_send( event, Message("123"), - result=MockQQGuildMessage(id="1234871", channel_id=event.channel_id), + result=model_dump( + MockQQGuildMessage(id="1234871", channel_id=event.channel_id) + ), ) @@ -216,7 +223,9 @@ async def _(): ctx.should_call_send( event, Message("123"), - result=MockQQGuildMessage(id="1234871", channel_id=event.channel_id), + result=model_dump( + MockQQGuildMessage(id="1234871", channel_id=event.channel_id) + ), ) ctx.should_call_api( "delete_message", @@ -257,7 +266,7 @@ async def test_send_active(app: App): "event_id": None, "content": "123", }, - result=MockQQGuildMessage(id="1234871", channel_id="2233"), + result=model_dump(MockQQGuildMessage(id="1234871", channel_id="2233")), ) target = TargetQQGuildChannel(channel_id=2233) await MessageFactory("123").send_to(target, bot) @@ -279,7 +288,7 @@ async def test_send_active(app: App): "event_id": None, "content": "123", }, - result=MockQQGuildMessage(id="1234871", channel_id="12479234"), + result=model_dump(MockQQGuildMessage(id="1234871", channel_id="12479234")), ) await MessageFactory("123").send_to(target, bot) # 再次发送,这次直接从缓存中获取 guild_id @@ -291,7 +300,7 @@ async def test_send_active(app: App): "event_id": None, "content": "1234", }, - result=MockQQGuildMessage(id="1234871", channel_id="12355131"), + result=model_dump(MockQQGuildMessage(id="1234871", channel_id="12355131")), ) await MessageFactory("1234").send_to(target, bot) @@ -306,7 +315,7 @@ async def test_send_active(app: App): "msg_seq": None, "event_id": None, }, - result=MockQQMessage(id="1234871", content="123"), + result=model_dump(MockQQMessage(id="1234871", content="123")), ) target = TargetQQGroupOpenId(bot_id="3344", group_openid="2233") await MessageFactory("123").send_to(target, bot) @@ -322,7 +331,7 @@ async def test_send_active(app: App): "msg_seq": None, "event_id": None, }, - result=MockQQMessage(id="1234871", content="123"), + result=model_dump(MockQQMessage(id="1234871", content="123")), ) target = TargetQQPrivateOpenId(bot_id="3344", user_openid="2233") await MessageFactory("123").send_to(target, bot) @@ -359,7 +368,7 @@ async def test_send_active_with_magic_msg_id(app: App, mocker: MockerFixture): "event_id": None, "content": "123", }, - result=MockQQGuildMessage(id="1234871", channel_id="2233"), + result=model_dump(MockQQGuildMessage(id="1234871", channel_id="2233")), ) target = TargetQQGuildChannel(channel_id=2233) await MessageFactory("123").send_to(target, bot) @@ -381,7 +390,7 @@ async def test_send_active_with_magic_msg_id(app: App, mocker: MockerFixture): "event_id": None, "content": "123", }, - result=MockQQGuildMessage(id="1234871", channel_id="12479234"), + result=model_dump(MockQQGuildMessage(id="1234871", channel_id="12479234")), ) await MessageFactory("123").send_to(target, bot) diff --git a/tests/test_red.py b/tests/test_red.py index 666608c0..747d1b18 100644 --- a/tests/test_red.py +++ b/tests/test_red.py @@ -6,6 +6,7 @@ from nonebug import App from respx import MockRouter from nonebot import get_adapter +from nonebot.compat import model_dump from pytest_mock import MockerFixture from nonebot.adapters.red import Bot, Adapter from nonebot.adapters.red.config import BotInfo @@ -95,7 +96,7 @@ async def process(msg: PrivateMessageEvent): "target": "1234", "elements": [{"elementType": 1, "textElement": {"content": "123"}}], }, - result=msg_event.dict(), + result=model_dump(msg_event), ) @@ -131,7 +132,7 @@ async def process(msg: PrivateMessageEvent): "target": "1234", "elements": [{"elementType": 1, "textElement": {"content": "123"}}], }, - result=msg_event.dict(), + result=model_dump(msg_event), ) @@ -307,7 +308,7 @@ async def process(msg: PrivateMessageEvent): {"elementType": 1, "textElement": {"content": "123"}}, ], }, - result=msg_event.dict(), + result=model_dump(msg_event), ) diff --git a/tests/test_send.py b/tests/test_send.py index cd0c544f..8b779f10 100644 --- a/tests/test_send.py +++ b/tests/test_send.py @@ -53,6 +53,6 @@ async def test_matcher(): "detail_type": "private", "user_id": event.user_id, }, - result={"message_id": 12451}, + result={"message_id": "12451"}, ) assertion(ctx)