File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import math
4
- from typing import TYPE_CHECKING , NoReturn , Protocol
4
+ from typing import TYPE_CHECKING , Protocol
5
5
6
6
import attrs
7
7
16
16
enable_ki_protection ,
17
17
remove_parking_lot_breaker ,
18
18
)
19
+ from ._depreciate import warn_deprecated
19
20
from ._util import final
20
21
21
22
if TYPE_CHECKING :
@@ -112,11 +113,16 @@ def statistics(self) -> EventStatistics:
112
113
"""
113
114
return EventStatistics (tasks_waiting = len (self ._tasks ))
114
115
115
- def __bool__ (self ) -> NoReturn :
116
- """Raise NotImplementedError."""
117
- raise NotImplementedError (
118
- "Trio events cannot be treated as bools; consider using 'event.is_set()'"
116
+ def __bool__ (self ) -> True :
117
+ """Return True and raise warning."""
118
+ warn_deprecated (
119
+ self .__bool__ ,
120
+ "0.30.1" ,
121
+ issue = 3238 ,
122
+ instead = self .is_set ,
123
+ use_triodeprecationwarning = True ,
119
124
)
125
+ return True
120
126
121
127
122
128
class _HasAcquireRelease (Protocol ):
You can’t perform that action at this time.
0 commit comments