Improve code readability
Code readability improvements suggested by ruff and flake8.
ruff check src
flake8 --ignore=E231,E225,E226,E266,E262,E501,E265,F401,F403,E722 --max-line-length=96 src
(Note that the above tells flake8 to ignore many kinds of formatting errors...)