
    xf                     B    d dl mZ d dlZd dlZd dlZd Zd ZddZd Zy)    )IterableNc                 j    | dk(  ry| dk(  ry| dv ry| dk(  ry| d	k(  ry
| dk(  ry| dk(  ryt        d      )zAConvert an extension mode to the corresponding integer code.
    nearestr   wrap   )reflectzgrid-mirror   mirror   constant   z	grid-wrap   zgrid-constant   zboundary mode not supported)RuntimeError)modes    ;/usr/lib/python3/dist-packages/scipy/ndimage/_ni_support.py_extend_mode_to_coder   %   s]     y		+	+								 899    c                     t        | t              }|s8t        | t              r(t        |       }t	        |      |k7  rd}t        |      |S | g|z  }|S )zIf 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.
    z6sequence argument must have length equal to input rank)
isinstancestrr   listlenr   )inputrankis_str
normalizederrs        r   _normalize_sequencer   :   s\    
 s#Fj1%[
z?d"JCs##  Wt^
r   c                    ||j                   }| v|s-t        j                  ||j                  j                        } | S t        j
                  |j                  t        j                        }t        j                  ||      } | S t        | t        t        j                  f      rv|r[t        j                  |       j                  dk7  r9t        j                  d       t        j
                  | t        j                        } t        j                  ||       } | S t        | t              r[t        j                  |    } |r-t        j                  |       j                  dk7  rt        d      t        j                  ||       } | S | j                   |k7  rt        d      |r$| j                  j                  dk7  rt        d      | S )N)dtypecz+promoting specified output dtype to complexzoutput must have complex dtypezoutput shape not correct)shapenumpyzerosr!   namepromote_types	complex64r   typekindwarningswarnr   
sctypeDictr   )outputr   r#   complex_outputcomplex_types        r   _get_outputr1   J   sk   }~[[ekk.>.>?F& M# !..u{{EOOLL[[l;F  M 
FT5;;/	0ekk&166#=MMGH((AFU&1 M 
FC	 !!&)ekk&166#=?@@U&1
 M	 
	566	FLL--4;<<Mr   c                    | t        t                    S t        j                  |       rt	        j
                  |       f} nht        | t              rK| D ]1  }t        d | D              } | k  s	|dz
  kD  s$t        d| d       t        fd| D              } nd}t        |      t        t        t        |                   t        |       k7  rt        d      | S )Nc              3   F   K   | ]  }t        j                  |        y w)N)operatorindex).0axs     r   	<genexpr>z_check_axes.<locals>.<genexpr>l   s     ;+;s   !r   zspecified axis: z is out of rangec              3   6   K   | ]  }|d k  r|z  n|  yw)r   N )r6   r7   ndims     r   r8   z_check_axes.<locals>.<genexpr>o   s      @R"q&R$Yb0@s   z6axes must be an integer, iterable of integers, or Nonezaxes must be unique)tupleranger$   isscalarr4   r5   r   r   
ValueErrorr   set)axesr;   r7   messages    `  r   _check_axesrC   e   s    |U4[!!		t$&	D(	# 	JB;d;;DTEzR$(] #3B47G!HII	J @4@@J!!
5TD	).//Kr   )NF)	collections.abcr   r4   r+   r$   r   r   r1   rC   r:   r   r   <module>rE      s'   > %   :* 6r   