ó
¦–Õ\c           @` s,  d  d l  m Z m Z m Z d  d l m Z d  d l m Z d  d l Z	 y d  d l
 m Z Wn! e k
 r d  d l m Z n Xd d l m Z d d l m Z d	 d
 l m Z m Z d „  Z e d „  ƒ Z e e ƒ Z e e	 j d d ƒZ e e	 j d d ƒZ e e	 j d d ƒZ e e	 j ƒ Z d S(   i    (   t   absolute_importt   divisiont   print_function(   t   partial(   t   productN(   t   curryi   (   t   tokenize(   t   funcnamei   (   t   Arrayt   normalize_chunksc         ` sÖ  d | k r$ ˆ  d ˆ  d } ‰  n | j  d ƒ } t | t ƒ rQ t d ƒ ‚ n  t | t j ƒ rr | j ƒ  } n  t | t t f ƒ s“ | f } n  | j  d d ƒ } | j  d d ƒ } | d k rÛ ˆ | ˆ  | Ž j
 } n  t j
 | ƒ } t | | d | ƒ} | j  d d ƒ } | p=t ˆ ƒ d	 t ˆ | | | ˆ  | ƒ } t | g g  | D] } t t | ƒ ƒ ^ qPŒ } t | Œ  }	 t ˆ d | | ‰ ‡  ‡ f d
 †  |	 Dƒ }
 t t | |
 ƒ ƒ } t | | | d | ƒS(   s=   
    Transform np creation function into blocked version
    t   shapei    i   sT   Dask array input not supported. Please use tuple, list, or a 1D numpy array instead.t   chunkst   autot   dtypet   namet   -c         3` s#   |  ] } ˆ f | f ˆ  Vq d  S(   N(    (   t   .0t   s(   t   argst   func(    s.   lib/python2.7/site-packages/dask/array/wrap.pys	   <genexpr>4   s    N(   t   popt
   isinstanceR   t	   TypeErrort   npt   ndarrayt   tolistt   tuplet   listt   NoneR   R	   R   R   R   t   ranget   lenR   t   dictt   zip(   R   R   t   kwargsR
   R   R   R   t   bdt   keyst   shapest   valst   dsk(    (   R   R   s.   lib/python2.7/site-packages/dask/array/wrap.pyt   wrap_func_shape_as_first_arg   s.    /1c         K` s\   t  |  | |  } d } | j d  k	 rX | i | j d 6| j | _ d | j | _ n  | S(   Ns¼   
    Blocked variant of %(name)s

    Follows the signature of %(name)s exactly except that it also requires a
    keyword argument chunks=(...)

    Original signature follows below.
    R   t   blocked_(   R   t   __doc__R   t   __name__(   t	   wrap_funcR   R!   t   ft   template(    (    s.   lib/python2.7/site-packages/dask/array/wrap.pyt   wrap:   s    R   t   f8(   t
   __future__R    R   R   t	   functoolsR   t	   itertoolsR   t   numpyR   t   cytoolzR   t   ImportErrort   toolzt   baseR   t   utilsR   t   coreR   R	   R'   R.   t   wt   onest   zerost   emptyt   full(    (    (    s.   lib/python2.7/site-packages/dask/array/wrap.pyt   <module>   s"   	(