python: support operator rewriting in __format__

Fixes #168.

* python/spot/__init__.py: Implement it.
* tests/python/formulas.ipynb: Test it.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2016-05-01 18:58:08 +02:00
parent d9174593c8
commit e91c6ba2f1
3 changed files with 23 additions and 4 deletions

View file

@ -204,7 +204,8 @@
"Spin+parentheses: {0:sp}\n",
"Spot (default): {0}\n",
"Spot+shell quotes: {0:q}\n",
"LBT, right aligned: {0:l:~>40}\"\"\".format(f))"
"LBT, right aligned: {0:l:~>40}\n",
"LBT, no M/W/R: {0:[MWR]l}\"\"\".format(f))"
],
"language": "python",
"metadata": {},
@ -217,7 +218,8 @@
"Spin+parentheses: (p1) U ((p2) V ((p3) && (!(p4))))\n",
"Spot (default): p1 U (p2 R (p3 & !p4))\n",
"Spot+shell quotes: 'p1 U (p2 R (p3 & !p4))'\n",
"LBT, right aligned: ~~~~~~~~~~~~~~~~~~~~~U p1 V p2 & p3 ! p4\n"
"LBT, right aligned: ~~~~~~~~~~~~~~~~~~~~~U p1 V p2 & p3 ! p4\n",
"LBT, no M/W/R: U p1 U & p3 ! p4 | & & p2 p3 ! p4 G & p3 ! p4\n"
]
}
],
@ -277,6 +279,8 @@
" quotes are *not* added)\n",
" - 'q': quote and escape for shell output, using single\n",
" quotes or double quotes depending on the contents.\n",
" - '[...]': rewrite away all the operators specified in brackets,\n",
" using spot.unabbreviate().\n",
" \n",
" - ':spec': pass the remaining specification to the\n",
" formating function for strings.\n",
@ -724,4 +728,4 @@
"metadata": {}
}
]
}
}