Go to the documentation of this file. 1 #ifndef NOTEBOOK_CONVERTER_HPP
2 #define NOTEBOOK_CONVERTER_HPP
8 #include <nlohmann/json.hpp>
44 void toggleSolution(
const QString &filePath,
const QString &solutionFilePath);
50 void resetNotebook(
const QString ¬ebookPath,
const QString ¬ebookSolutionPath);
73 void removeSolutionFromNotebook(
const QString ¬ebookPath);
75 QByteArray readFile(
const QString ¬ebookPath);
76 json parseJson(
const QByteArray &data,
const QString ¬ebookPath);
77 void processCells(
json ¬ebook,
const QString ¬ebookPath);
78 void processCell(
json &cell,
const QString ¬ebookPath,
int i);
79 void writeFile(
const json ¬ebook,
const QString ¬ebookPath);
80 void copyAndModifyNotebooks(
const QDir &sourceDir,
const QDir &destDir);
82 void removeSolutionCells(
const QString ¬ebookPath);
83 void addSolutionCells(
const QString ¬ebookPath,
const QString &solutionPath);
84 void manipulateSolutionCellContent(
json &solutionCell);
87 #endif // NOTEBOOK_CONVERTER_HPP
const QString USER_WORKSPACE
Path to the user workspace directory. Adjust it in devconatiner.json if changed.
Definition: folder_structure_constants.hpp:63
A class for converting Jupyter notebooks to Python scripts and processing task pools.
Definition: notebook_converter.hpp:23
const QString SOLUTION_CELL_TAG
Definition: notebook_converter.cpp:16
nlohmann::json json
Definition: notebook_converter.cpp:12
static bool hasSolutionCells(const QString ¬ebookPath)
Checks if the notebook contains any solution cells.
Definition: notebook_converter.cpp:428
nlohmann::json json
Definition: notebook_converter.hpp:10
const QString SOLUTION_CODE_PLACEHOLDER_END
Definition: notebook_converter.cpp:25
QString getPackagePath()
Retrieves the path of the package.
Definition: folder_structure_constants.hpp:80
const QString TASK_CELL_TAG
Definition: notebook_converter.cpp:14
void processTaskPool()
Modifies and copies all notebooks from task_pool to users workspace.
Definition: notebook_converter.cpp:95
const QString SOLUTION_SCRIPTS_SOURCE_PATH
Path to the solution scripts source directory.
Definition: folder_structure_constants.hpp:51
bool convertNotebook(const QString ¬ebookPath)
Converts a Jupyter notebook to a Python script. Ignoring code cells with "solution" tag.
Definition: notebook_converter.cpp:29
const QString NOT_IMPLEMENTED_ERROR
Definition: notebook_converter.cpp:18
const QString CONVERTED_SCRIPT_PATH
Path to the converted script.
Definition: folder_structure_constants.hpp:21
const QString SOLUTION_CODE_PLACEHOLDER_START
Definition: notebook_converter.cpp:24
const QString SOLUTION_REMOVED_CELL_TAG
Definition: notebook_converter.cpp:15
const QString WRITE_CODE_MARKER
Definition: notebook_converter.cpp:17
NotebookConverter()
Definition: notebook_converter.cpp:27
void toggleSolution(const QString &filePath, const QString &solutionFilePath)
Toggles the solution code in a Jupyter notebook.
Definition: notebook_converter.cpp:266
void resetNotebook(const QString ¬ebookPath, const QString ¬ebookSolutionPath)
Removes solution code from a Jupyter notebook.
Definition: notebook_converter.cpp:104
const QString SOLUTION_CELL_HEADER
Definition: notebook_converter.cpp:19