Skip to content

Commit 65305d8

Browse files
committed
Use always_iterable in Bus.wait
1 parent 4515443 commit 65305d8

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

cherrypy/process/wspbus.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
import subprocess
8282
import functools
8383

84+
from more_itertools import always_iterable
85+
8486

8587
# Here I save the value of os.getcwd(), which, if I am imported early enough,
8688
# will be the directory from which the startup script was run. This is needed
@@ -368,10 +370,7 @@ def block(self, interval=0.1):
368370

369371
def wait(self, state, interval=0.1, channel=None):
370372
"""Poll for the given state(s) at intervals; publish to channel."""
371-
if isinstance(state, (tuple, list)):
372-
states = state
373-
else:
374-
states = [state]
373+
states = set(always_iterable(state))
375374

376375
while self.state not in states:
377376
time.sleep(interval)

0 commit comments

Comments
 (0)