environment/lib/python2.7/site-packages/IPython/parallel/client/client.py
def _flush_iopub(self, sock):
        """Flush replies from the iopub channel waiting
        in the ZMQ queue.
        """
        idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
        while msg is not None:
            if self.debug:
                pprint(msg)
            parent = msg['parent_header']
            # ignore IOPub messages with no parent.
            # Caused by print statements or warnings from before the first execution.
            if not parent:
                continue
            msg_id = parent['msg_id']
            content = msg['content']
            header = msg['header']
            msg_type = msg['header']['msg_type']

            # init metadata:
            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']})
            elif msg_type == 'display_data':
                md['outputs'].append(content)
            elif msg_type == 'pyout':
                md['pyout'] = content
            elif msg_type == 'status':
                # idle message comes after all outputs
                if content['execution_state'] == 'idle':
                    md['outputs_ready'] = True
            else:
                # unhandled msg_type (status, etc.)
                pass

            # reduntant?
            self.metadata[msg_id] = md

            idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
def _flush_iopub(self, sock):
        """Flush replies from the iopub channel waiting
        in the ZMQ queue.
        """
        idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
        while msg is not None:
            if self.debug:
                pprint(msg)
            parent = msg['parent_header']
            # ignore IOPub messages with no parent.
            # Caused by print statements or warnings from before the first execution.
            if not parent:
                continue
            msg_id = parent['msg_id']
            content = msg['content']
            header = msg['header']
            msg_type = msg['header']['msg_type']

            # init metadata:
            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']})
            elif msg_type == 'display_data':
                md['outputs'].append(content)
            elif msg_type == 'pyout':
                md['pyout'] = content
            elif msg_type == 'status':
                # idle message comes after all outputs
                if content['execution_state'] == 'idle':
                    md['outputs_ready'] = True
            else:
                # unhandled msg_type (status, etc.)
                pass

            # reduntant?
            self.metadata[msg_id] = md

            idents,msg = self.session.recv(sock, mode=zmq.NOBLOCK)
Flush replies from the iopub channel waiting
        in the ZMQ queue.