How to use the outcome.capture 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 RazerM / sqlalchemy_aio / sqlalchemy_aio / trio.py View on Github external
def thread_fn(self):
        while True:
            try:
                request = self._portal.run(self._receive_from_trio.receive)
            except (Cancelled, RunFinishedError):
                break
            except trio.EndOfChannel:
                with suppress(Cancelled, RunFinishedError):
                    self._portal.run(self._send_to_trio.aclose)
                break

            response = outcome.capture(request)
            self._portal.run(self._send_to_trio.send, response)
github RazerM / sqlalchemy_aio / sqlalchemy_aio / asyncio.py View on Github external
def thread_fn(self):
        while True:
            fut = asyncio.run_coroutine_threadsafe(
                self._request_queue.get(), self._loop)
            try:
                request = fut.result()
            except CancelledError:
                continue

            if request is not _STOP:
                response = outcome.capture(request)
                fut = asyncio.run_coroutine_threadsafe(
                    self._response_queue.put(response), self._loop)
                fut.result()
            else:
                fut = asyncio.run_coroutine_threadsafe(
                    self._response_queue.put(None), self._loop)
                fut.result()
                break

outcome

Capture the outcome of Python function calls.

MIT OR Apache-2.0
Latest version published 1 year ago

Package Health Score

71 / 100
Full package analysis