modernize some Python code
Since we now require Python 3.6, we can use f-strings instead of format() to make the code more readable. * doc/org/tut01.org, doc/org/tut02.org, doc/org/tut03.org, doc/org/tut21.org, doc/org/tut24.org, doc/org/tut90.org, python/spot/__init__.py, python/spot/jupyter.py, tests/python/acc.py, tests/python/acc_cond.ipynb, tests/python/complement_semidet.py, tests/python/decompose.ipynb, tests/python/formulas.ipynb, tests/python/highlighting.ipynb, tests/python/ipnbdoctest.py, tests/python/ltlf.py, tests/python/parity.ipynb, tests/python/product.ipynb, tests/python/relabel.py, tests/python/satmin.ipynb, tests/python/stutter-inv.ipynb, tests/python/twagraph-internals.ipynb, tests/python/zlktree.ipynb: Use f-strings.
This commit is contained in:
parent
df44f7a5c2
commit
7ac570fa3f
23 changed files with 292 additions and 327 deletions
|
|
@ -215,7 +215,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"You have to be aware of this property being set in your back because if while playing with `is_stutter_invariant()` you the incorrect formula for an automaton by mistake, the automaton will have its property set incorrectly, and running `is_stutter_invariant()` with the correct formula will simply return the cached property.\n",
|
||||
"You have to be aware of this property being set in your back. If, after calling `is_stutter_invariant()`, you modify the automaton (e.g., adding edges, or changing labels), the modified automaton might then have its property set incorrectly, and running `is_stutter_invariant()` will not recompute a property that is set.\n",
|
||||
"\n",
|
||||
"In doubt, you can always reset the property as follows:"
|
||||
]
|
||||
|
|
@ -351,7 +351,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047afc00> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110141680> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -418,9 +418,9 @@
|
|||
" acc, rej, aut = \"rejected\", \"accepted\", pos\n",
|
||||
" word2 = spot.sl2(waut).intersecting_word(aut)\n",
|
||||
" word2.simplify()\n",
|
||||
" print(\"\"\"{} is {} by {}\n",
|
||||
" print(f\"\"\"{word} is {acc} by {f}\n",
|
||||
" but if we stutter some of its letters, we get\n",
|
||||
"{} which is {} by {}\"\"\".format(word, acc, f, word2, rej, f))"
|
||||
"{word2} which is {rej} by {f}\"\"\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -804,7 +804,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d0bd0> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110143b70> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -1165,7 +1165,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d0bd0> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110143b70> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -1389,7 +1389,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d1590> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110143d20> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -1576,7 +1576,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d0ab0> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110142b50> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -1962,7 +1962,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d2640> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110142340> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -2183,7 +2183,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d1d10> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110142580> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -2392,7 +2392,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d2370> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f21101417a0> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -2434,7 +2434,7 @@
|
|||
"source": [
|
||||
"sil_vec = spot.stutter_invariant_letters(pos, f)\n",
|
||||
"for q in range(pos.num_states()):\n",
|
||||
" print(\"sil_vec[{}] =\".format(q), spot.bdd_format_formula(pos.get_dict(), sil_vec[q]))"
|
||||
" print(f\"sil_vec[{q}] =\", spot.bdd_format_formula(pos.get_dict(), sil_vec[q]))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -2848,7 +2848,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d13e0> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110142430> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -3408,7 +3408,7 @@
|
|||
"</svg>\n"
|
||||
],
|
||||
"text/plain": [
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f47047d13e0> >"
|
||||
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2110142430> >"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
|
|
@ -3649,7 +3649,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.7"
|
||||
"version": "3.11.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue