+
    yȇiJ>                     	   ^ RI t^ RIt^ RIHtHtHtHtHt ^ RI	H
t ^ RIHtHt ^ RIHtHtHt ^ RIHt R tR tR tR	 t]P2                  P5                  R
R]RRRRRRRRR]P8                  .
/ 3R]P:                  RRRRRRRRR]P8                  .
/ 3R]P<                  RRRRRRRRR]P8                  .
/ 3R]P>                  RRRRRRRRR]P8                  .
R^/3R]P@                  RRRRR R!RRR"]P8                  .
R^/3R#]PB                  RRRRRRRRR$]P8                  .
/ 3.4      R% 4       t"R& t#]P2                  P5                  R'R(RRRR)RRHRR]P8                  ]P8                  .
3R*RRRR+R,RIRR]P8                  ]P8                  .
3.4      R- 4       t$]P2                  P5                  R.R/. RJO.R0. RKO..4      R1 4       t%R2 t&R3 t'R4 t(]P2                  P5                  RL^. RMO3RN. ROO3.4      ]P2                  P5                  RPR#. 3R5R".3.4      R6 4       4       t)]P2                  P5                  R7]]].4      ]P2                  P5                  R8. RQO4      ]P2                  P5                  R9R:^^.R;^ ^./R:^^.R;^ ^./R:^.^,          R;]P8                  ^^]P8                  .]*! ]+! ^^4      4      O/.4      R< 4       4       4       t,]P2                  P5                  R=^^^ .^.3^^^ ^.^^.3^^^ .^.3^^^ ^.^^.3^^]+! ^4      ]*! ]+! ^^4      4      ^.^,          ,           3^^]+! ^4      ^.^,          3^ ^ ]PZ                  ! . 4      ]PZ                  ! . 4      3^^ ]PZ                  ! . 4      ]PZ                  ! . 4      3^ ^^ .^ .3.	4      R> 4       t.]P2                  P5                  R?]! R;. RROR:. RSO/4      ^]! . RTO]P^                  ! . RSO]+! ^4      .R:R.R@7      R;]P`                  RA7      3]! R;]P8                  ^^]P8                  .]*! ]+! ^^4      4      OR:^.^,          ^.^,          ,           RB]+! ^4      /4      ^]! . RUO]P^                  ! ^.^,          ^.^,          ,           ]+! ^4      .R:R.R@7      R;]P`                  RA7      3.4      RC 4       t1]P2                  P5                  RD. RVO4      ]P2                  P5                  R8. RWO4      RE 4       4       t2RF t3RG t4R# )X    N)	DataFrame
MultiIndexSeriesconcat
date_range)BaseIndexerFixedForwardWindowIndexer)ExpandingIndexerFixedWindowIndexerVariableOffsetWindowIndexer)BusinessDayc                       ! R  R\         4      p V ! 4       p\        P                  ! \        RR7      ;_uu_ 4        \	        \        ^4      4      P                  V4       RRR4       R#   + '       g   i     R# ; i)c                   &   a  ] tR t^t o R tRtV tR# )8test_bad_get_window_bounds_signature.<locals>.BadIndexerc                    R # N )selfs   &u/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/window/test_base_indexer.pyget_window_boundsJtest_bad_get_window_bounds_signature.<locals>.BadIndexer.get_window_bounds   s        r   N__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__s   @r   
BadIndexerr      s     	 	r   r"   zBadIndexer does not implementmatchN)r   pytestraises
ValueErrorr   rangerolling)r"   indexers     r   $test_bad_get_window_bounds_signaturer+      sP    [  lG	z)H	I	IuQx  ) 
J	I	I	Is   $A))A:	c                      \        \        ^
4      4      p \        4       pV P                  V4      P	                  4       pV P                  4       P	                  4       p\        P                  ! W#4       R# )
   N)r   r(   r
   r)   mean	expandingtmassert_series_equal)sr*   resultexpecteds       r   test_expanding_indexerr5   #   sQ    uRyA GYYw$$&F{{}!!#H6,r   c                      . ROp \        R\        ^4      /4      p ! R R\        4      pV! ^V R7      pVP                  V4      P	                  4       p\        R. RO/4      p\
        P                  ! WE4       R# )Tvaluesc                   &   a  ] tR t^0t o R tRtV tR# )3test_indexer_constructor_arg.<locals>.CustomIndexerc                H   \         P                  ! V\         P                  R 7      p\         P                  ! V\         P                  R 7      p\        V4       FE  pV P                  V,          '       d   ^ Wh&   V^,           Wx&   K-  WV&   WP
                  ,           Wx&   KG  	  Wg3# dtype)npemptyint64r(   use_expandingwindow_size	r   
