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

Changed hatch density typing to float. Added FutureWarning for cases …#27032

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

Open
borgesaugusto wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromborgesaugusto:iss_26645

Conversation

borgesaugusto
Copy link
Contributor

@borgesaugustoborgesaugusto commentedOct 8, 2023
edited
Loading

…where conversion would change behaviour

PR summary

Relates to#26645 . The test for the FutureWarning is added in test_path.py ( there is no test_hatch.py). All signatures were changed to float, also the defaults converted from 6 to 6.0.

PR checklist

@oscargus
Copy link
Member

Not sure I fully understood the transition path, but I think that the default value should not be changed to a float at this stage as that will trigger warnings for the default which is a bit confusing (and leads to errors).

Probably, the way is to type it as both int and float for now and keep the int default?

@borgesaugusto
Copy link
ContributorAuthor

Not sure I fully understood the transition path, but I think that the default value should not be changed to a float at this stage as that will trigger warnings for the default which is a bit confusing (and leads to errors).

Probably, the way is to type it as both int and float for now and keep the int default?

Thanks for the feedback!
The default value as float doesn't trigger warnings. Just in case I changed the test to try that. First test takes the case were int(density) != density

deftest_hatch_density_integer_to_float():
withpytest.warns(FutureWarning,
match="behavior change due to float to int conversion."):
Path.hatch("x",6.6)

And the second one, passes a float and shouldn get a warning (could be any float 2.0~2.5)

deftest_hatch_density_integer():
Path.hatch("x",2.0)

Is that what you meant?

@ksunden
Copy link
Member

I think the check as implemented will not warn for floating inputs that are integers asint(6.0) == 6.0 evaluates to true and is rather unambiguously represented as a float.

That said, i'm unclear why additional casts were added here, as they seem a) likely to be unintentionally missed when doing the behavior change (a comment would help that point) and b) likely to cause inputs that wewant to warn tonot warn.

I think that the cast to int should be retained inget_path (but after the warning). and not distributed to all of the calling functions. this will keep the code change that is needed on expiry close to the warning.

That said, there may be some patterns (such as circles/stars/etc) thatare required to be integers, so maybe we should think about what the code looks like after expiry here... there may be some that can be continuously changed (lines feels like they should be able to) and some that are necessarily discrete (circles, maybe).

I'm going to play around with the density uncast and see what breaks.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[MNT]: Hatch density being int or float?
3 participants
@borgesaugusto@oscargus@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp