U
    /e                     @   s  d dl Z d dlZd dlmZ d dlZd dlZd dlmZ d dlm	Z	 d dl
mZ d dlmZmZmZmZmZmZmZ d dlmZmZ d dlmZmZ d	d
 Zej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/d0 Z.dDd2d3Z/d4d5 Z0d6d7 Z1d8d9 Z2d:d; Z3d<d= Z4d>d? Z5d@dA Z6dBdC Z7dS )E    N)partial)tokenizeget_dependencies)get_sync)SubgraphCallablecullfunctions_offusefuse_linearinlineinline_functions)applypartial_by_order)addincc                 C   sD   t | t |koB| j|jkoBt| jt|jkoBt| jt|jkS N)typeZoutkeysetinkeysr   dsk)selfother r   @/tmp/pip-unpacked-wheel-dbjnr7gq/dask/tests/test_optimization.py_subgraph_callables_eq   s    
r   c                 C   s   |  tdt dS )a  Ignore name when comparing instances of :class:`SubgraphCallable`.

    They have UUID-generated names which prevents instances generated by the
    test from comparing equal to reference values. Instead, compare the
    embedded graph using ``tokenize``.
    __eq__N)setattrr   r   )Zmonkeypatchr   r   r   compare_subgraph_callables!   s    r   c                 C   s   | d S )N   r   xr   r   r   double,   s    r"   c                     s   dt dft dftddfd t d\} }| dt dftddfdksHt|g dgdgdks`tt dt dgksztt ddgd	  kstt dgdggt ddgksttt fd
d d S )N   r!   y
   )r!   r$   zoutr'   )r!   r$   r'   r&   r   c                      s
   t  dS )NZbadkey)r   r   dr   r   <lambda>:       ztest_cull.<locals>.<lambda>)r   r   r   AssertionErrorpytestZraisesKeyError)Zculleddependenciesr   r(   r   	test_cull0   s    $r0   c                  O   s6   t | |}|ddk	r|S t| |}||ks2t|S )z9Run both ``fuse`` and ``fuse_linear`` and compare resultsrename_keysF)r   getr
   r,   )argskwargsZrv1Zrv2r   r   r   fuse2=   s    

r5   c                    s     fdd D fS )Nc                    s   i | ]}|t  |qS r   r   ).0kr   r   r   
<dictcomp>H   s      zwith_deps.<locals>.<dictcomp>r   r8   r   r8   r   	with_depsG   s    r:   c                  C   s  t } tdftdftdftddfddd}| |d	d
tttttddffffdddksZt| |dd
tttttddffffddddksttdftdftdftdftddfddd}| |d	d
ttdfttdffttddffdddkst| |dd
ttdfttdffttddffdddddks2ttdftdftdftdftdftddftdftdfddd
}| |d	d
ttttdffftdfttddfftdftdfdkst| |dd
ttttdffftdfttddfftdftdfddddd	ksttdftdftdftdftdfdd}| |d	d
ttdftdfttdfftdfdksdt| |dd
ttd ftd fttd fftdfd!d d"kstdtdftddfd#}| |d	d
ttdftddfd$kst| |dd
ttdftd%d%fd%d&kstd S )'Nr!   r$   r&   abr#   r   wr!   r$   r&   r;   r<   Fr1   )r>   r;   r<   Tz-y-x-w)r@   r;   r<   r>   )NEWr>   r!   r$   r&   r;   r<   )rA   r>   r$   r;   r<   z-yx-w)rA   rC   rB   r;   r<   r>   r$   r>   cr)   )
vur>   r!   r$   r&   r;   r<   rD   r)   )rF   rE   r$   r;   r<   c-ad-bx-w-u)	rI   rE   rB   rG   rH   r;   r<   rF   r$   r   )r;   r<   rD   r)   r!   r$   )r;   r<   r)   r!   y-xc-d)r;   r<   rK   rJ   r)   r!   r;   r<   rD   r<   rD   a-brN   rD   r<   )r5   r   r   r:   r,   )r
   r)   r   r   r   	test_fuseK   s    


	

	
	 
