From b1f95882c08b200fcf34df1f3e8b9059f6c483c5 Mon Sep 17 00:00:00 2001 From: Andy Bayer Roswell Date: Wed, 24 Jul 2024 00:03:59 +0200 Subject: [PATCH] adding rmd support: type hints --- vreapis/containerizer/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vreapis/containerizer/views.py b/vreapis/containerizer/views.py index 22efce6..9c3c6f9 100644 --- a/vreapis/containerizer/views.py +++ b/vreapis/containerizer/views.py @@ -69,14 +69,14 @@ class ExtractorHandler(APIView): authentication_classes = [StaticTokenAuthentication] permission_classes = [IsAuthenticated] - def extract_cell_by_index(self, notebook, cell_index): + def extract_cell_by_index(self, notebook: nbformat.notebooknode, cell_index: int) -> nbformat.NotebookNode: new_nb = copy.deepcopy(notebook) if cell_index < len(notebook.cells): new_nb.cells = [notebook.cells[cell_index]] return new_nb - def set_notebook_kernel(self, notebook, kernel): - new_nb = copy.deepcopy(notebook) + def set_notebook_kernel(self, notebook: nbformat.NotebookNode, kernel: str) -> nbformat.NotebookNode: + new_nb: nbformat.NotebookNode = copy.deepcopy(notebook) # Replace kernel name in the notebook metadata new_nb.metadata.kernelspec.name = kernel new_nb.metadata.kernelspec.display_name = kernel