

def _flush_iopub(self, sock):
    'Flush replies from the iopub channel waiting\n        in the ZMQ queue.\n        '
    (idents, msg) = self.session.recv(sock, mode=zmq.NOBLOCK)
    while (msg is not None):
        if self.debug:
            pprint(msg)
        parent = msg['parent_header']
        msg_id = parent['msg_id']
        content = msg['content']
        header = msg['header']
        msg_type = msg['msg_type']
        md = self.metadata[msg_id]
        if (msg_type == 'stream'):
            name = content['name']
            s = (md[name] or '')
            md[name] = (s + content['data'])
        elif (msg_type == 'pyerr'):
            md.update({
                'pyerr': self._unwrap_exception(content),
            })
        elif (msg_type == 'pyin'):
            md.update({
                'pyin': content['code'],
            })
        else:
            md.update({
                msg_type: content.get('data', ''),
            })
        self.metadata[msg_id] = md
        (idents, msg) = self.session.recv(sock, mode=zmq.NOBLOCK)

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client._flush_iopub/original