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:
Alexandre Duret-Lutz 2024-03-26 20:35:10 +01:00
parent df44f7a5c2
commit 7ac570fa3f
23 changed files with 292 additions and 327 deletions

View file

@ -387,7 +387,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f048a010> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01ddfe70> >"
]
},
"execution_count": 2,
@ -985,7 +985,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f048b0c0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d01decab0> >"
]
},
"execution_count": 10,
@ -994,7 +994,7 @@
}
],
"source": [
"a1 = spot.automaton(\"randaut -Q4 --colored -e.7 -A '{}' 2 |\".format(c.get_acceptance()))\n",
"a1 = spot.automaton(f\"randaut -Q4 --colored -e.7 -A '{c.get_acceptance()}' 2 |\")\n",
"a1"
]
},
@ -1809,7 +1809,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f048b510> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d01decd50> >"
]
},
"execution_count": 11,
@ -2131,7 +2131,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f048b540> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d01ded4d0> >"
]
},
"execution_count": 13,
@ -2140,7 +2140,7 @@
}
],
"source": [
"a2 = spot.automaton(\"randaut -Q3 -e.8 --seed=4 -A '{}' 2 |\".format(c.get_acceptance()))\n",
"a2 = spot.automaton(f\"randaut -Q3 -e.8 --seed=4 -A '{c.get_acceptance()}' 2 |\")\n",
"a2"
]
},
@ -2999,7 +2999,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f04a4660> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d01dedc50> >"
]
},
"execution_count": 14,
@ -3709,7 +3709,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f04a6460> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01defb10> >"
]
},
"metadata": {},
@ -4355,7 +4355,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f04a6490> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01defb40> >"
]
},
"metadata": {},
@ -4511,7 +4511,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f04a5ad0> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01def180> >"
]
},
"metadata": {},
@ -4717,7 +4717,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f04a6460> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01defb10> >"
]
},
"metadata": {},
@ -4777,7 +4777,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f04a6490> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01defb40> >"
]
},
"metadata": {},
@ -4837,7 +4837,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f04a5ad0> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01def180> >"
]
},
"metadata": {},
@ -5222,7 +5222,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f04a62b0> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d01deff30> >"
]
},
"execution_count": 18,
@ -6510,7 +6510,7 @@
"</script>"
],
"text/plain": [
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f92f04a6730> >"
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f2d01deefa0> >"
]
},
"execution_count": 20,
@ -7984,7 +7984,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f04a6d30> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d005206c0> >"
]
},
"execution_count": 29,
@ -9202,7 +9202,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f04a6fa0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d005207b0> >"
]
},
"execution_count": 31,
@ -10624,7 +10624,7 @@
"</script>"
],
"text/plain": [
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f92f04a7c60> >"
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f2d00520b40> >"
]
},
"execution_count": 40,
@ -12328,7 +12328,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0104390> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00521bc0> >"
]
},
"execution_count": 45,
@ -12687,7 +12687,7 @@
"</script>"
],
"text/plain": [
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f92f0104510> >"
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f2d00522160> >"
]
},
"execution_count": 47,
@ -13081,7 +13081,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0104450> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d005214d0> >"
]
},
"execution_count": 48,
@ -13418,7 +13418,7 @@
"</script>"
],
"text/plain": [
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f92f01040f0> >"
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f2d00521e60> >"
]
},
"execution_count": 49,
@ -13765,7 +13765,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0104e40> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00522310> >"
]
},
"execution_count": 50,
@ -14036,7 +14036,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0104960> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00522970> >"
]
},
"execution_count": 51,
@ -14219,7 +14219,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f92f01050e0> >"
"<spot.zielonka_tree; proxy of <Swig Object of type 'spot::zielonka_tree *' at 0x7f2d00522c40> >"
]
},
"execution_count": 52,
@ -14530,7 +14530,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0104ab0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00522ac0> >"
]
},
"execution_count": 53,
@ -14850,7 +14850,7 @@
"</script>"
],
"text/plain": [
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f92f0105500> >"
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f2d00522760> >"
]
},
"execution_count": 55,
@ -15094,7 +15094,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0105710> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00523150> >"
]
},
"execution_count": 57,
@ -15367,7 +15367,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0104d20> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00523240> >"
]
},
"execution_count": 58,
@ -15738,7 +15738,7 @@
"</script>"
],
"text/plain": [
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f92f01058c0> >"
"<spot.acd; proxy of <Swig Object of type 'spot::acd *' at 0x7f2d00523ab0> >"
]
},
"execution_count": 60,
@ -15966,7 +15966,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f01059e0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d005239c0> >"
]
},
"execution_count": 61,
@ -16205,7 +16205,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f01051d0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d005238a0> >"
]
},
"execution_count": 62,
@ -16744,7 +16744,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f01053b0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00523720> >"
]
},
"execution_count": 63,
@ -16901,7 +16901,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f0106430> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00523fc0> >"
]
},
"execution_count": 64,
@ -17068,7 +17068,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f92f01051a0> >"
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f2d00550090> >"
]
},
"execution_count": 66,
@ -17126,7 +17126,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.11.8"
}
},
"nbformat": 4,