Warning
This documentation is for an old version of IPython. You can find docs for newer versions here.
Module: html.services.contents.checkpoints
¶
Classes for managing Checkpoints.
2 Classes¶
-
class
IPython.html.services.contents.checkpoints.
Checkpoints
(**kwargs)¶ Bases:
IPython.config.configurable.LoggingConfigurable
Base class for managing checkpoints for a ContentsManager.
Subclasses are required to implement:
create_checkpoint(self, contents_mgr, path) restore_checkpoint(self, contents_mgr, checkpoint_id, path) rename_checkpoint(self, checkpoint_id, old_path, new_path) delete_checkpoint(self, checkpoint_id, path) list_checkpoints(self, path)
-
create_checkpoint
(contents_mgr, path)¶ Create a checkpoint.
-
delete_all_checkpoints
(path)¶ Delete all checkpoints for the given path.
-
delete_checkpoint
(checkpoint_id, path)¶ delete a checkpoint for a file
-
list_checkpoints
(path)¶ Return a list of checkpoints for a given file
-
rename_all_checkpoints
(old_path, new_path)¶ Rename all checkpoints for old_path to new_path.
-
rename_checkpoint
(checkpoint_id, old_path, new_path)¶ Rename a single checkpoint from old_path to new_path.
-
restore_checkpoint
(contents_mgr, checkpoint_id, path)¶ Restore a checkpoint
-
-
class
IPython.html.services.contents.checkpoints.
GenericCheckpointsMixin
¶ Bases:
object
Helper for creating Checkpoints subclasses that can be used with any ContentsManager.
Provides a ContentsManager-agnostic implementation of
create_checkpoint
andrestore_checkpoint
in terms of the following operations:- create_file_checkpoint(self, content, format, path)
- create_notebook_checkpoint(self, nb, path)
- get_file_checkpoint(self, checkpoint_id, path)
- get_notebook_checkpoint(self, checkpoint_id, path)
To create a generic CheckpointManager, add this mixin to a class that implement the above four methods plus the remaining Checkpoints API methods:
- delete_checkpoint(self, checkpoint_id, path)
- list_checkpoints(self, path)
- rename_checkpoint(self, checkpoint_id, old_path, new_path)
-
create_file_checkpoint
(content, format, path)¶ Create a checkpoint of the current state of a file
Returns a checkpoint model for the new checkpoint.
-
create_notebook_checkpoint
(nb, path)¶ Create a checkpoint of the current state of a file
Returns a checkpoint model for the new checkpoint.
-
get_file_checkpoint
(checkpoint_id, path)¶ Get the content of a checkpoint for a non-notebook file.
Returns a dict of the form: {
‘type’: ‘file’, ‘content’: <str>, ‘format’: {‘text’,’base64’},}
-
get_notebook_checkpoint
(checkpoint_id, path)¶ Get the content of a checkpoint for a notebook.
Returns a dict of the form: {
‘type’: ‘notebook’, ‘content’: <output of nbformat.read>,}
-
restore_checkpoint
(contents_mgr, checkpoint_id, path)¶ Restore a checkpoint.