CLN: Remove unused variables
Breaking up #21974.

Removes non-noqa, seemingly non-controversial, unused local variables according to PyCharm. These are mostly redefined elsewhere or not used.

I added some TODO comments about other unused local variables that seem misused.
