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

TYP: Clean up CapStyle/FillStyle type hints#25719

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
oscargus merged 2 commits intomatplotlib:mainfromksunden:style_str
Apr 19, 2023

Conversation

ksunden
Copy link
Member

PR Summary

Inputs generally accept either the enum or the raw string (literal), outputs are only the string literals

plotnine passes string literals, which are accepted, but did not previously type check

This ensures for instance thatobj.set_capstyle(obj.get_capstyle()) type checks, while also not misrepresenting the return type.

Enums are a bit odd, as they do inherit fromstr (for these cases), and so it kind of works, but we actually return[Cap|Join]Style.name, not the instance itself.
We know this to be a limited set of literals, so type hint it as such.

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

Inputs generally accept either the enum or the raw string (literal), outputs are only the string literalsplotnine passes string literals, which are accepted, but did not previously type check
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@oscargusoscargus added this to thev3.8.0 milestoneApr 19, 2023
@oscargusoscargus merged commit5dca030 intomatplotlib:mainApr 19, 2023
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestMay 6, 2023
When these Enum classes were added inmatplotlib#18544, they were supposed to befor documentation only. To that end,matplotlib#22055 was a followup that ensuredthat only the strings were exposed from the getter side.However, when user-supplied cap/join style were added inmatplotlib#20914, theywere only for the Enum type instead of the string, so correctly allowstrings here as well.Also, specifically type hint the return values as literals, as was doneinmatplotlib#25719.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestMay 6, 2023
When these Enum classes were added inmatplotlib#18544, they were supposed to befor documentation only. To that end,matplotlib#22055 was a followup that ensuredthat only the strings were exposed from the getter side.However, when user-supplied cap/join style were added inmatplotlib#20914, theywere only for the Enum type instead of the string, so correctly allowstrings here as well.Also, specifically type hint the return values as literals, as was doneinmatplotlib#25719.
@QuLogicQuLogic mentioned this pull requestMay 6, 2023
1 task
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestMay 31, 2023
When these Enum classes were added inmatplotlib#18544, they were supposed to befor documentation only. To that end,matplotlib#22055 was a followup that ensuredthat only the strings were exposed from the getter side.However, when user-supplied cap/join style were added inmatplotlib#20914, theywere only for the Enum type instead of the string, so correctly allowstrings here as well.Also, specifically type hint the return values as literals, as was doneinmatplotlib#25719.
devRD pushed a commit to devRD/matplotlib that referenced this pull requestJun 5, 2023
When these Enum classes were added inmatplotlib#18544, they were supposed to befor documentation only. To that end,matplotlib#22055 was a followup that ensuredthat only the strings were exposed from the getter side.However, when user-supplied cap/join style were added inmatplotlib#20914, theywere only for the Enum type instead of the string, so correctly allowstrings here as well.Also, specifically type hint the return values as literals, as was doneinmatplotlib#25719.
melissawm pushed a commit to melissawm/matplotlib that referenced this pull requestJun 15, 2023
When these Enum classes were added inmatplotlib#18544, they were supposed to befor documentation only. To that end,matplotlib#22055 was a followup that ensuredthat only the strings were exposed from the getter side.However, when user-supplied cap/join style were added inmatplotlib#20914, theywere only for the Enum type instead of the string, so correctly allowstrings here as well.Also, specifically type hint the return values as literals, as was doneinmatplotlib#25719.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.8.0
Development

Successfully merging this pull request may close these issues.

3 participants
@ksunden@QuLogic@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp