How to use the riffle.cumin.unmarshall function in Riffle

To help you get started, we’ve selected a few Riffle 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 exis-io / Exis / python / pyRiffle / riffle / crust.py View on Github external
''' Wait until the results of this invocation are resolved '''

        # if canReturn then this is a call. We need to retroactively inform the core of our types
        if self.canReturn:
            self.mantleDomain.CallExpects(self.cb, cumin.prepareSchema(types))

        # Get our current greenlet. If we're not running in a greenlet, someone screwed up bad
        self.green = greenlet.getcurrent()

        # Switch back to the parent greenlet: block until the parent has time to resolve us
        results = self.green.parent.switch(self)

        if isinstance(results, Exception):
            raise results

        r = cumin.unmarshall(results, types)

        # Actually, this cant happen. A return from a function should always come back as
        # a list. Unless you mean a return from... any other thing. In which case, bleh.
        if r is None:
            return r

        return r[0] if len(r) == 1 else r