Skip to content

Instantly share code, notes, and snippets.

@jakirkham
Created August 21, 2015 17:28
Show Gist options
  • Save jakirkham/0d2f4708cad69e71b1f6 to your computer and use it in GitHub Desktop.
Save jakirkham/0d2f4708cad69e71b1f6 to your computer and use it in GitHub Desktop.
jq_1.5_parsing_bug
$ jq '( .cells[] | select(.outputs) ) |= [] | (.cells[] | select(.execution_count)) |= null' Untitled.ipynb
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
$ jq '( .cells[] | select(.outputs) ) |= [] | (.cells[] | select(.execution_count)) |= null' Untitled.ipynb
jq: error (at Untitled.ipynb:34): Invalid path expression with result {"cell_type":"code","execu...
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment