mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-03 18:46:45 +00:00
✨ Feature: 支持 PEP 695 类型别名 (#3621)
This commit is contained in:
@ -99,6 +99,17 @@ def is_none_type(type_: type[t.Any]) -> bool:
|
||||
return type_ in NONE_TYPES
|
||||
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
|
||||
def is_type_alias_type(type_: type[t.Any]) -> bool:
|
||||
"""判断是否是 TypeAliasType 类型"""
|
||||
return isinstance(type_, t_ext.TypeAliasType)
|
||||
else:
|
||||
|
||||
def is_type_alias_type(type_: type[t.Any]) -> bool:
|
||||
return isinstance(type_, (t.TypeAliasType, t_ext.TypeAliasType))
|
||||
|
||||
|
||||
def evaluate_forwardref(
|
||||
ref: t.ForwardRef, globalns: dict[str, t.Any], localns: dict[str, t.Any]
|
||||
) -> t.Any:
|
||||
|
Reference in New Issue
Block a user