kernel.pendingdeferred — IPython 0.10.2 documentation

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »

# kernel.pendingdeferred

## Module: `kernel.pendingdeferred`

Inheritance diagram for `IPython.kernel.pendingdeferred`:

Classes to manage pending Deferreds.

A pending deferred is a deferred that may or may not have fired. This module is useful for taking a class whose methods return deferreds and wrapping it to provide API that keeps track of those deferreds for later retrieval. See the tests for examples of its usage.

## `PendingDeferredManager`

class `IPython.kernel.pendingdeferred.` `PendingDeferredManager`

  Bases: `object`

  A class to track pending deferreds.

  To track a pending deferred, the user of this class must first get a deferredID by calling get_next_deferred_id. Then the user calls save_pending_deferred passing that id and the deferred to be tracked. To later retrieve it, the user calls get_pending_deferred passing the id.

  `__init__`()

    Manage pending deferreds.

  `clear_pending_deferreds`()

    Remove all the deferreds I am tracking.

  `delete_pending_deferred`()

    Remove a deferred I am tracking and add a null Errback.

    Parameters : | deferredID : str The id of a deferred that I am tracking.

  `get_deferred_id`()
  `get_pending_deferred`()
  `quick_has_id`()
  `save_pending_deferred`()

    Save the result of a deferred for later retrieval.

    This works even if the deferred has not fired.

    Only callbacks and errbacks applied to d before this method is called will be called no the final result.

`IPython.kernel.pendingdeferred.` `two_phase`()

  Wrap methods that return a deferred into a two phase process.

  This transforms:

      foo(arg1, arg2, ...) -> foo(arg1, arg2,...,block=True).

  The wrapped method will then return a deferred to a deferred id. This will only work on method of classes that inherit from PendingDeferredManager, as that class provides an API for

  block is a boolean to determine if we should use the two phase process or just simply call the wrapped method. At this point block does not have a default and it probably won’t.

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »