
    ^Mh                     R    d dl mZ d dlZd dlZd dlZd
dZd ZddZd Z	d Z
d	 ZdS )    )IterableNFc                     | 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|rdS | dk    rdS | dk    r|rd
S | dk    rdS 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)mode	is_filters     Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/ndimage/_ni_support.py_extend_mode_to_coder   %   s     yq	q	+	+	+q			q			q				q			q		 	 Y	 q		 	 q8999    c                     t          | t                    }|sHt          j        |           r4t	          |           }t          |          |k    rd}t          |          n| 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strnpiterablelistlenr   )inputrankis_str
normalizederrs        r   _normalize_sequencer"   >   ss    
 s##F $bk%(( $%[[
z??d""JCs### # Wt^
r   c                    ||j         }| `|s"t          j        ||j        j                  } nt          j        |j        t          j                  }t          j        ||          } net          | t          t          j        f          rk|rRt          j        |           j	        dk    r5t          j        dd           t          j        | t          j                  } t          j        ||           } nt          | t                    rut          j        |           } |r| j	        dk    rt          d          t          | j        t          j                  st          d          t          j        ||           } nOt          j        |           } | j         |k    rt          d          |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)shaper   zerosr$   namepromote_types	complex64r   typekindwarningswarnr   r   
issubclassnumberasarray)outputr   r'   complex_outputcomplex_types        r   _get_outputr6   N   s   }~ 	9Xe5;+;<<<FF+EKFFLXe<888FF	FT28,	-	- A 	<bhv..3s::MGTUVVVV%fbl;;F%v...	FC	 	  A&!! 	AfkS00?@@@FK33 	A?@@@%v... F##<5  9::: 	A 1S 8 8?@@@Mr   c                 0   | t          t                              S t          j        |           rt	          j        |           f} nt          | t                    r]| D ]>}t          d | D                       } | k     s	|dz
  k    rt          d| d          ?t          fd| D                       } nd}t          |          t          t          t          |                               t          |           k    rt          d          | S )Nc              3   >   K   | ]}t          j        |          V  d S N)operatorindex).0axs     r   	<genexpr>z_check_axes.<locals>.<genexpr>u   s,      ;;++;;;;;;r   r   zspecified axis: z is out of rangec              3   2   K   | ]}|d k     r|z  n|V  dS )r   N )r<   r=   ndims     r   r>   z_check_axes.<locals>.<genexpr>x   s3      @@R"q&&R$YYb@@@@@@r   z6axes must be an integer, iterable of integers, or Nonezaxes must be unique)tupleranger   isscalarr:   r;   r   r   
ValueErrorr   set)axesrA   r=   messages    `  r   _check_axesrI   n   s)   |U4[[!!!	T		 
"t$$&	D(	#	# " 	J 	JB;;d;;;;;DTEzzR$(]] !HB!H!H!HIII +@@@@4@@@@@J!!!
5TD		)).///Kr   c                     t          | t                    rdS t          |           t          u rt          | t          j                  rdn| S t          | t          j                  rdn| S )z'array or dtype' polymorphism.

    Return None for np.int8, dtype('float32') or 'f' etc
           arg for np.empty(3) etc
    N)r   r   r,   r0   r   genericr$   args    r   _skip_if_dtyperN      sb     #s tCyyD!#rz22;tt;!#rx009ttc9r   c                 8    | t          | t                    rd n| S r9   )r   intrL   s    r   _skip_if_intrQ      s    K:c3#7#7K44cAr   )F)NF)collections.abcr   r:   r.   numpyr   r   r"   r6   rI   rN   rQ   r@   r   r   <module>rT      s   > % $ $ $ $ $      : : : :2      @  $: : :B B B B Br   