Language Translators

Translators

Translator

class papermill.translators.Translator
classmethod assign(name, str_val)
classmethod codify(parameters, comment='Parameters')
classmethod comment(cmt_str)
classmethod inspect(parameters_cell)

Inspect the parameters cell to get a Parameter list

It must return an empty list if no parameters are found and it should ignore inspection errors.

Note

inferred_type_name should be “None” if unknown (set it to “NoneType” for null value)

Parameters:parameters_cell (NotebookNode) – Cell tagged _parameters_
Returns:A list of all parameters
Return type:List[Parameter]
classmethod translate(val)

Translate each of the standard json/yaml types to appropiate objects.

classmethod translate_bool(val)

Default behavior for translation

classmethod translate_dict(val)
classmethod translate_escaped_str(str_val)

Reusable by most interpreters

classmethod translate_float(val)

Default behavior for translation

classmethod translate_int(val)

Default behavior for translation

classmethod translate_list(val)
classmethod translate_none(val)

Default behavior for translation

classmethod translate_raw_str(val)

Reusable by most interpreters

classmethod translate_str(val)

Default behavior for translation

PapermillTranslators

class papermill.translators.PapermillTranslators

The holder which houses any translator registered with the system. This object is used in a singleton manner to save and load particular named Translator objects for reference externally.

find_translator(kernel_name, language)
register(language, translator)

Python

class papermill.translators.PythonTranslator
PARAMETER_PATTERN = re.compile('^(?P<target>\\w[\\w_]*)\\s*(:\\s*[\\"\']?(?P<annotation>\\w[\\w_\\[\\],\\s]*)[\\"\']?\\s*)?=\\s*(?P<value>.*?)(\\s*#\\s*(type:\\s*(?P<type_comment>[^\\s]*)\\s*)?(?P<help>.*))?$')
classmethod codify(parameters, comment='Parameters')
classmethod comment(cmt_str)
classmethod inspect(parameters_cell)

Inspect the parameters cell to get a Parameter list

It must return an empty list if no parameters are found and it should ignore inspection errors.

Parameters:parameters_cell (NotebookNode) – Cell tagged _parameters_
Returns:A list of all parameters
Return type:List[Parameter]
classmethod translate_bool(val)

Default behavior for translation

classmethod translate_dict(val)
classmethod translate_float(val)

Default behavior for translation

classmethod translate_list(val)

R

class papermill.translators.RTranslator
classmethod assign(name, str_val)
classmethod comment(cmt_str)
classmethod translate_bool(val)

Default behavior for translation

classmethod translate_dict(val)
classmethod translate_list(val)
classmethod translate_none(val)

Default behavior for translation

Julia

class papermill.translators.JuliaTranslator
classmethod comment(cmt_str)
classmethod translate_dict(val)
classmethod translate_list(val)
classmethod translate_none(val)

Default behavior for translation

Scala

class papermill.translators.ScalaTranslator
classmethod assign(name, str_val)
classmethod comment(cmt_str)
classmethod translate_dict(val)

Translate dicts to scala Maps

classmethod translate_int(val)

Default behavior for translation

classmethod translate_list(val)

Translate list to scala Seq

Functions

papermill.translators.translate_parameters(kernel_name, language, parameters, comment='Parameters')