base.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. """
  2. Contains writer base class.
  3. """
  4. # Copyright (c) Jupyter Development Team.
  5. # Distributed under the terms of the Modified BSD License.
  6. from traitlets import List
  7. from ..utils.base import NbConvertBase
  8. class WriterBase(NbConvertBase):
  9. """Consumes output from nbconvert export...() methods and writes to a
  10. useful location. """
  11. files = List([], help="""
  12. List of the files that the notebook references. Files will be
  13. included with written output.""").tag(config=True)
  14. def __init__(self, config=None, **kw):
  15. """
  16. Constructor
  17. """
  18. super(WriterBase, self).__init__(config=config, **kw)
  19. def write(self, output, resources, **kw):
  20. """
  21. Consume and write Jinja output.
  22. Parameters
  23. ----------
  24. output : string
  25. Conversion results. This string contains the file contents of the
  26. converted file.
  27. resources : dict
  28. Resources created and filled by the nbconvert conversion process.
  29. Includes output from preprocessors, such as the extract figure
  30. preprocessor.
  31. """
  32. raise NotImplementedError()