num_valuesmin_periodscenterclosedstepstartendis	   &&&&&&   r   r   Etest_indexer_constructor_arg.<locals>.CustomIndexer.get_window_bounds1   s}    HHZrxx8E((:RXX6C:&%%a(( EHUCF !H!1!11CF ' :r   r   Nr   r    s   @r   CustomIndexerr9   0   s     
	 
	r   rM   rB   rA   NTFTFT)              ?      @rR         $@r   r(   r   r)   sumr0   assert_frame_equal)rA   dfrM   r*   r3   r4   s         r   test_indexer_constructor_argrX   +   si    4M	HeAh'	(B  GGZZ $$&F($>?@H&+r   c                      \        R \        ^4      /4      p  ! R R\        4      pV! ^R7      pV P                  VR^R^R7      P	                  4       p\        R . RO/4      p\
        P                  ! W44       R# )	r7   c                   &   a  ] tR t^Ft o R tRtV tR# )8test_indexer_accepts_rolling_args.<locals>.CustomIndexerc                P   \         P                  ! V\         P                  R 7      p\         P                  ! V\         P                  R 7      p\        V4       FI  pV'       d'   V^8X  d    VR8X  d   V^8X  d   V^8X  d   ^ Wh&   WV&   K1  WV&   WP                  ,           Wx&   KK  	  Wg3# )r<   both)r>   r?   r@   r(   rB   rC   s	   &&&&&&   r   r   Jtest_indexer_accepts_rolling_args.<locals>.CustomIndexer.get_window_boundsG   s    HHZrxx8E((:RXX6C:&#q(&(	Q EH'F !H!1!11CF ' :r   r   Nr   r    s   @r   rM   r[   F   s     	 	r   rM   rB   Tr]   )rF   rE   rG   rH   N)rP   rQ   rS   rR         @rT   )rW   rM   r*   r3   r4   s        r   !test_indexer_accepts_rolling_argsra   C   su    	HeAh'	(B & *GZZ!F  	ce  ($>?@H&+r   zfunc,np_func,expected,np_kwargscountrR          @minrP   rQ   r`         @      @       @max      Y@      "@stdgK@gDmK@g!?J@g'e?ddofvarg[{@@g[{@g[{Ħ@g      ?mediang      !@c                   aa \         P                  ! R 4      pRV^&   \        ^R7      pRpV ! V4      P                  VRR7      p	\        P
                  ! \        VR7      ;_uu_ 4        \        W4      ! 4        RRR4       RpV ! V4      P                  VR	R
7      p	\        P
                  ! \        VR7      ;_uu_ 4        \        W4      ! 4        RRR4       V ! V4      P                  V^VR7      p	\        W4      ! 4       p
V ! V4      RRV1,          p\        P                  ! W4       V ! V	P                  VV3R l4      4      p\        P                  ! W4       VR8X  d   ^ MRpV ! V4      P                  W|R7      p\        W4      ! 4       pV ! VP                  VV3R l4      4      p\        P                  ! W4       R#   + '       g   i     ELT; i  + '       g   i     EL; i)rS   ri   r_   z.Forward-looking windows can't have center=TrueT)windowrF   r#   NzAForward-looking windows don't support setting the closed argumentright)rp   rG   rp   rE   rH   c                    < S! V 3/ SB # r   r   xnp_func	np_kwargss   &r   <lambda>-test_rolling_forward_window.<locals>.<lambda>   s    8OY8Or   rb   rp   rE   c                    < S! V 3/ SB # r   r   rt   s   &r   rx   ry      s    9Pi9Pr   )r>   aranger	   r)   r%   r&   r'   getattrr0   assert_equalapply)frame_or_seriesfuncrv   r4   rw   rH   r7   r*   r$   r)   r3   	expected2rE   rolling3result3	expected3s   &&f&f&          r   test_rolling_forward_windowr   a   s   r YYt_FF1I'A6G<Ef%--WT-JG	z	/	/  
0 PEf%--WW-MG	z	/	/  
0 f%--W!RV-WGW#%F x(40HOOF%  .O PQIOOF& w!DKv&..g.WHh%'G/P QRIOOG'9 
0	/	/
 
0	/	/s   )GGG	G*	c                 D   \         P                  ! R 4      pRV^&   \        ^R7      pV ! V4      P                  V^VR7      pVP	                  4       pV ! RRRRRR	RR\         P
                  \         P
                  .
4      R
R
V1,          p\        P                  ! WV4       R
# )rS   ri   r_   rr   rP   go@g\QJ@g@gv-@gA@N)r>   r|   r	   r)   skewnanr0   r~   )r   rH   r7   r*   r)   r3   r4   s   &&     r   test_rolling_forward_skewnessr      s    YYt_FF1I'A6Gf%--W!RV-WG\\^FFFFF	
 fH OOF%r   zfunc,expectedcovg     @X@corrg?gh"?c                    \         P                  ! ^
4      P                  R^4      pV^,          p^dVR&   \         P                  ! W#.^R7      p\	        ^R7      p\        V4      P                  V^R7      p\        W`4      ! 4       P                  \        R4      ^3^ 3,          pVP                  RR7      p\        V4      P                  RR7      pVP                  Vn        \        P                  ! Wq4       R# )	r-   )axisr_   rz   NT)drop)   r   )r>   r|   reshapeconcatenater	   r   r)   r}   locslicereset_indexr   namer0   r~   )r   r4   values1values2r7   r*   r)   r3   s   &&      r   test_rolling_forward_cov_corrr      s    , iim##B*GkGGDM^^W.Q7F'A6G''wA'FGW#%))5;*:A*=>FT*Fh+++6HKKHMOOF%r   zclosed,expected_datarq   leftc                     \        R ^
R7      p\        \        ^
4      VR7      p\        ^4      p\	        W$R7      pVP                  WPR7      P                  4       p\        WR7      p\        P                  ! Wg4       R# )2020periods)indexr   offset)rG   N)	r   r   r(   r   r   r)   rU   r0   rV   )rG   expected_datar   rW   r   r*   r3   r4   s   &&      r   &test_non_fixed_variable_window_indexerr      sd     vr*E	59E	*B^F)EGZZZ/335F4H&+r   c                      \         P                  ! \        R R7      ;_uu_ 4        \        R\	        ^4      R7       RRR4       R#   + '       g   i     R# ; i)zindex must be a DatetimeIndex.r#   foor   N)r%   r&   r'   r   r   r   r   r   (test_variableoffsetwindowindexer_not_dtir     s2    	z)I	J	J#%AG 
K	J	J	Js   AA	c                      \        R ^
R7      p \        P                  ! \        RR7      ;_uu_ 4        \	        V RR7       RRR4       R#   + '       g   i     R# ; i)r   r   z(offset must be a DateOffset-like object.r#   r   r   N)r   r%   r&   r'   r   )idxs    r   +test_variableoffsetwindowindexer_not_offsetr     s:    
VR
(C	z)S	T	T##e< 
U	T	T	Ts   A

A	c                     \        R . RO/4      p\        ^R7      pVP                  V^ V R7      P                  4       p\        R . RO/4      RRV 1,          p\        P
                  ! W44       R# )bNr_   rr   )NNN   )rP   rP   rQ   rQ   )r   r	   r)   rb   r0   rV   )rH   rW   r*   r3   r4   s   &    r    test_fixed_forward_indexer_countr     s`    	C./	0B'A6GZZwADZAGGIF#345ff=H&+r   quantilec                    a   ! V 3R  lR\         4      p. ROp\        R\        ^4      /4      pV! ^VR7      p\        VP	                  V4      V4      ! V!  p\        RV/4      p	\
        P                  ! W4       R# )c                   .   <a  ] tR tRt o V3R ltRtV tR# )0test_indexer_quantile_sum.<locals>.CustomIndexeri+  c                ^  < \         P                  ! V\         P                  R 7      p\         P                  ! V\         P                  R 7      p\        V4       FO  pV P                  V,          '       d   ^ Wh&   \        VS	,           ^4      Wx&   K7  WV&   WP                  ,           Wx&   KQ  	  Wg3# r;   )r>   r?   r@   r(   rA   rh   rB   )
r   rD   rE   rF   rG   rH   rI   rJ   rK   	end_values
   &&&&&&   r   r   Btest_indexer_quantile_sum.<locals>.CustomIndexer.get_window_bounds,  s    HHZrxx8E((:RXX6C:&%%a(( EH Y2CF !H!1!11CF ' :r   r   Nr   )r!   r   s   @r   rM   r   +  s     
	 
	r   rM   r7   rN   NrO   )r   r   r(   r}   r)   r0   rV   )
r   r7   r   argsrM   rA   rW   r*   r3   r4   s
   f&&&      r   test_indexer_quantile_sumr   %  sl      5M	HeAh'	(BGGRZZ($/6F(F+,H&+r   indexer_classrB   df_dataar   c                    \        V4      p^pV ! VR7      pVP                  p\        V4       FM  pVP                  R4      R,          P	                  V^R7      P                  4        VP                  V8X  d   KM  Q h	  R# )   r_   r   r   rz   N)r   rB   r(   groupbyr)   r.   )r   rB   r   rW   
num_trialsr*   original_window_sizerK   s   &&&     r   0test_indexers_are_reusable_after_groupby_rollingr   A  sv      
7	BJ4G"..:


3$$G$CHHJ""&:::: r   z5window_size, num_values, expected_start, expected_endc           	      X   \        V R 7      pVP                  WR7      w  rg\        P                  ! V\        P
                  ! VRRV1,          4      RR7       \        P                  ! V\        P
                  ! VRRV1,          4      RR7       \        V4      \        V4      8X  g   Q hR# )r_   )rD   rH   NF)check_dtype)r	   r   r0   assert_numpy_array_equalr>   arraylen)rB   rD   expected_startexpected_endrH   r*   rI   rJ   s   &&&&&   r   !test_fixed_forward_indexer_boundsr   Z  s    $ (K@G**j*LJErxxvv./U RXXl6T6.B%CQVWu:S!!!r   zdf, window_size, expected)names)r   r   r=   cc                     \        VR 7      pV P                  R4      R,          P                  V^R7      P                  4       p\        P
                  ! WB4       R# )r_   r   r   rz   N)r	   r   r)   r.   r0   r1   )rW   rB   r4   r*   r3   s   &&&  r   0test_rolling_groupby_with_fixed_forward_specificr   v  sH    l (K@GZZ_S!))a)HMMOF6,r   
group_keysc                 v   \        R \        P                  ! \        V 4      4      R\        P                  ! \        V 4      \        P                  R7      ^,           R\        P                  ! \        V 4      \        P                  R7      /4      p\        VR7      pVP                  R 4      R,          P                  V^R7      P                  4       pR R.VP                  n        VP                  R 4      . R	O,          p\        V UUUu. uFc  w  rgTP                  \!        \        V4      4       Uu. uF/  pVR,          P"                  WV,            P                  ^R7      NK1  	  upR7      NKe  	  uppp4      p	V	P%                  R R.4      R,          p	\&        P(                  ! WI4       R# u upi u upppi )
r   r   r<   r   r_   rz   )	min_count)r   N)r   r   r   )r   r>   r   listr|   r   float64r@   r	   r   r)   rU   r   r   r   assignr(   iloc	set_indexr0   r1   )
r   rB   rW   r*   r3   groups_grK   manuals
   &&        r   ,test_rolling_groupby_with_fixed_forward_manyr     sf   " 
