U
    Y	a                    @   s  d Z ddlZddlZddlZddlZddlmZmZ ddl	m
Z
mZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z; G dd dZ<G d	d
 d
Z=G dd dZ>G dd dZ?G dd dZ@G dd dZAG dd dZBG dd dZCG dd dZDG dd dZEG dd dZFG dd dZGG dd  d ZHG d!d" d"ZIdS )#zTests suite for MaskedArray.
Adapted from the original test_ma by Pierre Gerard-Marchant

:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $

    N)assert_warnssuppress_warnings)assert_assert_array_equalassert_equalassert_almost_equal)arrayarangemaskedMaskedArraymasked_arraygetmaskarrayshapenomaskoneszeroscount)!
atleast_1d
atleast_2d
atleast_3dmr_dotpolyfitcovcorrcoefmedianaverageuniquesetxor1d	setdiff1dunion1dintersect1din1dediff1dapply_over_axesapply_along_axiscompress_ndcompress_rowcolsmask_rowcolsclump_maskedclump_unmaskedflatnotmasked_contiguousnotmasked_contiguousnotmasked_edges
masked_allmasked_all_likeisindiagflatstackvstackc                   @   sL   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dS )TestGenericc                 C   sJ  t dtd}tddgddgtd}t|| tddgddgd}t d|d}td	d	gd
d
g|d}t|| t d|d}td	d	gd	d	ggd
d
gd
d
gg|d}t|| tddddgfg}t d|d}tddgddg|d}t|| t d|d}tddgddg|d}t|| t d
|d}tdggdgg|d}t|| d S )N   dtype   maskr8   abfnamesformatsr   r   r9   r9   r6   r6   r<   r>   bar>   Zbbr>   r9   rC   )r.   floatr   r   npr8   )selftestcontroldt rP   >/tmp/pip-unpacked-wheel-zbzmve17/numpy/ma/tests/test_extras.pytest_masked_all%   s:    


 
 
zTestGeneric.test_masked_allc                 C   s   t ddtfgdffg}t jd|}tt|d t jjj tt|d d t jjj tt	|d d d t|d d j
d t|d d jj
d d S )Nr=   cr9   r9   rC   rP   rK   r8   objectmar.   r   typecorer   lenr   Z_fill_valuerL   Zmy_dtype
masked_arrrP   rP   rQ   "test_masked_all_with_object_nestedC   s    z.TestGeneric.test_masked_all_with_object_nestedc                 C   sr   t dtdffg}t jd|}tt|d t jjj tt	|d d t|d j
d t|d jj
d d S )Nr=   rT   r9   rC   rP   rU   r[   rP   rP   rQ   test_masked_all_with_objectO   s    z'TestGeneric.test_masked_all_with_objectc                 C   s   t ddgtd}t|}t ddgddgtd}t|| tddgddgd}t d	d	gd
d
g|d}t|}t ddgd
d
g|d}t|| tddddgfg}t ddgddg|d}t|}t|| d S )Nr9   r6   r7   r:   r<   r=   r>   r?   rB   rC   )
   r_   rE   rF   rH   rI   )r   rJ   r/   r   rK   r8   )rL   baserM   rN   rO   rP   rP   rQ   test_masked_all_likeY   s     

 z TestGeneric.test_masked_all_likec           	      C   s   t ddD ]}t d| D ]}tj|td}tj||td}td| }|d| @ dk|_d}||D ]}||j|  7 }qf|t	krt
|  | q|j |_t
|  | qq
d S )Nr9      r6   r7   r   )rangerK   r	   intfullr   r;   datasumr*   r   
compressed)	rL   r>   ijkjar<   sslrP   rP   rQ   check_clumpm   s    
zTestGeneric.check_clumpc                 C   s^   t td}t|ddddddg< t|}tddtdd	tddg}t|| | t d S 
Nr_   r   r9   r6         	      rb   )r   rK   r	   r
   r)   slicer   ro   rL   r<   rM   rN   rP   rP   rQ   test_clump_masked}   s    
zTestGeneric.test_clump_maskedc                 C   sV   t td}t|ddddddg< t|}tddtd	dg}t|| | t d S rp   )r   rK   r	   r
   r*   ru   r   ro   rv   rP   rP   rQ   test_clump_unmasked   s    
zTestGeneric.test_clump_unmaskedc                 C   s   t d}t|}t|td|jg tjdtd|_t|td|jg t	||dk |dkB |dkB < t|}t|tddtddg t	|d d < t|}t|g  d S )	Nr_   r   r7   rt   rr      rq   rs   )
r	   r+   r   ru   sizerK   r   boolr;   r
   )rL   r<   rM   rP   rP   rQ   test_flatnotmasked_contiguous   s    z)TestGeneric.test_flatnotmasked_contiguousN)__name__
__module____qualname__rR   r]   r^   ra   ro   rw   rx   r|   rP   rP   rP   rQ   r4   #   s   

r4   c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestAveragec                 C   s<  t ddddgddddgd}tdt|dd	 tdt|ddddgd
 t|ddddgdd\}}td| t|dk t|d d < tt|dd	jdg t ddddgddddgd}|dd}t|d d df< tt|dd	ddg tt|dd	jd dg tddgt|dd	 t|ddd\}}t|ddg d S )N              ?       @      @TFr;   r   axisweightsr   returned      @r6   r9   r   r   )r   r   r   r   r
   r;   reshape)rL   ZottresultwtsrP   rP   rQ   test_testAverage1   s     
zTestAverage.test_testAverage1c                 C   s  ddddddg}ddddddgddddddgg}t dtjd}tt|ddd tt|d|dd tt dtjddt d g}tt|d tjt dd	 d
  tt|ddt dd	 d  tt|ddt|ddt|ddd g tt|d |dd tt|d|ddddd	ddg tt|ddt|ddt|ddd g td}ddddddg}ddddddgddddddgg}t	d}ddddddg}	ttt
||ddd ttt
||ddd ttt
||ddjdg ttt
||	ddd tttt
||ddd t
||}
tt|
d d tt|
ddddddddg tt|
ddddg tt|
d|dddddddg d S )Nr   r9   rq   r7   r         @)r   r   r   r         (@r   g
@r   r   r   g      $@Tg     X@g      @      @)r	   rK   Zfloat_r   r   r   addreducer   r   r   r;   r   )rL   w1w2xym1m2Zm3Zm4Zm5zrP   rP   rQ   test_testAverage2   sF     &  
zTestAverage.test_testAverage2c                 C   sf  t d}t dd }t||g||ggddd\}}tt|t| t|j|j ttddddgdd\}}tt|t| ttddd	\}}tt|t| ttdtddd
\}}tt|t| tddgddggt}t|ddgddgg}t|dd}	t|	ddg t|dd}
t|
ddg t|d d}
t|
d t|dd}
t|
ddg d S )Nrq   rt   r9   Tr   )r6   r6   rt   r   r   r   r   )r   r   r6      Fr         ?r   r   g@      ?r   )r	   r   r   r   r   r   rJ   r   )rL   r<   r=   Zr1r   Zr2r   Za2dZa2dmZa2daZa2dmarP   rP   rQ   test_testAverage3   s*    
zTestAverage.test_testAverage3c                 C   sH   t tddg}t|d t tddddgddddgd}t|d d S )	Nr9   r6   r   rt   r   FTr   )r   r   r   rL   r<   rP   rP   rQ   test_onintegers_with_mask   s    
 z%TestAverage.test_onintegers_with_maskc                 C   s  t jdddddgdddddggtd}tdddddgdd	d
ddgg|d}t|}t | }t|j|j t|j|j t|dd}t|jddt|jddd	  }t|j|j t|j|j t|dd}t|jddt|jddd	  }t|j|j t|j|j t dddddgdddddgg}	t||	d}
t j| |	|  d}t|
j|j t|
j|j t||	dd}t|j|	ddt|j|	ddd	  }t|j|j t|j|j t||	dd}t|j|	ddt|j|	ddd	  }t|j|j t|j|j d S )Nr   r9   r7   y      ?       @y      @      @y      @      @y      @       @y              "@y              ?y       @      @y      @      @y      @      @r   r   r   r   r   r   )r   r   )	rK   r   r{   r   r   rh   r   realimag)rL   r;   r<   avexpectedZav0Z	expected0Zav1Z	expected1r   ZwavZwav0Zwav1rP   rP   rQ   test_complex   sR      zTestAverage.test_complexc                 C   s   t jjt ddddddgdddgdddggd}tdddgd	d}tdddgdddgd}t|d|d	d
}t dddg}t|| t|d|d	d
}t dddg}t|| d S )Nrs   rt   r9   r   r   ry         Fr         @g     @g     @g0N@g0N@)rK   rW   r   r	   r   r   r   r   )rL   r<   Zweights_unmaskedZweights_maskedZavg_unmaskedZexpected_unmaskedZ
avg_maskedZexpected_maskedrP   rP   rQ   test_masked_weights'  s     
zTestAverage.test_masked_weightsN)	r}   r~   r   r   r   r   r   r   r   rP   rP   rP   rQ   r      s   ",r   c                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestConcatenatorc                 C   s   t td tddddddg td}dddddg}t||d	}t|dd|f }tt|t t |ddddddddddddg t |jt|dd|f  d S )
N)r9   r6   rt   r   ry   rq   r9   r6   rt   r   ry   rq   r   r   )	r   r   r   r   r   r   
isinstancer   r;   )rL   r=   mdrS   rP   rP   rQ   test_1d<  s    "zTestConcatenator.test_1dc                 C   s0  t jdd}t jdd}t t jddd}t t jddd}t||d}t||d}td||f }t|jdk t|d d d df | t|d d dd f | t|j	t j
d||f  t||f }t|jdk t|d dd d f | t|dd d d f | t|j	t j
||f  d S )Nry   r   r   1)ry   r_   )r_   ry   )rK   randomrandZround_r   r   r   r   r   r;   Zr_)rL   Za_1Za_2Zm_1Zm_2Zb_1Zb_2r   rP   rP   rQ   test_2dG  s     zTestConcatenator.test_2dc                 C   sr   t tjjdf }t|jddg t|jd d t ddgtjjf }t|jdddg t|jd d ddg d S )Nr9   TFr6   )r   rK   rW   r
   r   r;   rf   )rL   actualrP   rP   rQ   test_masked_constant[  s    z%TestConcatenator.test_masked_constantN)r}   r~   r   r   r   r   rP   rP   rP   rQ   r   9  s   r   c                   @   s   e Zd Zdd Zdd ZdS )TestNotMaskedc                 C   s  t tddddddddgdddddgdddddgdddddgdddddggd}t|d }t|ddg t|d}t|d ddg t|d d	dg t|d}t|d dd
g t|d ddg t|jd }t|ddg t|jd}t|d ddg t|d ddg t|jd}t|d ddg t|d ddg t|d< t|d}t|d ddg t|d ddg t|d}t|d ddg t|d ddg d S )N   ry   r   r9   r      )r   r   r9   r   r   )r   r9   r6   rt   r   )rt   rt   rt   r   r   )r   r   r6   r   rt   )r   r6   r   r   r   )r   r   r   r   r   )r   r   r   r   r   )r9   r9   r6   r   r   )r   r9   r6   r   )r   r   r6   rt   )r   r6   r   r   )r   rK   r	   r   r-   r   rf   r
   rL   rf   rM   rP   rP   rQ   
test_edgesh  s>    




zTestNotMasked.test_edgesc                 C   sP  t tdddddddddddgddddddddgddddddddggd}t|d }t|tddd tdd	d td
dd g t|d}t|tddd tddd gtddd tddd gtddd tddd gtddd tddd gtddd gtddd gg tddd gg t|d}t|tddd gg tddd tddd gg d S )Nr   rt   rr   r   r9   r   r            r6   rq   rb   )r   rK   r	   r   r,   r   ru   )rL   r<   tmprP   rP   rQ   test_contiguous  s:    





