mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 04:56:57 +08:00
♻️ reorganize internal tree
This commit is contained in:
parent
65dc9a908b
commit
118519e15d
@ -22,12 +22,12 @@ except ImportError:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from nonebot.internal.bot import Bot as Bot
|
from nonebot.internal.adapter import Bot as Bot
|
||||||
from nonebot.internal.event import Event as Event
|
from nonebot.internal.adapter import Event as Event
|
||||||
from nonebot.internal.adapter import Adapter as Adapter
|
from nonebot.internal.adapter import Adapter as Adapter
|
||||||
from nonebot.internal.message import Message as Message
|
from nonebot.internal.adapter import Message as Message
|
||||||
from nonebot.internal.message import MessageSegment as MessageSegment
|
from nonebot.internal.adapter import MessageSegment as MessageSegment
|
||||||
from nonebot.internal.template import MessageTemplate as MessageTemplate
|
from nonebot.internal.adapter import MessageTemplate as MessageTemplate
|
||||||
|
|
||||||
__autodoc__ = {
|
__autodoc__ = {
|
||||||
"Bot": True,
|
"Bot": True,
|
||||||
|
@ -7,19 +7,19 @@ FrontMatter:
|
|||||||
description: nonebot.drivers 模块
|
description: nonebot.drivers 模块
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from nonebot.internal.model import URL as URL
|
from nonebot.internal.driver import URL as URL
|
||||||
from nonebot.internal.driver import Driver as Driver
|
from nonebot.internal.driver import Driver as Driver
|
||||||
from nonebot.internal.model import Cookies as Cookies
|
from nonebot.internal.driver import Cookies as Cookies
|
||||||
from nonebot.internal.model import Request as Request
|
from nonebot.internal.driver import Request as Request
|
||||||
from nonebot.internal.model import Response as Response
|
from nonebot.internal.driver import Response as Response
|
||||||
from nonebot.internal.model import WebSocket as WebSocket
|
from nonebot.internal.driver import WebSocket as WebSocket
|
||||||
from nonebot.internal.model import HTTPVersion as HTTPVersion
|
from nonebot.internal.driver import HTTPVersion as HTTPVersion
|
||||||
from nonebot.internal.driver import ForwardMixin as ForwardMixin
|
from nonebot.internal.driver import ForwardMixin as ForwardMixin
|
||||||
from nonebot.internal.driver import ForwardDriver as ForwardDriver
|
from nonebot.internal.driver import ForwardDriver as ForwardDriver
|
||||||
from nonebot.internal.driver import ReverseDriver as ReverseDriver
|
from nonebot.internal.driver import ReverseDriver as ReverseDriver
|
||||||
from nonebot.internal.driver import combine_driver as combine_driver
|
from nonebot.internal.driver import combine_driver as combine_driver
|
||||||
from nonebot.internal.model import HTTPServerSetup as HTTPServerSetup
|
from nonebot.internal.driver import HTTPServerSetup as HTTPServerSetup
|
||||||
from nonebot.internal.model import WebSocketServerSetup as WebSocketServerSetup
|
from nonebot.internal.driver import WebSocketServerSetup as WebSocketServerSetup
|
||||||
|
|
||||||
__autodoc__ = {
|
__autodoc__ = {
|
||||||
"URL": True,
|
"URL": True,
|
||||||
|
@ -21,8 +21,8 @@ from starlette.websockets import WebSocket, WebSocketState, WebSocketDisconnect
|
|||||||
|
|
||||||
from nonebot.config import Env
|
from nonebot.config import Env
|
||||||
from nonebot.typing import overrides
|
from nonebot.typing import overrides
|
||||||
from nonebot.internal.model import FileTypes
|
|
||||||
from nonebot.exception import WebSocketClosed
|
from nonebot.exception import WebSocketClosed
|
||||||
|
from nonebot.internal.driver import FileTypes
|
||||||
from nonebot.config import Config as NoneBotConfig
|
from nonebot.config import Config as NoneBotConfig
|
||||||
from nonebot.drivers import Request as BaseRequest
|
from nonebot.drivers import Request as BaseRequest
|
||||||
from nonebot.drivers import WebSocket as BaseWebSocket
|
from nonebot.drivers import WebSocket as BaseWebSocket
|
||||||
|
@ -24,8 +24,8 @@ from pydantic import BaseSettings
|
|||||||
|
|
||||||
from nonebot.config import Env
|
from nonebot.config import Env
|
||||||
from nonebot.typing import overrides
|
from nonebot.typing import overrides
|
||||||
from nonebot.internal.model import FileTypes
|
|
||||||
from nonebot.exception import WebSocketClosed
|
from nonebot.exception import WebSocketClosed
|
||||||
|
from nonebot.internal.driver import FileTypes
|
||||||
from nonebot.config import Config as NoneBotConfig
|
from nonebot.config import Config as NoneBotConfig
|
||||||
from nonebot.drivers import Request as BaseRequest
|
from nonebot.drivers import Request as BaseRequest
|
||||||
from nonebot.drivers import WebSocket as BaseWebSocket
|
from nonebot.drivers import WebSocket as BaseWebSocket
|
||||||
|
6
nonebot/internal/adapter/__init__.py
Normal file
6
nonebot/internal/adapter/__init__.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from .bot import Bot as Bot
|
||||||
|
from .event import Event as Event
|
||||||
|
from .adapter import Adapter as Adapter
|
||||||
|
from .message import Message as Message
|
||||||
|
from .message import MessageSegment as MessageSegment
|
||||||
|
from .template import MessageTemplate as MessageTemplate
|
@ -3,7 +3,7 @@ from contextlib import asynccontextmanager
|
|||||||
from typing import Any, Dict, AsyncGenerator
|
from typing import Any, Dict, AsyncGenerator
|
||||||
|
|
||||||
from nonebot.config import Config
|
from nonebot.config import Config
|
||||||
from nonebot.drivers import (
|
from nonebot.internal.driver import (
|
||||||
Driver,
|
Driver,
|
||||||
Request,
|
Request,
|
||||||
Response,
|
Response,
|
25
nonebot/internal/driver/__init__.py
Normal file
25
nonebot/internal/driver/__init__.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from .model import URL as URL
|
||||||
|
from .model import RawURL as RawURL
|
||||||
|
from .driver import Driver as Driver
|
||||||
|
from .model import Cookies as Cookies
|
||||||
|
from .model import Request as Request
|
||||||
|
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 .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 .driver import ForwardMixin as ForwardMixin
|
||||||
|
from .model import QueryVariable as QueryVariable
|
||||||
|
from .driver import ForwardDriver as ForwardDriver
|
||||||
|
from .driver import ReverseDriver as ReverseDriver
|
||||||
|
from .driver import combine_driver as combine_driver
|
||||||
|
from .model import HTTPServerSetup as HTTPServerSetup
|
||||||
|
from .model import WebSocketServerSetup as WebSocketServerSetup
|
@ -8,13 +8,12 @@ from nonebot.utils import escape_tag
|
|||||||
from nonebot.config import Env, Config
|
from nonebot.config import Env, Config
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.typing import T_BotConnectionHook, T_BotDisconnectionHook
|
from nonebot.typing import T_BotConnectionHook, T_BotDisconnectionHook
|
||||||
|
from nonebot.internal.params import BotParam, DependParam, DefaultParam
|
||||||
|
|
||||||
from .params import BotParam, DependParam, DefaultParam
|
|
||||||
from .model import Request, Response, WebSocket, HTTPServerSetup, WebSocketServerSetup
|
from .model import Request, Response, WebSocket, HTTPServerSetup, WebSocketServerSetup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .bot import Bot
|
from nonebot.internal.adapter import Bot, Adapter
|
||||||
from .adapter import Adapter
|
|
||||||
|
|
||||||
|
|
||||||
BOT_HOOK_PARAMS = [DependParam, BotParam, DefaultParam]
|
BOT_HOOK_PARAMS = [DependParam, BotParam, DefaultParam]
|
@ -42,12 +42,9 @@ from nonebot.exception import (
|
|||||||
RejectedException,
|
RejectedException,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .bot import Bot
|
|
||||||
from .rule import Rule
|
from .rule import Rule
|
||||||
from .event import Event
|
|
||||||
from .template import MessageTemplate
|
|
||||||
from .permission import USER, Permission
|
from .permission import USER, Permission
|
||||||
from .message import Message, MessageSegment
|
from .adapter import Bot, Event, Message, MessageSegment, MessageTemplate
|
||||||
from .params import (
|
from .params import (
|
||||||
Depends,
|
Depends,
|
||||||
ArgParam,
|
ArgParam,
|
||||||
|
@ -2,11 +2,11 @@ import asyncio
|
|||||||
from contextlib import AsyncExitStack
|
from contextlib import AsyncExitStack
|
||||||
from typing import Any, Set, Tuple, Union, NoReturn, Optional, Coroutine
|
from typing import Any, Set, Tuple, Union, NoReturn, Optional, Coroutine
|
||||||
|
|
||||||
from nonebot.adapters import Bot, Event
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.exception import SkippedException
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.typing import T_DependencyCache, T_PermissionChecker
|
from nonebot.typing import T_DependencyCache, T_PermissionChecker
|
||||||
|
|
||||||
|
from .adapter import Bot, Event
|
||||||
from .params import BotParam, EventParam, DependParam, DefaultParam
|
from .params import BotParam, EventParam, DependParam, DefaultParam
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@ import asyncio
|
|||||||
from contextlib import AsyncExitStack
|
from contextlib import AsyncExitStack
|
||||||
from typing import Set, Union, NoReturn, Optional
|
from typing import Set, Union, NoReturn, Optional
|
||||||
|
|
||||||
from nonebot.adapters import Bot, Event
|
|
||||||
from nonebot.dependencies import Dependent
|
from nonebot.dependencies import Dependent
|
||||||
from nonebot.exception import SkippedException
|
from nonebot.exception import SkippedException
|
||||||
from nonebot.typing import T_State, T_RuleChecker, T_DependencyCache
|
from nonebot.typing import T_State, T_RuleChecker, T_DependencyCache
|
||||||
|
|
||||||
|
from .adapter import Bot, Event
|
||||||
from .params import BotParam, EventParam, StateParam, DependParam, DefaultParam
|
from .params import BotParam, EventParam, StateParam, DependParam, DefaultParam
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user