
    ,Vhq                        d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	m
Z
mZmZmZ ddlmZ 	 ddlZej$                  j&                  dk(  Zej*                  d	k(  rd
ZndZd Zd Zd Z ej4                  d      Z ej4                  d      Z ej4                  d      ZdeiZd Z G d d      Z d Z!de!_"         G d d      Z# G d d      Z$d Z%d Z&d Z'd Z(d Z)i d d d!d"d#d#d$d$d%d%d&d&d'd'd(d(d)d)d*d*d+d+d,d,d-d-d.d.d/d/d0d0d1d2d3d4d5d6d7d8d9Z*d:jW                  e*jY                               Z-i d d d!d"d#d#d$d$d%d;d&d<d'd=d(d>d)d=d*d>d+d?d,d@d-dAd.d.d/d/d1d2dBd3d5d6d7d8dCZ.d:jW                  e.jY                               Z/dDdEdFdGdHZ0 G dI dJ      Z1dK Z2dL Z3dM Z4dN Z5dO Z6dP Z7dQ Z8dR Z9dS Z:dT Z;dU Z<efdVZ=y# e$ r dZY w xY w)WzI
A place for internal code

Some things are more easily handled Python.

    N   )DTypePromotionError   )dtypearrayndarraypromote_typesStringDType)_NoValuepypylittle<>c                 0   g }| j                         D ]  \  }}t        |      }t        |t              r|dvrt	        d      |dkD  r	|d   |k(  r>t        |d         }|dk  rt	        d      t        |d   |      }|dkD  r|d   }nd }|j                  ||||f        |j                  d 	       |D 	cg c]  }	|	d   	 }
}	|D 	cg c]  }	|	d   	 }}	|D 	cg c]  }	|	d   	 }}	|D 	cg c]  }	|	d
   	 }}	|
|||fS c c}	w c c}	w c c}	w c c}	w )N)r      zentry not a 2- or 3- tupler   r   r   zinvalid offset.alignc                     | d   S )Nr    )xs    E/home/dcms/DCMS/lib/python3.12/site-packages/numpy/_core/_internal.py<lambda>z!_makenames_list.<locals>.<lambda>/   s
    1     )keyr   )	itemslen
isinstancetuple
ValueErrorintr   appendsort)adictr   	allfieldsfnameobjnnumformattitler   namesformatsoffsetstitless                 r   _makenames_listr/      s>   Ikkm 6
sH#u%&9::q5SVu_#a&k7.//s1vU+q5FEE%e456  NN~N&$%aQqT%E%&'qt'G'&'qt'G'%&qad&F&'7F** &''&s   :DD	D0Dc                 V   	 | d   }|t        | |      \  }}}}nng }g }g }|D ]c  }| |   }|j                  |d          |j                  |d          t        |      dkD  r|j                  |d          S|j                  d        e t	        ||||d|      S # t         $ r d }Y w xY w)Nr   r   r   )r+   r,   r-   r.   )KeyErrorr/   r!   r   r   )r#   r   r+   r,   r-   r.   nameress           r   
_usefieldsr5   :   s    b	 }*9%*G'w 	$D+CNN3q6"NN3q6"3x!|c!f%d#	$ 5$$"$ &+, ,#  s   B B('B(c                 h   | j                   }|o| j                  }|N| j                  | j                  S | j                  j	                         }|r| j                  |fS | j                  S t        |d         |d   fS | j                  }|D cg c]  }||   |fz    }}g }d}|D ]  }	|	d   |kD  r$|	d   |z
  }
|j                  dd|
 f       ||
z  }n|	d   |k  rt        d      t        |	      dkD  r|	d   |	d   f}n|	d   }|	d   j                  r/|t        |	d   j                  d         |	d   j                  d   f}n|t        |	d         f}||	d   j                  z  }|j                  |        | j                  |kD  r%| j                  |z
  }
|j                  dd|
 f       |S c c}w )Nr   r    z|VzLdtype.descr is not defined for types with overlapping or out-of-order fieldsr   r   )fieldssubdtypemetadatastrcopy_array_descrr+   r!   r   r   itemsize)
descriptorr8   r9   newr+   r   ordered_fieldsresultoffsetfieldr(   r3   tups                r   r=   r=   Z   s   F~&&""*!~~% ))..0&NNC00%>>) !-x{;;E0561fQi1$&6N6FF 8f(V#CMM2C5z*+cMF1X&' ' u:>!HeAh'D8D8eAh&7&7&:;8$$Q')C eAh/0C%(###c'* V#!!F*rRu:&'M9 7s   F/zw(?P<order1>[<>|=]?)(?P<repeats> *[(]?[ ,0-9]*[)]? *)(?P<order2>[<>|=]?)(?P<dtype>[A-Za-z0-9.?]*(?:\[[a-zA-Z0-9,.]+\])?)z\s*,\s*z\s+$=c                    d}g }d}|t        |       k  rt        j                  | |      }	 |j                         \  }}}}|j                         }|t        |       k  rjt        j                  | |      rt        |       }nGt        j                  | |      }|st        dt        |      dz   | fz        |j                         }d	}|d
k(  r|}	nL|d
k(  r|}	nDt        j                  ||      }t        j                  ||      }||k7  rt        d|d|      |}	|	ddt        fv rd
}	|	|z   }|d
k(  r|}
n]|d   dk(  r>|d   dk(  r6|dd j                         d
k7  r d|vrt        j                  dt         d       |t#        j$                  |      f}
|j'                  |
       |t        |       k  r|r|S |d   S # t        t
        f$ r  t        dt        |      dz    d|  d      d w xY w)Nr   F)poszformat number r   z of "z" is not recognizedz*format number %d of "%s" is not recognizedTr7   z&inconsistent byte-order specification z and |rF   (r1   ),zPassing in a parenthesized single number for repeats is deprecated; pass either a single number or indicate a tuple with a comma, like "(2,)".r   
stacklevel)r   	format_rematchgroups	TypeErrorAttributeErrorr   endspace_resep_re
_convorderget_nbostripwarningswarnDeprecationWarningastliteral_evalr!   )astr
startindexrB   islistmoorder1repeatsorder2r   ordernewitems              r   _commastringri      s"   JFF
s4y
 __Tz_2	/1yy{,VWfe
 VVX
D	!~~d
~3 Y
\\$J\7$DVQ-./ /  VVX
R<Er\E^^FF3F^^FF3F&  V%& & ES#t$$Eb=G
c!gbkS&8"++-37*9:L 	"
 c..w78Ggg s4y
 j 6**c >* 	 VQuTF:MN	s   G   /G/c                   *    e Zd Zd Zd Zd Zd Zd Zy)dummy_ctypec                     || _         y N_cls)selfclss     r   __init__zdummy_ctype.__init__   s	    	r   c                     | S rm   r   rp   others     r   __mul__zdummy_ctype.__mul__   s    r   c                 $    | j                  |      S rm   rn   rt   s     r   __call__zdummy_ctype.__call__   s    yyr   c                 4    | j                   |j                   k(  S rm   rn   rt   s     r   __eq__zdummy_ctype.__eq__       yyEJJ&&r   c                 4    | j                   |j                   k7  S rm   rn   rt   s     r   __ne__zdummy_ctype.__ne__   r{   r   N)__name__
__module____qualname__rr   rv   rx   rz   r}   r   r   r   rk   rk      s     ''r   rk   c                  R   t         j                  } | | S t        dd l}t	        |j
                        } ngt        d      j                  }|dk(  rt        j                  } n<|dk(  rt        j                  } n&|dk(  rt        j                  } nt        j                  } | t         _        | S )Nr   r'   ilq)_getintp_ctypecachectypesnumpyrk   intpr   charc_intc_long
c_longlong)valnpr   s      r   r   r      s    


C

~"''"Sz3;,,CS[--CS[##C--CNJr   c                   &    e Zd Zd Z G d d      Zy)_missing_ctypesc                     |j                   S rm   value)rp   r(   r&   s      r   castz_missing_ctypes.cast   s    yyr   c                       e Zd Zd Zy)_missing_ctypes.c_void_pc                     || _         y rm   r   )rp   ptrs     r   rr   z!_missing_ctypes.c_void_p.__init__  s	    DJr   N)r~   r   r   rr   r   r   r   c_void_pr      s    	r   r   N)r~   r   r   r   r   r   r   r   r   r      s     r   r   c                   ~    e Zd ZddZd Zd Zd Zed        Zed        Z	ed        Z
ed	        Zd
 Zd Zd Zd Zy)_ctypesNc                 F   || _         t        r,t        | _        | j                  j                  |      | _        n@t               | _        | j                  j                  |      | _        || j                  _        | j                   j                  dk(  rd| _        y d| _        y )Nr   TF)	_arrr   r   r   _datar   _objectsndim_zerod)rp   r   r   s      r   rr   z_ctypes.__init__  su    	!DL..s3DJ +,DL..s3DJ"'DJJ99>>QDKDKr   c                 t    | j                   j                  | j                  |      }| j                  |_        |S )a  
        Return the data pointer cast to a particular c-types object.
        For example, calling ``self._as_parameter_`` is equivalent to
        ``self.data_as(ctypes.c_void_p)``. Perhaps you want to use
        the data as a pointer to a ctypes array of floating-point data:
        ``self.data_as(ctypes.POINTER(ctypes.c_double))``.

        The returned pointer will keep a reference to the array.
        )r   r   r   r   )rp   r&   r   s      r   data_asz_ctypes.data_as  s.     ll

C099
r   c                 |    | j                   ry || j                  j                  z  | j                  j                   S )z
        Return the shape tuple as an array of some other c-types
        type. For example: ``self.shape_as(ctypes.c_short)``.
        N)r   r   r   shaperp   r&   s     r   shape_asz_ctypes.shape_as*  s0    
 ;;"DIINN"TYY__55r   c                 |    | j                   ry || j                  j                  z  | j                  j                   S )z
        Return the strides tuple as an array of some other
        c-types type. For example: ``self.strides_as(ctypes.c_longlong)``.
        N)r   r   r   stridesr   s     r   
strides_asz_ctypes.strides_as3  s2    
 ;;"DIINN"TYY%6%677r   c                 .    | j                   j                  S )a  
        A pointer to the memory area of the array as a Python integer.
        This memory area may contain data that is not aligned, or not in
        correct byte-order. The memory area may not even be writeable.
        The array flags and data-type of this array should be respected
        when passing this attribute to arbitrary C-code to avoid trouble
        that can include Python crashing. User Beware! The value of this
        attribute is exactly the same as:
        ``self._array_interface_['data'][0]``.

        Note that unlike ``data_as``, a reference won't be kept to the array:
        code like ``ctypes.c_void_p((a + b).ctypes.data)`` will result in a
        pointer to a deallocated array, and should be spelt
        ``(a + b).ctypes.data_as(ctypes.c_void_p)``
        )r   r   rp   s    r   dataz_ctypes.data<  s    " zzr   c                 4    | j                  t                     S )a  
        (c_intp*self.ndim): A ctypes array of length self.ndim where
        the basetype is the C-integer corresponding to ``dtype('p')`` on this
        platform (see `~numpy.ctypeslib.c_intp`). This base-type could be
        `ctypes.c_int`, `ctypes.c_long`, or `ctypes.c_longlong` depending on
        the platform. The ctypes array contains the shape of
        the underlying array.
        )r   r   r   s    r   r   z_ctypes.shapeO  s     }}^-..r   c                 4    | j                  t                     S )aj  
        (c_intp*self.ndim): A ctypes array of length self.ndim where
        the basetype is the same as for the shape attribute. This ctypes
        array contains the strides information from the underlying array.
        This strides information is important for showing how many bytes
        must be jumped to get to the next element in the array.
        )r   r   r   s    r   r   z_ctypes.strides[  s     ~/00r   c                 @    | j                  t        j                        S )ze
        Overrides the ctypes semi-magic method

        Enables `c_func(some_array.ctypes)`
        )r   r   r   r   s    r   _as_parameter_z_ctypes._as_parameter_f  s     ||FOO,,r   c                 R    t        j                  dt        d       | j                  S )zYDeprecated getter for the `_ctypes.data` property.

        .. deprecated:: 1.21
        z,"get_data" is deprecated. Use "data" insteadr   rM   )r[   r\   r]   r   r   s    r   get_dataz_ctypes.get_dataq  s"    
 	D(Q	8yyr   c                 R    t        j                  dt        d       | j                  S )zZDeprecated getter for the `_ctypes.shape` property.

        .. deprecated:: 1.21
        z."get_shape" is deprecated. Use "shape" insteadr   rM   )r[   r\   r]   r   r   s    r   	get_shapez_ctypes.get_shapez  s"    
 	F(Q	8zzr   c                 R    t        j                  dt        d       | j                  S )z\Deprecated getter for the `_ctypes.strides` property.

        .. deprecated:: 1.21
        z2"get_strides" is deprecated. Use "strides" insteadr   rM   )r[   r\   r]   r   r   s    r   get_stridesz_ctypes.get_strides  s"    
 	J(Q	8||r   c                 R    t        j                  dt        d       | j                  S )zcDeprecated getter for the `_ctypes._as_parameter_` property.

        .. deprecated:: 1.21
        z>"get_as_parameter" is deprecated. Use "_as_parameter_" insteadr   rM   )r[   r\   r]   r   r   s    r   get_as_parameterz_ctypes.get_as_parameter  s&    
 	L1	
 """r   rm   )r~   r   r   rr   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r     sz     "&68    $ 	/ 	/ 1 1 - -	#r   r   c                    | j                   }t        |      }t        |t              r|g}t	               }t        |t        t
        f      rA|D ]%  }	 |j                  |       |j                  |       ' t        t        |      |z         S t        d|       # t        $ r# ||v rt        d|       dt        d|       dw xY w)zf
    Given a datatype and an order object, return a new names tuple, with the
    order indicated
    zduplicate field name: Nzunknown field name: zunsupported order value: )	r+   listr   r;   setr   remover   add)datatyperg   oldnames	nameslistseenr3   s         r   	_newnamesr     s    
 ~~HXI%5D%$' 	DN  & HHTN	 T%[9,--
08
99  N4<$'=dV%DE4O$';D6%BCM	Ns   B,Cc                     | j                   }|j                  |j                  D cg c]  }|j                  |   d    c}d}t        | |d      S c c}w )a  Return copy of structured array with padding between fields removed.

    Parameters
    ----------
    ary : ndarray
       Structured array from which to remove padding bytes

    Returns
    -------
    ary_copy : ndarray
       Copy of ary with padding bytes removed
    r   )r+   r,   T)r   r<   )r   r+   r8   r   )arydtr3   
copy_dtypes       r   _copy_fieldsr     sP     
B88=?XXFTbiioa0FHJJT22 Gs   Ac                    | j                   %|j                   | j                   |j                   k7  r&t        d| j                    d|j                    d      | |u }g }| j                   D ]  }| j                  |   }|j                  |   }t        |d   |d         }|xr ||d   u }|dd |dd k7  rt        d| d      t	        |      dk(  r|j                  ||f       z|j                  |d   |f|f        t        || j                  xs |j                  	      }|rU|j                  | j                  k(  r<| j                   D ]+  }| j                  |   d
   |j                  |   d
   k7  s)|c S  | S |S )a   Perform type promotion for two structured dtypes.

    Parameters
    ----------
    dt1 : structured dtype
        First dtype.
    dt2 : structured dtype
        Second dtype.

    Returns
    -------
    out : dtype
        The promoted dtype

    Notes
    -----
    If one of the inputs is aligned, the result will be.  The titles of
    both descriptors must match (point to the same field).
    Nzfield names `z` and `z` mismatch.r   r   zfield titles of field 'z
' mismatchr   r   )	r+   r   r8   r	   r   r!   r   isalignedstructr>   )	dt1dt2	identical
new_fieldsr3   field1field2	new_descrr4   s	            r   _promote_fieldsr     s   * 			SYY.399		3I!		{'#))KHJ 	J s
IJ		 >D!D!!&)VAY7	8)vay"8	 !":#%-dV:>@ @v;!tY/0q	40)<=> 
#"5"5"L9L9L
MC
 S\\S\\1II 	Dzz$"cjj&6q&99
	 
Jr   c                     |j                   s| j                   r`|dk(  r|| k(  ry| j                  >| j                  D ]/  }| j                  |   d   |k(  s| j                  |   d   |k(  s/ y t        d      y)a   Checks safety of getfield for object arrays.

    As in _view_is_safe, we need to check that memory containing objects is not
    reinterpreted as a non-object datatype and vice versa.

    Parameters
    ----------
    oldtype : data-type
        Data type of the original ndarray.
    newtype : data-type
        Data type of the field being accessed by ndarray.getfield
    offset : int
        Offset of the field being accessed by ndarray.getfield

    Raises
    ------
    TypeError
        If the field access is invalid

    r   Nr   z'Cannot get/set field of an object array)	hasobjectr+   r8   rR   )oldtypenewtyperC   r3   s       r   _getfield_is_safer     s    * G--Q;7g-==$ NN4(+v5t,Q/7: ABB
r   c                 V    | |k(  ry|j                   s| j                   rt        d      y)az   Checks safety of a view involving object arrays, for example when
    doing::

        np.zeros(10, dtype=oldtype).view(newtype)

    Parameters
    ----------
    oldtype : data-type
        Data type of original ndarray
    newtype : data-type
        Data type of the view

    Raises
    ------
    TypeError
        If the new type is incompatible with the old type.

    Nz0Cannot change data-type for array of references.)r   rR   )r   r   s     r   _view_is_safer     s/    , 'G--JKK
r   ?cS1bBhHr   Ir   Lr   QefdgZfFDGSUOV)ZdZgswr   r   r7   i2u2i4u4i8u8f2r   )r   r   r   r   zUCS-2 stringspointers	bitfieldszfunction pointers)u&tXc                   :    e Zd Zd Zd Zd Zd Zed        Zd Z	y)_Streamc                      || _         d| _        y )N@)r   	byteorder)rp   r   s     r   rr   z_Stream.__init__w  s    r   c                 L    | j                   d | }| j                   |d  | _         |S rm   r   )rp   r'   r4   s      r   advancez_Stream.advance{  s'    ffRaj
r   c                 p    | j                   d t        |       |k(  r| j                  t        |             yy)NTF)r   r   r
  )rp   r   s     r   consumez_Stream.consume  s.    66'3q6?aLLQ r   c                    t        |      rsd}|t        | j                        k  rH || j                  |         s3|dz   }|t        | j                        k  r || j                  |         s3| j                  |      S | j                  j	                  |      }| j                  |      }| j                  t        |             |S )Nr   r   )callabler   r   r
  index)rp   r   r   r4   s       r   consume_untilz_Stream.consume_until  s    A;Ac$&&k/!DFF1I,E c$&&k/!DFF1I,<<?"QA,,q/CLLQ Jr   c                      | j                   d   S )Nr   r	  r   s    r   nextz_Stream.next  s    vvayr   c                 ,    t        | j                        S rm   )boolr   r   s    r   __bool__z_Stream.__bool__  s    DFF|r   N)
r~   r   r   rr   r
  r  r  r   r  r  r   r   r   r  r  v  s/    

  r   r  c                 <    t        |       }t        |d      \  }}|S )NFis_subdtype)r  __dtype_from_pep3118)specstreamr   r   s       r   _dtype_from_pep3118r    s     T]F'EBLE5Lr   c                 L   t        g g g d      }d}d}d}| rd }| j                  d      rnd }| j                  d      r9| j                  d      }t        t	        t
        |j                  d                  }| j                  d	v r| j                  d      }|d
k(  rd}|| _	        | j                  dv rt        }	t        }
nt        }	t        }
| j                  d       }|rt        |      }nd}d}| j                  d      rt        | d      \  }}n| j                  |
v r| j                  dk(  r| j                  d      }n| j                  d      }|dk(  }|	|   }|dv r
|d|z  z  }d}dddj                  | j                  | j                        }t!        ||z         }|j"                  }nb| j                  t$        v r8t$        | j                     }t'        dj)                  | j                  |            t+        d| j,                  z        d}| j                  dk(  rS| |z  }|j.                   |z  }||z  }|dk7  r'|dkD  s|t1        |      dkD  rt3        ||      }n||z  }t5        ||      }|dk7  rt!        ||ff      }|t!        ||f      }| j                  d      r| j                  d      }nd }|r|T|||d   v rt7        d| d      |d   j9                  |       |d   j9                  |       |d   j9                  |       ||j.                  z  }||z  }||d <   | r| j                  dk(  r|d xx   | |z  z  cc<   |d   d gk(  r1|d   d   dk(  r&|d    |d   d   j.                  k(  r|s|d   d   }||fS t;        |       t!        |      }||fS )!Nr   r+   r,   r-   r>   r   F}rJ   rK   rL   )r  rF   r   r   ^!r!  r   )r  r   c                 $    | j                          S rm   )isdigit)r   s    r   r   z&__dtype_from_pep3118.<locals>.<lambda>  s    !))+o r   zT{Tr  Zr   r   USVz%drF   z,Unrepresentable PEP 3118 data type {!r} ({})z'Unknown PEP 3118 data type specifier %rr  :r+   zDuplicate field name 'z' in PEP3118 formatr,   r-   r>   )dictr  r  r   mapr    splitr  r
  r  _pep3118_native_map_pep3118_native_typechars_pep3118_standard_map_pep3118_standard_typecharsr  rX   r   	alignment_pep3118_unsupported_mapNotImplementedErrorr)   r   r   r>   _prod_add_trailing_padding_lcmRuntimeErrorr!   
_fix_names)r  r  
field_specrC   common_alignment
is_paddingr   r   r  type_maptype_map_charsitemsize_strr>   r   typechar	dtypecharnumpy_byteorderdescextra_offsetstart_paddingintra_paddingr3   rets                          r   r  r    s/   	J FJ  >># >>#((-E#c5;;s#345E ;;88q)IC	(F z)*H6N,H8N ++,EF<(HH 
>>$/D*LE5[[N*{{c!!>>!,!>>!,"c/J *IE!TH_,	$'c266  &"2"24O/I56EOOE[[44+FKK8D%>T*, , 9FHHD  s"$W-M#nn_5Mm#F!a<E$5%,:J1%GE !M1L  $E+;< q=58+./E 5%.)E >>#'',DDt|DJw,?$?",TF2EF  w&&t,y!((/y!((0%.. ,!'
:k p 3:F7.>">> 	7v%9%a(A-:&*Y*?*B*K*KK#A&    	 	:J    r   c                 j    | d   }t        |      D ]   \  }}|	d}	 d| }||vrn|dz   }|||<   " y)z< Replace names which are None with the next unused f%d name r+   Nr   r   r   )	enumerate)r6  r+   r   r3   js        r   r5  r5  3  sd    wEU# 
4qc7D5 AA	 
 a
r   c           	      J   | j                   t        dg| gdg| j                        }nY| j                   }| j                  }t        ||D cg c]
  }||   d    c}|D cg c]
  }||   d    c}| j                        }|dxx   |z  cc<   t	        |      S c c}w c c}w )zBInject the specified number of padding bytes at the end of a dtypef0r   r  r   r>   )r8   r'  r>   r+   r   )r   paddingr6  r8   r+   r3   s         r   r2  r2  B  s    ||&GC^^	

 167VD\!_7167VD\!_7^^	

 zg% 87s   B
!B c                 "    d}| D ]  }||z  }	 |S )Nr   r   )apr   s      r   r1  r1  X  s$    	A 	QHr   c                     t        j                  |       rt        j                  |      st        d|  d| d      |r
|| |z  }} |r
| S )z0Calculate the greatest common divisor of a and bzBCan only find greatest common divisor of finite arguments, found "z" and "")mathisfiniter   rK  r   s     r   _gcdrR  ^  sZ    MM!q!1 556CwqcD E 	E
!a%1 Hr   c                 &    | t        | |      z  |z  S rm   )rR  rQ  s     r   r3  r3  g  s    Q
?Qr   c                 ^   dj                  |D cg c]  }dj                  |       c}|j                         D cg c]  \  }}dj                  ||       c}}z         }||j                  dd      z   }	dj                  d |	D              }
dj                  ||||
      S c c}w c c}}w )= Format the error message for when __array_ufunc__ gives up. , z{!r}z{}={!r}outr   c              3   X   K   | ]"  }t        t        |      j                         $ y wrm   )reprtyper~   ).0args     r   	<genexpr>z/array_ufunc_errmsg_formatter.<locals>.<genexpr>p  s     F#T$s)"4"45Fs   (*zToperand type(s) all returned NotImplemented from __array_ufunc__({!r}, {!r}, {}): {})joinr)   r   rX   )dummyufuncmethodinputskwargsr\  kvargs_stringargstypes_strings              r   array_ufunc_errmsg_formatterri  j  s    ))6BCV]]3/B)/9!%A '--a3 99 :K FJJub))D99FFFL2VE6;=? C9s
   B$B)c                     dj                  | j                  | j                        }dj                  |t        |            S )rU  z{}.{}zOno implementation found for '{}' on types that implement __array_function__: {})r)   r   r~   r   )
public_apitypes	func_names      r   array_function_errmsg_formatterrn  v  s9    z44j6I6IJI%%+VItE{%CEr   c                    | j                   dk(  rd}n+dj                  d t        | j                         D              }| j                  dk(  rd}nd| j                  dk(  rd}nRdj	                  dj                  d	 t        | j                        D              t        d
| j                  z              }d}| j                  d| d}n|dz  }dj	                  | j                  |||      S )zz
    Builds a signature string which resembles PEP 457

    This is used to construct the first line of the docstring
    r   r   rV  c              3   ,   K   | ]  }d |dz      yw)r   r   Nr   r[  r   s     r   r]  z1_ufunc_doc_signature_formatter.<locals>.<genexpr>  s     @!a!uI@s   r   z, /, out=()z, /, out=Nonez%[, {positional}], / [, out={default}]c              3   D   K   | ]  }d j                  |dz           yw)zout{}r   N)r)   rq  s     r   r]  z1_ufunc_doc_signature_formatter.<locals>.<genexpr>  s$      !@()qs#!@s    rm   )
positionaldefaultz8, casting='same_kind', order='K', dtype=None, subok=Truez, where=Truez[, signature]z[, signature, axes, axis]z&{name}({in_args}{out_args}, *{kwargs}))r3   in_argsout_argsrc  )ninr^  rangenoutr)   rY  	signaturer~   )r`  ru  rv  rc  s       r   _ufunc_doc_signature_formatterr{  }  s     yyA~))@uUYY/?@@ zzQ 	q":AAyy !@-25::->!@ @+, B 
	  x}5-- 4::^^	 ;  r   c                     	 t         r| j                  d   }n| j                  d   }d|j                  v S # t        $ r Y yw xY w)Nr   F)IS_PYPY__mro__r   	Exception)rq   
ctype_bases     r   npy_ctypes_checkr    sK     RJ RJJ1111 s   25 	A Ac                 D    |t         u rt        |       S t        | |      S )N)coercer  	na_object)r   r
   r  s     r   _convert_to_stringdtype_kwargsr    s"    H&))f	::r   )>__doc__r^   rO  resysr[   
exceptionsr   
multiarrayr   r   r   r	   r
   r   r   r   ImportErrorimplementationr3   r  r  rY   r/   r5   r=   compilerO   rV   rU   rW   ri   rk   r   r   r   r   r   r   r   r   r   r*  r^  keysr+  r,  r-  r/  r  r  r  r5  r2  r1  rR  r3  ri  rn  r{  r  r  r   r   r   <module>r     s     	 
  , I I  


!
!V
+==HDD+<,@-d BJJ K L	 
J	2::g 4[
9+v' '"*   P# P#f:.3$6r@B  	
             !" 	##$ 
				/ 2 GG$7$<$<$>?   	
             	#!" 	##$ 
			+ . !gg&;&@&@&BC  
				 ! !H
R!h,	?E-`& 6> ;]  Fs   G GG