zTestNotMasked.test_contiguousN)r}   r~   r   r   r   rP   rP   rP   rQ   r   e  s   "r   c                   @   s~   e Zd Zdd Zdd Zdd Zejddd	d
gejddge	j
jd	fe	j
jd
fgdd Zdd Zdd Zdd ZdS )TestCompressFunctionsc                 C   s>  t ttdddd}t dt}d|d< t||d}t|}t	|d	d
ddgddddgddddggddddgddddgddddggg t|d	}t	|d	dd
ddgdd d!d"d#gdd$dddgdd%dddggdd&dddgd'd(d)d*d+gdd,dddgdd-dddggg t|d}t	|d	dd
ddgdd$dddgdd%dddggd.d/d0d1d2gd3d4d5d6d7gd8d9d:d;d<ggdd&dddgdd,dddgdd-dddggg t|d=}t|d>}t|d?}t	|| t	|| t	|| t|d
}t	|d	d
ddgdd!d"d#gddddgddddggd.d0d1d2gd@dAdBdCgd3d5d6d7gd8d:d;d<ggddddgd'd)d*d+gddddgddddggg t|dD}t|dE}t|dF}t	|| t	|| t	|| t|dG}t	|d	dd
ddgdd$dddgdd%dddggdd&dddgdd,dddgdd-dddggg t|dH}t	|| t|dI}t	|d	d
ddgddddgddddggd.d0d1d2gd3d5d6d7gd8d:d;d<ggddddgddddgddddggg t|dJ}t|dK}t|dL}t	|| t	|| t	|| t|dM}t	|d	d
ddgdd!d"d#gddddgddddggddddgd'd)d*d+gddddgddddggg t|dN}t	|| d S )ON<   rt   r   ry   )rt   r   ry   Tr9   r9   r9   r   r   r6   r_                        (   *   +   ,   2   4   5   6   7   9   :   ;   r9   rq   rb   rr   rs      r   )   -   .   /   0   1   3   8         r   r   r      r       !   "   #   $   %   &   '   rT   r   )r   r      r      r5   r   )r   )r   r9   )r   r   r9   r6   )r   r6   )r9   r   )r   r   r   r6   )r   r   )
rK   r   listrc   r   r   astyper{   r&   r   )rL   r   r   r<   a2a3Za4rP   rP   rQ   test_compress_nd  s    



























































	
z&TestCompressFunctions.test_compress_ndc                 C   s  t tddddddgdddgdddggd}tt|ddgdd	gg tt|ddddgd
dd	gg tt|dddgddgdd	gg t |jdddgdddgdddggd}tt|ddgd
d	gg tt|ddddgd
dd	gg tt|dddgddgd
d	gg t |jdddgdddgdddggd}tt|d	gg tt|dd
dd	gg tt|ddgdgd	gg t |jdddgdddgdddggd}tt|jd tt|djd tt|djd d S )Nrs   rt   r9   r   r   r   ry   rb   rr   rq   r6   )r   rK   r	   r   r   r'   _datarz   rL   r   rP   rP   rQ   test_compress_rowcols  s$     "& "&&z+TestCompressFunctions.test_compress_rowcolsc                 C   s  t tddddddgdddgdddggd}tt|jdddgdddgdddgg tt|djdddgdddgdddgg tt|djdddgdddgdddgg t |jdddgdddgdddggd}tt|jdddgdddgdddgg tt|djdddgdddgdddgg tt|djdddgdddgdddgg t |jdddgdddgdddggd}tt|jdddgdddgdddgg tt|djdddgdddgdddgg tt|djdddgdddgdddgg t |jdddgdddgdddggd}tt|	 t
k tt|d	 t
k tt|d	 t
k tt|j	  tt|dj	  tt|dj	  d S )Nrs   rt   r9   r   r   )r   rK   r	   r   r   r(   r;   r   r   allr
   r   rP   rP   rQ   test_mask_rowcols1  sN    
&
&
&z'TestCompressFunctions.test_mask_rowcolsr   Nr   r9   funcrowcols_axisc              	   C   sf   t tddddddgdddgdddggd}tt" |||d}t|t|| W 5 Q R X d S )Nrs   rt   r9   r   r   r   )r   rK   r	   r   r   DeprecationWarningr   r(   )rL   r   r   r   r   resrP   rP   rQ   #test_mask_row_cols_axis_deprecationQ  s    
z9TestCompressFunctions.test_mask_row_cols_axis_deprecationc                 C   s   t dd}ddddddg}t||ddd}t||ddd}t||dd}t|jddgddgg t||dd}t|jdddgdddgdddgg t||d	d}t|t |d|d t||d	d}t|t |d|d ddddddg}t||ddd}t||ddd}t||dd}t|jddgddgg t||dd}t|jdddgdddgdddgg t||d	d}t|t |d|d t|t|| t||d	d}t|t |d|d ddddddg}t||ddd}t||ddd}t||}t|jt t||}t|jt t|ddddddgddd}t|ddddddgddd}t||dd}t|jddgddgg t||d	d}t|t |d|d t||dd}t|jdddgdddgdddgg t||d	d}t|t |d|d t|ddddddgddd}t|ddddddgddd}t||dd}t|jddgddgg t||}t|t |d|d t||dd}t|jdddgdddgdddgg t||d	d}t|t |d|d t|ddddddgddd}t|ddddddgddd}t||dd}t|jddgddgg t||d	d}t|t |d|d t||dd}t|jdddgdddgdddgg t||d	d}t|t |d|d d S )
Nr9   rb   r   r   r6   rt   T)strictF)	rK   r	   r   r   r   r   r;   filledr   )rL   nr   r<   r=   rS   rP   rP   rQ   test_dot]  sz    $$

  $  
$  $zTestCompressFunctions.test_dotc                 C   sn   t d}t|}ttt||tk ttt||tk ttt||tk ttt||tk d S )Nrt   )rK   eyer   r   rX   r   r   rL   r<   r=   rP   rP   rQ   test_dot_returns_maskedarray  s    
z2TestCompressFunctions.test_dot_returns_maskedarrayc                 C   sD   t td}t td}t|||d}t||k t|| d S )Nrt   )rt   rt   out)r   rK   r  r   r   r   r   )rL   r<   r  r  rP   rP   rQ   test_dot_out  s
    z"TestCompressFunctions.test_dot_out)r}   r~   r   r   r   r   pytestmarkZparametrizerK   rW   Z	mask_rowsZ	mask_colsr  r  r	  r  rP   rP   rP   rQ   r     s   p 	F	r   c                   @   s   e Zd Zdd Zdd ZdS )TestApplyAlongAxisc                 C   s@   t dddd}dd }t|d|}t|ddgdd	gg d S )
