o
    Eb                     @   s:   d dl mZ d dlZd dlZdd Zdd Zd
dd	ZdS )    )IterableNc                 C   s\   | dkrdS | dkrdS | dv rdS | dkrdS | d	krd
S | dkr$dS | dkr*dS t d)zAConvert an extension mode to the corresponding integer code.
    Znearestr   wrap   )Zreflectzgrid-mirror   Zmirror   Zconstant   z	grid-wrap   zgrid-constant   zboundary mode not supported)RuntimeError)mode r   ;/usr/lib/python3/dist-packages/scipy/ndimage/_ni_support.py_extend_mode_to_code$   s   r   c                 C   sJ   t | t}|st | trt| }t||krd}t||S | g| }|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
   )inputZrankZis_strZ
normalizederrr   r   r   _normalize_sequence9   s   

r   Fc                 C   s  |d u r|j }| d u r)|stj||jjd} | S t|jtj}tj||d} | S t| ttjfrP|rGt| j	dkrGt
d t| tj} tj|| d} | S t| trqtj|  } |rht| j	dkrhtdtj|| d} | S | j |krztd|r| jj	dkrtd| S )N)dtypecz+promoting specified output dtype to complexzoutput must have complex dtypezoutput shape not correct)shapenumpyZzerosr   nameZpromote_typesZ	complex64r   typekindwarningswarnr   Z
sctypeDictr
   )outputr   r   Zcomplex_outputZcomplex_typer   r   r   _get_outputI   s4   




r    )NF)Zcollections.abcr   r   r   r   r   r    r   r   r   r   <module>   s   