Skip to content

Commit f585d60

Browse files
authored
Merge pull request #657 from syseleven/sneubauer/fix-deprecation-warning
fix(recipe): fix deprecation warning from threading.Event
2 parents 1ea097d + 569c89c commit f585d60

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

kazoo/recipe/lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _inner_acquire(self, blocking, timeout, ephemeral=True):
276276
pass # predecessor has already been deleted
277277
else:
278278
self.wake_event.wait(timeout)
279-
if not self.wake_event.isSet():
279+
if not self.wake_event.is_set():
280280
raise LockTimeout(
281281
"Failed to acquire lock on %s after %s seconds"
282282
% (self.path, timeout)
@@ -638,7 +638,7 @@ def _inner_acquire(self, blocking, timeout=None):
638638
# If blocking, wait until self._watch_lease_change() is
639639
# called before returning
640640
self.wake_event.wait(w.leftover())
641-
if not self.wake_event.isSet():
641+
if not self.wake_event.is_set():
642642
raise LockTimeout(
643643
"Failed to acquire semaphore on %s"
644644
" after %s seconds" % (self.path, timeout)

kazoo/recipe/queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def check_for_updates(event):
292292
if event is not None and event.type != EventType.CHILD:
293293
return
294294
with lock:
295-
if canceled or flag.isSet():
295+
if canceled or flag.is_set():
296296
return
297297
values = self.client.retry(
298298
self.client.get_children,

kazoo/testing/harness.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ def watch_loss(state):
229229
self.client._call(break_event, None)
230230

231231
lost.wait(5)
232-
if not lost.isSet():
232+
if not lost.is_set():
233233
raise Exception("Failed to get notified of broken connection.")
234234

235235
safe.wait(15)
236-
if not safe.isSet():
236+
if not safe.is_set():
237237
raise Exception("Failed to see client reconnect.")
238238

239239
self.client.retry(self.client.get_async, '/')

kazoo/tests/test_lock.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def _thread(lock, event, timeout):
397397
with lock:
398398
started.set()
399399
event.wait(timeout)
400-
if not event.isSet():
400+
if not event.is_set():
401401
# Eventually fail to avoid hanging the tests
402402
self.fail("lock2 never timed out")
403403

@@ -409,7 +409,7 @@ def _thread(lock, event, timeout):
409409
client2 = self._get_client()
410410
client2.start()
411411
started.wait(5)
412-
assert started.isSet() is True
412+
assert started.is_set() is True
413413
lock2 = client2.Lock(self.lockpath, "two")
414414
try:
415415
lock2.acquire(timeout=timeout)
@@ -712,7 +712,7 @@ def _thread(sem, event, timeout):
712712
with sem:
713713
started.set()
714714
event.wait(timeout)
715-
if not event.isSet():
715+
if not event.is_set():
716716
# Eventually fail to avoid hanging the tests
717717
self.fail("sem2 never timed out")
718718

@@ -724,7 +724,7 @@ def _thread(sem, event, timeout):
724724
client2 = self._get_client()
725725
client2.start()
726726
started.wait(5)
727-
assert started.isSet() is True
727+
assert started.is_set() is True
728728
sem2 = client2.Semaphore(self.lockpath, "two")
729729
try:
730730
sem2.acquire(timeout=timeout)

0 commit comments

Comments
 (0)