| Conditions | 3 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from __future__ import absolute_import, print_function, unicode_literals |
||
| 15 | def inspect_ipynb_package(filename, fileobj, *args, **kwargs): |
||
| 16 | notebook = nbformat.read(fileobj, nbformat.NO_CONVERT) |
||
| 17 | summary = notebook['metadata'].get('summary', 'Jupyter Notebook') |
||
| 18 | description = notebook['metadata'].get('description', 'Jupyter Notebook') |
||
| 19 | |||
| 20 | package_data = { |
||
| 21 | 'name': re.sub('\-ipynb$', '', parameterize(os.path.basename(filename))), |
||
| 22 | 'summary': summary, |
||
| 23 | 'description': description, |
||
| 24 | } |
||
| 25 | |||
| 26 | if 'parser_args' in kwargs and kwargs['parser_args'].thumbnail: |
||
| 27 | package_data['thumbnail'] = data_uri_from(kwargs['parser_args'].thumbnail) |
||
| 28 | |||
| 29 | release_data = { |
||
| 30 | 'version': datetime.now().strftime('%Y.%m.%d.%H%M'), |
||
| 31 | 'summary': summary, |
||
| 32 | 'description': description, |
||
| 33 | } |
||
| 34 | |||
| 35 | file_data = { |
||
| 36 | 'basename': os.path.basename(filename), |
||
| 37 | 'attrs': {} |
||
| 38 | } |
||
| 39 | |||
| 40 | return package_data, release_data, file_data |
||
| 41 |