Skip to content

Commit

Permalink
adding rmd support: type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyBRoswell committed Jul 23, 2024
1 parent b7550c0 commit b1f9588
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vreapis/containerizer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b1f9588

Please sign in to comment.