ó
î&]\c           @` sc   d  d l  m Z m Z m Z d  d l Z d  d l m Z d   Z d   Z d d  Z
 d   Z d S(   i    (   t   divisiont   print_functiont   absolute_importN(   t   string_typesc         C` s`   |  d k r d S|  d k r  d S|  d k r0 d S|  d k r@ d S|  d	 k rP d
 St  d   d S(   sA   Convert an extension mode to the corresponding integer code.
    t   nearesti    t   wrapi   t   reflecti   t   mirrori   t   constanti   s   boundary mode not supportedN(   t   RuntimeError(   t   mode(    (    s8   lib/python2.7/site-packages/scipy/ndimage/_ni_support.pyt   _extend_mode_to_code&   s    c         C` sl   t  |  t  } t |  d  r[ | r[ t |   } t |  | k rh d } t |   qh n |  g | } | S(   sˇ   If input is a scalar, create a sequence of length equal to the
    rank by duplicating the input. If input is a sequence,
    check if its length is equal to the length of array.
    t   __iter__s6   sequence argument must have length equal to input rank(   t
   isinstanceR   t   hasattrt   listt   lenR	   (   t   inputt   rankt   is_strt
   normalizedt   err(    (    s8   lib/python2.7/site-packages/scipy/ndimage/_ni_support.pyt   _normalize_sequence7   s    c         C` sŕ   | d  k r | j } n  |  d  k rB t j | d | j j }  n t |   t t  t t j d  j  g k r t j | d |  }  nR t |  t  rž t j	 |  }  t j | d |  }  n |  j | k rÜ t
 d   n  |  S(   Nt   dtypei   s   output shape not correct(   i   (   t   Nonet   shapet   numpyt   zerosR   t   namet   typeR   R   t   typeDictR	   (   t   outputR   R   (    (    s8   lib/python2.7/site-packages/scipy/ndimage/_ni_support.pyt   _get_outputG   s    0c         C` sD   |  d k  r |  | 7}  n  |  d k  s1 |  | k r@ t  d   n  |  S(   Ni    s   invalid axis(   t
   ValueError(   t   axisR   (    (    s8   lib/python2.7/site-packages/scipy/ndimage/_ni_support.pyt   _check_axisV   s
    (   t
   __future__R    R   R   R   t   scipy._lib.sixR   R   R   R   R    R#   (    (    (    s8   lib/python2.7/site-packages/scipy/ndimage/_ni_support.pyt   <module>   s   		