kazoo.handlers.utils

Kazoo handler helpers

Public API

kazoo.handlers.utils.capture_exceptions(async_result)[source]

Return a new decorated function that propagates the exceptions of the wrapped function to an async_result.

Parameters:

async_result – An async result implementing IAsyncResult

kazoo.handlers.utils.wrap(async_result)[source]

Return a new decorated function that propagates the return value or exception of wrapped function to an async_result. NOTE: Only propagates a non-None return value.

Parameters:

async_result – An async result implementing IAsyncResult

Private API

kazoo.handlers.utils.create_socket_pair(module, port=0)[source]

Create socket pair.

If socket.socketpair isn’t available, we emulate it.

kazoo.handlers.utils.create_tcp_socket(module)[source]

Create a TCP socket with the CLOEXEC flag set.