Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raise
except Exception as e:
# something bad happened, set exception and exit
logger.exception("Exception in wait_for predicate!")
# signal that an error happened
await p.set(outcome.Error(e))
raise ListenerExit
else:
# exit now if result is true
if res is True:
await p.set(outcome.Value(args))
raise ListenerExit
self.add_temporary_listener(name=event_name, listener=listener)
try:
output: outcome.Outcome = await p.wait()
except Exception: # cancellations or timeouts
self.remove_listener_early(event_name, listener=listener)
raise
result = output.unwrap()
# unwrap tuples, if applicable
if len(result) == 1:
return result[0]
return result