🐛 Lint: 修复 async 函数返回值 (#3364)

This commit is contained in:
Ju4tCode 2025-03-12 11:24:37 +08:00 committed by GitHub
parent dc42a6acca
commit c91fdad9f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,10 +17,11 @@ FrontMatter:
description: nonebot.drivers.websockets 模块 description: nonebot.drivers.websockets 模块
""" """
from collections.abc import AsyncGenerator, Coroutine from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from functools import wraps from functools import wraps
import logging import logging
from types import CoroutineType
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union
from typing_extensions import ParamSpec, override from typing_extensions import ParamSpec, override
@ -47,8 +48,8 @@ logger.addHandler(LoguruHandler())
def catch_closed( def catch_closed(
func: Callable[P, Coroutine[Any, Any, T]], func: Callable[P, "CoroutineType[Any, Any, T]"],
) -> Callable[P, Coroutine[Any, Any, T]]: ) -> Callable[P, "CoroutineType[Any, Any, T]"]:
@wraps(func) @wraps(func)
async def decorator(*args: P.args, **kwargs: P.kwargs) -> T: async def decorator(*args: P.args, **kwargs: P.kwargs) -> T:
try: try: