ipypublish.postprocessors.file_actions module

class ipypublish.postprocessors.file_actions.CopyResourcePaths(*args, **kwargs)[source]

Bases: ipypublish.postprocessors.base.IPyPostProcessor

copy filepaths in the resources dict to another folder

property allowed_mimetypes

override in subclasses

return a list of allowed mime types if None, then all are allowed

Text based mime-types include: text/plain, text/latex, text/restructuredtext, text/html, text/x-python, application/json, text/markdown, text/asciidoc, text/yaml

files_folder

A trait for unicode strings.

property logger_name

override in subclass

property requires_path

override in subclasses

whether the prostprocessor requires the supplied filepath to have an existing parent directory

if True and filepath is None, will raise an IOError, otherwise, will try to make the directory if it doesn’t exist

resource_keys

An instance of a Python list.

run_postprocess(stream, mimetype, filepath, resources)[source]

should not be called directly override in sub-class

Parameters
  • stream (str) – the main file contents

  • filepath (None or pathlib.Path) – the path to the output file

  • resources (dict) – a resources dict, output from exporter.from_notebook_node

Returns

class ipypublish.postprocessors.file_actions.RemoveFolder(*args, **kwargs)[source]

Bases: ipypublish.postprocessors.base.IPyPostProcessor

remove a folder and all its contents

property allowed_mimetypes

override in subclasses

return a list of allowed mime types if None, then all are allowed

Text based mime-types include: text/plain, text/latex, text/restructuredtext, text/html, text/x-python, application/json, text/markdown, text/asciidoc, text/yaml

files_folder

A trait for unicode strings.

property logger_name

override in subclass

property requires_path

override in subclasses

whether the prostprocessor requires the supplied filepath to have an existing parent directory

if True and filepath is None, will raise an IOError, otherwise, will try to make the directory if it doesn’t exist

run_postprocess(stream, mimetype, filepath, resources)[source]

should not be called directly override in sub-class

Parameters
  • stream (str) – the main file contents

  • filepath (None or pathlib.Path) – the path to the output file

  • resources (dict) – a resources dict, output from exporter.from_notebook_node

Returns

class ipypublish.postprocessors.file_actions.WriteResourceFiles(*args, **kwargs)[source]

Bases: ipypublish.postprocessors.base.IPyPostProcessor

write content contained in the resources dict to file (as bytes)

property allowed_mimetypes

override in subclasses

return a list of allowed mime types if None, then all are allowed

Text based mime-types include: text/plain, text/latex, text/restructuredtext, text/html, text/x-python, application/json, text/markdown, text/asciidoc, text/yaml

property logger_name

override in subclass

property requires_path

override in subclasses

whether the prostprocessor requires the supplied filepath to have an existing parent directory

if True and filepath is None, will raise an IOError, otherwise, will try to make the directory if it doesn’t exist

resource_keys

An instance of a Python list.

run_postprocess(stream, mimetype, filepath, resources)[source]

should not be called directly override in sub-class

Parameters
  • stream (str) – the main file contents

  • filepath (None or pathlib.Path) – the path to the output file

  • resources (dict) – a resources dict, output from exporter.from_notebook_node

Returns

class ipypublish.postprocessors.file_actions.WriteTextFile(*args, **kwargs)[source]

Bases: ipypublish.postprocessors.base.IPyPostProcessor

write the stream to a text based file

property allowed_mimetypes

override in subclasses

return a list of allowed mime types if None, then all are allowed

Text based mime-types include: text/plain, text/latex, text/restructuredtext, text/html, text/x-python, application/json, text/markdown, text/asciidoc, text/yaml

encoding

A trait for unicode strings.

property logger_name

override in subclass

property requires_path

override in subclasses

whether the prostprocessor requires the supplied filepath to have an existing parent directory

if True and filepath is None, will raise an IOError, otherwise, will try to make the directory if it doesn’t exist

run_postprocess(stream, mimetype, filepath, resources)[source]

should not be called directly override in sub-class

Parameters
  • stream (str) – the main file contents

  • filepath (None or pathlib.Path) – the path to the output file

  • resources (dict) – a resources dict, output from exporter.from_notebook_node

Returns