diff --git a/nonebot/adapters/_bot.py b/nonebot/adapters/_bot.py index 058b9ec8..05762233 100644 --- a/nonebot/adapters/_bot.py +++ b/nonebot/adapters/_bot.py @@ -27,13 +27,11 @@ class Bot(abc.ABC): _calling_api_hook: Set[T_CallingAPIHook] = set() """ - :类型: ``Set[T_CallingAPIHook]`` - :说明: call_api 时执行的函数 + :说明: call_api 时执行的函数 """ _called_api_hook: Set[T_CalledAPIHook] = set() """ - :类型: ``Set[T_CalledAPIHook]`` - :说明: call_api 后执行的函数 + :说明: call_api 后执行的函数 """ def __init__(self, adapter: "Adapter", self_id: str): diff --git a/nonebot/adapters/_message.py b/nonebot/adapters/_message.py index 3175bed8..629215fd 100644 --- a/nonebot/adapters/_message.py +++ b/nonebot/adapters/_message.py @@ -26,13 +26,11 @@ class MessageSegment(Mapping, abc.ABC, Generic[TM]): type: str """ - - 类型: ``str`` - - 说明: 消息段类型 + - 说明: 消息段类型 """ data: Dict[str, Any] = field(default_factory=lambda: {}) """ - - 类型: ``Dict[str, Union[str, list]]`` - - 说明: 消息段数据 + - 说明: 消息段数据 """ @classmethod diff --git a/nonebot/config.py b/nonebot/config.py index 7421457e..65043199 100644 --- a/nonebot/config.py +++ b/nonebot/config.py @@ -137,8 +137,7 @@ class Env(BaseConfig): environment: str = "prod" """ - - **类型**: ``str`` - - **默认值**: ``"prod"`` + - **默认值**: ``"prod"`` :说明: 当前环境名。 NoneBot 将从 ``.env.{environment}`` 文件中加载配置。 @@ -163,8 +162,7 @@ class Config(BaseConfig): # nonebot configs driver: str = "~fastapi" """ - - **类型**: ``str`` - - **默认值**: ``"~fastapi"`` + - **默认值**: ``"~fastapi"`` :说明: @@ -176,8 +174,7 @@ class Config(BaseConfig): """ host: IPvAnyAddress = IPv4Address("127.0.0.1") # type: ignore """ - - **类型**: ``IPvAnyAddress`` - - **默认值**: ``127.0.0.1`` + - **默认值**: ``127.0.0.1`` :说明: @@ -185,8 +182,7 @@ class Config(BaseConfig): """ port: int = 8080 """ - - **类型**: ``int`` - - **默认值**: ``8080`` + - **默认值**: ``8080`` :说明: @@ -194,8 +190,7 @@ class Config(BaseConfig): """ log_level: Union[int, str] = "INFO" """ - - **类型**: ``Union[int, str]`` - - **默认值**: ``INFO`` + - **默认值**: ``INFO`` :说明: @@ -215,8 +210,7 @@ class Config(BaseConfig): # bot connection configs api_timeout: Optional[float] = 30.0 """ - - **类型**: ``Optional[float]`` - - **默认值**: ``30.`` + - **默认值**: ``30.`` :说明: @@ -226,8 +220,7 @@ class Config(BaseConfig): # bot runtime configs superusers: Set[str] = set() """ - - **类型**: ``Set[str]`` - - **默认值**: ``set()`` + - **默认值**: ``set()`` :说明: @@ -241,8 +234,7 @@ class Config(BaseConfig): """ nickname: Set[str] = set() """ - - **类型**: ``Set[str]`` - - **默认值**: ``set()`` + - **默认值**: ``set()`` :说明: @@ -250,8 +242,7 @@ class Config(BaseConfig): """ command_start: Set[str] = {"/"} """ - - **类型**: ``Set[str]`` - - **默认值**: ``{"/"}`` + - **默认值**: ``{"/"}`` :说明: @@ -259,8 +250,7 @@ class Config(BaseConfig): """ command_sep: Set[str] = {"."} """ - - **类型**: ``Set[str]`` - - **默认值**: ``{"."}`` + - **默认值**: ``{"."}`` :说明: @@ -268,8 +258,7 @@ class Config(BaseConfig): """ session_expire_timeout: timedelta = timedelta(minutes=2) """ - - **类型**: ``timedelta`` - - **默认值**: ``timedelta(minutes=2)`` + - **默认值**: ``timedelta(minutes=2)`` :说明: diff --git a/nonebot/drivers/__init__.py b/nonebot/drivers/__init__.py index 7c7bf3a9..cabc3629 100644 --- a/nonebot/drivers/__init__.py +++ b/nonebot/drivers/__init__.py @@ -41,18 +41,15 @@ class Driver(abc.ABC): _adapters: Dict[str, "Adapter"] = {} """ - :类型: ``Dict[str, Adapter]`` - :说明: 已注册的适配器列表 + :说明: 已注册的适配器列表 """ _bot_connection_hook: Set[T_BotConnectionHook] = set() """ - :类型: ``Set[T_BotConnectionHook]`` - :说明: Bot 连接建立时执行的函数 + :说明: Bot 连接建立时执行的函数 """ _bot_disconnection_hook: Set[T_BotDisconnectionHook] = set() """ - :类型: ``Set[T_BotDisconnectionHook]`` - :说明: Bot 连接断开时执行的函数 + :说明: Bot 连接断开时执行的函数 """ def __init__(self, env: Env, config: Config): @@ -64,26 +61,20 @@ class Driver(abc.ABC): """ self.env: str = env.environment """ - :类型: ``str`` - :说明: 环境名称 + :说明: 环境名称 """ self.config: Config = config """ - :类型: ``Config`` - :说明: 配置对象 + :说明: 配置对象 """ self._clients: Dict[str, "Bot"] = {} """ - :类型: ``Dict[str, Bot]`` - :说明: 已连接的 Bot + :说明: 已连接的 Bot """ @property def bots(self) -> Dict[str, "Bot"]: """ - :类型: - - ``Dict[str, Bot]`` :说明: 获取当前所有已连接的 Bot diff --git a/nonebot/drivers/_model.py b/nonebot/drivers/_model.py index 0484e054..68c8424d 100644 --- a/nonebot/drivers/_model.py +++ b/nonebot/drivers/_model.py @@ -168,7 +168,6 @@ class WebSocket(abc.ABC): @abc.abstractmethod def closed(self) -> bool: """ - :类型: ``bool`` :说明: 连接是否已经关闭 """ raise NotImplementedError diff --git a/nonebot/drivers/fastapi.py b/nonebot/drivers/fastapi.py index 882e97b0..8951b3e7 100644 --- a/nonebot/drivers/fastapi.py +++ b/nonebot/drivers/fastapi.py @@ -48,90 +48,54 @@ class Config(BaseSettings): fastapi_openapi_url: Optional[str] = None """ - :类型: - - ``Optional[str]`` - :说明: ``openapi.json`` 地址,默认为 ``None`` 即关闭 """ fastapi_docs_url: Optional[str] = None """ - :类型: - - ``Optional[str]`` - :说明: ``swagger`` 地址,默认为 ``None`` 即关闭 """ fastapi_redoc_url: Optional[str] = None """ - :类型: - - ``Optional[str]`` - :说明: ``redoc`` 地址,默认为 ``None`` 即关闭 """ fastapi_include_adapter_schema: bool = True """ - :类型: - - ``bool`` - :说明: 是否包含适配器路由的 schema,默认为 ``True`` """ fastapi_reload: bool = False """ - :类型: - - ``bool`` - :说明: 开启/关闭冷重载 """ fastapi_reload_dirs: Optional[List[str]] = None """ - :类型: - - ``Optional[List[str]]`` - :说明: 重载监控文件夹列表,默认为 uvicorn 默认值 """ fastapi_reload_delay: Optional[float] = None """ - :类型: - - ``Optional[float]`` - :说明: 重载延迟,默认为 uvicorn 默认值 """ fastapi_reload_includes: Optional[List[str]] = None """ - :类型: - - ``Optional[List[str]]`` - :说明: 要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值 """ fastapi_reload_excludes: Optional[List[str]] = None """ - :类型: - - ``Optional[List[str]]`` - :说明: 不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值 diff --git a/nonebot/drivers/quart.py b/nonebot/drivers/quart.py index a8330044..84b6ce49 100644 --- a/nonebot/drivers/quart.py +++ b/nonebot/drivers/quart.py @@ -56,50 +56,30 @@ class Config(BaseSettings): quart_reload: bool = False """ - :类型: - - ``bool`` - :说明: 开启/关闭冷重载 """ quart_reload_dirs: Optional[List[str]] = None """ - :类型: - - ``Optional[List[str]]`` - :说明: 重载监控文件夹列表,默认为 uvicorn 默认值 """ quart_reload_delay: Optional[float] = None """ - :类型: - - ``Optional[float]`` - :说明: 重载延迟,默认为 uvicorn 默认值 """ quart_reload_includes: Optional[List[str]] = None """ - :类型: - - ``Optional[List[str]]`` - :说明: 要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值 """ quart_reload_excludes: Optional[List[str]] = None """ - :类型: - - ``Optional[List[str]]`` - :说明: 不要监听的文件列表,支持 glob pattern,默认为 uvicorn 默认值 diff --git a/nonebot/matcher.py b/nonebot/matcher.py index ce30608b..c9a60f08 100644 --- a/nonebot/matcher.py +++ b/nonebot/matcher.py @@ -66,7 +66,6 @@ T = TypeVar("T") matchers: Dict[int, List[Type["Matcher"]]] = defaultdict(list) """ -:类型: ``Dict[int, List[Type[Matcher]]]`` :说明: 用于存储当前所有的事件响应器 """ current_bot: ContextVar[Bot] = ContextVar("current_bot") @@ -106,81 +105,66 @@ class Matcher(metaclass=MatcherMeta): plugin: Optional["Plugin"] = None """ - :类型: ``Optional[Plugin]`` - :说明: 事件响应器所在插件 + :说明: 事件响应器所在插件 """ module: Optional[ModuleType] = None """ - :类型: ``Optional[ModuleType]`` - :说明: 事件响应器所在插件模块 + :说明: 事件响应器所在插件模块 """ plugin_name: Optional[str] = None """ - :类型: ``Optional[str]`` - :说明: 事件响应器所在插件名 + :说明: 事件响应器所在插件名 """ module_name: Optional[str] = None """ - :类型: ``Optional[str]`` - :说明: 事件响应器所在点分割插件模块路径 + :说明: 事件响应器所在点分割插件模块路径 """ type: str = "" """ - :类型: ``str`` - :说明: 事件响应器类型 + :说明: 事件响应器类型 """ rule: Rule = Rule() """ - :类型: ``Rule`` - :说明: 事件响应器匹配规则 + :说明: 事件响应器匹配规则 """ permission: Permission = Permission() """ - :类型: ``Permission`` - :说明: 事件响应器触发权限 + :说明: 事件响应器触发权限 """ handlers: List[Dependent[Any]] = [] """ - :类型: ``List[Handler]`` - :说明: 事件响应器拥有的事件处理函数列表 + :说明: 事件响应器拥有的事件处理函数列表 """ priority: int = 1 """ - :类型: ``int`` - :说明: 事件响应器优先级 + :说明: 事件响应器优先级 """ block: bool = False """ - :类型: ``bool`` - :说明: 事件响应器是否阻止事件传播 + :说明: 事件响应器是否阻止事件传播 """ temp: bool = False """ - :类型: ``bool`` - :说明: 事件响应器是否为临时 + :说明: 事件响应器是否为临时 """ expire_time: Optional[datetime] = None """ - :类型: ``Optional[datetime]`` - :说明: 事件响应器过期时间点 + :说明: 事件响应器过期时间点 """ _default_state: T_State = {} """ - :类型: ``T_State`` - :说明: 事件响应器默认状态 + :说明: 事件响应器默认状态 """ _default_type_updater: Optional[Dependent[str]] = None """ - :类型: ``Optional[Dependent]`` - :说明: 事件响应器类型更新函数 + :说明: 事件响应器类型更新函数 """ _default_permission_updater: Optional[Dependent[Permission]] = None """ - :类型: ``Optional[Dependent]`` - :说明: 事件响应器权限更新函数 + :说明: 事件响应器权限更新函数 """ HANDLER_PARAM_TYPES = [ diff --git a/nonebot/permission.py b/nonebot/permission.py index afb527cc..2bad7061 100644 --- a/nonebot/permission.py +++ b/nonebot/permission.py @@ -77,10 +77,6 @@ class Permission: :说明: 存储 ``PermissionChecker`` - - :类型: - - * ``Set[Dependent[bool]]`` """ async def __call__( diff --git a/nonebot/plugin/on.py b/nonebot/plugin/on.py index b0ab2377..afca33d2 100644 --- a/nonebot/plugin/on.py +++ b/nonebot/plugin/on.py @@ -485,15 +485,13 @@ class CommandGroup: """ self.basecmd: Tuple[str, ...] = (cmd,) if isinstance(cmd, str) else cmd """ - - **类型**: ``Tuple[str, ...]`` - - **说明**: 命令前缀 + - **说明**: 命令前缀 """ if "aliases" in kwargs: del kwargs["aliases"] self.base_kwargs: Dict[str, Any] = kwargs """ - - **类型**: ``Dict[str, Any]`` - - **说明**: 其他传递给 ``on_command`` 的参数默认值 + - **说明**: 其他传递给 ``on_command`` 的参数默认值 """ def command(self, cmd: Union[str, Tuple[str, ...]], **kwargs) -> Type[Matcher]: @@ -554,13 +552,11 @@ class MatcherGroup: """ self.matchers: List[Type[Matcher]] = [] """ - :类型: ``List[Type[Matcher]]`` - :说明: 组内事件响应器列表 + :说明: 组内事件响应器列表 """ self.base_kwargs: Dict[str, Any] = kwargs """ - - **类型**: ``Dict[str, Any]`` - - **说明**: 其他传递给 ``on`` 的参数默认值 + - **说明**: 其他传递给 ``on`` 的参数默认值 """ def on(self, **kwargs) -> Type[Matcher]: diff --git a/nonebot/plugin/plugin.py b/nonebot/plugin/plugin.py index 83d37c79..d549d22e 100644 --- a/nonebot/plugin/plugin.py +++ b/nonebot/plugin/plugin.py @@ -10,7 +10,6 @@ if TYPE_CHECKING: plugins: Dict[str, "Plugin"] = {} """ -:类型: ``Dict[str, Plugin]`` :说明: 已加载的插件 """ @@ -21,43 +20,35 @@ class Plugin(object): name: str """ - - **类型**: ``str`` - - **说明**: 插件名称,使用 文件/文件夹 名称作为插件名 + - **说明**: 插件名称,使用 文件/文件夹 名称作为插件名 """ module: ModuleType """ - - **类型**: ``ModuleType`` - - **说明**: 插件模块对象 + - **说明**: 插件模块对象 """ module_name: str """ - - **类型**: ``str`` - - **说明**: 点分割模块路径 + - **说明**: 点分割模块路径 """ manager: "PluginManager" """ - - **类型**: ``PluginManager`` - - **说明**: 导入该插件的插件管理器 + - **说明**: 导入该插件的插件管理器 """ export: Export = field(default_factory=Export) """ - - **类型**: ``Export`` - - **说明**: 插件内定义的导出内容 + - **说明**: 插件内定义的导出内容 """ matcher: Set[Type[Matcher]] = field(default_factory=set) """ - - **类型**: ``Set[Type[Matcher]]`` - - **说明**: 插件内定义的 ``Matcher`` + - **说明**: 插件内定义的 ``Matcher`` """ parent_plugin: Optional["Plugin"] = None """ - - **类型**: ``Optional[Plugin]`` - - **说明**: 父插件 + - **说明**: 父插件 """ sub_plugins: Set["Plugin"] = field(default_factory=set) """ - - **类型**: ``Set[Plugin]`` - - **说明**: 子插件集合 + - **说明**: 子插件集合 """ diff --git a/nonebot/rule.py b/nonebot/rule.py index 368dc490..66d41a48 100644 --- a/nonebot/rule.py +++ b/nonebot/rule.py @@ -106,10 +106,6 @@ class Rule: :说明: 存储 ``RuleChecker`` - - :类型: - - * ``Set[Dependent[bool]]`` """ async def __call__( diff --git a/nonebot/typing.py b/nonebot/typing.py index 55774ca1..759ac861 100644 --- a/nonebot/typing.py +++ b/nonebot/typing.py @@ -47,8 +47,6 @@ def overrides(InterfaceClass: object): T_State = Dict[Any, Any] """ -:类型: ``Dict[Any, Any]`` - :说明: 事件处理状态 State 类型 @@ -56,24 +54,18 @@ T_State = Dict[Any, Any] T_BotConnectionHook = Callable[["Bot"], Awaitable[None]] """ -:类型: ``Callable[[Bot], Awaitable[None]]`` - :说明: Bot 连接建立时执行的函数 """ T_BotDisconnectionHook = Callable[["Bot"], Awaitable[None]] """ -:类型: ``Callable[[Bot], Awaitable[None]]`` - :说明: Bot 连接断开时执行的函数 """ T_CallingAPIHook = Callable[["Bot", str, Dict[str, Any]], Awaitable[None]] """ -:类型: ``Callable[[Bot, str, Dict[str, Any]], Awaitable[None]]`` - :说明: ``bot.call_api`` 时执行的函数 @@ -82,8 +74,6 @@ T_CalledAPIHook = Callable[ ["Bot", Optional[Exception], str, Dict[str, Any], Any], Awaitable[None] ] """ -:类型: ``Callable[[Bot, Optional[Exception], str, Dict[str, Any], Any], Awaitable[None]]`` - :说明: ``bot.call_api`` 后执行的函数,参数分别为 bot, exception, api, data, result @@ -91,8 +81,6 @@ T_CalledAPIHook = Callable[ T_EventPreProcessor = Callable[..., Union[None, Awaitable[None]]] """ -:类型: ``Callable[..., Union[None, Awaitable[None]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -107,8 +95,6 @@ T_EventPreProcessor = Callable[..., Union[None, Awaitable[None]]] """ T_EventPostProcessor = Callable[..., Union[None, Awaitable[None]]] """ -:类型: ``Callable[..., Union[None, Awaitable[None]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -123,8 +109,6 @@ T_EventPostProcessor = Callable[..., Union[None, Awaitable[None]]] """ T_RunPreProcessor = Callable[..., Union[None, Awaitable[None]]] """ -:类型: ``Callable[..., Union[None, Awaitable[None]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -140,8 +124,6 @@ T_RunPreProcessor = Callable[..., Union[None, Awaitable[None]]] """ T_RunPostProcessor = Callable[..., Union[None, Awaitable[None]]] """ -:类型: ``Callable[..., Union[None, Awaitable[None]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -159,8 +141,6 @@ T_RunPostProcessor = Callable[..., Union[None, Awaitable[None]]] T_RuleChecker = Callable[..., Union[bool, Awaitable[bool]]] """ -:类型: ``Callable[..., Union[bool, Awaitable[bool]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -175,8 +155,6 @@ T_RuleChecker = Callable[..., Union[bool, Awaitable[bool]]] """ T_PermissionChecker = Callable[..., Union[bool, Awaitable[bool]]] """ -:类型: ``Callable[..., Union[bool, Awaitable[bool]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -191,16 +169,12 @@ T_PermissionChecker = Callable[..., Union[bool, Awaitable[bool]]] T_Handler = Callable[..., Any] """ -:类型: ``Callable[..., Any]`` - :说明: Handler 处理函数。 """ T_TypeUpdater = Callable[..., Union[str, Awaitable[str]]] """ -:类型: ``Callable[..., Union[None, Awaitable[None]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -216,8 +190,6 @@ T_TypeUpdater = Callable[..., Union[str, Awaitable[str]]] """ T_PermissionUpdater = Callable[..., Union["Permission", Awaitable["Permission"]]] """ -:类型: ``Callable[..., Union[Permission, Awaitable[Permission]]]`` - :依赖参数: * ``DependParam``: 子依赖参数 @@ -233,7 +205,6 @@ T_PermissionUpdater = Callable[..., Union["Permission", Awaitable["Permission"]] """ T_DependencyCache = Dict[Callable[..., Any], "Task[Any]"] """ -:类型: ``Dict[Callable[..., Any], Task[Any]]`` :说明: 依赖缓存, 用于存储依赖函数的返回值 """