python.py 675 B

1234567891011121314151617181920212223242526
  1. """Python script Exporter class"""
  2. # Copyright (c) Jupyter Development Team.
  3. # Distributed under the terms of the Modified BSD License.
  4. from traitlets import default
  5. from .templateexporter import TemplateExporter
  6. class PythonExporter(TemplateExporter):
  7. """
  8. Exports a Python code file.
  9. Note that the file produced will have a shebang of '#!/usr/bin/env python'
  10. regardless of the actual python version used in the notebook.
  11. """
  12. @default("file_extension")
  13. def _file_extension_default(self):
  14. return ".py"
  15. @default("template_name")
  16. def _template_name_default(self):
  17. return "python"
  18. output_mimetype = "text/x-python"