1
- # validated: 2024-01-23 DS 70b60e3a7465 button/Trigger.java
1
+ # validated: 2024-04-02 DS 0b1345946950 button/Trigger.java
2
2
from types import SimpleNamespace
3
3
from typing import Callable , overload
4
4
@@ -227,7 +227,7 @@ def __bool__(self) -> bool:
227
227
228
228
def __and__ (self , other : Callable [[], bool ]) -> "Trigger" :
229
229
assert callable (other )
230
- return Trigger (lambda : self () and other ())
230
+ return Trigger (self . _loop , lambda : self () and other ())
231
231
232
232
def and_ (self , other : Callable [[], bool ]) -> "Trigger" :
233
233
"""
@@ -240,7 +240,7 @@ def and_(self, other: Callable[[], bool]) -> "Trigger":
240
240
241
241
def __or__ (self , other : Callable [[], bool ]) -> "Trigger" :
242
242
assert callable (other )
243
- return Trigger (lambda : self () or other ())
243
+ return Trigger (self . _loop , lambda : self () or other ())
244
244
245
245
def or_ (self , other : Callable [[], bool ]) -> "Trigger" :
246
246
"""
@@ -252,7 +252,7 @@ def or_(self, other: Callable[[], bool]) -> "Trigger":
252
252
return self | other
253
253
254
254
def __invert__ (self ) -> "Trigger" :
255
- return Trigger (lambda : not self ())
255
+ return Trigger (self . _loop , lambda : not self ())
256
256
257
257
def negate (self ) -> "Trigger" :
258
258
"""
@@ -280,4 +280,4 @@ def debounce(
280
280
:returns: The debounced trigger.
281
281
"""
282
282
debouncer = Debouncer (seconds , debounce_type )
283
- return Trigger (lambda : debouncer .calculate (self ()))
283
+ return Trigger (self . _loop , lambda : debouncer .calculate (self ()))
0 commit comments