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

FIX: Correct variable name from _frame to _frames in PillowWriter class#29520

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 3 commits intomatplotlib:mainfromAnselmoo:Anselmoo/issue29519
Jan 27, 2025

Conversation

Anselmoo
Copy link
Contributor

@AnselmooAnselmoo commentedJan 25, 2025
edited
Loading

PR summary

Correct the variable name from_frame to_frames in the PillowWriter class to ensure proper functionality.

PR checklist

Copy link

@github-actionsgithub-actionsbot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

We strive to be a welcoming and open project. Please follow ourCode of Conduct.

@Anselmoo
Copy link
ContributorAuthor

@rcomer can you take a look at it later, please?

@@ -526,3 +526,31 @@ def test_movie_writer_invalid_path(anim):
with pytest.raises(FileNotFoundError, match=match_str):
anim.save("/foo/bar/aardvark/thiscannotreallyexist.mp4",
writer=animation.FFMpegFileWriter())


def test_exhausted_animation_with_transparency(tmp_path):
Copy link
Member

Choose a reason for hiding this comment

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

What exactly is the purpose of the test?

From a quick reading it is

  1. a smoke test to exercise the anim code path for transparency
  2. testing that a saved animation is exhausted.

Can you please describe more precisely what the test wants to ensure? Also it seems (2) is quite unrelated to transparency.

Anselmoo reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The goal of this test is to actually verify the non-covered section:

ifim.getextrema()[3][0]<255:# This frame has transparency, so we'll just add it as is.self._frames.append(im)

viasavefig_kwargs={"transparent": True}.

I tried just to mock up theclass PillowWriter(AbstractMovieWriter):, but it actually raise an error thatsavefig_kwargs={"transparent": True} is not included. Consequently, I extended a little bit the test. Considering, to leave this part out?

# Verify exhausted warningwithpytest.warns(UserWarning,match="exhausted"):anim._start()

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@timhoffm what about this test? Only using the PillowWriter?

deftest_animation_with_transparency():"""Test animation exhaustion with transparency using PillowWriter directly"""fig,ax=plt.subplots()rect=plt.Rectangle((0,0),1,1,color='red',alpha=0.5)ax.add_patch(rect)ax.set_xlim(0,1)ax.set_ylim(0,1)writer=PillowWriter(fps=30)writer.setup(fig,'unused.gif',dpi=100)writer.grab_frame(transparent=True)frame=writer._frames[-1]# Check that the alpha channel is not 255, so frame has transparencyassertframe.getextrema()[3][0]<255plt.close(fig)

so the missing part is also captured? thx for feedback

image

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

If former test fits better, I will submit a revert commit

@timhoffmtimhoffm added this to thev3.10.1 milestoneJan 27, 2025
@timhoffmtimhoffm merged commit6c5e3f3 intomatplotlib:mainJan 27, 2025
39 of 41 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJan 27, 2025
oscargus added a commit that referenced this pull requestJan 28, 2025
…520-on-v3.10.xBackport PR#29520 on branch v3.10.x (FIX: Correct variable name from _frame to _frames in PillowWriter class)
@ksundenksunden mentioned this pull requestMar 3, 2025
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@timhoffmtimhoffmtimhoffm approved these changes

@oscargusoscargusoscargus approved these changes

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

Successfully merging this pull request may close these issues.

[Bug]: 'PillowWriter' object has no attribute '_frame' shoudln't be '_frames'?
3 participants
@Anselmoo@timhoffm@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp