✏️ fix docstring typo

This commit is contained in:
yanyongyu 2020-11-30 12:43:44 +08:00
parent e5463cc564
commit 0775a232ce
4 changed files with 153 additions and 117 deletions

View File

@ -24,14 +24,16 @@ NoneBot 使用 [pydantic](https://pydantic-docs.helpmanual.io/) 以及 [python-d
### `environment` ### `environment`
* 类型: `str` * **类型**: `str`
* 默认值: `"prod"` * **默认值**: `"prod"`
* 说明: * **说明**
当前环境名。 NoneBot 将从 `.env.{environment}` 文件中加载配置。
当前环境名。 NoneBot 将从 `.env.{environment}` 文件中加载配置。
## _class_ `Config` ## _class_ `Config`
@ -47,69 +49,80 @@ NoneBot 主要配置。大小写不敏感。
### `driver` ### `driver`
* 类型: `str` * **类型**: `str`
* 默认值: `"nonebot.drivers.fastapi"` * **默认值**: `"nonebot.drivers.fastapi"`
* 说明: * **说明**
NoneBot 运行所使用的 `Driver` 。继承自 `nonebot.driver.BaseDriver`
NoneBot 运行所使用的 `Driver` 。继承自 `nonebot.driver.BaseDriver`
### `host` ### `host`
* 类型: `IPvAnyAddress` * **类型**: `IPvAnyAddress`
* 默认值: `127.0.0.1` * **默认值**: `127.0.0.1`
* 说明: * **说明**
NoneBot 的 HTTP 和 WebSocket 服务端监听的 IP/主机名。
NoneBot 的 HTTP 和 WebSocket 服务端监听的 IP/主机名。
### `port` ### `port`
* 类型: `int` * **类型**: `int`
* 默认值: `8080` * **默认值**: `8080`
* 说明: * **说明**
NoneBot 的 HTTP 和 WebSocket 服务端监听的端口。
NoneBot 的 HTTP 和 WebSocket 服务端监听的端口。
### `debug` ### `debug`
* 类型: `bool` * **类型**: `bool`
* 默认值: `False` * **默认值**: `False`
* 说明: * **说明**
是否以调试模式运行 NoneBot。
是否以调试模式运行 NoneBot。
### `api_root` ### `api_root`
* 类型: `Dict[str, str]` * **类型**: `Dict[str, str]`
* 默认值: `{}` * **默认值**: `{}`
* 说明: * **说明**
以机器人 ID 为键,上报地址为值的字典,环境变量或文件中应使用 json 序列化。
以机器人 ID 为键,上报地址为值的字典,环境变量或文件中应使用 json 序列化。
* 示例:
* **示例**
```default ```default
API_ROOT={"123456": "http://127.0.0.1:5700"} API_ROOT={"123456": "http://127.0.0.1:5700"}
@ -119,30 +132,35 @@ API_ROOT={"123456": "http://127.0.0.1:5700"}
### `api_timeout` ### `api_timeout`
* 类型: `Optional[float]` * **类型**: `Optional[float]`
* 默认值: `30.` * **默认值**: `30.`
* 说明: * **说明**
API 请求超时时间,单位: 秒。
API 请求超时时间,单位: 秒。
### `access_token` ### `access_token`
* 类型: `Optional[str]` * **类型**: `Optional[str]`
* 默认值: `None` * **默认值**: `None`
* 说明: * **说明**
API 请求以及上报所需密钥,在请求头中携带。
API 请求以及上报所需密钥,在请求头中携带。
* 示例:
* **示例**
```http ```http
POST /cqhttp/ HTTP/1.1 POST /cqhttp/ HTTP/1.1
@ -153,17 +171,20 @@ Authorization: Bearer kSLuTF2GC2Q4q4ugm3
### `secret` ### `secret`
* 类型: `Optional[str]` * **类型**: `Optional[str]`
* 默认值: `None` * **默认值**: `None`
* 说明: * **说明**
HTTP POST 形式上报所需签名,在请求头中携带。
HTTP POST 形式上报所需签名,在请求头中携带。
* 示例:
* **示例**
```http ```http
POST /cqhttp/ HTTP/1.1 POST /cqhttp/ HTTP/1.1
@ -174,17 +195,20 @@ X-Signature: sha1=f9ddd4863ace61e64f462d41ca311e3d2c1176e2
### `superusers` ### `superusers`
* 类型: `Set[int]` * **类型**: `Set[int]`
* 默认值: `set()` * **默认值**: `set()`
* 说明: * **说明**
机器人超级用户。
机器人超级用户。
* 示例:
* **示例**
```default ```default
SUPER_USERS=[12345789] SUPER_USERS=[12345789]
@ -194,56 +218,65 @@ SUPER_USERS=[12345789]
### `nickname` ### `nickname`
* 类型: `Set[str]` * **类型**: `Set[str]`
* 默认值: `set()` * **默认值**: `set()`
* 说明: * **说明**
机器人昵称。
机器人昵称。
### `command_start` ### `command_start`
* 类型: `Set[str]` * **类型**: `Set[str]`
* 默认值: `{"/"}` * **默认值**: `{"/"}`
* 说明: * **说明**
命令的起始标记,用于判断一条消息是不是命令。
命令的起始标记,用于判断一条消息是不是命令。
### `command_sep` ### `command_sep`
* 类型: `Set[str]` * **类型**: `Set[str]`
* 默认值: `{"."}` * **默认值**: `{"."}`
* 说明: * **说明**
命令的分隔标记,用于将文本形式的命令切分为元组(实际的命令名)。
命令的分隔标记,用于将文本形式的命令切分为元组(实际的命令名)。
### `session_expire_timeout` ### `session_expire_timeout`
* 类型: `timedelta` * **类型**: `timedelta`
* 默认值: `timedelta(minutes=2)` * **默认值**: `timedelta(minutes=2)`
* 说明: * **说明**
等待用户回复的超时时间。
等待用户回复的超时时间。
* 示例:
* **示例**
```default ```default
SESSION_EXPIRE_TIMEOUT=120 # 单位: 秒 SESSION_EXPIRE_TIMEOUT=120 # 单位: 秒
@ -255,11 +288,12 @@ SESSION_EXPIRE_TIMEOUT=P[DD]DT[HH]H[MM]M[SS]S # ISO 8601
### `apscheduler_config` ### `apscheduler_config`
* 类型: `dict` * **类型**: `dict`
* 默认值: `{"apscheduler.timezone": "Asia/Shanghai"}` * **默认值**: `{"apscheduler.timezone": "Asia/Shanghai"}`
* 说明: * **说明**
APScheduler 的配置对象,见 [Configuring the Scheduler](https://apscheduler.readthedocs.io/en/latest/userguide.html#configuring-the-scheduler)
APScheduler 的配置对象,见 [Configuring the Scheduler](https://apscheduler.readthedocs.io/en/latest/userguide.html#configuring-the-scheduler)

View File

@ -46,10 +46,11 @@ nonebot.export().default = "bar"
def some_function(): def some_function():
pass pass
# this don't work under python 3.9 # this doesn't work before python 3.9
# use # use
# export = nonebot.export(); @export.sub # export = nonebot.export(); @export.sub
# instead # instead
# See also PEP-614: https://www.python.org/dev/peps/pep-0614/
@nonebot.export().sub @nonebot.export().sub
def something_else(): def something_else():
pass pass

View File

@ -102,9 +102,9 @@ class Env(BaseSettings):
environment: str = "prod" environment: str = "prod"
""" """
- 类型: ``str`` - **类型**: ``str``
- 默认值: ``"prod"`` - **默认值**: ``"prod"``
- 说明: :说明:
当前环境名 NoneBot 将从 ``.env.{environment}`` 文件中加载配置 当前环境名 NoneBot 将从 ``.env.{environment}`` 文件中加载配置
""" """
@ -122,33 +122,33 @@ class Config(BaseConfig):
# nonebot configs # nonebot configs
driver: str = "nonebot.drivers.fastapi" driver: str = "nonebot.drivers.fastapi"
""" """
- 类型: ``str`` - **类型**: ``str``
- 默认值: ``"nonebot.drivers.fastapi"`` - **默认值**: ``"nonebot.drivers.fastapi"``
- 说明: :说明:
NoneBot 运行所使用的 ``Driver`` 继承自 ``nonebot.driver.BaseDriver`` NoneBot 运行所使用的 ``Driver`` 继承自 ``nonebot.driver.BaseDriver``
""" """
host: IPvAnyAddress = IPv4Address("127.0.0.1") # type: ignore host: IPvAnyAddress = IPv4Address("127.0.0.1") # type: ignore
""" """
- 类型: ``IPvAnyAddress`` - **类型**: ``IPvAnyAddress``
- 默认值: ``127.0.0.1`` - **默认值**: ``127.0.0.1``
- 说明: :说明:
NoneBot HTTP WebSocket 服务端监听的 IP/主机名 NoneBot HTTP WebSocket 服务端监听的 IP/主机名
""" """
port: int = 8080 port: int = 8080
""" """
- 类型: ``int`` - **类型**: ``int``
- 默认值: ``8080`` - **默认值**: ``8080``
- 说明: :说明:
NoneBot HTTP WebSocket 服务端监听的端口 NoneBot HTTP WebSocket 服务端监听的端口
""" """
debug: bool = False debug: bool = False
""" """
- 类型: ``bool`` - **类型**: ``bool``
- 默认值: ``False`` - **默认值**: ``False``
- 说明: :说明:
是否以调试模式运行 NoneBot 是否以调试模式运行 NoneBot
""" """
@ -156,13 +156,13 @@ class Config(BaseConfig):
# bot connection configs # bot connection configs
api_root: Dict[str, str] = {} api_root: Dict[str, str] = {}
""" """
- 类型: ``Dict[str, str]`` - **类型**: ``Dict[str, str]``
- 默认值: ``{}`` - **默认值**: ``{}``
- 说明: :说明:
以机器人 ID 为键上报地址为值的字典环境变量或文件中应使用 json 序列化 以机器人 ID 为键上报地址为值的字典环境变量或文件中应使用 json 序列化
- 示例: :示例:
.. code-block:: default .. code-block:: default
@ -170,21 +170,21 @@ class Config(BaseConfig):
""" """
api_timeout: Optional[float] = 30. api_timeout: Optional[float] = 30.
""" """
- 类型: ``Optional[float]`` - **类型**: ``Optional[float]``
- 默认值: ``30.`` - **默认值**: ``30.``
- 说明: :说明:
API 请求超时时间单位: API 请求超时时间单位:
""" """
access_token: Optional[str] = None access_token: Optional[str] = None
""" """
- 类型: ``Optional[str]`` - **类型**: ``Optional[str]``
- 默认值: ``None`` - **默认值**: ``None``
- 说明: :说明:
API 请求以及上报所需密钥在请求头中携带 API 请求以及上报所需密钥在请求头中携带
- 示例: :示例:
.. code-block:: http .. code-block:: http
@ -193,13 +193,13 @@ class Config(BaseConfig):
""" """
secret: Optional[str] = None secret: Optional[str] = None
""" """
- 类型: ``Optional[str]`` - **类型**: ``Optional[str]``
- 默认值: ``None`` - **默认值**: ``None``
- 说明: :说明:
HTTP POST 形式上报所需签名在请求头中携带 HTTP POST 形式上报所需签名在请求头中携带
- 示例: :示例:
.. code-block:: http .. code-block:: http
@ -210,13 +210,13 @@ class Config(BaseConfig):
# bot runtime configs # bot runtime configs
superusers: Set[int] = set() superusers: Set[int] = set()
""" """
- 类型: ``Set[int]`` - **类型**: ``Set[int]``
- 默认值: ``set()`` - **默认值**: ``set()``
- 说明: :说明:
机器人超级用户 机器人超级用户
- 示例: :示例:
.. code-block:: default .. code-block:: default
@ -224,37 +224,37 @@ class Config(BaseConfig):
""" """
nickname: Set[str] = set() nickname: Set[str] = set()
""" """
- 类型: ``Set[str]`` - **类型**: ``Set[str]``
- 默认值: ``set()`` - **默认值**: ``set()``
- 说明: :说明:
机器人昵称 机器人昵称
""" """
command_start: Set[str] = {"/"} command_start: Set[str] = {"/"}
""" """
- 类型: ``Set[str]`` - **类型**: ``Set[str]``
- 默认值: ``{"/"}`` - **默认值**: ``{"/"}``
- 说明: :说明:
命令的起始标记用于判断一条消息是不是命令 命令的起始标记用于判断一条消息是不是命令
""" """
command_sep: Set[str] = {"."} command_sep: Set[str] = {"."}
""" """
- 类型: ``Set[str]`` - **类型**: ``Set[str]``
- 默认值: ``{"."}`` - **默认值**: ``{"."}``
- 说明: :说明:
命令的分隔标记用于将文本形式的命令切分为元组实际的命令名 命令的分隔标记用于将文本形式的命令切分为元组实际的命令名
""" """
session_expire_timeout: timedelta = timedelta(minutes=2) session_expire_timeout: timedelta = timedelta(minutes=2)
""" """
- 类型: ``timedelta`` - **类型**: ``timedelta``
- 默认值: ``timedelta(minutes=2)`` - **默认值**: ``timedelta(minutes=2)``
- 说明: :说明:
等待用户回复的超时时间 等待用户回复的超时时间
- 示例: :示例:
.. code-block:: default .. code-block:: default
@ -264,9 +264,9 @@ class Config(BaseConfig):
""" """
apscheduler_config: dict = {"apscheduler.timezone": "Asia/Shanghai"} apscheduler_config: dict = {"apscheduler.timezone": "Asia/Shanghai"}
""" """
- 类型: ``dict`` - **类型**: ``dict``
- 默认值: ``{"apscheduler.timezone": "Asia/Shanghai"}`` - **默认值**: ``{"apscheduler.timezone": "Asia/Shanghai"}``
- 说明: :说明:
APScheduler 的配置对象 `Configuring the Scheduler`_ APScheduler 的配置对象 `Configuring the Scheduler`_

View File

@ -46,10 +46,11 @@ class Export(dict):
def some_function(): def some_function():
pass pass
# this don't work under python 3.9 # this doesn't work before python 3.9
# use # use
# export = nonebot.export(); @export.sub # export = nonebot.export(); @export.sub
# instead # instead
# See also PEP-614: https://www.python.org/dev/peps/pep-0614/
@nonebot.export().sub @nonebot.export().sub
def something_else(): def something_else():
pass pass