rP   c               	   C   s  t } dtdftdfd}dg}| ||ddttdftdfdksFt| ||ddttdftd	fd	d
kspttdftdftdftddfddd}ddg}| ||ddttdfttdfftddfdddkst| ||ddttdfttdfftddfddddkstd S )Nr#   r;   r<   rL   Fr?   rM   TrN   rO   r!   r$   r&   r   r=   )r>   r!   r&   r;   r<   rJ   )r>   rJ   r&   r;   r<   r!   )r5   r   r:   r,   r   )r
   r)   keysr   r   r   test_fuse_keys   s:    

 

rR   c               
   C   s  dt dft dftddfd} t| dt dft dftddfdksDtt| dddgdt dft t dfftdt t dfffdkstdt dftddfd} t| dt dftddfdkstt| dd	dt dftdt dffdkstt| dd
ddt dftdt dffdkstddddddgttdfdfd} t| dddddddgttdddgfdfdksftt| dd
dddddddgttdfdfdkstd S )Nr#   r;   r<   rD   r;   r<   rD   r)   r!   r$   )r!   r$   r&   )rQ   F)rQ   inline_constantsr)   r;   r<   rD   r)   e)rT   )r   r   r   r,   lenr(   r   r   r   test_inline   s>    (
"* rX   c               
   C   st   d\} }}}dt ||f|t| f|t|f| d|di}t|g thd}dt t| f|f|t|f| d|di}||ksptd S NZxyidr'   r#   Zfast_functions)r   r   r"   r   r,   )r!   r$   ir)   r   resultexpectedr   r   r   test_inline_functions  s
    &"r^   c                  C   sT   ddt tddftdfd} t| g thd}|d t| d fksDtd|ksPtd S )Nr#   r   r!   r;   )r!   r$   r;   r<   rZ   r<   )r   r   r   r   r,   r   r\   r   r   r   (test_inline_ignores_curries_and_partials  s    r`   c                  C   sf   G dd d} |  }dt df|dft dfd}t|g t hd}|d ||d fksVtd|ksbtd S )	Nc                   @   s   e Zd Zdd Zdd ZdS )z?test_inline_functions_non_hashable.<locals>.NonHashableCallablec                 S   s   |d S )Nr#   r   )r   r;   r   r   r   __call__  s    zHtest_inline_functions_non_hashable.<locals>.NonHashableCallable.__call__c                 S   s   t dd S )NzNot hashable)	TypeError)r   r   r   r   __hash__  s    zHtest_inline_functions_non_hashable.<locals>.NonHashableCallable.__hash__N)__name__
__module____qualname__ra   rc   r   r   r   r   NonHashableCallable  s   rg   r#   r;   r<   rD   rS   rZ   r   r   r,   )rg   Znohashr   r\   r   r   r   "test_inline_functions_non_hashable  s    ri   c                  C   s.   t dfdd} t| g t hd}|| ks*td S )Nr$   r#   r!   r$   rZ   rh   r_   r   r   r   /test_inline_doesnt_shrink_fast_functions_at_top)  s    rk   c               
   C   sx   d\} }}}dt ||gf|t| f|t|f| d|di}dt t| f|gf|t|f| d|di}t|g thd}||ksttd S rY   )sumr   r"   r   r,   )r!   r$   r[   r)   r   r]   r\   r   r   r   test_inline_traverses_lists/  s
    ($rm   c                  C   s^   t dftdfd} t| g t gdtt dffiks4tt| dgt gtdft dfdksZtd S )Nr#   r!   rj   r$   )r$   r!   )r   r"   r   r,   r8   r   r   r   *test_inline_functions_protects_output_keys7  s    "rn   c                  C   s   dd } dd }t | df| hks&tt | |dff| |hksBtt | |dfgf| |hks`tt | |dfgggf| |hkstt dt kstt | t kstt | f| hkstd S )Nc                 S   s   | S r   r   r    r   r   r   r*   >  r+   z#test_functions_of.<locals>.<lambda>c                 S   s   | S r   r   r    r   r   r   r*   ?  r+   r#   )r	   r,   r   r;   r<   r   r   r   test_functions_of=  s    "rp   c                  C   sF   ddddddgt tdfdfd} t| ddg\}}t|dh|d d S )	Nr#   r;   r<   rD   r)   rU   rV   r/   )r   rW   r   r   )r)   d2r/   r   r   r   test_inline_cull_dependenciesI  s     rs   c               "   C   s  dd } d| df| ddf| ddfd}t |dd	d
