Backport PR #41462: CI: Fix changed flake8 error message after upgrade (#41462)
cc @jreback We could avoid the version changes in the pre commits if you prefer
Thanks @phofl probably makes sense to update pre-commit as well to be consistent so that anyone doing manual backports can use pre-commit to make sure that the ci will pass