Nr   r6   rt   c                 S   s   | d S Nr9   rP   )r=   rP   rP   rQ   myfunc  s    z*TestApplyAlongAxis.test_3d.<locals>.myfuncr9   r   rb   r_   r	   r   r%   r   rL   r<   r  ZxarP   rP   rQ   test_3d  s    zTestApplyAlongAxis.test_3dc                 C   sF   t dddd}ddd}t|d|dd}t|dd	gd
dgg d S )Nr   r6   rt   r   c                 S   s   | d|  S r  rP   )r=   offsetrP   rP   rQ   r    s    z1TestApplyAlongAxis.test_3d_kwargs.<locals>.myfuncr9   )r  ry   rr   r   )r   r  r  rP   rP   rQ   test_3d_kwargs  s    
z!TestApplyAlongAxis.test_3d_kwargsN)r}   r~   r   r  r  rP   rP   rP   rQ   r    s   
r  c                   @   s   e Zd Zdd ZdS )TestApplyOverAxesc                 C   s   t dddd}ttj|ddg}tdgdgdggg}t|| t||d t	< ttj|ddg}td	gd
gdggg}t|| d S )Nr   r6   rt   r   r   r   \   |   r   r   )
r	   r   r$   rK   rg   r   r   r
   r   r{   )rL   r<   rM   ZctrlrP   rP   rQ   
test_basic  s    
zTestApplyOverAxes.test_basicN)r}   r~   r   r  rP   rP   rP   rQ   r    s   r  c                   @   s   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-S ).
TestMedianc                 C   s4   t jjt jt jgt jt jggdd}t|t j d S )Nr   r   )rK   rW   r   infr   rL   rrP   rP   rQ   test_pytype  s    $zTestMedian.test_pytypec                 C   s   t jjt jt jt jgt jt jggdd}t|t j t jjt jt jt jgt jt jggd d}t|t j t jjt jjt jt jgt jt jggdddd}t|jd t jjt jjt jt jgt jt jggddd d}t|jd d S )Nr   r   Tr   )rK   rW   r   r   r  r   r;   r  rP   rP   rQ   test_inf  s8    



zTestMedian.test_infc                 C   sl  t d}tt j|d ttt j|tk	 td}tt j|d ttt j|tk	 d}tt j|d ttt j|tk	 t d	dd}tt jj|dd	t j|dd	 tt jj|d
d	t j|d
d	 tt jj|d
d	tk	 t d	dd}tt jj|dd	t j|dd	 tt jj|d
d	t j|d
d	 tt jj|d
d	tk	 d S )Nrs   r   rr   g      @ry   r   H   r   r   r9   g      R@)
rK   r	   r   rW   r   r   rX   r   rc   r   r   rP   rP   rQ   test_non_masked  s"    
    zTestMedian.test_non_maskedc                 C   s  t tddgd dgd  d}ttj|d ttj|jdd tttj|t	k	 t td	
d
ddgd dgd  d}ttj|d ttj|jdd tttj|t	k	 tjj|ddd}t|ddg t|jdd tt|t	k dS )z5test the examples given in the docstring of ma.medianrr   r   r   r9   r   r   rP   shape mismatchr_   r6   ry   rq   r   r   Tr   Zoverwrite_inputr   r   r5   N)r   rK   r	   r   rW   r   r   r   rX   r   r   )rL   r   Zma_xrP   rP   rQ   test_docstring_examples  s    "*z"TestMedian.test_docstring_examplesc                 C   s   d}t dD ]}dD ]}td||d}tt | |ddg}|D ]H\}}ztjj|||d W qB tk
r   t|||||f Y qBX qBt|d  |gddg}|D ]J\}}ztjj|||d W n tj	k
r   Y qX t|||||f qqqd S )	Nz5mask = %s, ndim = %s, axis = %s, overwrite_input = %sry   )FTr9   )ndminr;   FTr$  )
rc   r   	itertoolsproductrK   rW   r   	ExceptionAssertionErrorZ	AxisError)rL   msgr&  r;   r   argsr   ZoverrP   rP   rQ   test_axis_argument_errors  s"    z$TestMedian.test_axis_argument_errorsc                 C   sD   t ddd}ttj|d t ddd}ttj|tjj d S )Nr9   Fr   T)r   r   rK   rW   r   r
   r   rP   rP   rQ   test_masked_0d*  s    zTestMedian.test_masked_0dc                 C   s  t tddd}ttj|tjj ttj|jdd tt	tj|tjj
jk t tddd}ttj|d ttj|jdd tt	tj|tk	 t tddd	dddgd}ttj|d
 ttj|jdd tt	tj|tk	 t tddd	d	d	d	gd}ttj|d ttj|jdd tt	tj|tk	 t tddd	d	ddgd}ttj|d ttj|jdd tt	tj|tk	 t tddd	d	ddgd}ttj|d ttj|jdd tt	tj|tk	 t tddd	d	d	d	dgd}ttj|d
 ttj|jdd tt	tj|tk	 t tddd	d	d	d	dgd}ttj|d
 ttj|jdd tt	tj|tk	 d S )Nry   Tr   rP   r#  Fr   r   r9   r   r   r   r   rq   r   )r   rK   r	   r   rW   r   r
   r   r   rX   rY   ZMaskedConstantr   r   rP   rP   rQ   test_masked_1d1  s@    zTestMedian.test_masked_1dc              	   C   sJ   t tjtdddgdddgdjtjtdddgdddgdj d S )Nr9   r6   rt   r   r   )r   rK   rW   r   r   r   rL   rP   rP   rQ   test_1d_shape_consistencyW  s    " z$TestMedian.test_1d_shape_consistencyc                 C   s   d\}}t tdd|}t |d d< |dd < t tj||ftd}|d d  |d d df< tt|}td|D ]$}tj	
| || |d d |f< qxtt|d d df d tt|d tt|dd	t| tt|jdd	t| d S )
N)e   r         r   r_   r7   r   r9   r   )r   rK   Zlinspacer
   emptyrJ   r	   rZ   rc   r   shuffler   r   r   T)rL   r  pr   r   idxri   rP   rP   rQ   r   [  s    zTestMedian.test_2dc                 C   s   t tddd}t |d d< |dd < tt|d tttj	|t
k	 tt|ddddd	g tttj	j|ddt
k tt|d
dddddddddddg
 tttj	j|d
dt
k tt|d
djd
d
d
ddddd
d
d
g
 d S )Nr   r_   rt         -@r   r         +@g      /@r9   r   r   r   )r   rK   r	   r   r
   r   r   r   rX   rW   r   r;   r   rP   rP   rQ   test_2d_waxisk  s    &zTestMedian.test_2d_waxisc                 C   s   t jdddd}t||d dk< tt|dddgdd	gddgd
d	gg d|_tt|dddgddgddgg t jdddd}t||d dk< tt|dddgddgddgg d S )Nr   rt   r   r6   r   r   rs   rq   r   r   )r   rt   r6   c   r_   r   r   r   ry   rr   r   r   )rK   rW   r	   r   r
   r   r   r   r   rP   rP   rQ   r  w  s    ("zTestMedian.test_3dc                 C   sL   t tddd}t |d d< |dd < tt|ddt|dd d S )Nr   r_   rt   r:  r   r   r9   )r   rK   r	   r   r
   r   r   r   rP   rP   rQ   test_neg_axis  s    zTestMedian.test_neg_axisc                 C   s   dD ]~}t t|}t |d d< |dd < t td}t||d}|dkr\t|d n
t|d t||k tt|t	k qd S )	N)r         >@r   g      ?@rt   r:  rP   r
  r   r;  g      .@)
r   rK   r	   r
   r   r   r   r   rX   r   )rL   vr   r  r  rP   rP   rQ   test_out_1d  s    
zTestMedian.test_out_1dc                 C   s  dD ]}t t|dd}t |d d< |dd < t td}t|d|d}|dkrt d	gd dd
ddg d	gd  dgd dgd  dgd  d}nBt d	gd ddddg d	gd  dgd dgd  dgd  d}t|| t||k tt	|t
k qd S )N)r   g      D@r   r@  r_   r   rt   r:  r9   )r   r  r   r   r   r   r   TFr   r   r<  g     1@g     5@g     9@)r   rK   r	   r   r
   r   r   r   r   rX   r   )rL   rA  r   r  r  erP   rP   rQ   test_out  s    
  
zTestMedian.test_outc                 C   sF   ddgddgddgg}t j|d}ddg}tt jj|dd| d S )Nr   r   r   r   r   )rK   rW   Zmasked_equalr   r   )rL   rf   r\   r   rP   rP   rQ   $test_single_non_masked_value_on_axis  s    z/TestMedian.test_single_non_masked_value_on_axisc                 C   s  dt jdtdfD ]}t jdt jdgdddgg}||_t jj|d d}tt 	| t
|t j t jj| dd}tt 	| t
|t j t jj|dd}tt|t t
|dt jdg t jj|dd}tt|t t
|t jdg t jj|d	d}tt|t t
|t jdg qt jdt jdgdddgg}t jj|d d df< t
t jj|d dt j t
t jj|dddt jdg t
t jj|ddt jd
g d S )NFrq   r7   r9   rt   r6   r   r   r   r   )rK   r   r{   rW   r   nanr;   r   r   isscalarr   Zravelr   rX   r   r
   )rL   r;   dmr  rP   rP   rQ   test_nan  s.    zTestMedian.test_nanc                 C   s   t jt d}t jt d}t j|d< t jj|d< tt jj|d|d| t jt d}tt jj|d|d| t jt d	}tt jj||d| d S )
N)r   )rt   r   )r6   r9   rD   r   r
  rt   r9   rP   )	rK   rW   r   r   r   rF  r
   r   r   )rL   or   rP   rP   rQ   test_out_nan  s    
zTestMedian.test_out_nanc                 C   s  t jt jdtd}t jj|d d d< t j|d< tt j|t j tt jj|ddt j t jt jdtd	ddd}t |j
d dk|_| }t j|d	< t j|d
< tt j|t j tt t j| t jj|dd}t j|d< t j|d< tt j|d| t jj|dd}t j|d< t j|d< tt j|d| t jj|dd}t j|d< t j|d< tt j|d| d S )Nr   r7   rt   r6   r   r   r   r9   )r9   r6   rt   )r9   r9   r6   r6   rt   r   r9   rt   r   )rK   rW   r   r	   rJ   r
   rF  r   r   r   rz   r;   copyr   rG  r   )rL   r<   Zaorigr=   rP   rP   rQ   test_nan_behavior  s0    
 







zTestMedian.test_nan_behaviorc                 C   s   t jdddgdddggt jd}t jj||dkd}tt jj|ddd tt jj|ddjd tt jj|dd|d  tt j|d d S )	Nrt      r7   r   r9   r   Fr   )rK   r   Zuint8rW   r   r   r   r;   r   rP   rP   rQ   test_ambigous_fill  s     zTestMedian.test_ambigous_fillc                 C   s  t jt j fD ]}t |t jgt jt jgg}t jj|t |d}tt jj|dd|t jg tt jj|dd|t jg tt j|| t t jt j|gt jt j|gg}t jj|t |d}t	t jj|dd| t	t jj|ddj
d t	t jj|dd|d  t	t j|| t ||g||gg}tt j|| tt jj|dd| tt jj|dd| t j|d| dgdt jt jd	gd
t jt j|ggt jd}t jj|t |d}|dkrtt jj|dddd| dg tt j|d n2tt jj|dddd| dg tt j|d tt jj|dddd|g tddD ]}tddD ]}t t jg| |g|  gd }t jj|t |d}tt j|| tt jj|dd| tt jj|ddt jg| |g|   qhqZqd S )Nr   r   r   r9   Frb   ir4  ry   r   r7   r         @r   g      @g      $g      "g      r3  r_   r6   )rK   r  r   rF  rW   r   isnanr   r   r   r;   Zfloat32rc   )rL   r  r<   ri   rj   rP   rP   rQ   test_special  sL    "
  "zTestMedian.test_specialc              	   C   st  t jt jg td}t 8}|t tt j	|t j
 t|jd jtk W 5 Q R X t jt jg tdd}t F}|t tddt tt j	|t j
 t|jd jtk W 5 Q R X t jt jg tdd}tt jj	|dd| tt jj	|d	d| t jt jt j
tdd}tjd
d<}tddt tt jj	|dd| t|d jtk W 5 Q R X d S )Nr7   r   rt   )r8   r&  always r6   r   r9   T)record)rK   rW   r   r   rJ   r   rX  RuntimeWarningr   r   rF  r   logcategorywarningsfilterwarningsr   catch_warnings)rL   r<   wr=   rP   rP   rQ   
test_empty.  s&    

zTestMedian.test_emptyc                 C   sX   t jt d}ttt j|tt	 t j
|d< ttt j|tt	 d S )NrS  r6   )rK   rW   r   r	   r   rX   r   r   rV   rJ   rF  )rL   rK  rP   rP   rQ   test_objectK  s    
zTestMedian.test_objectN)r}   r~   r   r  r   r"  r%  r-  r.  r/  r1  r   r=  r  r?  rB  rD  rE  rI  rL  rP  rR  rU  r`  ra  rP   rP   rP   rQ   r    s,   &	#	+r  c                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )TestCovc                 C   s   t tjd| _d S Nr   )r   rK   r   r   rf   r0  rP   rP   rQ   setupT  s    zTestCov.setupc                 C   sZ   | j }tt|t| ttj|ddt|dd ttj|dddt|ddd d S )NFrowvarTrf  bias)rf   r   rK   r   r   rP   rP   rQ   test_1d_without_missingW  s    zTestCov.test_1d_without_missingc                 C   sb   | j dd}tt|t| ttj|ddt|dd ttj|dddt|ddd d S )Nrt   r   Fre  Trg  )rf   r   r   rK   r   r   rP   rP   rQ   test_2d_without_missing_  s    zTestCov.test_2d_without_missingc                 C   s@  | j }t|d< || 8 }| }tt|t| ttj|ddt|dd ttj|dddt|ddd zt|dd W n tk
r   Y nX |dd }tt||d d d t||d d d  ttj||d d d ddt||d d d dd ttj||d d d dddt||d d d ddd d S )Nr   Fre  Trg  Zallow_maskedr9   )rf   r
   meanrh   r   rK   r   
ValueError)rL   r   nxrP   rP   rQ   test_1d_with_missingg  s*    ,zTestCov.test_1d_with_missingc                 C   s6  | j }t|d< |dd}tt|t}t||j	}||
dd d d f  d}tt|t||jd d  |d   tt|ddtj|dd|jd  |  t|j	|}||
d d}tt|d	d
tj|d	d
|jd d  |d   tt|d	ddtj|d	dd|jd  |  d S )Nr   rt   r   r9   r   r   Trh  Fre  rg  )rf   r
   r   rK   Zlogical_notr   r   rd   r   r7  rl  r  r   r   r   )rL   r   ZvalidfracZxfrP   rP   rQ   test_2d_with_missing  s8     zTestCov.test_2d_with_missingN)r}   r~   r   rd  ri  rj  ro  rr  rP   rP   rP   rQ   rb  R  s
   rb  c                   @   sD   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dS )TestCorrcoefc                 C   s(   t tjd| _t tjd| _d S rc  )r   rK   r   r   rf   data2r0  rP   rP   rQ   rd    s    zTestCorrcoef.setupc              	   C   s   | j | j }}t|}t||}t }td ttt|dd |	td t
tj|ddt|dd t
t|dd| t
t||dd| t
t|dd| t
t||dd| W 5 Q R X d S )NrV  r   Zddofbias and ddof have no effectr   rt   rf   rt  rK   r   r   r\  simplefilterr   r   filterr   )rL   r   r   r   Z	expected2suprP   rP   rQ   	test_ddof  s    

zTestCorrcoef.test_ddofc              	   C   s   | j | j }}t|}t b}td ttt||dd ttt||dd ttt|dd |	td t
t|dd| W 5 Q R X d S )NrV  TFrp  rv  r9   rw  )rL   r   r   r   rz  rP   rP   rQ   	test_bias  s    

zTestCorrcoef.test_biasc              	   C   sx   | j }tt|t| ttj|ddt|dd t 2}|td ttj|dddt|ddd W 5 Q R X d S )NFre  rv  Trg  )rf   r   rK   r   r   ry  r   rL   r   rz  rP   rP   rQ   ri    s    
z$TestCorrcoef.test_1d_without_missingc              	   C   s   | j dd}tt|t| ttj|ddt|dd t 2}|td ttj|dddt|ddd W 5 Q R X d S )Nrt   r   Fre  rv  Trg  )rf   r   r   rK   r   r   ry  r   r}  rP   rP   rQ   rj    s    
z$TestCorrcoef.test_2d_without_missingc              	   C   s  | j }t|d< || 8 }| }tt|t| ttj|ddt|dd t 2}|t	d ttj|dddt|ddd W 5 Q R X zt|dd W n t
k
r   Y nX |dd }tt||d d d t||d d d  ttj||d d d ddt||d d d dd t r}|t	d tt||d d d t||d d d dd	 tt||d d d t||d d d d
d W 5 Q R X d S )Nr   Fre  rv  Trg  rk  r9   rp  r6   ru  )rf   r
   rl  rh   r   rK   r   r   ry  r   rm  )rL   r   rn  rz  rP   rP   rQ   ro    s<    
,z!TestCorrcoef.test_1d_with_missingc              	   C   s  | j }t|d< |dd}t|}t|}t|d dd df |d dd df  t }|td tt|ddd dd df |d dd df  tt|ddd dd df |d dd df  tt|ddd dd df |d dd df  W 5 Q R X d S )	Nr   rt   r   rv  r   ru  r9   rp  )	rf   r
   r   r   rK   r   r   ry  r   )rL   r   rM   rN   rz  rP   rP   rQ   rr    s"    
*z!TestCorrcoef.test_2d_with_missingN)
r}   r~   r   rd  r{  r|  ri  rj  ro  rr  rP   rP   rP   rQ   rs    s   rs  c                   @   s   e Zd Zdd Zdd ZdS )TestPolynomialc                 C   s  t jd}t jddd}tt||dt ||d |t}t|d< |t}t |d< |d< t||d d df dd	d
\}}}}}t j|dd  |dd df 	 dd	d
\}}	}
}}t
|||||f||	|
||fD ]\}}t|| qt||d d df dd	d
\}}}}}t j|dd |dddf dd	d
\}}	}
}}t
|||||f||	|
||fD ]\}}t|| qht||dd	d
\}}}}}t j|dd |ddd d f dd	d
\}}	}
}}t
|||||f||	|
||fD ]\}}t|| qt jdd }| }|dd }|dd }|dd }t||dd	|d\}}}}}t j||dd	|d\}}	}
}}t|| t
|||||f||	|
||fD ]\}}t|| qd S )Nr_   r   r   r6   rt   r   rB   r   r   Tre   r9   )re   r_  )rK   r   r   r   r   r   viewr   r
   rh   ziprO  r   )rL   r   r   CRKSDrS   r  rk   rm   r   r<   a_r_  ZwoxsZyswsrP   rP   rQ   test_polyfit  s>    

&"&&0&4&
&zTestPolynomial.test_polyfitc                 C   s   t jd}t jddd}t j|d< t j|d< |t}|t}t|d< t|d< t||ddd	\}}}}}t j|d
d |d
dd d f ddd	\}}	}
}}t	|||||f||	|
||fD ]\}}t
|| qd S )Nr_   r   r   r6   r   r  rt   Tr  r9   )rK   r   r   r   rF  r  r   r
   r   r  r   )rL   r   r   r  r  r  r  r  rS   r  rk   rm   r   r<   r  rP   rP   rQ   test_polyfit_with_masked_NaNs)  s    



4&z,TestPolynomial.test_polyfit_with_masked_NaNsN)r}   r~   r   r  r  rP   rP   rP   rQ   r~     s   'r~  c                   @   s   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!S )"TestArraySetOpsc                 C   s   ddddddg}t |ddd}tt|d t t|d tdddgdddgd t|d dddg t|d ddddddg d S )	Nr9   r6   rt   TZreturn_indexZreturn_inverser   r   ry   )r   r   r   r   r   r   r   rP   rP   rQ   test_unique_onlist<  s    "z"TestArraySetOps.test_unique_onlistc                 C   s  t ddddddgddddddgd}t|ddd}t|d t ddddgddddgd t|d ddd	dg t|d ddddddg d|_t ddddddgddddddgdd
}t|ddd}t|d t ddddgddddgd t|d ddd	dg t|d ddddddg d S )Nr9   r6   rt   r   r   Tr  r   ry   )rf   r;   
fill_value)r   r   r   r  r   rP   rP   rQ   test_unique_onmaskedarrayE  s    $& &z)TestArraySetOps.test_unique_onmaskedarrayc                 C   s   t dddgdd}t|ddd}t|d t dgdgd t|d dg t|d dddg t}t|ddd}t|d t t t|d dg t|d dg d S )Nr9   Tr   r  r   r6   )r   r   r   r
   r   rP   rP   rQ   test_unique_allmaskedU  s    z%TestArraySetOps.test_unique_allmaskedc                 C   sr   t tddddddgd}tddddgddddgd}t|}t|| t|d|d t|j|j d S )Nry   r9   r   r   r   )r   rK   r	   r   r#   r   r  r;   )rL   r   rN   rM   rP   rP   rQ   test_ediff1dd  s    
zTestArraySetOps.test_ediff1dc              	   C   s   t tddddddgd}t|td}tdddddgdddddgd}t|| t|d|d t|j|j t|dddgd}tdddddddgdddddddgd}t|| t|d|d t|j|j d S )	Nry   r9   r   r   )to_beginr   r6   rt   	r   rK   r	   r#   r
   r   r   r  r;   rL   r   rM   rN   rP   rP   rQ   test_ediff1d_tobeginm  s     
(
z$TestArraySetOps.test_ediff1d_tobeginc              	   C   s   t tddddddgd}t|td}tdddddgdddddgd}t|| t|d|d t|j|j t|dddgd}tdddddddgdddddddgd}t|| t|d|d t|j|j d S )	Nry   r9   r   r   )to_endr   r6   rt   r  r  rP   rP   rQ   test_ediff1d_toend|  s     
(
z"TestArraySetOps.test_ediff1d_toendc              
   C   s   t tddddddgd}t|ttd}tddddddgddddddgd}t|| t|d|d t|j|j t|dddgtd}tddddddddgddddddddgd}t|| t|d|d t|j|j d S )	Nry   r9   r   r   r  r  r   r6   rt   r  r  rP   rP   rQ   test_ediff1d_tobegin_toend  s    $

z*TestArraySetOps.test_ediff1d_tobegin_toendc                 C   s   t d}t|}tddddgddddgd}t|| tt|t t|d|d t|j	|j	 t|t
t
d}tddddddgddddddgd}tt|t t|d|d t|j	|j	 d S )Nry   r9   r   r   r  )rK   r	   r#   r   r   r   r   r   r  r;   r
   r  rP   rP   rQ   test_ediff1d_ndarray  s    

$z$TestArraySetOps.test_ediff1d_ndarrayc                 C   sh   t ddddgddddgd}t ddddgddddgd}t||}t dddgdddgd}t|| d S )Nr9   rt   r   r   r   )r   r!   r   )rL   r   r   rM   rN   rP   rP   rQ   test_intersect1d  s
    
z TestArraySetOps.test_intersect1dc                 C   s  t dddddgdddddgd}t dddd	ddgddddddgd}t||}t|t dd	dg t dddddgdddddgd}dddd	dg}t||}t|t dd	ddgddddgd t dddg}t d
dd	g}t||}tt|t t|dddd	dd
g t ddddgddddgd}t d
dd	dgddddgd}t||}tt|t t|dddd	dd
g tg tg g  d S )Nr9   r6   ry   rb   r   r   r   rt   r   rq   rr   )r   r   r   r   r   r   r   rL   r<   r=   rM   rP   rP   rQ   test_setxor1d  s&     $
 
"

