Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8da090
commit 53320d0
Showing
3 changed files
with
27 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,42 @@ | ||
from IPython.utils.tz import utcnow | ||
from jupyter_server.services.contents.checkpoints import GenericCheckpointsMixin, Checkpoints | ||
|
||
|
||
class NoOpCheckpoints(GenericCheckpointsMixin, Checkpoints): | ||
"""requires the following methods:""" | ||
# source: https://jupyter-server.readthedocs.io/en/latest/developers/contents.html | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.log.info("**** NoOpCheckpoints initialized") | ||
|
||
def checkpoint_model(self): | ||
info = { | ||
"id": "", | ||
"last_modified": utcnow() | ||
} | ||
return info | ||
|
||
def create_file_checkpoint(self, content, format, path): | ||
""" -> checkpoint model""" | ||
return self.checkpoint_model() | ||
|
||
def create_notebook_checkpoint(self, nb, path): | ||
""" -> checkpoint model""" | ||
return self.checkpoint_model() | ||
|
||
def get_file_checkpoint(self, checkpoint_id, path): | ||
""" -> {'type': 'file', 'content': <str>, 'format': {'text', 'base64'}}""" | ||
|
||
def get_notebook_checkpoint(self, checkpoint_id, path): | ||
""" -> {'type': 'notebook', 'content': <output of nbformat.read>}""" | ||
|
||
def delete_checkpoint(self, checkpoint_id, path): | ||
"""deletes a checkpoint for a file""" | ||
|
||
def list_checkpoints(self, path): | ||
"""returns a list of checkpoint models for a given file, | ||
default just does one per file | ||
""" | ||
return [] | ||
|
||
def rename_checkpoint(self, checkpoint_id, old_path, new_path): | ||
"""renames checkpoint from old path to new path""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters