A base class notebook manager.
Copy an existing notebook and return its notebook_id.
Create a checkpoint of the current state of a notebook
Returns a checkpoint_id for the new checkpoint.
delete a checkpoint for a notebook
Delete notebook by notebook_id.
Delete a notebook’s id in the mapping.
This doesn’t delete the actual notebook, only its entry in the mapping.
Get the representation of a notebook in format by notebook_id.
Increment a filename to make it unique.
This exists for notebook stores that must have unique names. When a notebook is created or copied this method constructs a unique filename, typically by appending an integer to the name.
Return a list of checkpoints for a given notebook
List all notebooks.
This returns a list of dicts, each of the form:
This list of dicts should be sorted by name:
data = sorted(data, key=lambda item: item['name'])
Load the notebook names into memory.
This should be called once immediately after the notebook manager is created to load the existing notebooks into the mapping in memory.
Create a new notebook and return its notebook_id.
Generate a new notebook_id for a name and store its mapping.
Does a notebook exist?
Get the object representation of a notebook by notebook_id.
Restore a notebook from one of its checkpoints
Save a new notebook and return its notebook_id.
If a name is passed in, it overrides any values in the notebook data and the value in the data is updated to use that value.
Save an existing notebook by notebook_id.
Write a notebook object and return its notebook_id.
If notebook_id is None, this method should create a new notebook_id. If notebook_id is not None, this method should check to make sure it exists and is valid.