From 571cdef826f9eb8b273cf2cea13369a54284a354 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Wed, 28 Jul 2021 16:32:50 +0800 Subject: [PATCH] :memo: fix sphinx build errors --- docs/api/adapters/ding.md | 8 ++++---- docs/api/adapters/mirai.md | 4 ++-- docs/api/drivers/README.md | 8 ++++---- docs_build/adapters/README.rst | 4 ++-- docs_build/adapters/cqhttp.rst | 4 ++-- docs_build/adapters/ding.rst | 4 ++-- docs_build/adapters/feishu.rst | 4 ++-- docs_build/adapters/mirai.rst | 4 ++-- docs_build/conf.py | 2 +- docs_build/config.rst | 4 ++-- docs_build/drivers/README.rst | 4 ++-- docs_build/drivers/fastapi.rst | 4 ++-- docs_build/drivers/quart.rst | 6 +++--- docs_build/exception.rst | 4 ++-- docs_build/handler.rst | 4 ++-- docs_build/log.rst | 4 ++-- docs_build/matcher.rst | 4 ++-- docs_build/message.rst | 4 ++-- docs_build/nonebot.rst | 4 ++-- docs_build/permission.rst | 4 ++-- docs_build/plugin.rst | 4 ++-- docs_build/rule.rst | 4 ++-- docs_build/typing.rst | 4 ++-- docs_build/utils.rst | 4 ++-- nonebot/drivers/__init__.py | 9 ++++----- nonebot/log.py | 10 +++++++--- .../nonebot/adapters/ding/message.py | 8 ++++---- 27 files changed, 67 insertions(+), 64 deletions(-) diff --git a/docs/api/adapters/ding.md b/docs/api/adapters/ding.md index b4eae9e4..556102a8 100644 --- a/docs/api/adapters/ding.md +++ b/docs/api/adapters/ding.md @@ -245,12 +245,12 @@ message += MessageSegment.atDingtalkIds(event.senderId) ### _static_ `extension(dict_)` -"标记 text 文本的 extension 属性,需要与 text 消息段相加。 +标记 text 文本的 extension 属性,需要与 text 消息段相加。 ### _static_ `code(code_language, code)` -"发送 code 消息段 +发送 code 消息段 ### _static_ `markdown(title, text)` @@ -274,7 +274,7 @@ message += MessageSegment.atDingtalkIds(event.senderId) * `btnOrientation`: 0:按钮竖直排列 1:按钮横向排列 - * `btns`: [{ "title": title, "actionURL": actionURL }, ...] + * `btns`: `[{ "title": title, "actionURL": actionURL }, ...]` @@ -286,7 +286,7 @@ message += MessageSegment.atDingtalkIds(event.senderId) * **参数** - * `links`: [{ "title": xxx, "messageURL": xxx, "picURL": xxx }, ...] + * `links`: `[{ "title": xxx, "messageURL": xxx, "picURL": xxx }, ...]` diff --git a/docs/api/adapters/mirai.md b/docs/api/adapters/mirai.md index 137c1c7c..2416b9df 100644 --- a/docs/api/adapters/mirai.md +++ b/docs/api/adapters/mirai.md @@ -292,7 +292,7 @@ API中为了使代码更加整洁, 我们采用了与PEP8相符的命名规则 * **参数** - * `type: str`: "friend" 或 "group" 或 "temp" + * `type: str`: “friend” 或 “group” 或 “temp” * `img: BytesIO`: 图片的BytesIO对象 @@ -311,7 +311,7 @@ API中为了使代码更加整洁, 我们采用了与PEP8相符的命名规则 * **参数** - * `type: str`: 当前仅支持 "group" + * `type: str`: 当前仅支持 “group” * `voice: BytesIO`: 语音的BytesIO对象 diff --git a/docs/api/drivers/README.md b/docs/api/drivers/README.md index 1bfba3fc..57c4d135 100644 --- a/docs/api/drivers/README.md +++ b/docs/api/drivers/README.md @@ -262,12 +262,12 @@ Reverse Driver 基类。将后端框架封装,以满足适配器使用。 ### `http_version` -One of "1.0", "1.1" or "2". +One of `"1.0"`, `"1.1"` or `"2"`. ### `scheme` -URL scheme portion (likely "http" or "https"). +URL scheme portion (likely `"http"` or `"https"`). ### `path` @@ -279,7 +279,7 @@ decoded into characters. ### `query_string` -URL portion after the ?, percent-encoded. +URL portion after the `?`, percent-encoded. ### `headers` @@ -314,7 +314,7 @@ The HTTP method name, uppercased. Body of the request. -Optional; if missing defaults to b"". +Optional; if missing defaults to `b""`. ### _property_ `type` diff --git a/docs_build/adapters/README.rst b/docs_build/adapters/README.rst index ec75d8b0..8e759794 100644 --- a/docs_build/adapters/README.rst +++ b/docs_build/adapters/README.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.adapters 模块 ===================== diff --git a/docs_build/adapters/cqhttp.rst b/docs_build/adapters/cqhttp.rst index 1678f208..d49c5c66 100644 --- a/docs_build/adapters/cqhttp.rst +++ b/docs_build/adapters/cqhttp.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.adapters.cqhttp 模块 ============================= diff --git a/docs_build/adapters/ding.rst b/docs_build/adapters/ding.rst index 21cbed1f..974c73ef 100644 --- a/docs_build/adapters/ding.rst +++ b/docs_build/adapters/ding.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.adapters.ding 模块 =========================== diff --git a/docs_build/adapters/feishu.rst b/docs_build/adapters/feishu.rst index 540b0e80..5f71704f 100644 --- a/docs_build/adapters/feishu.rst +++ b/docs_build/adapters/feishu.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.adapters.feishu 模块 ============================ diff --git a/docs_build/adapters/mirai.rst b/docs_build/adapters/mirai.rst index 4a991217..e877fa60 100644 --- a/docs_build/adapters/mirai.rst +++ b/docs_build/adapters/mirai.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.adapters.mirai 模块 =========================== diff --git a/docs_build/conf.py b/docs_build/conf.py index 29bb0dc4..76bd31fb 100644 --- a/docs_build/conf.py +++ b/docs_build/conf.py @@ -46,7 +46,7 @@ templates_path = ['_templates'] # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'zh' +language = 'zh_CN' master_doc = "README" diff --git a/docs_build/config.rst b/docs_build/config.rst index 7354a565..fda56368 100644 --- a/docs_build/config.rst +++ b/docs_build/config.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.config 模块 =================== diff --git a/docs_build/drivers/README.rst b/docs_build/drivers/README.rst index e4bf6104..f8bbf4e5 100644 --- a/docs_build/drivers/README.rst +++ b/docs_build/drivers/README.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.drivers 模块 ===================== diff --git a/docs_build/drivers/fastapi.rst b/docs_build/drivers/fastapi.rst index 87c7b609..098975ae 100644 --- a/docs_build/drivers/fastapi.rst +++ b/docs_build/drivers/fastapi.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.drivers.fastapi 模块 ============================= diff --git a/docs_build/drivers/quart.rst b/docs_build/drivers/quart.rst index 189dd478..f27a5797 100644 --- a/docs_build/drivers/quart.rst +++ b/docs_build/drivers/quart.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.drivers.quart 模块 ========================== @@ -9,4 +9,4 @@ NoneBot.drivers.quart 模块 .. automodule:: nonebot.drivers.quart :members: :private-members: - :show-inheritance: \ No newline at end of file + :show-inheritance: diff --git a/docs_build/exception.rst b/docs_build/exception.rst index 7b643758..1f999802 100644 --- a/docs_build/exception.rst +++ b/docs_build/exception.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.exception 模块 ====================== diff --git a/docs_build/handler.rst b/docs_build/handler.rst index d7376b97..413ff50b 100644 --- a/docs_build/handler.rst +++ b/docs_build/handler.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.handler 模块 ==================== diff --git a/docs_build/log.rst b/docs_build/log.rst index 49799128..749a8089 100644 --- a/docs_build/log.rst +++ b/docs_build/log.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.log 模块 ================= diff --git a/docs_build/matcher.rst b/docs_build/matcher.rst index edc42bfe..5963bd28 100644 --- a/docs_build/matcher.rst +++ b/docs_build/matcher.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.matcher 模块 ==================== diff --git a/docs_build/message.rst b/docs_build/message.rst index 61c44c35..0a878d73 100644 --- a/docs_build/message.rst +++ b/docs_build/message.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.message 模块 ====================== diff --git a/docs_build/nonebot.rst b/docs_build/nonebot.rst index 1e8f5107..d954fcdd 100644 --- a/docs_build/nonebot.rst +++ b/docs_build/nonebot.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot 模块 =============== diff --git a/docs_build/permission.rst b/docs_build/permission.rst index 0dde5fa8..3cae2186 100644 --- a/docs_build/permission.rst +++ b/docs_build/permission.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.permission 模块 ======================= diff --git a/docs_build/plugin.rst b/docs_build/plugin.rst index 9c463240..09d2a6d1 100644 --- a/docs_build/plugin.rst +++ b/docs_build/plugin.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.plugin 模块 ==================== diff --git a/docs_build/rule.rst b/docs_build/rule.rst index e182de79..c2657409 100644 --- a/docs_build/rule.rst +++ b/docs_build/rule.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.rule 模块 ==================== diff --git a/docs_build/typing.rst b/docs_build/typing.rst index 211cb6fa..ae174593 100644 --- a/docs_build/typing.rst +++ b/docs_build/typing.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.typing 模块 =================== diff --git a/docs_build/utils.rst b/docs_build/utils.rst index b63448d0..533341cb 100644 --- a/docs_build/utils.rst +++ b/docs_build/utils.rst @@ -1,7 +1,7 @@ ---- +\-\-\- contentSidebar: true sidebarDepth: 0 ---- +\-\-\- NoneBot.utils 模块 ================== diff --git a/nonebot/drivers/__init__.py b/nonebot/drivers/__init__.py index abb289fd..d7a7a8df 100644 --- a/nonebot/drivers/__init__.py +++ b/nonebot/drivers/__init__.py @@ -192,7 +192,6 @@ class Driver(abc.ABC): asyncio.create_task(_run_hook(bot)) -# TODO: issue #240 class ForwardDriver(Driver): @abc.abstractmethod @@ -239,9 +238,9 @@ class ReverseDriver(Driver): @dataclass class HTTPConnection(abc.ABC): http_version: str - """One of `"1.0"`, `"1.1"` or `"2"`.""" + """One of ``"1.0"``, ``"1.1"`` or ``"2"``.""" scheme: str - """URL scheme portion (likely `"http"` or `"https"`).""" + """URL scheme portion (likely ``"http"`` or ``"https"``).""" path: str """ HTTP request target excluding any query string, @@ -249,7 +248,7 @@ class HTTPConnection(abc.ABC): decoded into characters. """ query_string: bytes = b"" - """ URL portion after the `?`, percent-encoded.""" + """ URL portion after the ``?``, percent-encoded.""" headers: Dict[str, str] = field(default_factory=dict) """A dict of name-value pairs, where name is the header name, and value is the header value. @@ -279,7 +278,7 @@ class HTTPRequest(HTTPConnection): body: bytes = b"" """Body of the request. - Optional; if missing defaults to b"". + Optional; if missing defaults to ``b""``. """ @property diff --git a/nonebot/log.py b/nonebot/log.py index bd963583..1263f6f2 100644 --- a/nonebot/log.py +++ b/nonebot/log.py @@ -12,13 +12,17 @@ NoneBot 使用 `loguru`_ 来记录日志信息。 import sys import logging -from typing import Union +from typing import Union, TYPE_CHECKING import loguru -from loguru._logger import Logger + +if TYPE_CHECKING: + # avoid sphinx autodoc resolve annotation failed + # because loguru module do not have `Logger` class actually + from loguru import Logger # logger = logging.getLogger("nonebot") -logger: "Logger" = loguru.logger # type: ignore +logger: "Logger" = loguru.logger """ :说明: diff --git a/packages/nonebot-adapter-ding/nonebot/adapters/ding/message.py b/packages/nonebot-adapter-ding/nonebot/adapters/ding/message.py index a9559435..eb7d655d 100644 --- a/packages/nonebot-adapter-ding/nonebot/adapters/ding/message.py +++ b/packages/nonebot-adapter-ding/nonebot/adapters/ding/message.py @@ -60,12 +60,12 @@ class MessageSegment(BaseMessageSegment["Message"]): @staticmethod def extension(dict_: dict) -> "MessageSegment": - """"标记 text 文本的 extension 属性,需要与 text 消息段相加。""" + """标记 text 文本的 extension 属性,需要与 text 消息段相加。""" return MessageSegment("extension", dict_) @staticmethod def code(code_language: str, code: str) -> "Message": - """"发送 code 消息段""" + """发送 code 消息段""" message = MessageSegment.text(code) message += MessageSegment.extension({ "text_type": "code_snippet", @@ -110,7 +110,7 @@ class MessageSegment(BaseMessageSegment["Message"]): :参数: * ``btnOrientation``: 0:按钮竖直排列 1:按钮横向排列 - * ``btns``: [{ "title": title, "actionURL": actionURL }, ...] + * ``btns``: ``[{ "title": title, "actionURL": actionURL }, ...]`` """ return MessageSegment( "actionCard", { @@ -128,7 +128,7 @@ class MessageSegment(BaseMessageSegment["Message"]): :参数: - * ``links``: [{ "title": xxx, "messageURL": xxx, "picURL": xxx }, ...] + * ``links``: ``[{ "title": xxx, "messageURL": xxx, "picURL": xxx }, ...]`` """ return MessageSegment("feedCard", {"links": links})