+
    ,iG                      
   ^ RI t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t
^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ]P*                  ! 4       R 4       t ! R R	]P.                  4      tR
 t]P4                  P7                  R]! ]R7      .R.R7      R 4       tR t]P>                  PA                  R4       ! R R]4      4       t!. R?Ot"R t#]P4                  P7                  R]#! 4       4      ]P4                  P7                  R]! ]R7      .R.R7      R 4       4       t$]P4                  P7                  R]#! 4       4      R 4       t%]P4                  P7                  R]PL                  ! R]P4                  PO                  ]PP                  PS                  4       '       * RR7      R7      ]PL                  ! R]P4                  PO                  ]PT                  PS                  4       '       * RR7      R7      .4      ]P4                  P7                  R. R@O4      ]P4                  P7                  R]! ]R7      .R.R7      R 4       4       4       t+]P4                  P7                  RR ^
R!],! ]-! ^4      4      /.R.R7      R" 4       t.R# t/]P4                  P7                  R$]PL                  ! R%]P4                  PO                  ]P>                  Pa                  ]Pb                  R&,          4      '       * R'R7      R7      R(.4      ]P4                  P7                  R]! ^R)7      .R.R7      R* 4       4       t2]P4                  P7                  R$]PL                  ! R%]P4                  PO                  ]P>                  Pa                  ]Pb                  R&,          4      '       * R'R7      R7      R(.4      ]P4                  P7                  R]! ^R)7      .R.R7      R+ 4       4       t3]P4                  PO                  ]Ph                  ! R,4      RJ R-R7      R. 4       t5]P4                  P7                  R/R0R1.4      R2 4       t6]P4                  P7                  R3. RAO4      R4 4       t7R5 t8R6 t9]! R7.R87      R9 4       t:]P4                  P7                  R]! ]R7      .R.R7      R: 4       t;]P4                  P7                  R]! ]R7      .R.R7      R; 4       t<]P4                  P7                  R]! ]R7      .R.R7      R< 4       t=R= t>R> t?R# )B    N)Path)pyplot)	animation)PillowWriter)check_figures_equalc           	     Z  a \         P                  ! 4       w  rVP                  . . 4      w  oVP                  ^ ^
4       VP	                  R	^4       V3R lpV3R lp\        \        V R/ 4      4      pVP                  R\        P                  4      pRV9  d   ^VR&   V! R
RVRVRV/VB # )z)Create a simple animation (with options).c                  .   < S P                  . . 4       S 3# Nset_datalines   A/usr/lib/python3/dist-packages/matplotlib/tests/test_animation.pyinitanim.<locals>.init       b"u    c                    < \         P                  ! ^ ^
^d4      p\         P                  ! W,           4      pSP                  W4       S3# )r   )nplinspacesinr   )ixyr   s   &  r   animateanim.<locals>.animate!   s7    KK2s#FF15Maur   paramklassframesfigfunc	init_func )
pltsubplotsplotset_xlimset_ylimdictgetattrpopr   FuncAnimation)requestr    axr   r   kwargsr   r   s   &      @r   animr1      s     llnGCGGBOEDKK2KKA ''7B/0FJJw	 7 78EvxASAwA$A&AAr   c                   6   a  ] tR t^/t o RtR tR tR tRtV t	R# )NullMovieWritera~  
A minimal MovieWriter.  It doesn't actually write anything.
It just saves the arguments that were given to the setup() and
grab_frame() methods as attributes, and counts how many times
grab_frame() is called.

This class doesn't have an __init__ method with the appropriate
signature, and it doesn't define an isAvailable() method, so
it cannot be added to the 'writers' registry.
c                D    Wn         W n        W0n        W@n        ^ V n        R# )r   N)r    outfiledpiargs_count)selfr    r5   r6   r7   s   &&&&*r   setupNullMovieWriter.setup;   s    	r   c                `    ^ RI Hp V! V4       Wn        V ;P                  ^,          un        R# )r   )_validate_grabframe_kwargsN)matplotlib.animationr=   savefig_kwargsr8   )r9   r?   r=   s   &, r   
grab_frameNullMovieWriter.grab_frameB   s!    C">2,qr   c                    R # r
   r$   r9   s   &r   finishNullMovieWriter.finishH   s    r   )r8   r7   r6   r    r5   r?   N)
__name__
__module____qualname____firstlineno____doc__r:   r@   rD   __static_attributes____classdictcell____classdict__s   @r   r3   r3   /   s     	 r   r3   c                    R \         P                  R&   Rp^2p\        ^ R7      p\        4       pV P	                  WVVR7       VP
                  \         P                  ! ^4      8X  g   Q hVP                  V8X  g   Q hVP                  V8X  g   Q hVP                  R8X  g   Q hVP                  4        F  w  rVVP                  V,          V8X  d   K  Q h	  VP                  V P                  8X  g   Q hR# )autozsavefig.facecolorunused.null)foo)r6   writerr?   Nr$   )r%   rcParamsr*   r3   saver    figurer5   r6   r7   itemsr?   r8   _save_count)r1   filenamer6   r?   rS   kvs   &      r   test_null_movie_writerr\   L   s    (.CLL$%H
Ca[NFIIh+  - ::A&&&>>X%%%::;;" $$&$$Q'1,,, '==D,,,,,r   r1   )r   )indirectc                 b   \         P                  ! 4       R 8X  d   \        P                  P	                  4        \
        P                  ! R/ V B p \        P                  ! \        RR7      ;_uu_ 4        ? \        P                  P	                  4        RRR4       R#   + '       g   i     R# ; i)PyPyzAnimation was deletedmatchNr$   )
platformpython_implementationr   testingbreak_cyclesr   r-   pytestwarnsWarningr1   s   &r   test_animation_deleterj   b   sl    %%'61 	

!""*T*D	g%<	=	=


! 
>	=	=	=s   3 BB.	c                       ! R  R\         P                  4      p \        P                  ! 4       pRp^pRp^pR.pV ! W4WV4      pVP	                  W4       VP
                  VP
                  8X  g   Q hR# )c                   &   a  ] tR t^pt o R tRtV tR# )7test_movie_writer_dpi_default.<locals>.DummyMovieWriterc                    R # r
   r$   rC   s   &r   _run<test_movie_writer_dpi_default.<locals>.DummyMovieWriter._runq   s    r   r$   N)rF   rG   rH   rI   ro   rK   rL   rM   s   @r   DummyMovieWriterrm   p   s     	 	r   rq   rQ   unusedN)r   MovieWriterr%   rV   r:   r6   )rq   r    rY   fpscodecbitrate
extra_argsrS   s           r   test_movie_writer_dpi_defaultrx   o   sj    900 
 **,CH
CEGJc'>F
LL::   r   nullc                   :   a  ] tR t^t o RR lt]R 4       tRtV tR# )RegisteredNullMovieWriterNc                    R # r
   r$   )r9   rt   ru   rv   rw   metadatas   &&&&&&r   __init__"RegisteredNullMovieWriter.__init__   s    r   c                    R # )Tr$   )clss   &r   isAvailable%RegisteredNullMovieWriter.isAvailable   s    r   r$   )NNNNN)	rF   rG   rH   rI   r~   classmethodr   rK   rL   rM   s   @r   r{   r{      s       r   r{   ffmpegimagemagickc               #     "   \          F  w  r\        P                  P                  V 4      '       gh   \        P
                  P                  R V  R24      p\        P                  ! V RW.R7      x  \        P                  ! V R\        V4      V.R7      x  K  \        P                  V ,          p\        VRR.4       F  pWV3x  W\        V4      3x  K  	  K  	  R# 5i)zwriter 'z' not available on this systemNmarkssupported_formats)
WRITER_OUTPUTr   writersis_availablerf   markskipr   r   r+   )rS   outputr   writer_classframe_formats        r   gen_writersr      s     '  --f55;;##6("@ACD,,vtV6BB,,vtT&\$HH ((0#L2EvNL..V44 O (s   CC!zwriter, frame_format, outputc                 P   Ve   V\         P                  R&   \        P                  ! R/ VB pR pR pVR8X  d    VP                  P                  R4       RpRpV P                  4       ;_uu_ 4        VP                  V^VRVVR7       R R R 4       ?R #   + '       g   i     ?R # ; i)	Nanimation.frame_formatr         Y@h264i  )rt   rS   rv   r6   ru   r$   g33333%@gQk"@)r%   rT   r   r-   _figset_size_inchesas_cwdrU   )tmpdirrS   r   r   r1   r6   ru   s   &&&&&  r   test_save_animation_smoketestr      s     1=-.""*T*D
CE		!!-0 
		&b# 	 	 
 		 
 	s   0BB%	c                    \         P                  V,          pVe   V\        P                  R&   \        P                  ! 4       w  rVR pR pVR8X  d   VP                  R4       RpRpV! 4       p	V P                  4       ;_uu_ 4        V	P                  WSV4      ;_uu_ 4        V	P                  4        R FP  p
\        P                  ! \        RV
: 2R7      ;_uu_ 4        V	P                  ! R	/ V
\        4       /B  R R R 4       KR  	  R R R 4       R R R 4       R #   + '       g   i     Kw  ; i  + '       g   i     L.; i  + '       g   i     R # ; i)
Nr   r   r   r   z.grab_frame got an unexpected keyword argument r`   r   >   r6   formatbbox_inchesr$   )r   r   r%   rT   r&   r   r   savingr@   rf   raises	TypeErrorobject)r   rS   r   r   WriterClassr    r/   r6   ru   test_writerrZ   s   &&&&       r   test_grabframer      s   ##F+K1=-.llnGC
CEM*-K 
S11""$5]]! NqeT   **;a];	  6 2 

  	 21 
s<   E  >D-	D;D-	E D*$	D-	-D=8E  E	rS   Requires FFMpeg)reasonr   zRequires ImageMagickz
html, wantc                    \         P                  ! 4       R 8X  d   \        P                  P	                  4        V R8X  dB   VR8X  d;   \
        P                  P                  4       '       g   \        P                  ! R4       \
        P                  ! R/ VB p\        P                  ! RV RV/4      ;_uu_ 4        VP                  4       pRRR4       VfS   Ve   Q h\        P                  ! \        4      ;_uu_ 4        ?\        P                  P	                  4        RRR4       R# W!9   g   Q hR#   + '       g   i     Lp; i  + '       g   i     R# ; i)r_   r   html5r   animation.writerzanimation.htmlNr$   )rb   rc   r   rd   re   r   FFMpegWriterr   rf   r   r-   r%   
rc_context_repr_html_rg   UserWarning)rS   htmlwantr1   s   &&&&r   test_animation_repr_htmlr      s    " %%'61 	

!-DGO**6688%& ""*T*D	+V)41 
2 
2!
2 |||\\+&&JJ##% '& ||
2 
2
 '&&s   9D2> E2E	E	
save_countr   c                 <    V P                  R \        4       R7       R# )rQ   rS   N)rU   r3   ri   s   &r   test_no_length_framesr     s     	IImO$5I6r   c                  t   \        \        P                  P                  4      ^ 8  g   Q hR\        P
                  R&   \        P                  P                  R4      '       d   Q h\        P                  R8w  d   RMRp V \        P
                  R&   \        P                  P                  R4      '       g   Q hR# )r   not_available_ever_xxxxzanimation.ffmpeg_pathr   win32truewhereN)	lenr   r   _registeredmplrT   r   sysrb   )bins    r   test_movie_writer_registryr     s    y  ,,-111,ECLL()  --h7777LLG+&C,/CLL()))(3333r   method_nameto_html5_videor   zanimation writer not installed	to_jshtml)r   c           	         VP                  R 4       VP                  4       ;_uu_ 4        \        P                  ! RR/4      ;_uu_ 4        \	        W04      ! 4        RRR4       RRR4       \        VP                  4      ^8X  g   Q hVP                  w  pVP                  R8X  d   VP                  R 8X  g   Q hR#   + '       g   i     Lh; i  + '       g   i     Ls; i)WARNINGzanimation.embed_limitgư>Nzmatplotlib.animation)		set_levelr   r   r   r+   r   recordsname	levelname)r   caplogr   r1   records   &&&& r   test_embed_limitr   $  s     Y	^^4d;<<D&( = 
 v~~!###nnGFKK11  I-/ .- =< 
s#   !CB<	C<CCC	c           	          VP                  4       ;_uu_ 4        \        W 4      ! 4        \        \        \	        V4      4      P                  4       4      . 8X  g   Q h R R R 4       R #   + '       g   i     R # ; ir
   )r   r+   listr   striterdir)r   r   r1   s   &&&r   test_cleanup_temporariesr   6  sK     
"$DV%--/0B666 
s   AA''A8	z/bin/shzrequires a POSIX OSc           	        V P                  4       ;_uu_ 4        VP                  RR\        P                  R,          ,           4       \	        \        V 4      R4      pVP                  R4       \        P                  ! VR4       \        P                  ! \        P                  4      ;_uu_ 4        VP                  R4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)a  
Test that we correctly raise a CalledProcessError when ffmpeg fails.

To do so, mock ffmpeg using a simple executable shell script that
succeeds when called with no arguments (so that it gets registered by
`isAvailable`), but fails otherwise, and add it to the $PATH.
PATHz.:r   s   #!/bin/sh
[[ $@ -eq 0 ]]
i  z	test.mpegN)r   setenvosenvironr   r   write_byteschmodrf   r   
subprocessCalledProcessErrorrU   )r   monkeypatchr1   exe_paths   &&& r   test_failing_ffmpegr   C  s     
64"**V*<#<=FX.;<
5!]]:8899IIk" : 

 :9 
s$   BC(1C	C(C% C((C9	cache_frame_dataFTc           	        a
aa \         P                  ! 4       w  rVP                  . . 4      w  o ! R  R\        4      o
V3R lpV3R lp. oV
V3R lp^dp\        P
                  ! WVVV VR7      p\        4       pVP                  RVR7       \        S4      ^8X  g   Q h\        P                  P                  4        S F  p	V	! 4       RJ V 8w  d   K  Q h	  R# )	c                       ] tR tRtRtR# )2test_funcanimation_cache_frame_data.<locals>.FrameiZ  r$   N)rF   rG   rH   rI   rK   r$   r   r   Framer   Z  s    r   r   c                  .   < S P                  . . 4       S 3# r
   r   r   s   r   r   1test_funcanimation_cache_frame_data.<locals>.init^  r   r   c                 J   < SP                  V R ,          V R,          4       S3# r   r   r   )framer   s   &r   r   4test_funcanimation_cache_frame_data.<locals>.animateb  s     eCj%*-ur   c               3     <"   \        ^4       Fl  p \        P                  ! ^ ^
^d4      p\        P                  P	                  ^d4      pS! WR7      pSP                  \        P                  ! V4      4       Vx  Kn  	  R# 5i)   r   N)ranger   r   randomrandappendweakrefref)_r   r   r   r   frames_generateds       r   frames_generator=test_funcanimation_cache_frame_data.<locals>.frames_generatorh  s_     qAAr3'A		s#AAOE ##GKK$67K s   A>B)r"   r   r   r   rQ   r   N)r%   r&   r'   r*   r   r-   r3   rU   r   r   rd   re   )r   r    r/   r   r   r   
MAX_FRAMESr1   rS   fr   r   r   s   &         @@@r   #test_funcanimation_cache_frame_datar   U  s    llnGCGGBOED   J""34*:4D.8:D
 FIImFI+ A%%%JJ t 0000 r   return_valuec           	        a a \         P                  ! 4       w  rVP                  . 4      w  oVV 3R  lp\        P                  ! \
        4      ;_uu_ 4        \        P                  ! WRRR7       RRR4       R#   + '       g   i     R# ; i)c                 F   < SP                  ^ ^.^ V .4       SR8X  d   S# S# )r   artistr   )r   r   r   s   &r   r    test_draw_frame.<locals>.animate  s,    q!fq!f%8#Kr   TF)blitr   N)r%   r&   r'   rf   r   RuntimeErrorr   r-   )r   r    r/   r   r   s   f   @r   test_draw_framer    s[     llnGCGGBKED  
|	$	$te	
 
%	$	$	$s   A::B	c           	         \         P                  ! 4       w  rR  p\        P                  ! W\	        \        ^
4      4      RRR7      pV P                  4       ;_uu_ 4        VP                  RRR7       RRR4       \        P                  ! \        RR7      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     LO; i  + '       g   i     R# ; i)	c                     . # r
   r$   r   s   &r   update(test_exhausted_animation.<locals>.update      	r   Fr   repeatr   test.gifpillowr   N	exhaustedr`   )r%   r&   r   r-   iterr   r   rU   rf   rg   r   _startr   r    r/   r  r1   s   &    r   test_exhausted_animationr    s    llnGC ""DrOED
 
		*X	. 
 
k	5	5 
6	5 
 
6	5	5s   B:C:C
	C	c                    \         P                  ! 4       w  rR  p\        P                  ! W. RRR7      p\        P
                  ! \        RR7      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)c                     . # r
   r$   r  s   &r   r  %test_no_frame_warning.<locals>.update  r  r   Fr  r  r`   N)r%   r&   r   r-   rf   rg   r   r  r  s   &    r   test_no_frame_warningr    s[    llnGC ""BuD
 
k	5	5 
6	5	5	5s   A44B	png)
extensionsc           	        aa VP                  4       pVP                  ^ ^\        P                  ,          4       VP	                  R^4       \        P
                  ! ^ ^\        P                  ,          ^d4      oVP                  . . 4      w  oV3R lpVV3R lp\        P                  ! WV^RRR7      pV P                  4       ;_uu_ 4        VP                  R4       RRR4       VP                  4       pVP                  ^ ^\        P                  ,          4       VP	                  R^4       VP                  S\        P                  ! SR	,           4      4       R#   + '       g   i     L; i)
r   c                  .   < S P                  . . 4       S 3# r
   r   r   s   r   r   "test_animation_frame.<locals>.init  r   r   c                 r   < SP                  S\        P                  ! SV ^d,          ,           4      4       S3# )d   )r   r   r   )r   r   r   s   &r   r   %test_animation_frame.<locals>.animate  s)    aAG,-ur   TF)r"   r   r   r	  r
  Nr#   g{Gz?)add_subplotr(   r   pir)   r   r'   r   r-   r   rU   r   )	r   fig_testfig_refr/   r   r   r1   r   r   s	   &&&    @@r   test_animation_framer!    s   
 
			BKK1ruu9KKA
Aq255y#&AGGBOED ""T!%!D 
		* 
 
			BKK1ruu9KKA GGArvva'k"# 
s   EE/	c                    ^p\        \        ^4      4      pRV: R\        V4      : R2p\        P                  ! \
        \        P                  ! V4      R7      ;_uu_ 4        \        P                  ! R/ / V CRVRV/CB p RRR4       V P                  \        V4      8X  g   Q hV P                  4        R#   + '       g   i     L>; i)	r   %You passed in an explicit save_count=z0 which is being ignored in favor of len(frames)=.r`   r   r   Nr$   )r   r   r   rf   rg   r   reescaper   r-   rX   
_init_drawr1   r   r   match_targets   &   r   ,test_save_count_override_warnings_has_lengthr*    s     J%(^F
0ZM 2v;.	  
k<)@	A	A&& 
BBxzB
 
B s6{***OO 
B	As   #B88C	c                 l   ^p^pRV: R2R,           RV: R2,           p\         P                  ! \        \        P                  ! V4      R7      ;_uu_ 4        \
        P                  ! R
/ / V CRVRV/CB p R	R	R	4       V P                  V8X  g   Q hV P                  4        R	#   + '       g   i     L5; i)r   r#   z#which is being ignored in favor of frames=r$  r`   r   r   Nr$   )	rf   rg   r   r%  r&  r   r-   rX   r'  r(  s   &   r   (test_save_count_override_warnings_scalerr.    s    JF
0ZM3-	.6)1	  
k<)@	A	A&& 
BBxzB
 
