python: more conventional __repr__ for several types

* NEWS: Mention the change.
* python/spot/__init__.py: Add _repr_latex_ for twa_word, and
remove __repr__ and __str__ for atomic_prop_set.
* python/spot/impl.i: Implement __repr__ and __str__ for
atomic_prop_set.  Fix __repr__ for trival, acc_code, acc_cond,
mark_t.  Remove __repr__ for twa_run and twa_word.
* tests/python/acc_cond.ipynb, tests/python/accparse.ipynb,
tests/python/atva16-fig2a.ipynb, tests/python/automata.ipynb,
tests/python/bdditer.py, tests/python/contains.ipynb,
tests/python/gen.ipynb, tests/python/highlighting.ipynb,
tests/python/ltlsimple.py, tests/python/ltsmin-dve.ipynb,
tests/python/product.ipynb, tests/python/relabel.py,
tests/python/satmin.ipynb tests/python/stutter-inv.ipynb,
tests/python/word.ipynb: Adjust test cases.
* tests/python/formulas.ipynb: Add test for atomic_prop_set.
This commit is contained in:
Alexandre Duret-Lutz 2018-11-02 17:18:42 +01:00
parent c3b7a691e4
commit 60296317c7
19 changed files with 686 additions and 700 deletions

View file

@ -240,7 +240,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44f3f090> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2846aa7b0> >"
]
},
"execution_count": 4,
@ -352,7 +352,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa; proxy of <Swig Object of type 'std::shared_ptr< spot::twa > *' at 0x7f6a44edacc0> >"
"<spot.twa; proxy of <Swig Object of type 'std::shared_ptr< spot::twa > *' at 0x7fc2846aa780> >"
]
},
"execution_count": 5,
@ -462,7 +462,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44f3f090> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2846aa7b0> >"
]
},
"execution_count": 6,
@ -695,7 +695,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44eec0c0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845d2720> >"
]
},
"execution_count": 8,
@ -713,25 +713,23 @@
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Prefix:\n",
" 4\n",
" | 1\n",
" 0\n",
" | !a & !b\n",
"Cycle:\n",
" 1\n",
" | !b\t{0}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"Prefix:\n",
" 4\n",
" | 1\n",
" 0\n",
" | !a & !b\n",
"Cycle:\n",
" 1\n",
" | !b\t{0}\n",
"\n"
]
}
],
"source": [
"r = b.accepting_run(); r"
"r = b.accepting_run(); print(r)"
]
},
{
@ -892,7 +890,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44eec0c0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845d2720> >"
]
},
"execution_count": 11,
@ -977,7 +975,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7cb70> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845e4f00> >"
]
},
"metadata": {},
@ -1032,7 +1030,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7c8a0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845e4e40> >"
]
},
"metadata": {},
@ -1126,7 +1124,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7c960> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845d2600> >"
]
},
"execution_count": 13,
@ -1144,23 +1142,21 @@
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Prefix:\n",
" 1,0\n",
" | !a & b\n",
"Cycle:\n",
" 0,0\n",
" | a\t{0}"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
"name": "stdout",
"output_type": "stream",
"text": [
"Prefix:\n",
" 1,0\n",
" | !a & b\n",
"Cycle:\n",
" 0,0\n",
" | a\t{0}\n",
"\n"
]
}
],
"source": [
"run = prod.accepting_run(); run"
"run = prod.accepting_run(); print(run)"
]
},
{
@ -1257,7 +1253,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7c960> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845d2600> >"
]
},
"metadata": {},
@ -1322,7 +1318,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7cb70> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845e4f00> >"
]
},
"metadata": {},
@ -1377,7 +1373,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7c8a0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845e4e40> >"
]
},
"metadata": {},
@ -1401,24 +1397,23 @@
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Prefix:\n",
" 0 * 3\n",
" | a & !b\n",
" 1 * 2\n",
" | a\t{0}\n",
" 1 * 1\n",
" | a\t{0}\n",
" 1 * 0\n",
" | a & b\t{0}\n",
"Cycle:\n",
" 1 * 4\n",
" | a\t{0,1}"
]
},
"metadata": {},
"output_type": "display_data"
"name": "stdout",
"output_type": "stream",
"text": [
"Prefix:\n",
" 0 * 3\n",
" | a & !b\n",
" 1 * 2\n",
" | a\t{0}\n",
" 1 * 1\n",
" | a\t{0}\n",
" 1 * 0\n",
" | a & b\t{0}\n",
"Cycle:\n",
" 1 * 4\n",
" | a\t{0,1}\n",
"\n"
]
},
{
"data": {
@ -1609,7 +1604,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_product; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_product > *' at 0x7f6a44e7cf00> >"
"<spot.impl.twa_product; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_product > *' at 0x7fc284574690> >"
]
},
"metadata": {},
@ -1694,7 +1689,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7cf60> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc2845746f0> >"
]
},
"metadata": {},
@ -1791,7 +1786,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7cdb0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc284574570> >"
]
},
"metadata": {},
@ -1805,7 +1800,8 @@
"run2 = prod2.accepting_run()\n",
"run2.project(left2).highlight(5)\n",
"run2.project(right2, True).highlight(5)\n",
"display(run2, prod2, left2, right2)"
"print(run2)\n",
"display(prod2, left2, right2)"
]
},
{
@ -1959,7 +1955,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7cea0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc284574840> >"
]
},
"execution_count": 18,
@ -2127,7 +2123,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7cea0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc284574840> >"
]
},
"execution_count": 19,
@ -2290,7 +2286,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f6a44e7cea0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fc284574840> >"
]
},
"metadata": {},
@ -2765,7 +2761,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.6"
"version": "3.6.7"
}
},
"nbformat": 4,