CI: Upgrade 'pyupgrade' (v2.7.4 --> v2.9.0)
- [x] closes #39523 
- [ ] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry
------
This PR upgrades `pyupgrade` and also includes style/formatting changes required after upgrading `pyupgrade`, namely, removing unused imports (`flake8`), and running `black` and `isort`.