zTestArraySetOps.test_setxor1dc                 C   s   t ddddg}t dddg}d|d< t||d}tdd	d
ddddddg	dddddddddg	d}tdtd}d|d< d|d< d|d< t||}tt|t	 t
|| t |||j  |j @ }t
|| d S )Nr   r6   rt   r   r9   )r9   r6   r   r   r   r_   r   r   r   r   r   )rf   r;   )r6   rt   r   r7   T)r   r   r   )r   r   r9   )r   r6   rt   )rK   r	   r   r   r   r{   r0   r   r   r   r   r;   )rL   r<   r;   r=   ZecrS   r   rP   rP   rQ   	test_isin  s     

zTestArraySetOps.test_isinc                 C   s   t dddddgdddddgd}t dddd	ddgddddddgd}t||}t|d
d
d
dd
g t dddddgdddddgd}t dddgdddgd}t||}t|d
d
dd
d
g tg tg g  d S )Nr9   r6   ry   rb   r   r   r   rt   r   TF)r   r"   r   r   r  rP   rP   rQ   	test_in1d  s     $
 
zTestArraySetOps.test_in1dc                 C   s   t dddddgdddddgd}t dddd	ddgddddddgd}ttt||t||d
d t dddddgdddddgd}t dddgdddgd}ttt||t||d
d tg tg g d
d d S )Nr9   r6   ry   rb   r   r   r   rt   r   T)invert)r   r   rK   r  r"   r   r  rP   rP   rQ   test_in1d_invert  s     $   z TestArraySetOps.test_in1d_invertc           	   	   C   s  t ddddddgddddddgd}t dddd	ddgddddddgd}t||}t dddd	dddgdddddddgd}t|| t dddgdd	dggdddgdddggd}t ddddd	gdddddgd}t ddddd	dgddddddgd}t||}t|| tg tg g  d S )
Nr9   r6   ry   rb   r   r   r   rt   r   )r   r    r   r   )	rL   r<   r=   rM   rN   r   r   Zezr   rP   rP   rQ   test_union1d  s    $$
(
, $

zTestArraySetOps.test_union1dc              
   C   s   t ddddddddgddddddddgd}t ddd	d	dddg}t||}t|t ddd
gdddgd td}td}tt||t ddg t g tjg d}tt|g jtj d S )Nrq   ry   r   rb   r9   r6   r   r   rt   r   r_   rr   rs   )r   r   r   r	   rK   Zuint32r8   r  rP   rP   rQ   test_setdiff1d  s    ,
zTestArraySetOps.test_setdiff1dc                 C   s<   t dddg}t dddg}tt||t dg d S )Nr<   r=   rS   rm   )rK   r   r   r   r  rP   rP   rQ   test_setdiff1d_char_array  s    z)TestArraySetOps.test_setdiff1d_char_arrayN)r}   r~   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rP   rP   rP   rQ   r  :  s    		r  c                   @   s   e Zd Zdd Zdd ZdS )TestShapeBasec                 C   sr   t dddgdddgd}t|}t|jd t|jj|jj t|jd t|jj|jj t|jj|jj d S )Nr   r9   r6   r   rN  rJ  )r   r   r   r   r;   rf   r  rP   rP   rQ   test_atleast_2d$  s    zTestShapeBase.test_atleast_2dc                 C   s  t d}t|jd t|jj|j t|jj|j t dd}|D ]0}t|jd t|jj|j t|jj|j qBtd}t|jd t|jj|j t|jj|j tdd}|D ]0}t|jd t|jj|j t|jj|j qtd}t|jd t|jj|j t|jj|j tdd}|D ]2}t|jd t|jj|j t|jj|j q*td}t|jd t|jj|jj d S )Nr   rT   r   rC   r   )r   r   r   r;   rf   r   r   r1   )rL   r=   r<   rP   rP   rQ   test_shape_scalar.  s<    


zTestShapeBase.test_shape_scalarN)r}   r~   r   r  r  rP   rP   rP   rQ   r  "  s   
r  c                   @   s$   e Zd Zdd Zdd Zdd ZdS )	TestStackc                 C   s   t dddgdddgd}t dddgdddgd}t||gdd}t|jd	 t|j|d j t|j|d j t||g}t|j|j t|j|j t||gdd}t|jd
 t|j|d d df j t|j|d d df j d S )Nr   r9   r6   r   rs   rr   rb   r   rM  rt   r6   r   r2   r   r   r   r;   r3   rf   rL   r<   r=   rS   r   rP   rP   rQ   test_stack_1d\  s    zTestStack.test_stack_1dc                 C   s   t dddgdd}t dddgd	d}t||gdd
}t|jd t|j|d j t|j|d j t||g}t|j|j t|j|j t||gdd
}t|jd t|j|d d df j t|j|d d df j d S )Nr   r9   r6   Tr   rs   rr   rb   Fr   rM  r  r  r  rP   rP   rQ   test_stack_masksn  s    zTestStack.test_stack_masksc           
      C   s  d}t jdd|}t jdd|}t jdd|t}t jdd|t}t||d}t||d}t||gdd}d| }	t|j|	 t	|j
|d j
 t	|j
|d j
 t||gd	d}|d }	t|j|	 t	|j
|d
 j
 t	|j
|d j
 d}t jdd|}t jdd|}t jdd|t}t jdd|t}t||d}t||d}t||gdd}d| }	t|j|	 t	|j
|d j
 t	|j
|d j
 t||gd	d}|d }	t|j|	 t	|j
|d
 j
 t	|j
|d j
 d S )Nr  r   r_   r6   r   r   r5   r9   r   ).r   ).r9   )rt   r6   r   ry   )rK   r   randintr   r{   r   r2   r   r   r   r;   )
rL   Zshpd1Zd2r   r   Za1r   rS   Zc_shprP   rP   rQ   test_stack_nd  sD    zTestStack.test_stack_ndN)r}   r~   r   r  r  r  rP   rP   rP   rQ   r  Z  s   r  )J__doc__r\  r'  r  ZnumpyrK   Znumpy.testingr   r   Znumpy.ma.testutilsr   r   r   r   Znumpy.ma.corer   r	   r
   r   r   r   r   r   r   r   r   Znumpy.ma.extrasr   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/   r0   r1   r2   r3   r4   r   r   r   r   r  r  r  rb  rs  r~  r  r  r  rP   rP   rP   rQ   <module>   s:   4
  ,F    }Ck: i8