Skip to content

Fixes for pycodestyle v2.11 #26414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2023
Merged

Fixes for pycodestyle v2.11 #26414

merged 1 commit into from
Jul 30, 2023

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented Jul 30, 2023

PR summary

flake8 is currently failing in CI with

E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

I think this is the relevant change: PyCQA/pycodestyle#1086

In the bubble example, it looks like the type check was there just to make sure we get an array-like out of the method. We can achieve that with the keepdims keyword.

Everywhere else I just replaced == with is as that preserves existing behaviour so seems safest. Possibly some places could have used isinstance instead but I do not know if there is an advantage to changing it to that (and I also do not know those parts of the code well enough to make that call).

PR checklist

@rcomer rcomer added this to the v3.7-doc milestone Jul 30, 2023
@oscargus oscargus modified the milestones: v3.7-doc, v3.7.3 Jul 30, 2023
@oscargus
Copy link
Member

Changed the milestone as this is also library code.

@oscargus oscargus merged commit f7a8cab into matplotlib:main Jul 30, 2023
@lumberbot-app
Copy link

lumberbot-app bot commented Jul 30, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.7.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 f7a8cabc1cf1ac9b35502f08e764d74d07d865ac
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #26414: Fixes for pycodestyle v2.11'
  1. Push to a named branch:
git push YOURFORK v3.7.x:auto-backport-of-pr-26414-on-v3.7.x
  1. Create a PR against branch v3.7.x, I would have named this PR:

"Backport PR #26414 on branch v3.7.x (Fixes for pycodestyle v2.11)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@rcomer
Copy link
Member Author

rcomer commented Jul 30, 2023

I assumed we would want to backport this to the doc branch as the CI is failing there too - #26413.

@QuLogic
Copy link
Member

QuLogic commented Aug 1, 2023

We don't backport to that branch because it wouldn't have any effect, but this will, so it's okay to backport.

QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Aug 1, 2023
@QuLogic QuLogic modified the milestones: v3.7.3, v3.7-doc Aug 1, 2023
QuLogic added a commit that referenced this pull request Aug 1, 2023
…3.7.2-doc

Backport PR #26414: Fixes for pycodestyle v2.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants