Show More
@@ -224,12 +224,3 b' def get_export_names():' | |||||
224 | # filter out the one method that is not a template |
|
224 | # filter out the one method that is not a template | |
225 | l = [x for x in l if 'by_name' not in x] |
|
225 | l = [x for x in l if 'by_name' not in x] | |
226 | return sorted(l) |
|
226 | return sorted(l) | |
227 |
|
||||
228 | def get_exporters(): |
|
|||
229 | "Return a list of the currently supported export targets" |
|
|||
230 | # grab everything after 'export_' |
|
|||
231 | l = [x for x in __all__ if x.endswith('Exporter')] |
|
|||
232 | g = globals() |
|
|||
233 | # filter out the one method that is not a template |
|
|||
234 | l = [g[x] for x in l if issubclass(g[x], Exporter)] |
|
|||
235 | return sorted(l) |
|
@@ -23,14 +23,12 b' import glob' | |||||
23 |
|
23 | |||
24 | #From IPython |
|
24 | #From IPython | |
25 | from IPython.core.application import BaseIPythonApplication, base_aliases, base_flags |
|
25 | from IPython.core.application import BaseIPythonApplication, base_aliases, base_flags | |
26 |
from IPython.config |
|
26 | from IPython.config import catch_config_error, Configurable | |
27 | from IPython.utils.traitlets import Unicode, List, Instance, DottedObjectName, Type |
|
27 | from IPython.utils.traitlets import Unicode, List, Instance, DottedObjectName, Type | |
28 | from IPython.utils.importstring import import_item |
|
28 | from IPython.utils.importstring import import_item | |
29 |
|
29 | |||
30 | from .exporters.export import ( |
|
30 | from .exporters.export import export_by_name, get_export_names, ExporterNameError | |
31 | export_by_name, get_export_names, ExporterNameError, get_exporters |
|
31 | from IPython.nbconvert import exporters, transformers, writers | |
32 | ) |
|
|||
33 | from .writers import FilesWriter, StdoutWriter |
|
|||
34 | from .utils.base import NbConvertBase |
|
32 | from .utils.base import NbConvertBase | |
35 |
|
33 | |||
36 | #----------------------------------------------------------------------------- |
|
34 | #----------------------------------------------------------------------------- | |
@@ -63,15 +61,13 b' class NbConvertApp(BaseIPythonApplication):' | |||||
63 | flags = nbconvert_flags |
|
61 | flags = nbconvert_flags | |
64 |
|
62 | |||
65 | def _classes_default(self): |
|
63 | def _classes_default(self): | |
66 | classes = [] |
|
64 | classes = [NbConvertBase] | |
67 | classes.extend(get_exporters()) |
|
65 | for pkg in (exporters, transformers, writers): | |
68 | classes.extend([FilesWriter, StdoutWriter]) |
|
66 | for name in dir(pkg): | |
69 |
|
67 | cls = getattr(pkg, name) | ||
70 | return [ |
|
68 | if isinstance(cls, type) and issubclass(cls, Configurable): | |
71 | Exporter, |
|
69 | classes.append(cls) | |
72 | WriterBase, |
|
70 | return classes | |
73 | NbConvertBase, |
|
|||
74 | ] |
|
|||
75 |
|
71 | |||
76 | description = Unicode( |
|
72 | description = Unicode( | |
77 | u"""This application is used to convert notebook files (*.ipynb). |
|
73 | u"""This application is used to convert notebook files (*.ipynb). |
General Comments 0
You need to be logged in to leave comments.
Login now