🚨 Develop: 完全使用 ruff 替代 isort 与 black (#3151)

This commit is contained in:
Ju4tCode
2024-12-01 12:31:11 +08:00
committed by GitHub
parent 6dad4d2a74
commit 081dc8352d
83 changed files with 1815 additions and 1769 deletions

View File

@ -1,31 +1,31 @@
from .model import URL as URL
from .model import RawURL as RawURL
from .abstract import Mixin as Mixin
from .model import Cookies as Cookies
from .model import Request as Request
from .abstract import Driver as Driver
from .model import FileType as FileType
from .model import Response as Response
from .model import DataTypes as DataTypes
from .model import FileTypes as FileTypes
from .model import WebSocket as WebSocket
from .model import FilesTypes as FilesTypes
from .model import QueryTypes as QueryTypes
from .abstract import ASGIMixin as ASGIMixin
from .model import CookieTypes as CookieTypes
from .model import FileContent as FileContent
from .model import HTTPVersion as HTTPVersion
from .model import HeaderTypes as HeaderTypes
from .model import SimpleQuery as SimpleQuery
from .model import ContentTypes as ContentTypes
from .model import QueryVariable as QueryVariable
from .abstract import ForwardMixin as ForwardMixin
from .abstract import ReverseMixin as ReverseMixin
from .abstract import Driver as Driver
from .abstract import ForwardDriver as ForwardDriver
from .abstract import ReverseDriver as ReverseDriver
from .combine import combine_driver as combine_driver
from .model import HTTPServerSetup as HTTPServerSetup
from .abstract import ForwardMixin as ForwardMixin
from .abstract import HTTPClientMixin as HTTPClientMixin
from .abstract import HTTPClientSession as HTTPClientSession
from .model import WebSocketServerSetup as WebSocketServerSetup
from .abstract import Mixin as Mixin
from .abstract import ReverseDriver as ReverseDriver
from .abstract import ReverseMixin as ReverseMixin
from .abstract import WebSocketClientMixin as WebSocketClientMixin
from .combine import combine_driver as combine_driver
from .model import URL as URL
from .model import ContentTypes as ContentTypes
from .model import Cookies as Cookies
from .model import CookieTypes as CookieTypes
from .model import DataTypes as DataTypes
from .model import FileContent as FileContent
from .model import FilesTypes as FilesTypes
from .model import FileType as FileType
from .model import FileTypes as FileTypes
from .model import HeaderTypes as HeaderTypes
from .model import HTTPServerSetup as HTTPServerSetup
from .model import HTTPVersion as HTTPVersion
from .model import QueryTypes as QueryTypes
from .model import QueryVariable as QueryVariable
from .model import RawURL as RawURL
from .model import Request as Request
from .model import Response as Response
from .model import SimpleQuery as SimpleQuery
from .model import WebSocket as WebSocket
from .model import WebSocketServerSetup as WebSocketServerSetup

View File

@ -1,13 +1,13 @@
from collections.abc import Awaitable, Iterable
from types import TracebackType
from typing import Any, Callable, Optional, Union, cast
from typing_extensions import TypeAlias
from collections.abc import Iterable, Awaitable
from typing import Any, Union, Callable, Optional, cast
import anyio
from anyio.abc import TaskGroup
from exceptiongroup import suppress
from nonebot.utils import run_sync, is_coroutine_callable
from nonebot.utils import is_coroutine_callable, run_sync
SYNC_LIFESPAN_FUNC: TypeAlias = Callable[[], Any]
ASYNC_LIFESPAN_FUNC: TypeAlias = Callable[[], Awaitable[Any]]

View File

@ -1,41 +1,41 @@
import abc
from types import TracebackType
from collections.abc import AsyncGenerator
from typing_extensions import Self, TypeAlias
from contextlib import AsyncExitStack, asynccontextmanager
from typing import TYPE_CHECKING, Any, Union, ClassVar, Optional
from types import TracebackType
from typing import TYPE_CHECKING, Any, ClassVar, Optional, Union
from typing_extensions import Self, TypeAlias
from anyio.abc import TaskGroup
from anyio import CancelScope, create_task_group
from anyio.abc import TaskGroup
from exceptiongroup import BaseExceptionGroup, catch
from nonebot.log import logger
from nonebot.config import Env, Config
from nonebot.config import Config, Env
from nonebot.dependencies import Dependent
from nonebot.exception import SkippedException
from nonebot.internal.params import BotParam, DependParam, DefaultParam
from nonebot.utils import escape_tag, run_coro_with_catch, flatten_exception_group
from nonebot.internal.params import BotParam, DefaultParam, DependParam
from nonebot.log import logger
from nonebot.typing import (
T_DependencyCache,
T_BotConnectionHook,
T_BotDisconnectionHook,
T_DependencyCache,
)
from nonebot.utils import escape_tag, flatten_exception_group, run_coro_with_catch
from ._lifespan import LIFESPAN_FUNC, Lifespan
from .model import (
CookieTypes,
HeaderTypes,
HTTPServerSetup,
HTTPVersion,
QueryTypes,
Request,
Response,
WebSocket,
QueryTypes,
CookieTypes,
HeaderTypes,
HTTPVersion,
HTTPServerSetup,
WebSocketServerSetup,
)
if TYPE_CHECKING:
from nonebot.internal.adapter import Bot, Adapter
from nonebot.internal.adapter import Adapter, Bot
BOT_HOOK_PARAMS = [DependParam, BotParam, DefaultParam]

View File

@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, Union, TypeVar, overload
from typing import TYPE_CHECKING, TypeVar, Union, overload
from .abstract import Mixin, Driver
from .abstract import Driver, Mixin
D = TypeVar("D", bound="Driver")
@ -39,6 +39,4 @@ def combine_driver(
+ "+".join(x.type.__get__(self) for x in mixins) # type: ignore
)
return type(
"CombinedDriver", (*mixins, driver), {"type": property(type_)}
) # type: ignore
return type("CombinedDriver", (*mixins, driver), {"type": property(type_)}) # type: ignore

View File

@ -1,14 +1,14 @@
import abc
import urllib.request
from enum import Enum
from collections.abc import Awaitable, Iterator, Mapping, MutableMapping
from dataclasses import dataclass
from typing_extensions import TypeAlias
from enum import Enum
from http.cookiejar import Cookie, CookieJar
from typing import IO, Any, Union, Callable, Optional
from collections.abc import Mapping, Iterator, Awaitable, MutableMapping
from typing import IO, Any, Callable, Optional, Union
from typing_extensions import TypeAlias
import urllib.request
from yarl import URL as URL
from multidict import CIMultiDict
from yarl import URL as URL
RawURL: TypeAlias = tuple[bytes, bytes, Optional[int], bytes]