import zmq
from pyre import zhelper


def pipe(ctx=None, hwm=1000):
    if ctx is None:
        ctx = zmq.Context.instance()
    return zhelper.zcreate_pipe(ctx, hwm)
@@ -159,8 +159,757 @@
 tx, hwm)
+%0A%0A%0Aclass Poller:%0A    def __init__(self):%0A        self._poller = zmq.Poller()%0A        self.data = %7B%7D%0A%0A    @property%0A    def sockets(self):%0A        return self.data.keys()%0A%0A    def __contains__(self, socket):%0A        return socket in self.data%0A%0A    def register(self, socket, flags=zmq.POLLIN%7Czmq.POLLOUT, data=None):%0A        self._poller.register(socket, flags)%0A        self.data%5Bsocket%5D = data%0A%0A    def modify(self, socket, flags=zmq.POLLIN%7Czmq.POLLOUT, data=None):%0A        self.register(socket, data, flags)%0A%0A    def unregister(self, socket):%0A        self._poller.unregister(socket)%0A        del self.data%5Bsocket%5D%0A%0A    def poll(self, timeout=None):%0A        return %5B(socket, event, self.data%5Bsocket%5D) for socket, event in self._poller.poll(timeout)%5D%0A

add a wrapper around Poller that can store arbitrary per-socket data