B
 v%%%OO 
B	As   B##B3	c                 p   R p\        \        ^4      4      pRV: RV: R2p\        P                  ! \        \
        P                  ! V4      R7      ;_uu_ 4        \        P                  ! R	/ / V CRVRV/CB p RRR4       V P                  RJ g   Q hV P                  4        R#   + '       g   i     L4; i)
Tr-  ze which we can infer the length of, did not pass an explicit *save_count* and passed cache_frame_data=z.  To avoid a possibly unbounded cache, frame data caching has been disabled. To suppress this warning either pass `cache_frame_data=False` or `save_count=MAX_FRAMES`.r`   r   r   NFr$   )r  r   rf   rg   r   r%  r&  r   r-   _cache_frame_datar'  )r1   r   r   r)  s   &   r   test_disable_cache_warningr1    s    %(^F6+ (&( )?	?  
k<)@	A	A&& 
NN)+;XvN
 
B !!U***OO 
B	As   B%%B5	c                    \         P                  R 8X  d   RpMRp\        P                  ! \        VR7      ;_uu_ 4        V P                  R\        P                  ! 4       R7       RRR4       R#   + '       g   i     R# ; i)r   z,\[WinError 3] .*'\\\\foo\\\\bar\\\\aardvark'z\[Errno 2] .*'/foor`   z+/foo/bar/aardvark/thiscannotreallyexist.mp4r   N)r   rb   rf   r   FileNotFoundErrorrU   r   FFMpegFileWriter)r1   	match_strs   & r   test_movie_writer_invalid_pathr6  #  sY    
||wC	)		(		:	:		?"335 	 	7 
;	:	:	:s   'A00B	c                    \         P                  ! 4       w  r\         P                  ! R
^^RRR7      pVP                  V4       VP	                  ^ ^4       VP                  ^ ^4       \        ^R7      pVP                  V R^dR7       VP                  RR7       VP                  R,          pVP                  4       ^,          ^ ,          ^8  g   Q h\         P                  ! V 4       R	# )zGTest animation exhaustion with transparency using PillowWriter directlyredg      ?)coloralpha)rt   z
unused.gif)r6   T)transparentN)r   r   r#   )r%   r&   	Rectangle	add_patchr(   r)   r   r:   r@   _frames
getextremaclose)r    r/   rectrS   r   s        r    test_animation_with_transparencyrB  -  s    llnGC==AU#>DLLKK1KK1b!F
LLlL,
$'NN2Ea #c)))IIcNr   ))r   	movie.mp4)ffmpeg_filerC  )r   	movie.gif)imagemagick_filerE  )r  rE  )r   z
movie.html)ry   z
movie.null))noneN)r   z<video width)jshtmlz<script )Nstring   )rI  r   )@r   pathlibr   rb   r%  shutilr   r   r   numpyr   rf   
matplotlibr   r   r%   r   r>   r   matplotlib.testing.decoratorsr   fixturer1   AbstractMovieWriterr3   r\   r   parametrizer*   rj   rx   r   registerr{   r   r   r   r   r   skipifr   r   ImageMagickWriterr   r  r   r   r   r   rT   r   r   whichr   r   r  r  r  r!  r*  r.  r1  r6  rB  r$   r   r   <module>rW     s2   	   	   
     $   - = B B4i33 :-, $T"2!3vhG	" H	"!& F#  $"5$ 7G$T"2!3vhG H H* 7G< H<> 
LL**&&2244$ + &' LLV[[//++7799) 0 +,	$ 	  ( 
 $T"2!3vhG H	 2 
B$uQx.12X  
7
74 \\"&++*<*<**3<<8J+KLL/ += +1 2  $a.!1VHE/ F/ \\"&++*<*<**3<<8J+KLL/ += +1 2  $a.!1VHE7 F7 FLL+t3<QR# S#" +eT];,1 <,1^  * 

*$ ($ )$B $T"2!3vhG H$ $T"2!3vhG H$ $T"2!3vhG H&7r   