mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-27 18:45:05 +08:00
🚨 Fix: 错误的类型标注和 annotated 处理 (#2828)
This commit is contained in:
parent
015ddd9517
commit
2f60c5e9b4
@ -15,7 +15,7 @@ def combine_driver(driver: type[D]) -> type[D]: ...
|
|||||||
|
|
||||||
@overload
|
@overload
|
||||||
def combine_driver(
|
def combine_driver(
|
||||||
driver: type[D], _m: type[Mixin], *mixins: type[Mixin]
|
driver: type[D], __m: type[Mixin], /, *mixins: type[Mixin]
|
||||||
) -> type["CombinedDriver"]: ...
|
) -> type["CombinedDriver"]: ...
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ FrontMatter:
|
|||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
import warnings
|
import warnings
|
||||||
import contextlib
|
|
||||||
import typing as t
|
import typing as t
|
||||||
import typing_extensions as t_ext
|
import typing_extensions as t_ext
|
||||||
from typing import TYPE_CHECKING, TypeVar
|
from typing import TYPE_CHECKING, TypeVar
|
||||||
@ -86,9 +85,7 @@ def all_literal_values(type_: type[t.Any]) -> list[t.Any]:
|
|||||||
|
|
||||||
def origin_is_annotated(origin: t.Optional[type[t.Any]]) -> bool:
|
def origin_is_annotated(origin: t.Optional[type[t.Any]]) -> bool:
|
||||||
"""判断是否是 Annotated 类型"""
|
"""判断是否是 Annotated 类型"""
|
||||||
with contextlib.suppress(TypeError):
|
return origin is t_ext.Annotated
|
||||||
return origin is not None and issubclass(origin, t_ext.Annotated)
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
NONE_TYPES = {None, type(None), t.Literal[None], t_ext.Literal[None]}
|
NONE_TYPES = {None, type(None), t.Literal[None], t_ext.Literal[None]}
|
||||||
|
16
yarn.lock
16
yarn.lock
@ -1512,7 +1512,7 @@
|
|||||||
sitemap "^7.1.1"
|
sitemap "^7.1.1"
|
||||||
tslib "^2.4.0"
|
tslib "^2.4.0"
|
||||||
|
|
||||||
"@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2":
|
"@docusaurus/react-loadable@5.5.2":
|
||||||
version "5.5.2"
|
version "5.5.2"
|
||||||
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
|
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
|
||||||
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
||||||
@ -7620,9 +7620,9 @@ pure-color@^1.2.0:
|
|||||||
integrity sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==
|
integrity sha512-QFADYnsVoBMw1srW7OVKEYjG+MbIa49s54w1MA1EDY6r2r/sTcKKYqRX1f4GYvnXP7eN/Pe9HFcX+hwzmrXRHA==
|
||||||
|
|
||||||
pyright@^1.1.317:
|
pyright@^1.1.317:
|
||||||
version "1.1.352"
|
version "1.1.372"
|
||||||
resolved "https://registry.npmjs.org/pyright/-/pyright-1.1.352.tgz#2feb37438bc79ddf2bc1fdcc139f4ba088719f14"
|
resolved "https://registry.npmjs.org/pyright/-/pyright-1.1.372.tgz#4ac7b6ca189b58629ef26445f98c6685849dda5a"
|
||||||
integrity sha512-X7fuuB24n3RIVCEPovrAadYJjxeB5RccArug+/oLwQnsHbSaDUQVHHkF/PJHkKpaIPX/RboG+EW8uCNUp1RnwQ==
|
integrity sha512-S0XYmTQWK+ha9FTIWviNk91UnbD569wPUCNEltSqtHeTJhbHj5z3LkOKiqXAOvn72BBfylcgpQqyQHsocmQtiQ==
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "~2.3.3"
|
fsevents "~2.3.3"
|
||||||
|
|
||||||
@ -7805,6 +7805,14 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.10.3"
|
"@babel/runtime" "^7.10.3"
|
||||||
|
|
||||||
|
"react-loadable@npm:@docusaurus/react-loadable@5.5.2":
|
||||||
|
version "5.5.2"
|
||||||
|
resolved "https://registry.npmjs.org/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
|
||||||
|
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
|
||||||
|
dependencies:
|
||||||
|
"@types/react" "*"
|
||||||
|
prop-types "^15.6.2"
|
||||||
|
|
||||||
react-router-config@^5.1.1:
|
react-router-config@^5.1.1:
|
||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
resolved "https://registry.npmjs.org/react-router-config/-/react-router-config-5.1.1.tgz#0f4263d1a80c6b2dc7b9c1902c9526478194a988"
|
resolved "https://registry.npmjs.org/react-router-config/-/react-router-config-5.1.1.tgz#0f4263d1a80c6b2dc7b9c1902c9526478194a988"
|
||||||
|
Loading…
Reference in New Issue
Block a user