$z*+3z?"**=B3z?"((;	

B (K@GZZ_S!))a)HLLNFsFLLZZ__-F 	
  HH #3q6]* cFKKO48818E*   	

F sCj)#.F6*	
s   (F435F/(F4/F4c                      ! R  R\         4      p V ! 4       p\        ^4      P                  V4      pRp\        P                  ! \
        VR7      ;_uu_ 4        VP                  4        RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        \        V4      4       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        VP                  RR7       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        VP                  RR7       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lw; i  + '       g   i     R# ; i)c                   &   a  ] tR tRt o R tRtV tR# )4test_unequal_start_end_bounds.<locals>.CustomIndexeri  c                `    \         P                  ! ^.4      \         P                  ! ^^.4      3#    r>   r   r   rD   rE   rF   rG   rH   s   &&&&&&r   r   Ftest_unequal_start_end_bounds.<locals>.CustomIndexer.get_window_bounds  s$    88QC="((Aq6"222r   r   Nr   r    s   @r   rM   r     s     	3 	3r   rM   rI   r#   NTpairwiser   r   r)   r%   r&   r'   r.   nextiterr   r   rM   r*   rollr$   s       r   test_unequal_start_end_boundsr     s    3 3 oG!9W%DE	z	/	/		 
0 
z	/	/T$Z 
0 
z	/	/		4	  
0 
z	/	/$ 
0	/ 
0	/ 
0	/ 
0	/ 
0	/	/s0   D1EEE*1E	E	E'	*E;	c                       ! R  R\         4      p V ! 4       p\        ^^.4      P                  V4      pRp\        P                  ! \
        VR7      ;_uu_ 4        VP                  4        RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        \        V4      4       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        VP                  RR7       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        VP                  RR7       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lw; i  + '       g   i     R# ; i)c                   &   a  ] tR tRt o R tRtV tR# )4test_unequal_bounds_to_object.<locals>.CustomIndexeri  c                ^    \         P                  ! ^.4      \         P                  ! ^.4      3# r   r   r   s   &&&&&&r   r   Ftest_unequal_bounds_to_object.<locals>.CustomIndexer.get_window_bounds  s!    88QC="((A3-//r   r   Nr   r    s   @r   rM   r     s     	0 	0r   rM   zstart and endr#   NTr   r   r   s       r   test_unequal_bounds_to_objectr     s    0 0 oG1a&>!!'*DE	z	/	/		 
0 
z	/	/T$Z 
0 
z	/	/		4	  
0 
z	/	/$ 
0	/ 
0	/ 
0	/ 
0	/ 
0	/	/s0   D3EEE,3E	E	E)	,E=	g     @Wg1=)
rP   rQ   rc   rR   rf         (@re   rf   rg   rj   )
rP   rP   rQ   rc         @rj   r   re   rf   rg   )r   r7   )rP   r   r   r      r   )rP   r   r   r   r   )r   r   )r   r      )r   r   r   )r   r   r   )r   g      ?rc   )@r   g      @r   r   g      @re   r   g      )@g      *@g      +@g      ,@g      -@g      .@g      /@g      0@g     0@g      1@)	r   )r   r   )r   r   )r   r   r   )r   r   r   )r   r   r   r   )r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r      r         )5numpyr>   r%   pandasr   r   r   r   r   pandas._testing_testingr0   pandas.api.indexersr   r	   pandas.core.indexers.objectsr
   r   r   pandas.tseries.offsetsr   r+   r5   rX   ra   markparametrizer   r   rd   rh   rk   rm   rn   r   r   r   r   r   r   r   r   r   r(   r   r   r   from_arraysr   r   r   r   r   r   r   r   <module>r     s        /*-,0,< %	#S#sCc3RVVLbQ	c3S#sCbffMrRFF#sE5%c3G		
 FF QK	
$ FF QK	
$ II#sCc3S"&&A		
W14j'(k4j'(T&2 	c3c5#sBFFBFFKL"$"	
*&+*&  	EF	CD,,H=, q"34r;L6MN )XrNZ#<O+PQ, R,0 (*CEUV 
3	q!fcAq6"	q!fcAq6"	qcBhbffaBFFHT%2,5GHI
; 4
; ;	
AsQC	
A1v1v	
AsQC	
A1v1v	
Bb	4a-q89	Qa1#'"	
Arxx|RXXb\*	
Arxx|RXXb\*	
AsQC
""  sIsI67 ,,iq-B3PT+Vjj			
 "&&!QDeArl1CD!qA38+r ( !,,S1WsRx'r3C; jj3$	
03h-i3h- 
 (>?+ @+> * r   