/usr/lib/python2.7/dist-packages/sagenb_export/actions.py is in python-sagenb-export 3.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import sys
from sagenb_export.logger import log
from sagenb_export.sagenb_reader import NotebookSageNB
def action_list(dot_sage):
def tr(unique_id, name):
print(u'{0:<15} | {1}'.format(unique_id, name))
tr('Unique ID', 'Notebook Name')
print('-' * 79)
notebooks = dict(
(notebook.sort_key, notebook)
for notebook in NotebookSageNB.all_iter(dot_sage)
)
for key in sorted(notebooks.keys()):
notebook = notebooks[key]
tr(notebook.unique_id, notebook.name)
def action_print(sagenb):
from sagenb_export.text_writer import TextWriter
TextWriter(sagenb).write(sys.stdout)
def action_convert_ipynb(sagenb, ipynb_filename):
from sagenb_export.ipynb_writer import IpynbWriter
IpynbWriter(sagenb).write(ipynb_filename)
|