File tree Expand file tree Collapse file tree 4 files changed +13
-13
lines changed
Expand file tree Collapse file tree 4 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ def __repr__(self):
162162 except DeviceClosed :
163163 return super (SmoothedInputDevice , self ).__repr__ ()
164164 else :
165- if self .partial or self ._queue .full .wait ( 0 ):
165+ if self .partial or self ._queue .full .is_set ( ):
166166 return super (SmoothedInputDevice , self ).__repr__ ()
167167 else :
168168 return "<gpiozero.%s object on pin=%r, pull_up=%s>" % (
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ def active_time(self):
234234 The length of time (in seconds) that the device has been active for.
235235 When the device is inactive, this is ``None``.
236236 """
237- if self ._active_event .wait ( 0 ):
237+ if self ._active_event .is_set ( ):
238238 return time () - self ._last_changed
239239 else :
240240 return None
@@ -245,7 +245,7 @@ def inactive_time(self):
245245 The length of time (in seconds) that the device has been inactive for.
246246 When the device is active, this is ``None``.
247247 """
248- if self ._inactive_event .wait ( 0 ):
248+ if self ._inactive_event .is_set ( ):
249249 return time () - self ._last_changed
250250 else :
251251 return None
@@ -434,11 +434,11 @@ def __init__(self, parent):
434434 self .start ()
435435
436436 def held (self , parent ):
437- while not self .stopping .wait ( 0 ):
437+ while not self .stopping .is_set ( ):
438438 if self .holding .wait (0.1 ):
439439 self .holding .clear ()
440440 while not (
441- self .stopping .wait ( 0 ) or
441+ self .stopping .is_set ( ) or
442442 parent ._inactive_event .wait (parent .hold_time )
443443 ):
444444 if parent ._held_from is None :
Original file line number Diff line number Diff line change @@ -64,20 +64,20 @@ def test_input_event_activated():
6464 pin = MockPin (2 )
6565 with DigitalInputDevice (pin ) as device :
6666 device .when_activated = lambda : event .set ()
67- assert not event .wait ( 0 )
67+ assert not event .is_set ( )
6868 pin .drive_high ()
69- assert event .wait ( 0 )
69+ assert event .is_set ( )
7070
7171def test_input_event_deactivated ():
7272 event = Event ()
7373 pin = MockPin (2 )
7474 with DigitalInputDevice (pin ) as device :
7575 device .when_deactivated = lambda : event .set ()
76- assert not event .wait ( 0 )
76+ assert not event .is_set ( )
7777 pin .drive_high ()
78- assert not event .wait ( 0 )
78+ assert not event .is_set ( )
7979 pin .drive_low ()
80- assert event .wait ( 0 )
80+ assert event .is_set ( )
8181
8282def test_input_wait_active ():
8383 pin = MockPin (2 )
Original file line number Diff line number Diff line change @@ -160,15 +160,15 @@ def changed():
160160 pin .when_changed = changed
161161 pin .drive_high ()
162162 assert pin .state
163- assert fired .wait ( 0 )
163+ assert fired .is_set ( )
164164 fired .clear ()
165165 pin .edges = 'falling'
166166 pin .drive_low ()
167167 assert not pin .state
168- assert fired .wait ( 0 )
168+ assert fired .is_set ( )
169169 fired .clear ()
170170 pin .drive_high ()
171171 assert pin .state
172- assert not fired .wait ( 0 )
172+ assert not fired .is_set ( )
173173 assert pin .edges == 'falling'
174174
You can’t perform that action at this time.
0 commit comments