How to use the aiozk.iterables.drain function in aiozk

To help you get started, we’ve selected a few aiozk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github micro-fan / aiozk / aiozk / connection.py View on Github external
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
github micro-fan / aiozk / aiozk / states.py View on Github external
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)
github micro-fan / aiozk / aiozk / connection.py View on Github external
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