

@spin_first
def get_result(self, indices_or_msg_ids=None, block=None):
    'Retrieve a result by msg_id or history index, wrapped in an AsyncResult object.\n        \n        If the client already has the results, no request to the Hub will be made.\n        \n        This is a convenient way to construct AsyncResult objects, which are wrappers\n        that include metadata about execution, and allow for awaiting results that\n        were not submitted by this Client.\n        \n        It can also be a convenient way to retrieve the metadata associated with\n        blocking execution, since it always retrieves\n        \n        Examples\n        --------\n        ::\n        \n            In [10]: r = client.apply()\n        \n        Parameters\n        ----------\n        \n        indices_or_msg_ids : integer history index, str msg_id, or list of either\n            The indices or msg_ids of indices to be retrieved\n        \n        block : bool\n            Whether to wait for the result to be done\n        \n        Returns\n        -------\n        \n        AsyncResult\n            A single AsyncResult object will always be returned.\n        \n        AsyncHubResult\n            A subclass of AsyncResult that retrieves results from the Hub\n        \n        '
    block = (self.block if (block is None) else block)
    if (indices_or_msg_ids is None):
        indices_or_msg_ids = (- 1)
    if (not isinstance(indices_or_msg_ids, (list, tuple))):
        indices_or_msg_ids = [indices_or_msg_ids]
    theids = []
    for id in indices_or_msg_ids:
        if isinstance(id, int):
            id = self.history[id]
        if (not isinstance(id, str)):
            raise TypeError(('indices must be str or int, not %r' % id))
        theids.append(id)
    local_ids = [msg_id for msg_id in theids if ((msg_id in self.history) or (msg_id in self.results))]
    remote_ids = [msg_id for msg_id in theids if (msg_id not in local_ids)]
    if remote_ids:
        ar = AsyncHubResult(self, msg_ids=theids)
    else:
        ar = AsyncResult(self, msg_ids=theids)
    if block:
        ar.wait()
    return ar

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