t|ks@tt |ddd
t|ksZtt |dd	d
td| | df| ddffdkstt |ddd
td| | df| ddffddkstd| df| ddf| dddf| dddfd}t |dd	d
t|kstt |ddd
t|kstt |dd	d
td| | df| ddf| dddffdksZtt |ddd
td| | df| ddf| dddffddkstd| df| df| dddfd}t |dd	d
t|kstt |ddd
t|kstt |dd	d
td| d| df| dffdks tt |ddd
td| d| df| dffddksTtd| df| df| ddf| df| df| ddfd}t |dd	d
t|kstt |ddd
t|kstt |dd	d
td| | df| dff| | df| dffdkstt |ddd
td| | df| dff| | df| dffdddks@td| df| df| df| df| ddf| ddf| ddfd }t |dd	d
t|kstt |ddd
t|ksttd| | df| dff| | df| dff| ddfd!}t |dd	d
|kstt |dd	d
|ksttd| | df| dff| | df| dff| ddfd"d#d$}t |ddd
|ksdtt |ddd
|ks|tt |dd	d
td| | | df| dff| | df| dfffd%kstt |ddd
td| | | df| dff| | df| dfffd&d'kstd| df| df| df| df| df| df| df| df| ddf| ddf| d(d)f| d*d+f| ddf| d,d-f| ddfd.}t |dd	d
t|kstt |ddd
t|ksttd| | df| dff| | df| dff| | df| dff| | df| dff| ddf| d,d-f| ddfd/}t |dd	d
|ks*tt |dd	d
|ksBttd| | df| dff| | df| dff| | df| dff| | df| dff| ddf| d,d-f| ddfd"d#d0d1d2}t |ddd
|kstt |ddd
|ksttd| | | df| dff| | df| dfff| | | df| dff| | df| dfff| ddfd3}t |dd	d
|ksRtt |d4d	d
|ksjttd| | | df| dff| | df| dfff| | | df| dff| | df| dfff| ddfd5d6d7}t |ddd
|kstt |d4dd
|kstt |d8d	d
td| | | | df| dff| | df| dfff| | | df| dff| | df| dffffd9ksftt |d8dd
td| | | | df| dff| | df| dfff| | | df| dff| | df| dffffd:d;kstd| df| df| df| df| df| df| df| df| df| df| df| df| df| df| df| df| ddf| ddf| d(d)f| d*d+f| d<d=f| d>d?f| d@dAf| dBdCf| ddf| d,d-f| dDdEf| dFdGf| ddf| dHdIf| dJdKfdL }t |dd	d
t|k	stt |ddd
t|k	sttd| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| ddf| d,d-f| dDdEf| dFdGf| ddf| dHdIf| dJdKfdM}t |dd	d
|k
stt |dd	d
|k
sttd| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| | df| dff| ddf| d,d-f| dDdEf| dFdGf| ddf| dHdIf| dJdKfd"d#d0d1dNdOdPdQdR}t |ddd
|kstt |ddd
|ksttd| | | df| dff| | df| dfff| | | df| dff| | df| dfff| | | df| dff| | df| dfff| | | df| dff| | df| dfff| ddf| dHdIf| dJdKfdS}t |dd	d
|kstt |d4d	d
|ksttd| | | df| dff| | df| dfff| | | df| dff| | df| dfff| | | df| dff| | df| dfff| | | df| dff| | df| dfff| ddf| dHdIf| dJdKfd5d6dTdUdV}t |ddd
|kstt |d4dd
|ksttd| | | | df| dff| | df| dfff| | | df| dff| | df| dffff| | | | df| dff| | df| dfff| | | df| dff| | df| dffff| dJdKfdW}t |d8d	d
|ksxtt |dXd	d
|ksttd| | | | df| dff| | df| dfff| | | df| dff| | df| dffff| | | | df| dff| | df| dfff| | | df| dff| | df| dffff| dJdKfdYdZd[}t |d8dd
|ksXtt |dXdd
|ksptt |d\d	d
td| | | | | df| dff| | df| dfff| | | df| dff| | df| dffff| | | | df| dff| | df| dfff| | | df| dff| | df| dfffffd]ks,tt |d\dd
td| | | | | df| dff| | df| dfff| | | df| dff| | df| dffff| | | | df| dff| | df| dfff| | | df| dff| | df| dfffffd^d_kstd| dfd`}t |dd	d
tda| dfikstt |ddd
t| dfdbdcksBtd| df| daf| dfdd}t |dd	d
tde| | | dfffikstt |ddd
t| | | dfffdfdgkstd| df| ddaf| ddfdd}t |dd	d
td| d| d| dfffd%kstt |ddd
td| d| d| dfffdhdiks:td| df| df| df| df| df| dJdfdj}td| df| | | | dffff| dJdfdk}t |dd	d
|kstt |dd	d
|ksttd| df| | | | dffff| dJdfdldm}t |ddd
|ks
tt |ddd
|ks"tt |dd	d
td| | | | | dffff| dffd]ks^tt |ddd
td| | | | | dffff| dffdndokstd| df| df| ddf| ddf| ddf| ddJdfdj}td| df| d| d| d| dffff| ddJdfdk}t |dd	d
|kstt |dd	d
|ks6ttd| df| d| d| d| dffff| ddJdfdldm}t |ddd
|kstt |ddd
|kstt |dd	d
td| d| d| d| d| dffff| dffd]kstt |ddd
td| d| d| d| d| dffff| dffdndoks&td| df| df| df| df| df| df| df| df| d,f| dddHf| dpf| dqfdr}t |dd	d
td| | | dfff| | | dfff| | | dfff| | | dddHfffdskstt |ddd
td| | | dfff| | | dfff| | | dfff| | | dddHfffdtdudvdwdx	ks:td| df| daf| dadf| def| dpf| dedqfdy}t |dd	d
t| df| da| daff| de| | defffdzkstt |ddd
t| df| da| daff| de| | defffdbd{dwd|kstd S )}Nc                  W   s   | S r   r   r3   r   r   r   fQ  s    z,test_fuse_reductions_single_input.<locals>.fr#   r;   b1b2)r;   rv   rw   rD   gffffff?F	ave_widthr1   Tr   )r;   rD   b1-b2-c)r;   rz   rD   b3)r;   rv   rw   r{   rD   333333@   
b1-b2-b3-c)r;   r~   rD   rD   d1rr   )r;   rv   rw   rD   r   rr   rV   )r;   rD   rV   d1-d2-e)r;   rz   r   rD   rV   b4c1c2)r;   rv   rw   r{   r   r   r   r)   )r;   r   r   r)   b1-b2-c1b3-b4-c2)r;   r   r   r)   r   r   )r;   r)   b1-b2-b3-b4-c1-c2-d)r;   r   r)   b5b6b7b8c3c4)r;   rv   rw   r{   r   r   r   r   r   r   r   r   r   r   rr   rV   )r;   r   r   r   r   r   rr   rV   b5-b6-c3b7-b8-c4)r;   r   r   r   r   r   rr   rV   r   r   r   r   )r;   r   rr   rV   gffffff@b1-b2-b3-b4-c1-c2-d1b5-b6-b7-b8-c3-c4-d2)r;   r   r   rV   r   rr   g@)r;   rV   +b1-b2-b3-b4-b5-b6-b7-b8-c1-c2-c3-c4-d1-d2-e)r;   r   rV   b9b10b11b12b13b14b15b16c5c6c7c8d3d4e1e2) r;   rv   rw   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rr   r   r   r   r   ru   )r;   r   r   r   r   r   r   r   r   r   rr   r   r   r   r   ru   	b10-b9-c5
b11-b12-c6
b13-b14-c7
b15-b16-c8)r;   r   r   r   r   r   r   r   r   r   rr   r   r   r   r   ru   r   r   r   r   r   r   r   r   )r;   r   rr   r   r   r   r   ru   b10-b11-b12-b9-c5-c6-d3b13-b14-b15-b16-c7-c8-d4)r;   r   r   r   r   r   r   ru   r   rr   r   r   )r;   r   r   ru   g@,b1-b2-b3-b4-b5-b6-b7-b8-c1-c2-c3-c4-d1-d2-e13b10-b11-b12-b13-b14-b15-b16-b9-c5-c6-c7-c8-d3-d4-e2)r;   r   r   ru   r   r   g      @)r;   ru   bb1-b10-b11-b12-b13-b14-b15-b16-b2-b3-b4-b5-b6-b7-b8-b9-c1-c2-c3-c4-c5-c6-c7-c8-d1-d2-d3-d4-e1-e2-f)r;   r   ru   ro   r<   rN   )rN   r<   rS   r)   a-b-c-d)r   r)   b-c-d)r;   r   r)   )r;   rv   rw   r   r   r   ru   )r;   rw   r   ru   b1-c1-d1-e1)r;   rw   r   ru   r   b1-b2-c1-d1-e1-f)r;   r   ru   rV   ru   )r;   rv   rw   r{   r   r   r   r   rr   r   rV   ru   g)r;   r   rr   r   r   b1-c1-d1b2-c2-d2b3-c3-d3e-f-g)	r;   r   r   r   r   r   rr   r   r   )r;   r<   rD   r)   rV   ru   r   )r<   r)   r   rK   )rN   rK   r   r<   r)   r   r
   r:   r,   ru   r)   r]   r   r   r   !test_fuse_reductions_single_inputP  s   



"	&

*$$$$
$$"$$$$ $$$$$$$$$$$$$$$$$,	&	"	
	

	*
		&r   c                  C   s   dd } d| df| df| dt ddd t ddd ffd	| | d
| dgfff| ddf| dt ddd t ddd ff| df| df| dt ddd t ddd ff| ddf| dfd}ddddh}t||ddd}|t|d kstd S )Nc                  W   s   | S r   r   rt   r   r   r   ru     s    ztest_fuse_stressed.<locals>.fr#   )cholesky-26a6b670a8aabb7e2f8936db7ccb6a88r   r   /cholesky-upper-26a6b670a8aabb7e2f8936db7ccb6a88r   r#   /array-original-27b9f9d257a80fa6adae06a98faf71ebr   r%   r   r   r#   &array-27b9f9d257a80fa6adae06a98faf71ebr#   r#   z0cholesky-lt-dot-26a6b670a8aabb7e2f8936db7ccb6a88r#   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   T)rQ   ry   r1   )slicer
   r:   r,   )ru   r)   rQ   rvr   r   r   test_fuse_stressed  sd    	;r   c                  C   s  dd } dd| ddf| dfd}t |dd	d
td| | ddffiksHtt |ddd
t| | ddffddksrtt |dd	d
tdd| | ddffdkstt |ddd
tdd| | ddffddkstdd| df| ddf| df| dddfd}t|}t |dd	d
|kstt |dd	d
|ks,tt |ddd
|ksDtt |ddd
|ks\tt |dd	d
tdd| | df| ddf| dffdkstt |ddd
tdd| | df| ddf| dffddkstdd| df| ddf| df| ddf| ddfd}t |dd	d
t|kstt |ddd
t|ks8tt |dd	d
tdd| ddf| | dfdf| d| dffdksztt |ddd
tdd| ddf| | dfdf| d| dffdddkstdd| df| ddf| df| ddf| ddf| dd fd!}t |dd	d
t|kstt |ddd
t|ks.tt |dd	d
tdd| ddf| | | dfdf| d| dfffd"ksttt |ddd
tdd| ddf| | | dfdf| d| dfffd#d$kstd S )%Nc                  W   s   | S r   r   rt   r   r   r   ru     s    z.test_fuse_reductions_multiple_input.<locals>.fr#   r   a1a2r<   )r   r   r<   rD   Frx   rD   T	a1-a2-b-c)r   rD   )r   r   rD   b-c)r   r   r   rD   rv   rw   r{   )r   r   rv   rw   r{   rD   r|   r}   r~   )r   r   r~   rD   )r   r   rv   rw   r{   r   r   )r   r   rw   r   r   b1-c1b3-c2)r   r   rw   r   r   r   r   r   r   )r   r   rv   rw   r{   r   r   r)   )r   r   rw   r)   b1-b3-c1-c2-d)r   r   rw   r   r)   r   r   r   r   r   #test_fuse_reductions_multiple_input  s    (



 
		
r   r   c                 C   s   | | | S r   r   rL   r   r   r   func_with_kwargsX  s    r   c                  C   s  dddg} t tddgft tdgtdgddft tddgtdgd	ftd
ftddfd
ddtdt| ffgttdftd
dgffd}t|dddgdd}|jdkstt	|dkstt|dddgdd}||kstt|dddgdd}||kstt
td d d gstt
|t
|kst| }|ddd |ddtt|dgd dgd ksbt|dd|ddks|ttt|}||kstt
|t
|kst|dd|ddkstd S )Nr#   r   r}   in1in2)r#   r      )functionr   rD   )r   r   r;   rD   r)   r<   ru   )r;   r<   rD   r)   rV   ru   hr   testnamer   )r   r   r   )r   r   r   r   r   rl   r   r   r,   reprhashcopyupdater   r   pickleloadsdumps)Znon_hashabler   ru   f2f3dsk2r   r   r   test_SubgraphCallable\  sD    

,r   c                  C   s   t d} d| di}t|dd gdd}t|dd gdd}||ksHtd| dd i}t|dd gdd}||ksxtt|dd gdd}||kstd S )Nnumpyr;   r%   r   r   r#   Ztest2)r-   importorskiparanger   r,   )npdsk1f1r   r   r   f4r   r   r    test_SubgraphCallable_with_numpy  s    
r   c            	      C   s  ddt ddfd} tdftdft ddfd}t| dddg}t|dddg}||ksXtt|ddd	g|jd
}||ksztt|dddg|jd
}||kstt| dddg|jd
}||kstt|t|kstt| dddgdd
}t| dddgdd
}||kstd S )Nr#   r   r)   rV   rL   r   r;   rD   ru   r   firstsecond)r   r   r   r,   r   r   )	r   r   r   r   r   r   Zf5Zunnamed1Zunnamed2r   r   r   test_SubgraphCallable_eq  s    r   c                 C   sh  dt dft dftddft dft dftddft dft d	fd
	}t|ddd}tdtdtdt t dffft t tdt t dfffffdddfd}||kstt|dddd}tdtdtdt t dffft t tdt t dfffffdddfi}||kstt|ddd}ttdtdt t dffftdt t dfffdddfdt t dffd}||ksZtt|ddd}g }tdD ]V}|tdt t dffdttddft t tdt t dfffffdd|f| d qv||kstt|ddgdd}g }tdD ]X}|tdt t dffttddftdt t dfffdd|f| dt t dffd q||ksdtd S )Nr#   x-1inc-1inc-2add-1inc-3inc-4add-2inc-5)	r   r   r   r   r   r   r   r   inc-6r   Tfuse_subgraphsadd-inc-x-1)r   r   r   r   )r   r   F)r   r1   )r   r   r   )r   r   r   )r   r   	inc-add-1)r   r   )r   r   r   r   )r   r   )r   r   r   r   r   )	r   r   r
   r:   r   r,   	itertoolspermutationsappend)r   r   ressolZsolsr   r   r   r   test_fuse_subgraphs  s    




r  c              
   C   s   dt ddft ddft ddft ddft ddfd}t|dd	d
}ttdt ddft ddft ddft ddft ddfdddfdd}||kstd S )Nr#   r   r   r   add-3add-4)r   r   r   r  r  add-5r  Tr   r   add-x-1)r  r  )r   r
   r:   r   r,   )r   r   r  r  r   r   r   3test_fuse_subgraphs_linear_chains_of_duplicate_deps8  s2    	r	  c                  C   s8   t d} | dtdfd}t|dd |ks4tdS )za
    Some types should stay in the graph bare

    This helps with things like serialization
    r      r!   rj   r$   r   N)r-   r   r   r   r
   r,   )r   r   r   r   r   test_dont_fuse_numpy_arraysY  s    
r  c               	   C   sP   t jddi6 dtdfd} ddi}t| d|d| |fksBtW 5 Q R X d S )	Nzoptimization.fuse.activeFr#   r;   ro   r<   )r;   rq   )daskconfigr   r   r
   r,   )r)   r/   r   r   r   test_fuse_confige  s    r  c               	   C   s^   t dft dft dft dft dftddfdd	d
} t| dd\}}|D ]}t|dk sDtqDd S )NXv-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongXw-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongXx-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongXy-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongXz-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongr;   r<   r#   r   )zXu-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongr  r  r  r  r  r;   r<   Tr?      )r   r   r
   rW   r,   )r)   Zfuseddepskeyr   r   r   test_fused_keys_max_lengtho  s2    r  )r   )8r   r   	functoolsr   r-   r  Z	dask.baser   Z	dask.corer   Z
dask.localr   Zdask.optimizationr   r   r	   r
   r   r   r   Z
dask.utilsr   r   Zdask.utils_testr   r   r   Zfixturer   r"   r0   r5   r:   rP   rR   rX   r^   r`   ri   rk   rm   rn   rp   rs   r   r   r   r   r   r   r   r  r	  r  r  r  r   r   r   r   <module>   sX   $		


v##	    YHk
/!
