We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e79650 commit f7cf43aCopy full SHA for f7cf43a
1 file changed
.github/workflows/validate_and_fix_notebook.yml
@@ -36,8 +36,11 @@ jobs:
36
with open(file, 'r') as f:
37
nb = nbformat.read(f, as_version=4)
38
nbformat.validate(nb)
39
- if 'application/vnd.jupyter.widget-state+json' not in nb.metadata.get('widgets', {}):
40
- nb.metadata['widgets'] = {'application/vnd.jupyter.widget-state+json': {'version': '1.0'}}
+ if 'widgets' in nb.metadata:
+ if 'application/vnd.jupyter.widget-state+json' not in nb.metadata['widgets']:
41
+ nb.metadata['widgets']['application/vnd.jupyter.widget-state+json'] = {'version': '1.0', 'state': {}}
42
+ elif 'state' not in nb.metadata['widgets']['application/vnd.jupyter.widget-state+json']:
43
+ nb.metadata['widgets']['application/vnd.jupyter.widget-state+json']['state'] = {}
44
with open(file, 'w') as f:
45
nbformat.write(nb, f)
46
"
0 commit comments