mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-05 03:26:46 +00:00
✨ Feature: 支持 PEP 695 类型别名 (#3621)
This commit is contained in:
21
tests/python_3_12/plugins/aliased_param/param_depend.py
Normal file
21
tests/python_3_12/plugins/aliased_param/param_depend.py
Normal file
@ -0,0 +1,21 @@
|
||||
from typing import Annotated
|
||||
|
||||
from nonebot import on_message
|
||||
from nonebot.params import Depends
|
||||
|
||||
test_depends = on_message()
|
||||
|
||||
runned = []
|
||||
|
||||
|
||||
def dependency():
|
||||
runned.append(1)
|
||||
return 1
|
||||
|
||||
|
||||
type AliasedDepends = Annotated[int, Depends(dependency)]
|
||||
|
||||
|
||||
@test_depends.handle()
|
||||
async def aliased_depends(x: AliasedDepends):
|
||||
return x
|
Reference in New Issue
Block a user