Converters#

Submodules#

Autograde#

class Autograde(**kwargs: Any)[source]#
autograde_preprocessors#

An instance of a Python list.

convert_notebooks() None[source]#
convert_single_notebook(notebook_filename: str) None[source]#

Convert a single notebook.

Performs the following steps:
  1. Initialize notebook resources

  2. Export the notebook to a particular format

  3. Write the exported notebook to file

preprocessors#

An instance of a Python list.

sanitize_preprocessors#

An instance of a Python list.

start() None[source]#
class AutogradeApp(**kwargs: Any)[source]#
start()[source]#

Start the app mainloop.

Override in subclasses.

version = '0.1.2'#

Base#

class BaseConverter(**kwargs: Any)[source]#
assignments#

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, traits args in favor of value_trait, per_key_traits.

convert_notebooks() None[source]#
convert_single_notebook(notebook_filename: str) None[source]#

Convert a single notebook.

Performs the following steps:
  1. Initialize notebook resources

  2. Export the notebook to a particular format

  3. Write the exported notebook to file

exporter#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

exporter_class#

A trait whose value must be a subclass of a specified class.

force#

A boolean (True, False) trait.

ignore#

An instance of a Python list.

init_destination() bool[source]#

Initialize the destination for an assignment. Returns whether the assignment should actually be processed or not (i.e. whether the initialization was successful).

init_notebooks() None[source]#
init_single_notebook_resources(notebook_filename: str) Dict[str, Any][source]#
notebooks#

An instance of a Python list.

permissions#

An int trait.

post_convert_hook#

A trait which allows any value.

pre_convert_hook#

A trait which allows any value.

preprocessors#

An instance of a Python list.

run_post_convert_hook()[source]#
run_pre_convert_hook()[source]#
set_permissions() None[source]#
start() None[source]#
write_single_notebook(output: str, resources: nbconvert.exporters.exporter.ResourcesDict) None[source]#
writer#

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

exception GraderConvertException[source]#

BaseApp#

class ConverterApp(**kwargs: Any)[source]#
aliases: Dict[str, str] = {'file_pattern': 'ConverterApp.file_pattern', 'i': 'ConverterApp.input_directory', 'input_directory': 'ConverterApp.input_directory', 'log-level': 'Application.log_level', 'o': 'ConverterApp.output_directory', 'output_directory': 'ConverterApp.output_directory', 'p': 'ConverterApp.file_pattern'}#

the alias map for configurables Keys might strings or tuples for additional options; single-letter alias accessed like -v. Values might be like “Class.trait” strings of two-tuples: (Class.trait, help-text).

description = 'Base app for converters\n    '#
fail(msg, *args)[source]#

Log the error msg using self.log.error and exit using sys.exit(1).

file_pattern#

A trait for unicode strings.

flags: Dict[str, Any] = {'debug': ({'Application': {'log_level': 'DEBUG'}}, 'set log level to DEBUG (maximize logging output)'), 'quiet': ({'Application': {'log_level': 'CRITICAL'}}, 'set log level to CRITICAL (minimize logging output)')}#
input_directory#

A trait for unicode strings.

output_directory#

A trait for unicode strings.

Generate Assignment#

class GenerateAssignment(**kwargs: Any)[source]#
create_assignment#

A boolean (True, False) trait.

preprocessors#

An instance of a Python list.

start() None[source]#
class GenerateAssignmentApp(**kwargs: Any)[source]#
start()[source]#

Start the app mainloop.

Override in subclasses.

version = '0.1.2'#

Generate Feedback#

class GenerateFeedback(**kwargs: Any)[source]#
preprocessors#

An instance of a Python list.

class GenerateFeedbackApp(**kwargs: Any)[source]#
start()[source]#

Start the app mainloop.

Override in subclasses.

version = '0.1.2'#

Generate Solution#

class GenerateSolution(**kwargs: Any)[source]#
create_assignment#

A boolean (True, False) trait.

preprocessors#

An instance of a Python list.

start() None[source]#
class GenerateSolutionApp(**kwargs: Any)[source]#
start()[source]#

Start the app mainloop.

Override in subclasses.

version = '0.1.2'#

Update App#

class UpdateApp(**kwargs: Any)[source]#
aliases: Dict[str, str] = {'log-level': 'Application.log_level'}#

the alias map for configurables Keys might strings or tuples for additional options; single-letter alias accessed like -v. Values might be like “Class.trait” strings of two-tuples: (Class.trait, help-text).

description = 'Update nbgrader notebook metadata'#
examples = '\n        nbgrader stores metadata in the JSON source of the notebooks. Previously,\n        we did not do a good job of validating whether this metadata was\n        correctly formatted or not. Starting in version 0.4.0 of nbgrader, we\n        are explicitly validating this metadata. This will require that you\n        update the metadata in your old nbgrader notebooks to be consistent\n        with what nbgrader expects.\n\n        The `nbgrader update` command performs this metadata update for you\n        easily. All you need to do is point it at a directory, and it will\n        find all notebooks in that directory and update them to have the\n        correct metadata:\n\n            # update notebooks rooted in the current directory\n            nbgrader update .\n\n            # update notebooks rooted in the `class_files` directory\n            nbgrader update class_files/\n\n        Alternately, you can open all your notebooks with the "Create Assignment"\n        toolbar and re-save them from the notebook interface. But, it will be\n        more efficient to run the `nbgrader update` command to get them all in\n        one fell swoop.\n        '#
flags: Dict[str, Any] = {}#
name = 'update'#
start()[source]#

Start the app mainloop.

Override in subclasses.

validate#

A boolean (True, False) trait.

Validate App#

class ValidateApp(**kwargs: Any)[source]#
aliases: Dict[str, str] = {}#

the alias map for configurables Keys might strings or tuples for additional options; single-letter alias accessed like -v. Values might be like “Class.trait” strings of two-tuples: (Class.trait, help-text).

description = 'Validate a notebook by running it'#
examples = '\n        You can run `grader-convert validate` on just a single file, e.g.:\n            grader-convert validate "Problem 1.ipynb"\n\n        Or, you can run it on multiple files using shell globs:\n            grader-convert validate "Problem Set 1/*.ipynb"\n\n        If you want to test instead that none of the tests pass (rather than that\n        all of the tests pass, which is the default), you can use --invert:\n            grader-convert validate --invert "Problem 1.ipynb"\n        '#
flags: Dict[str, Any] = {'invert': ({'Validator': {'invert': True}}, 'Complain when cells pass, rather than vice versa.')}#
name = 'validate'#
start()[source]#

Start the app mainloop.

Override in subclasses.