interrupt
Broadcast Interrupt 相关的工具
AnnotationWaiter 🔗
Bases: _ExtendedWaiter[T, T_E]
用于直接获取对应标注的 Waiter.
Source code in src/graia/ariadne/util/interrupt.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
__init__ 🔗
__init__(
annotation: Type[T],
events: List[Type[T_E]],
dispatchers: Optional[List[T_Dispatcher]] = None,
decorator: Optional[Decorator] = None,
headless_decorators: Optional[List[Decorator]] = None,
extra_validator: Optional[Callable[[T_E], bool]] = None,
priority: int = 15,
block_propagation: bool = False,
) -> None
Parameters:
-
annotation
(
Type[T]
) –参数标注
-
events
(
List[Type[T_E]]
) –事件类型
-
dispatchers
(
Optional[List[T_Dispatcher]]
) –Dispatcher 列表
-
decorator
(
Decorator
) –可选的参数装饰器
-
headless_decorators
(
Optional[List[Decorator]]
) –无头 Decorator 列表
-
extra_validator
(
Optional[Callable[[T_E], bool]]
) –额外的验证器
-
priority
(
int
) –优先级, 越小越靠前
-
block_propagation
(
bool
) –是否阻止事件往下传播
Source code in src/graia/ariadne/util/interrupt.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
EventWaiter 🔗
Bases: _ExtendedWaiter[T_E, T_E]
将 Waiter.create_using_event 封装了一层.
Source code in src/graia/ariadne/util/interrupt.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
__init__ 🔗
__init__(
events: List[Type[T_E]],
dispatchers: Optional[List[T_Dispatcher]] = None,
decorators: Optional[List[Decorator]] = None,
extra_validator: Optional[Callable[[T_E], bool]] = None,
priority: int = 15,
block_propagation: bool = False,
) -> None
Parameters:
-
events
(
List[Type[T_E]]
) –事件类型
-
dispatchers
(
Optional[List[T_Dispatcher]]
) –Dispatcher 列表
-
decorators
(
Optional[List[Decorator]]
) –Decorator 列表
-
extra_validator
(
Optional[Callable[[T_E], bool]]
) –额外的验证器
-
priority
(
int
) –优先级, 越小越靠前
-
block_propagation
(
bool
) –是否阻止事件往下传播
Source code in src/graia/ariadne/util/interrupt.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
FunctionWaiter 🔗
Bases: _ExtendedWaiter[T, Dispatchable]
将 Waiter.create_using_function 封装了一层
Source code in src/graia/ariadne/util/interrupt.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
__init__ 🔗
__init__(
func: Callable[..., Awaitable[Optional[T]]],
events: List[Type[Dispatchable]],
dispatchers: Optional[List[T_Dispatcher]] = None,
decorators: Optional[List[Decorator]] = None,
priority: int = 15,
block_propagation: bool = False,
) -> None
Parameters:
-
func
(
Callable
) –调用函数
-
events
(
List[Type[Dispatchable]]
) –事件类型
-
dispatchers
(
Optional[List[T_Dispatcher]]
) –广播器
-
decorators
(
Optional[List[Decorator]]
) –装饰器
-
priority
(
int
) –优先级
-
block_propagation
(
bool
) –是否阻止事件往下传播
Source code in src/graia/ariadne/util/interrupt.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|