...and fix most of the boring and hopefully uncontroversial errors and warnings.
We have many unused variables and even undefined variables and various other issues that are ignored in .flake8
but those generally require more insight to fix quickly. For example, there are a bunch of unused variables in tests and I can't tell if they were supposed to be used for forgotten tests or something.
I found autoflake8 useful:
autoflake8 --keep-pass-statements --in-place --expand-star-imports -r .
autoflake8 --keep-pass-statements --in-place --remove-unused-variables -r .
Requesting review from @blume since you care about at least some of these errors and warnings based on your reviews. It probably makes sense to look through the commits one by one.