def __init__(self, context, socket_type):
        super(Socket, self).__init__(context, socket_type)
        on_state_changed_fd = self.getsockopt(_zmq.FD)
        # NOTE: pyzmq 13.0.0 messed up with setattr (they turned it into a
        # non-op) and you can't assign attributes normally anymore, hence the
        # tricks with self.__dict__ here
        self.__dict__["_readable"] = gevent.event.Event()
        self.__dict__["_writable"] = gevent.event.Event()
        try:
            # gevent>=1.0
            self.__dict__["_state_event"] = gevent.hub.get_hub().loop.io(
                on_state_changed_fd, gevent.core.READ)
            self._state_event.start(self._on_state_changed)
        except __HOLE__:
            # gevent<1.0
            self.__dict__["_state_event"] = \
                gevent.core.read_event(on_state_changed_fd,
                                       self._on_state_changed, persist=True)
dataset/ETHPy150Open 0rpc/zerorpc-python/zerorpc/gevent_zmq.py/Socket.__init__