a
    “Àh&  ã                   @   sJ   d dl mZ d dlZd dlZd dlZdd„ Zdd„ Zddd	„Z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r0dS | d	kr<d
S | dkrHdS | dkrTdS t dƒ‚dS )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 supportedN)ÚRuntimeError)Úmode© r   úU/var/www/html/assistant/venv/lib/python3.9/site-packages/scipy/ndimage/_ni_support.pyÚ_extend_mode_to_code%   s    r   c                 C   sH   t | tƒ}|s:t | tƒr:t| ƒ}t|ƒ|krDd}t|ƒ‚n
| g| }|S )z·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.
    z6sequence argument must have length equal to input rank)Ú
isinstanceÚstrr   ÚlistÚlenr
   )ÚinputZrankZis_strÚ
normalizedÚerrr   r   r   Ú_normalize_sequence:   s    


r   Fc                 C   s&  |d u r|j }| d u rN|s.tj||jjd} nt |jtj¡}tj||d} nÔt| ttjfƒrž|rŽt | ¡j	dkrŽt
jddd t | tj¡} tj|| d} n„t| tƒrðt | ¡} |rÊ| j	dkrÊtdƒ‚nt| jtjƒsàtdƒ‚tj|| d} n2| j |krtdƒ‚n|r"| jj	dkr"tdƒ‚| S )	N)ÚdtypeÚcz+promoting specified output dtype to complexr   )Ú
stacklevelzoutput must have complex dtypezoutput must have numeric dtypezoutput shape not correct)ÚshapeÚnumpyZzerosr   ÚnameZpromote_typesZ	complex64r   ÚtypeÚkindÚwarningsÚwarnr   r
   Ú
issubclassÚnumber)Úoutputr   r   Zcomplex_outputZcomplex_typer   r   r   Ú_get_outputJ   s0    



r$   c                    sÀ   | d u rt tˆ ƒƒS t | ¡r,t | ¡f} npt| tƒr| D ]<}t dd„ | D ƒƒ} |ˆ  k sf|ˆ d kr:td|› dƒ‚q:t ‡ fdd„| D ƒƒ} nd}t|ƒ‚t	t t
| ƒƒƒt	| ƒkr¼tdƒ‚| S )	Nc                 s   s   | ]}t  |¡V  qd S )N)ÚoperatorÚindex©Ú.0Úaxr   r   r   Ú	<genexpr>n   ó    z_check_axes.<locals>.<genexpr>r   zspecified axis: z is out of rangec                 3   s"   | ]}|d k r|ˆ  n|V  qdS )r   Nr   r'   ©Úndimr   r   r*   q   r+   z6axes must be an integer, iterable of integers, or Nonezaxes must be unique)ÚtupleÚranger   Zisscalarr%   r&   r   r   Ú
ValueErrorr   Úset)Zaxesr-   r)   Úmessager   r,   r   Ú_check_axesg   s    

r3   )NF)	Úcollections.abcr   r%   r   r   r   r   r$   r3   r   r   r   r   Ú<module>   s   
