How to use the outcome.Value function in outcome

To help you get started, we’ve selected a few outcome 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 Fuyukai / curious / curious / core / event / manager.py View on Github external
async def listener(*args):
            # exit immediately if the predicate is none
            if predicate is None:
                await p.set(outcome.Value(None))
                raise ListenerExit

            try:
                res = predicate(*args)
                if inspect.isawaitable(res):
                    res = await res
            except ListenerExit:
                # ???
                await p.set(outcome.Value(args))
                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
github Fuyukai / curious / curious / core / event / manager.py View on Github external
if inspect.isawaitable(res):
                    res = await res
            except ListenerExit:
                # ???
                await p.set(outcome.Value(args))
                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
github Fuyukai / curious / curious / core / event / manager.py View on Github external
async def listener(*args):
            # exit immediately if the predicate is none
            if predicate is None:
                await p.set(outcome.Value(None))
                raise ListenerExit

            try:
                res = predicate(*args)
                if inspect.isawaitable(res):
                    res = await res
            except ListenerExit:
                # ???
                await p.set(outcome.Value(args))
                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

outcome

Capture the outcome of Python function calls.

MIT OR Apache-2.0
Latest version published 6 months ago

Package Health Score

82 / 100
Full package analysis