Learn Environment
Public Member Functions | Static Public Member Functions | List of all members
NotebookConverter Class Reference

A class for converting Jupyter notebooks to Python scripts and processing task pools. More...

#include <notebook_converter.hpp>

Collaboration diagram for NotebookConverter:
Collaboration graph

Public Member Functions

 NotebookConverter ()
 
bool convertNotebook (const QString &notebookPath)
 Converts a Jupyter notebook to a Python script. Ignoring code cells with "solution" tag. More...
 
void processTaskPool ()
 Modifies and copies all notebooks from task_pool to users workspace. More...
 
void toggleSolution (const QString &filePath, const QString &solutionFilePath)
 Toggles the solution code in a Jupyter notebook. More...
 
void resetNotebook (const QString &notebookPath, const QString &notebookSolutionPath)
 Removes solution code from a Jupyter notebook. More...
 

Static Public Member Functions

static bool hasSolutionCells (const QString &notebookPath)
 Checks if the notebook contains any solution cells. More...
 

Detailed Description

A class for converting Jupyter notebooks to Python scripts and processing task pools.

The NotebookConverter class provides functionality to convert Jupyter notebooks into Python scripts, ignoring code cells with a "solution" tag. It also processes and modifies notebooks from a task pool, removing solution code and adding metadata tags to indicate modified cells.

The class includes methods for reading and writing files, parsing JSON content, and processing notebook cells. It ensures that the structure of the notebook is preserved while removing solution code and adding necessary metadata.

Constructor & Destructor Documentation

◆ NotebookConverter()

NotebookConverter::NotebookConverter ( )
explicit

Member Function Documentation

◆ convertNotebook()

bool NotebookConverter::convertNotebook ( const QString &  notebookPath)

Converts a Jupyter notebook to a Python script. Ignoring code cells with "solution" tag.

Parameters
notebookPathPath to the notebook file.
Returns
True if conversion is successful, else False.

◆ hasSolutionCells()

bool NotebookConverter::hasSolutionCells ( const QString &  notebookPath)
static

Checks if the notebook contains any solution cells.

Parameters
notebookPathPath to the notebook file.
Returns
True if solution cells are present, else False.
Here is the caller graph for this function:

◆ processTaskPool()

void NotebookConverter::processTaskPool ( )

Modifies and copies all notebooks from task_pool to users workspace.

Here is the caller graph for this function:

◆ resetNotebook()

void NotebookConverter::resetNotebook ( const QString &  notebookPath,
const QString &  notebookSolutionPath 
)

Removes solution code from a Jupyter notebook.

Parameters
notebookPathPath to the notebook file.

◆ toggleSolution()

void NotebookConverter::toggleSolution ( const QString &  filePath,
const QString &  solutionFilePath 
)

Toggles the solution code in a Jupyter notebook.

Parameters
filePathPath to the notebook file.
solutionFilePathPath to the solution notebook file.
Here is the caller graph for this function:

The documentation for this class was generated from the following files: