📝 annotate links

This commit is contained in:
yanyongyu 2021-12-27 13:51:38 +08:00
parent c815ac7ca3
commit 7e9dabfd5f
4 changed files with 17 additions and 17 deletions

View File

@ -13,7 +13,7 @@ options:
针对这个问题, `nonebot2` 提供一个便捷而高效的解决方案:事件处理函数重载机制。简单地说,`handler` (事件处理函数) 会根据其参数的 `type hints` ([PEP484 类型标注](https://www.python.org/dev/peps/pep-0484/)) 来对相对应的 `adapter``Event` 进行响应,并且会忽略不符合其参数类型标注的情况。 针对这个问题, `nonebot2` 提供一个便捷而高效的解决方案:事件处理函数重载机制。简单地说,`handler` (事件处理函数) 会根据其参数的 `type hints` ([PEP484 类型标注](https://www.python.org/dev/peps/pep-0484/)) 来对相对应的 `adapter``Event` 进行响应,并且会忽略不符合其参数类型标注的情况。
必须要注意的是,该机制利用了 `inspect` 标准库获取到了事件处理函数的 `singnature` (签名) ,进一步获取到参数名称和类型标注。故而,我们在编写 `handler` 时,参数的名称和类型标注必须要符合 `T_Handler` 规定,详情可以参看 **指南** 中的[事件处理](../../guide/creating-a-handler)。 <!-- 必须要注意的是,该机制利用了 `inspect` 标准库获取到了事件处理函数的 `singnature` (签名) ,进一步获取到参数名称和类型标注。故而,我们在编写 `handler` 时,参数的名称和类型标注必须要符合 `T_Handler` 规定,详情可以参看 **指南** 中的[事件处理](../../guide/creating-a-handler)。 -->
:::tip 提示 :::tip 提示

View File

@ -11,7 +11,7 @@ options:
## 应用 ## 应用
如同 `Rule` 一样, `Permission` 可以在[注册事件响应器](../guide/creating-a-matcher)时添加 `permission` 参数来加以应用,这样 `Nonebot` 会在事件响应时检测事件主体的权限。下面我们以 `SUPERUSER` 为例,对该机制的应用做一下介绍。 <!-- 如同 `Rule` 一样, `Permission` 可以在[注册事件响应器](../guide/creating-a-matcher)时添加 `permission` 参数来加以应用,这样 `Nonebot` 会在事件响应时检测事件主体的权限。下面我们以 `SUPERUSER` 为例,对该机制的应用做一下介绍。 -->
```python ```python
from nonebot.permission import SUPERUSER from nonebot.permission import SUPERUSER

View File

@ -105,7 +105,7 @@ const config = {
icon: ["fas", "book"], icon: ["fas", "book"],
items: [ items: [
{ label: "Introduction", to: "/docs/guide" }, { label: "Introduction", to: "/docs/guide" },
{ label: "Installation", to: "/docs/guide/installation" }, { label: "Installation", to: "/docs/guide/start/installation" },
], ],
}, },
{ {

View File

@ -1849,9 +1849,9 @@
integrity sha1-k+Jb+e51/g/YC1lLxP6w6GIRG1o= integrity sha1-k+Jb+e51/g/YC1lLxP6w6GIRG1o=
"@types/node@*": "@types/node@*":
version "17.0.4" version "17.0.5"
resolved "https://registry.npmmirror.com/@types/node/download/@types/node-17.0.4.tgz#fec0ce0526abb6062fd206d72a642811b887a111" resolved "https://registry.npmmirror.com/@types/node/download/@types/node-17.0.5.tgz#57ca67ec4e57ad9e4ef5a6bab48a15387a1c83e0"
integrity sha512-6xwbrW4JJiJLgF+zNypN5wr2ykM9/jHcL7rQ8fZe2vuftggjzZeRSM4OwRc6Xk8qWjwJ99qVHo/JgOGmomWRog== integrity sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==
"@types/parse-json@^4.0.0": "@types/parse-json@^4.0.0":
version "4.0.0" version "4.0.0"
@ -3031,9 +3031,9 @@ css-select@^2.0.0:
nth-check "^1.0.2" nth-check "^1.0.2"
css-select@^4.1.3: css-select@^4.1.3:
version "4.2.0" version "4.2.1"
resolved "https://registry.npmmirror.com/css-select/download/css-select-4.2.0.tgz#ab28276d3afb00cc05e818bd33eb030f14f57895" resolved "https://registry.npmmirror.com/css-select/download/css-select-4.2.1.tgz#9e665d6ae4c7f9d65dbe69d0316e3221fb274cdd"
integrity sha512-6YVG6hsH9yIb/si3Th/is8Pex7qnVHO6t7q7U6TIUnkQASGbS8tnUDBftnPynLNnuUl/r2+PTd0ekiiq7R0zJw== integrity sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==
dependencies: dependencies:
boolbase "^1.0.0" boolbase "^1.0.0"
css-what "^5.1.0" css-what "^5.1.0"
@ -3338,19 +3338,19 @@ dns-txt@^2.0.2:
buffer-indexof "^1.0.0" buffer-indexof "^1.0.0"
docusaurus-preset-nonepress@canary: docusaurus-preset-nonepress@canary:
version "0.0.0-122" version "0.0.0-123"
resolved "https://registry.npmmirror.com/docusaurus-preset-nonepress/download/docusaurus-preset-nonepress-0.0.0-122.tgz#7daaef39d45984852b30d30ac69751c0f4eba586" resolved "https://registry.npmmirror.com/docusaurus-preset-nonepress/download/docusaurus-preset-nonepress-0.0.0-123.tgz#2cafef58c6264ac6da0e6ed9c70720084df39024"
integrity sha512-EOFVl1xV/vbTTOdMLyXnXEAKg4jEmm9CR8HbUQlEX2/+y5mLpGMAafGEXEyxzZT1KlfQcpGKhCMkMDhcWY8gRg== integrity sha512-PuSOUwWYI2aDyFQfLKhyn0w94a22leL8cB6LfivDvn9qlDmglxa6Le3VNsmgxiGieeoEQ3IA5907RoZQwzuQjg==
dependencies: dependencies:
"@docusaurus/core" "2.0.0-beta.9" "@docusaurus/core" "2.0.0-beta.9"
"@docusaurus/plugin-content-docs" "2.0.0-beta.9" "@docusaurus/plugin-content-docs" "2.0.0-beta.9"
"@docusaurus/plugin-content-pages" "2.0.0-beta.9" "@docusaurus/plugin-content-pages" "2.0.0-beta.9"
docusaurus-theme-nonepress "0.0.0-122" docusaurus-theme-nonepress "0.0.0-123"
docusaurus-theme-nonepress@0.0.0-122: docusaurus-theme-nonepress@0.0.0-123:
version "0.0.0-122" version "0.0.0-123"
resolved "https://registry.npmmirror.com/docusaurus-theme-nonepress/download/docusaurus-theme-nonepress-0.0.0-122.tgz#0ca3649b3f7c56ca421eab05ab41e889d8c5bc5a" resolved "https://registry.npmmirror.com/docusaurus-theme-nonepress/download/docusaurus-theme-nonepress-0.0.0-123.tgz#0bbba71820930bcbfec5b1ea7191dbbb698dc0bc"
integrity sha512-fk+miOhRYYpM4hzPTFsYYXnDq0nV66uhASVbV2L1RxxrJOebcdvHJxuFPelh42NsQNQBDq/ypOS2mjO9yfTcoQ== integrity sha512-eOh+sM0pp0tjB5g4lTwUkWERwmWjv9M//bhoNZ5NwJ9sAVLB7AI+YiQP2BthAk8HlVqvQyR5EJz0hFCr6THZ1Q==
dependencies: dependencies:
"@docsearch/react" "^3.0.0-alpha.39" "@docsearch/react" "^3.0.0-alpha.39"
"@docusaurus/core" "2.0.0-beta.9" "@docusaurus/core" "2.0.0-beta.9"