diff --git a/nonebot/adapters/console/adapter.py b/nonebot/adapters/console/adapter.py index 1df9366..ac56c33 100644 --- a/nonebot/adapters/console/adapter.py +++ b/nonebot/adapters/console/adapter.py @@ -1,7 +1,8 @@ import sys import asyncio from typing_extensions import override -from typing import Any, Dict, List, Callable, Optional, Awaitable +from typing import Any, Callable, Optional +from collections.abc import Awaitable from textual.color import Color from nonebot.drivers import Driver @@ -18,6 +19,8 @@ class Adapter(BaseAdapter): + _frontend: Frontend[AdapterConsoleBackend] + @override def __init__(self, driver: Driver, **kwargs: Any) -> None: super().__init__(driver, **kwargs) @@ -25,9 +28,9 @@ def __init__(self, driver: Driver, **kwargs: Any) -> None: self.bot = Bot(self, BOT_ID) self._task: Optional[asyncio.Task] = None - self._frontend: Optional[Frontend[AdapterConsoleBackend]] = None + self._stdout = sys.stdout - self.clients: List[Callable[[Bot, str, Dict[str, Any]], Awaitable[Any]]] = [] + self.clients: list[Callable[[Bot, str, dict[str, Any]], Awaitable[Any]]] = [] self.setup() diff --git a/nonebot/adapters/console/backend.py b/nonebot/adapters/console/backend.py index 95ae927..61cffcc 100644 --- a/nonebot/adapters/console/backend.py +++ b/nonebot/adapters/console/backend.py @@ -6,8 +6,8 @@ from nonechat import Backend from nonechat.info import Robot from nonechat.app import Frontend -from nonechat.message import Text, Emoji from nonechat.info import Event as ConsoleEvent +from nonechat.message import Text, Emoji, Markup, Markdown from nonechat.info import MessageEvent as ConsoleMessageEvent from nonebot.log import logger, logger_id, default_filter, default_format @@ -19,15 +19,14 @@ class AdapterConsoleBackend(Backend): + _adapter: "Adapter" + def __init__(self, frontend: "Frontend"): super().__init__(frontend) - self.frontend.storage.current_user = replace( - self.frontend.storage.current_user, id="User" - ) + self.frontend.storage.current_user = replace(self.frontend.storage.current_user, id="User") self._stdout = sys.stdout self._logger_id: Optional[int] = None self._should_restore_logger: bool = False - self._adapter: Optional["Adapter"] = None # noqa: UP037 def set_adapter(self, adapter: "Adapter"): self._adapter = adapter @@ -75,9 +74,9 @@ async def post_event(self, event: ConsoleEvent): elif isinstance(elem, Emoji): message += MessageSegment.emoji(elem.name) else: - message += MessageSegment( - type=elem.__class__.__name__.lower(), data=asdict(elem) # noqa - ) + if TYPE_CHECKING: + assert isinstance(elem, (Markdown, Markup)) + message += MessageSegment(type=elem.__class__.__name__.lower(), data=asdict(elem)) # noqa self._adapter.post_event( MessageEvent( time=event.time, diff --git a/nonebot/adapters/console/bot.py b/nonebot/adapters/console/bot.py index 09c6627..84e800c 100644 --- a/nonebot/adapters/console/bot.py +++ b/nonebot/adapters/console/bot.py @@ -48,9 +48,7 @@ async def send( full_message = Message() full_message += message - return await self.send_msg( - user_id=event.user.nickname, message=full_message, **kwargs - ) + return await self.send_msg(user_id=event.user.nickname, message=full_message, **kwargs) async def send_msg(self, *, user_id: str, message: Message, **kwargs: Any) -> None: elements = [] @@ -63,9 +61,7 @@ async def send_msg(self, *, user_id: str, message: Message, **kwargs: Any) -> No elements.append(Markdown(**seg.data)) elif seg.type == "markup": elements.append(Markup(**seg.data)) - return await self.call_api( - "send_msg", user_id=user_id, message=ConsoleMessage(elements), **kwargs - ) + return await self.call_api("send_msg", user_id=user_id, message=ConsoleMessage(elements), **kwargs) async def handle_event(self, event: Event) -> None: """处理收到的事件""" diff --git a/nonebot/adapters/console/event.py b/nonebot/adapters/console/event.py index e2ae98e..e3942b3 100644 --- a/nonebot/adapters/console/event.py +++ b/nonebot/adapters/console/event.py @@ -1,5 +1,5 @@ from datetime import datetime -from typing import List, Literal +from typing import Literal from typing_extensions import override from nonechat.info import User @@ -68,15 +68,13 @@ def is_tome(self) -> bool: @override def get_event_description(self) -> str: - texts: List[str] = [] - msg_string: List[str] = [] + texts: list[str] = [] + msg_string: list[str] = [] for seg in self.message: if seg.is_text(): texts.append(str(seg)) else: - msg_string.extend( - (escape_tag("".join(texts)), f"{escape_tag(str(seg))}") - ) + msg_string.extend((escape_tag("".join(texts)), f"{escape_tag(str(seg))}")) texts.clear() msg_string.append(escape_tag("".join(texts))) return f"Message from {self.user.nickname} {''.join(msg_string)!r}" diff --git a/nonebot/adapters/console/message.py b/nonebot/adapters/console/message.py index 25066e4..4452090 100644 --- a/nonebot/adapters/console/message.py +++ b/nonebot/adapters/console/message.py @@ -1,5 +1,6 @@ from typing_extensions import Self, override -from typing import Type, Union, Iterable, Optional +from typing import Union, Optional +from collections.abc import Iterable from rich.style import Style from rich.emoji import EmojiVariant @@ -14,32 +15,22 @@ class MessageSegment(BaseMessageSegment["Message"]): @classmethod @override - def get_message_class(cls) -> Type["Message"]: + def get_message_class(cls) -> type["Message"]: return Message @override - def __add__( - self, other: Union[str, "MessageSegment", Iterable["MessageSegment"]] - ) -> "Message": - return Message(self) + ( - MessageSegment.text(other) if isinstance(other, str) else other - ) + def __add__(self, other: Union[str, "MessageSegment", Iterable["MessageSegment"]]) -> "Message": + return Message(self) + (MessageSegment.text(other) if isinstance(other, str) else other) @override - def __radd__( - self, other: Union[str, "MessageSegment", Iterable["MessageSegment"]] - ) -> "Message": - return ( - MessageSegment.text(other) if isinstance(other, str) else Message(other) - ) + self + def __radd__(self, other: Union[str, "MessageSegment", Iterable["MessageSegment"]]) -> "Message": + return (MessageSegment.text(other) if isinstance(other, str) else Message(other)) + self @override def __str__(self) -> str: if self.type == "text": return self.data["text"] - params = ", ".join( - [f"{k}={truncate(str(v))}" for k, v in self.data.items() if v is not None] - ) + params = ", ".join([f"{k}={truncate(str(v))}" for k, v in self.data.items() if v is not None]) return f"[{self.type}{':' if params else ''}{params}]" @override @@ -100,32 +91,20 @@ class Message(BaseMessage[MessageSegment]): @classmethod @override - def get_segment_class(cls) -> Type[MessageSegment]: + def get_segment_class(cls) -> type[MessageSegment]: return MessageSegment @override - def __add__( - self, other: Union[str, MessageSegment, Iterable[MessageSegment]] - ) -> Self: - return super().__add__( - MessageSegment.text(other) if isinstance(other, str) else other - ) + def __add__(self, other: Union[str, MessageSegment, Iterable[MessageSegment]]) -> Self: + return super().__add__(MessageSegment.text(other) if isinstance(other, str) else other) @override - def __radd__( - self, other: Union[str, MessageSegment, Iterable[MessageSegment]] - ) -> Self: - return super().__radd__( - MessageSegment.text(other) if isinstance(other, str) else other - ) + def __radd__(self, other: Union[str, MessageSegment, Iterable[MessageSegment]]) -> Self: + return super().__radd__(MessageSegment.text(other) if isinstance(other, str) else other) @override - def __iadd__( - self, other: Union[str, MessageSegment, Iterable[MessageSegment]] - ) -> Self: - return super().__iadd__( - MessageSegment.text(other) if isinstance(other, str) else other - ) + def __iadd__(self, other: Union[str, MessageSegment, Iterable[MessageSegment]]) -> Self: + return super().__iadd__(MessageSegment.text(other) if isinstance(other, str) else other) @staticmethod @override diff --git a/nonebot/adapters/console/utils.py b/nonebot/adapters/console/utils.py index 3abe4b3..0aa90e6 100644 --- a/nonebot/adapters/console/utils.py +++ b/nonebot/adapters/console/utils.py @@ -3,9 +3,7 @@ log = logger_wrapper("Console") -def truncate( - s: str, length: int = 70, kill_words: bool = True, end: str = "..." -) -> str: +def truncate(s: str, length: int = 70, kill_words: bool = True, end: str = "...") -> str: if len(s) <= length: return s diff --git a/pdm.lock b/pdm.lock index 0dae960..b39bf6f 100644 --- a/pdm.lock +++ b/pdm.lock @@ -3,15 +3,21 @@ [metadata] groups = ["default", "dev"] -strategy = ["cross_platform"] -lock_version = "4.4.1" -content_hash = "sha256:dc001d92eb5a0071b8cd1c3749380fbbe014e642611250c9f64a88866ed74273" +strategy = [] +lock_version = "4.5.0" +content_hash = "sha256:ec8ff2d897f570f7e1791b7eeb1e74b6cc3c3898d9f81c9c9edc0b1cc6ee4200" + +[[metadata.targets]] +requires_python = "~=3.9" [[package]] name = "annotated-types" version = "0.7.0" requires_python = ">=3.8" summary = "Reusable constraint types to use with typing.Annotated" +dependencies = [ + "typing-extensions>=4.0.0; python_version < \"3.9\"", +] files = [ {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, @@ -19,7 +25,7 @@ files = [ [[package]] name = "black" -version = "24.4.2" +version = "24.8.0" requires_python = ">=3.8" summary = "The uncompromising code formatter." dependencies = [ @@ -32,24 +38,24 @@ dependencies = [ "typing-extensions>=4.0.1; python_version < \"3.11\"", ] files = [ - {file = "black-24.4.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dd1b5a14e417189db4c7b64a6540f31730713d173f0b63e55fabd52d61d8fdce"}, - {file = "black-24.4.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e537d281831ad0e71007dcdcbe50a71470b978c453fa41ce77186bbe0ed6021"}, - {file = "black-24.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaea3008c281f1038edb473c1aa8ed8143a5535ff18f978a318f10302b254063"}, - {file = "black-24.4.2-cp310-cp310-win_amd64.whl", hash = "sha256:7768a0dbf16a39aa5e9a3ded568bb545c8c2727396d063bbaf847df05b08cd96"}, - {file = "black-24.4.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:257d724c2c9b1660f353b36c802ccece186a30accc7742c176d29c146df6e474"}, - {file = "black-24.4.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bdde6f877a18f24844e381d45e9947a49e97933573ac9d4345399be37621e26c"}, - {file = "black-24.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e151054aa00bad1f4e1f04919542885f89f5f7d086b8a59e5000e6c616896ffb"}, - {file = "black-24.4.2-cp311-cp311-win_amd64.whl", hash = "sha256:7e122b1c4fb252fd85df3ca93578732b4749d9be076593076ef4d07a0233c3e1"}, - {file = "black-24.4.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:accf49e151c8ed2c0cdc528691838afd217c50412534e876a19270fea1e28e2d"}, - {file = "black-24.4.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:88c57dc656038f1ab9f92b3eb5335ee9b021412feaa46330d5eba4e51fe49b04"}, - {file = "black-24.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be8bef99eb46d5021bf053114442914baeb3649a89dc5f3a555c88737e5e98fc"}, - {file = "black-24.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:415e686e87dbbe6f4cd5ef0fbf764af7b89f9057b97c908742b6008cc554b9c0"}, - {file = "black-24.4.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37aae07b029fa0174d39daf02748b379399b909652a806e5708199bd93899da1"}, - {file = "black-24.4.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:da33a1a5e49c4122ccdfd56cd021ff1ebc4a1ec4e2d01594fef9b6f267a9e741"}, - {file = "black-24.4.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ef703f83fc32e131e9bcc0a5094cfe85599e7109f896fe8bc96cc402f3eb4b6e"}, - {file = "black-24.4.2-cp39-cp39-win_amd64.whl", hash = "sha256:b9176b9832e84308818a99a561e90aa479e73c523b3f77afd07913380ae2eab7"}, - {file = "black-24.4.2-py3-none-any.whl", hash = "sha256:d36ed1124bb81b32f8614555b34cc4259c3fbc7eec17870e8ff8ded335b58d8c"}, - {file = "black-24.4.2.tar.gz", hash = "sha256:c872b53057f000085da66a19c55d68f6f8ddcac2642392ad3a355878406fbd4d"}, + {file = "black-24.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:09cdeb74d494ec023ded657f7092ba518e8cf78fa8386155e4a03fdcc44679e6"}, + {file = "black-24.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:81c6742da39f33b08e791da38410f32e27d632260e599df7245cccee2064afeb"}, + {file = "black-24.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:707a1ca89221bc8a1a64fb5e15ef39cd755633daa672a9db7498d1c19de66a42"}, + {file = "black-24.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d6417535d99c37cee4091a2f24eb2b6d5ec42b144d50f1f2e436d9fe1916fe1a"}, + {file = "black-24.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fb6e2c0b86bbd43dee042e48059c9ad7830abd5c94b0bc518c0eeec57c3eddc1"}, + {file = "black-24.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:837fd281f1908d0076844bc2b801ad2d369c78c45cf800cad7b61686051041af"}, + {file = "black-24.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:62e8730977f0b77998029da7971fa896ceefa2c4c4933fcd593fa599ecbf97a4"}, + {file = "black-24.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:72901b4913cbac8972ad911dc4098d5753704d1f3c56e44ae8dce99eecb0e3af"}, + {file = "black-24.8.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:7c046c1d1eeb7aea9335da62472481d3bbf3fd986e093cffd35f4385c94ae368"}, + {file = "black-24.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:649f6d84ccbae73ab767e206772cc2d7a393a001070a4c814a546afd0d423aed"}, + {file = "black-24.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2b59b250fdba5f9a9cd9d0ece6e6d993d91ce877d121d161e4698af3eb9c1018"}, + {file = "black-24.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:6e55d30d44bed36593c3163b9bc63bf58b3b30e4611e4d88a0c3c239930ed5b2"}, + {file = "black-24.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:eab4dd44ce80dea27dc69db40dab62d4ca96112f87996bca68cd75639aeb2e4c"}, + {file = "black-24.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3c4285573d4897a7610054af5a890bde7c65cb466040c5f0c8b732812d7f0e5e"}, + {file = "black-24.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9e84e33b37be070ba135176c123ae52a51f82306def9f7d063ee302ecab2cf47"}, + {file = "black-24.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:73bbf84ed136e45d451a260c6b73ed674652f90a2b3211d6a35e78054563a9bb"}, + {file = "black-24.8.0-py3-none-any.whl", hash = "sha256:972085c618ee94f402da1af548a4f218c754ea7e5dc70acb168bfaca4c2542ed"}, + {file = "black-24.8.0.tar.gz", hash = "sha256:2500945420b6784c38b9ee885af039f5e7471ef284ab03fa35ecdde4688cd83f"}, ] [[package]] @@ -69,6 +75,7 @@ requires_python = ">=3.7" summary = "Composable command line interface toolkit" dependencies = [ "colorama; platform_system == \"Windows\"", + "importlib-metadata; python_version < \"3.8\"", ] files = [ {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, @@ -124,19 +131,6 @@ files = [ {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] -[[package]] -name = "importlib-metadata" -version = "7.1.0" -requires_python = ">=3.8" -summary = "Read metadata from Python packages" -dependencies = [ - "zipp>=0.5", -] -files = [ - {file = "importlib_metadata-7.1.0-py3-none-any.whl", hash = "sha256:30962b96c0c223483ed6cc7280e7f0199feb01a0e40cfae4d4450fc6fab1f570"}, - {file = "importlib_metadata-7.1.0.tar.gz", hash = "sha256:b78938b926ee8d5f020fc4772d487045805a55ddbad2ecf21c6d60938dc7fcd2"}, -] - [[package]] name = "isort" version = "5.13.2" @@ -166,6 +160,7 @@ version = "0.7.2" requires_python = ">=3.5" summary = "Python logging made (stupidly) simple" dependencies = [ + "aiocontextvars>=0.2.0; python_version < \"3.7\"", "colorama>=0.3.4; sys_platform == \"win32\"", "win32-setctime>=1.0.0; sys_platform == \"win32\"", ] @@ -318,7 +313,7 @@ files = [ [[package]] name = "nonebot2" -version = "2.3.1" +version = "2.3.2" requires_python = "<4.0,>=3.9" summary = "An asynchronous python bot framework." dependencies = [ @@ -331,21 +326,21 @@ dependencies = [ "yarl<2.0.0,>=1.7.2", ] files = [ - {file = "nonebot2-2.3.1-py3-none-any.whl", hash = "sha256:91ac0abebe6c403c2443b11a49e065b79e6199460bdd61a32148366b35f81c4d"}, - {file = "nonebot2-2.3.1.tar.gz", hash = "sha256:ac5a1a1759f15310e9183b606ce6bdbe52a90287bf36a69201be548e23d41e6c"}, + {file = "nonebot2-2.3.2-py3-none-any.whl", hash = "sha256:c51aa3c1f23d8062ce6d13c8423dcb9a8bf0c44f21687916095f825da79a9a55"}, + {file = "nonebot2-2.3.2.tar.gz", hash = "sha256:af52e27e03e7fe147f2b642151eec81f264d058efe53b974eb08b5d90177cd14"}, ] [[package]] name = "nonechat" -version = "0.2.1" -requires_python = "<4.0,>=3.8" +version = "0.3.0" +requires_python = "<4.0,>=3.9" summary = "Awesome chat console using Textual" dependencies = [ - "textual~=0.29.0", + "textual>=0.76.0", ] files = [ - {file = "nonechat-0.2.1-py3-none-any.whl", hash = "sha256:458e294dcc7e06f624bf8102b84ee14f45edf87f7b574379db320fd08fef805a"}, - {file = "nonechat-0.2.1.tar.gz", hash = "sha256:5c5ec15cb6ece2d5374575cace807d35a760017c060213d6bfb7ace5da3cdf35"}, + {file = "nonechat-0.3.0-py3-none-any.whl", hash = "sha256:4091c90a9a718a3b8a9db49ea2d6b779926e6246f25dd0bea2033d5b364a9d06"}, + {file = "nonechat-0.3.0.tar.gz", hash = "sha256:a8e66d6a3d8ce1597464293c04aec69cc84caaecde58b906553c9268dac0777e"}, ] [[package]] @@ -406,7 +401,7 @@ files = [ [[package]] name = "pre-commit" -version = "3.7.1" +version = "3.8.0" requires_python = ">=3.9" summary = "A framework for managing and maintaining multi-language pre-commit hooks." dependencies = [ @@ -417,8 +412,8 @@ dependencies = [ "virtualenv>=20.10.0", ] files = [ - {file = "pre_commit-3.7.1-py2.py3-none-any.whl", hash = "sha256:fae36fd1d7ad7d6a5a1c0b0d5adb2ed1a3bda5a21bf6c3e5372073d7a11cd4c5"}, - {file = "pre_commit-3.7.1.tar.gz", hash = "sha256:8ca3ad567bc78a4972a3f1a477e94a79d4597e8140a6e0b651c5e33899c3654a"}, + {file = "pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f"}, + {file = "pre_commit-3.8.0.tar.gz", hash = "sha256:8bb6494d4a20423842e198980c9ecf9f96607a07ea29549e180eef9ae80fe7af"}, ] [[package]] @@ -604,6 +599,7 @@ summary = "Render rich text, tables, progress bars, syntax highlighting, markdow dependencies = [ "markdown-it-py>=2.2.0", "pygments<3.0.0,>=2.13.0", + "typing-extensions<5.0,>=4.0.0; python_version < \"3.9\"", ] files = [ {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"}, @@ -612,43 +608,43 @@ files = [ [[package]] name = "ruff" -version = "0.4.6" +version = "0.5.7" requires_python = ">=3.7" summary = "An extremely fast Python linter and code formatter, written in Rust." files = [ - {file = "ruff-0.4.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ef995583a038cd4a7edf1422c9e19118e2511b8ba0b015861b4abd26ec5367c5"}, - {file = "ruff-0.4.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:602ebd7ad909eab6e7da65d3c091547781bb06f5f826974a53dbe563d357e53c"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f9ced5cbb7510fd7525448eeb204e0a22cabb6e99a3cb160272262817d49786"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:04a80acfc862e0e1630c8b738e70dcca03f350bad9e106968a8108379e12b31f"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:be47700ecb004dfa3fd4dcdddf7322d4e632de3c06cd05329d69c45c0280e618"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:1ff930d6e05f444090a0139e4e13e1e2e1f02bd51bb4547734823c760c621e79"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f13410aabd3b5776f9c5699f42b37a3a348d65498c4310589bc6e5c548dc8a2f"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0cf5cc02d3ae52dfb0c8a946eb7a1d6ffe4d91846ffc8ce388baa8f627e3bd50"}, - {file = "ruff-0.4.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ea3424793c29906407e3cf417f28fc33f689dacbbadfb52b7e9a809dd535dcef"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:1fa8561489fadf483ffbb091ea94b9c39a00ed63efacd426aae2f197a45e67fc"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:4d5b914818d8047270308fe3e85d9d7f4a31ec86c6475c9f418fbd1624d198e0"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:4f02284335c766678778475e7698b7ab83abaf2f9ff0554a07b6f28df3b5c259"}, - {file = "ruff-0.4.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3a6a0a4f4b5f54fff7c860010ab3dd81425445e37d35701a965c0248819dde7a"}, - {file = "ruff-0.4.6-py3-none-win32.whl", hash = "sha256:9018bf59b3aa8ad4fba2b1dc0299a6e4e60a4c3bc62bbeaea222679865453062"}, - {file = "ruff-0.4.6-py3-none-win_amd64.whl", hash = "sha256:a769ae07ac74ff1a019d6bd529426427c3e30d75bdf1e08bb3d46ac8f417326a"}, - {file = "ruff-0.4.6-py3-none-win_arm64.whl", hash = "sha256:735a16407a1a8f58e4c5b913ad6102722e80b562dd17acb88887685ff6f20cf6"}, - {file = "ruff-0.4.6.tar.gz", hash = "sha256:a797a87da50603f71e6d0765282098245aca6e3b94b7c17473115167d8dfb0b7"}, + {file = "ruff-0.5.7-py3-none-linux_armv6l.whl", hash = "sha256:548992d342fc404ee2e15a242cdbea4f8e39a52f2e7752d0e4cbe88d2d2f416a"}, + {file = "ruff-0.5.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00cc8872331055ee017c4f1071a8a31ca0809ccc0657da1d154a1d2abac5c0be"}, + {file = "ruff-0.5.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eaf3d86a1fdac1aec8a3417a63587d93f906c678bb9ed0b796da7b59c1114a1e"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a01c34400097b06cf8a6e61b35d6d456d5bd1ae6961542de18ec81eaf33b4cb8"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fcc8054f1a717e2213500edaddcf1dbb0abad40d98e1bd9d0ad364f75c763eea"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f70284e73f36558ef51602254451e50dd6cc479f8b6f8413a95fcb5db4a55fc"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:a78ad870ae3c460394fc95437d43deb5c04b5c29297815a2a1de028903f19692"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9ccd078c66a8e419475174bfe60a69adb36ce04f8d4e91b006f1329d5cd44bcf"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7e31c9bad4ebf8fdb77b59cae75814440731060a09a0e0077d559a556453acbb"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d796327eed8e168164346b769dd9a27a70e0298d667b4ecee6877ce8095ec8e"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:4a09ea2c3f7778cc635e7f6edf57d566a8ee8f485f3c4454db7771efb692c499"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a36d8dcf55b3a3bc353270d544fb170d75d2dff41eba5df57b4e0b67a95bb64e"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9369c218f789eefbd1b8d82a8cf25017b523ac47d96b2f531eba73770971c9e5"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b88ca3db7eb377eb24fb7c82840546fb7acef75af4a74bd36e9ceb37a890257e"}, + {file = "ruff-0.5.7-py3-none-win32.whl", hash = "sha256:33d61fc0e902198a3e55719f4be6b375b28f860b09c281e4bdbf783c0566576a"}, + {file = "ruff-0.5.7-py3-none-win_amd64.whl", hash = "sha256:083bbcbe6fadb93cd86709037acc510f86eed5a314203079df174c40bbbca6b3"}, + {file = "ruff-0.5.7-py3-none-win_arm64.whl", hash = "sha256:2dca26154ff9571995107221d0aeaad0e75a77b5a682d6236cf89a58c70b76f4"}, + {file = "ruff-0.5.7.tar.gz", hash = "sha256:8dfc0a458797f5d9fb622dd0efc52d796f23f0a1493a9527f4e49a550ae9a7e5"}, ] [[package]] name = "textual" -version = "0.29.0" -requires_python = ">=3.7,<4.0" +version = "0.76.0" +requires_python = "<4.0.0,>=3.8.1" summary = "Modern Text User Interface framework" dependencies = [ - "importlib-metadata>=4.11.3", "markdown-it-py[linkify,plugins]>=2.1.0", "rich>=13.3.3", "typing-extensions<5.0.0,>=4.4.0", ] files = [ - {file = "textual-0.29.0-py3-none-any.whl", hash = "sha256:949fd8f16a412404ba785605dda1e2fab8166656e4d29d4177ec63cd73ba83d4"}, - {file = "textual-0.29.0.tar.gz", hash = "sha256:7eb87b6d007dc9bd08e00e893b860ecb7a11ca815c8866db39fe17ec547e2fcf"}, + {file = "textual-0.76.0-py3-none-any.whl", hash = "sha256:e2035609c889dba507d34a5d7b333f1c8c53a29fb170962cb92101507663517a"}, + {file = "textual-0.76.0.tar.gz", hash = "sha256:b12e8879d591090c0901b5cb8121d086e28e677353b368292d3865ec99b83b70"}, ] [[package]] @@ -663,12 +659,12 @@ files = [ [[package]] name = "typing-extensions" -version = "4.12.0" +version = "4.12.2" requires_python = ">=3.8" summary = "Backported and Experimental Type Hints for Python 3.8+" files = [ - {file = "typing_extensions-4.12.0-py3-none-any.whl", hash = "sha256:b349c66bea9016ac22978d800cfff206d5f9816951f12a7d0ec5578b0a819594"}, - {file = "typing_extensions-4.12.0.tar.gz", hash = "sha256:8cbcdc8606ebcb0d95453ad7dc5065e6237b6aa230a31e81d0f440c30fed5fd8"}, + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, ] [[package]] @@ -689,6 +685,7 @@ summary = "Virtual Python Environment builder" dependencies = [ "distlib<1,>=0.3.7", "filelock<4,>=3.12.2", + "importlib-metadata>=6.6; python_version < \"3.8\"", "platformdirs<5,>=3.9.1", ] files = [ @@ -700,6 +697,9 @@ files = [ name = "wcwidth" version = "0.2.13" summary = "Measures the displayed width of unicode strings in a terminal" +dependencies = [ + "backports-functools-lru-cache>=1.2.1; python_version < \"3.2\"", +] files = [ {file = "wcwidth-0.2.13-py2.py3-none-any.whl", hash = "sha256:3da69048e4540d84af32131829ff948f1e022c1c6bdb8d6102117aac784f6859"}, {file = "wcwidth-0.2.13.tar.gz", hash = "sha256:72ea0c06399eb286d978fdedb6923a9eb47e1c486ce63e9b4e64fc18303972b5"}, @@ -723,6 +723,7 @@ summary = "Yet another URL library" dependencies = [ "idna>=2.0", "multidict>=4.0", + "typing-extensions>=3.7.4; python_version < \"3.8\"", ] files = [ {file = "yarl-1.9.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a8c1df72eb746f4136fe9a2e72b0c9dc1da1cbd23b5372f94b5820ff8ae30e0e"}, @@ -788,13 +789,3 @@ files = [ {file = "yarl-1.9.4-py3-none-any.whl", hash = "sha256:928cecb0ef9d5a7946eb6ff58417ad2fe9375762382f1bf5c55e61645f2c43ad"}, {file = "yarl-1.9.4.tar.gz", hash = "sha256:566db86717cf8080b99b58b083b773a908ae40f06681e87e589a976faf8246bf"}, ] - -[[package]] -name = "zipp" -version = "3.19.0" -requires_python = ">=3.8" -summary = "Backport of pathlib-compatible object wrapper for zip files" -files = [ - {file = "zipp-3.19.0-py3-none-any.whl", hash = "sha256:96dc6ad62f1441bcaccef23b274ec471518daf4fbbc580341204936a5a3dddec"}, - {file = "zipp-3.19.0.tar.gz", hash = "sha256:952df858fb3164426c976d9338d3961e8e8b3758e2e059e0f754b8c4262625ee"}, -] diff --git a/pyproject.toml b/pyproject.toml index e16eaf0..9c82fbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,10 +12,9 @@ authors = [ { name = "yanyongyu", email = "yyy@nonebot.dev" }, ] dependencies = [ - "nonechat<1.0.0,>=0.2.0", - "nonebot2<3.0.0,>=2.2.0", + "nonechat<1.0.0,>=0.3.0", + "nonebot2<3.0.0,>=2.3.0", "typing-extensions>=4.7.1", - "pydantic>=1.10.0,<3.0.0,!=2.5.0,!=2.5.1", ] requires-python = ">=3.9,<4.0" readme = "README.md" @@ -26,31 +25,32 @@ includes = ["nonebot"] [tool.pdm.dev-dependencies] dev = [ - "isort<6.0,>=5.10.1", - "black<25.0,>=24.0.0", - "nonemoji<0.2,>=0.1.3", - "pre-commit<4.0,>=3.1.0", - "ruff~=0.4.0", + "isort>=5.13.2", + "black>=24.4.2", + "loguru>=0.7.2", + "ruff>=0.4.2", + "nonemoji<0.2,>=0.1.3", + "pre-commit<4.0,>=3.1.0", ] [tool.black] -line-length = 88 -target-version = ["py38", "py39", "py310", "py311", "py312"] +line-length = 110 +target-version = ["py39", "py310", "py311", "py312"] include = '\.pyi?$' extend-exclude = ''' ''' [tool.isort] profile = "black" -line_length = 88 +line_length = 110 length_sort = true skip_gitignore = true force_sort_within_sections = true extra_standard_library = ["typing_extensions"] [tool.ruff] -line-length = 88 -target-version = "py38" +line-length = 110 +target-version = "py39" [tool.ruff.lint] select = ["E", "W", "F", "UP", "C", "T", "PYI", "PT", "Q"] @@ -61,7 +61,7 @@ fixture-parentheses = false mark-parentheses = false [tool.pyright] -pythonVersion = "3.8" +pythonVersion = "3.9" pythonPlatform = "All" defineConstant = { PYDANTIC_V2 = true }