Preprocessors#
Submodules#
Base#
Check cell metadata#
- class CheckCellMetadata(**kwargs: Any)[source]#
A preprocessor for checking that grade ids are unique.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: Dict) Tuple[nbformat.notebooknode.NotebookNode, Dict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
Clear marking scheme#
- class ClearMarkScheme(**kwargs: Any)[source]#
- begin_mark_scheme_delimeter#
A trait for unicode strings.
- end_mark_scheme_delimeter#
A trait for unicode strings.
- enforce_metadata#
A boolean (True, False) trait.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
Clear output#
Clear solutions#
- class ClearSolutions(**kwargs: Any)[source]#
- begin_solution_delimeter#
A trait for unicode strings.
- code_stub#
An instance of a Python dict.
One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.
Changed in version 5.0: Added key_trait for validating dict keys.
Changed in version 5.0: Deprecated ambiguous
trait,traitsargs in favor ofvalue_trait,per_key_traits.
- end_solution_delimeter#
A trait for unicode strings.
- enforce_metadata#
A boolean (True, False) trait.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
- text_stub#
A trait for unicode strings.
Compute checksums#
- class ComputeChecksums(**kwargs: Any)[source]#
A preprocessor to compute checksums of grade cells.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
grader_convert.preprocessors.deduplicateids module#
- class DeduplicateIds(**kwargs: Any)[source]#
A preprocessor to overwrite information about grade and solution cells.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
Execute#
- class Execute(**kwargs: Any)[source]#
- allow_errors: bool#
A boolean (True, False) trait.
- execute_retries#
An int trait.
- extra_arguments: t.List#
An instance of a Python list.
- interrupt_on_timeout: bool#
A boolean (True, False) trait.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, retries: Optional[Any] = None) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- raise_on_iopub_timeout: bool#
A boolean (True, False) trait.
Get grades#
- class GetGrades(**kwargs: Any)[source]#
Preprocessor for saving grades from the database to the notebook
- display_data_priority#
An instance of a Python list.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
Limit output#
- class LimitOutput(**kwargs: Any)[source]#
Preprocessor for limiting cell output
- max_lines#
An int trait.
- max_traceback#
An int trait.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
Lock cells#
- class LockCells(**kwargs: Any)[source]#
A preprocessor for making cells undeletable.
- lock_all_cells#
A boolean (True, False) trait.
- lock_grade_cells#
A boolean (True, False) trait.
- lock_readonly_cells#
A boolean (True, False) trait.
- lock_solution_cells#
A boolean (True, False) trait.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
Overwrite cells#
- class OverwriteCells(**kwargs: Any)[source]#
A preprocessor to overwrite information about grade and solution cells.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
Overwrite kernel spec#
- class OverwriteKernelspec(**kwargs: Any)[source]#
A preprocessor for checking the notebook kernelspec metadata.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
Save autogrades#
- class SaveAutoGrades(**kwargs: Any)[source]#
Preprocessor for saving out the autograder grades into a database
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed
Save cells#
- class SaveCells(**kwargs: Any)[source]#
A preprocessor to save information about grade and solution cells.
- preprocess(nb: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Preprocessing to apply on each notebook.
Must return modified nb, resources.
If you wish to apply your preprocessing to each cell, you might want to override preprocess_cell method instead.
- Parameters
- nbNotebookNode
Notebook being converted
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- preprocess_cell(cell: nbformat.notebooknode.NotebookNode, resources: nbconvert.exporters.exporter.ResourcesDict, cell_index: int) Tuple[nbformat.notebooknode.NotebookNode, nbconvert.exporters.exporter.ResourcesDict][source]#
Override if you want to apply some preprocessing to each cell. Must return modified cell and resource dictionary.
- Parameters
- cellNotebookNode cell
Notebook cell being processed
- resourcesdictionary
Additional resources used in the conversion process. Allows preprocessors to pass variables into the Jinja engine.
- indexint
Index of the cell being processed