Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def drain_all_pending(self):
for special_xid in protocol.SPECIAL_XIDS:
for f in iterables.drain(self.pending_specials[special_xid]):
yield f
for _, f in iterables.drain(self.pending):
yield f
def transition_to(self, state):
if (self.current_state, state) not in self.valid_transitions:
raise exc.InvalidStateTransition(
"Invalid session state transition: %s -> %s" % (
self.current_state, state
)
)
log.debug("Session transition: %s -> %s", self.current_state, state)
self.current_state = state
for future in drain(self.futures[state]):
if not future.done():
future.set_result(None)
def drain_all_pending(self):
for special_xid in protocol.SPECIAL_XIDS:
for f in iterables.drain(self.pending_specials[special_xid]):
yield f
for _, f in iterables.drain(self.pending):
yield f