Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use kwonlyargs instead of popping from kwargs#11145

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:masterfromZac-HD:kwonlyargs
May 2, 2018

Conversation

@Zac-HD
Copy link
Contributor

This pull contains part of my follow-up to#11137, likewise addressing#9912.

For this one, I've only included the cases where a straight translation from kwargs.pop to keyword-only arguments gives exactly the same behaviour (modulo two cases where unknown kwargs now raise TypeError!). There are many more that require some additional refactoring, but in the hope of a quick review cycle I'm leaving them all for later.

  • Code is PEP 8 compliant
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

self.barb_increments=barb_incrementsordict()
self.rounding=rounding
self.flip=flip_barb
transform=kw.pop('transform',ax.transData)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is there a reason not to converttransform?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

IfNone could be a user-supplied value, yes. Otherwise no!

For this pull I'm really trying to make a small, obviously correct, incremental step. I can't clean it up all at once, and I'm not going to try - I'd go crazy before it was debugged, let alone reviewed...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I see the value of small incremental steps and agree with the strategy.

Indeed, explicitly providingtransform=None is currently accepted and results in anIdentityTransform. I suppose this is not intended, but should be discussed as a separate issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think None as IdentityTransform is fine...

Copy link
Member

@timhoffmtimhoffmMay 1, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@anntzer I don't think so, because if not given, the default is ax.transData and in a quick test, I didn't get any reasonable output when usingquiver(..., transform=None) explicitly. But let's not go there in this PR. I'll open an issue for this soon when I have time to write it up correctly.

anntzer reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Zac-HD reacted with hooray emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

... all artists have a default of transform=None maps to IdentityTransform. Ummm, why? I have no idea. Back in the day, I think more was done in pixel co-ordinates.

vmin=kwargs.pop('vmin',None)
vmax=kwargs.pop('vmax',None)
linewidth=kwargs.get('linewidth',None)
shade=kwargs.pop('shade',cmapisNone)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

shade could be converted as well (you already did it for plot_trisurf 😄)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've actually reversed that now in an attempt to eliminate all behaviour differences 😭

(my mantra: be incremental; you can come back later)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

An explicitshade=None was interpreted asshade=False. I suppose this is also an unintended implementation detail. I'm happy to discuss this separately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

See#11154.

Zac-HD reacted with hooray emoji
@Zac-HDZac-HDforce-pushed thekwonlyargs branch 2 times, most recently from2269e22 toed13662CompareMay 1, 2018 14:45
Copy link
Member

@timhoffmtimhoffm left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Also for some reason, at least some of the generated test images are not antialiased, where the expected images are. Did you change something in this respect?

self.coord=kw.pop('coordinates','axes')
self.color=kw.pop('color',None)
self.angle=angle
self.coord=coord
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Unwanted name changecoord /coordinates

@Zac-HD
Copy link
ContributorAuthor

Also for some reason, at least some of the generated test images are not antialiased, where the expected images are. Did you change something in this respect?

Yep, I had a typo incontour.py, which convertedkwargs.pop('antialiased', None) (preserving the axes setting) intoantialiased=False. Whoops!

@Zac-HD
Copy link
ContributorAuthor

🎉@timhoffm, it's all working now. Ready to merge?

Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for this - I think these are all very helpful and will make the signatures more informative!

@timhoffmtimhoffm added this to thev3.0 milestoneMay 2, 2018
@timhoffmtimhoffm merged commit4536165 intomatplotlib:masterMay 2, 2018
@Zac-HDZac-HD deleted the kwonlyargs branchMay 2, 2018 07:53
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@anntzeranntzeranntzer left review comments

@jklymakjklymakjklymak approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

v3.0.0

Development

Successfully merging this pull request may close these issues.

4 participants

@Zac-HD@anntzer@jklymak@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp