
    SBgq                        S r SSKrSSKrSSKrSSKrSSKrSSKJr  SSKJ	r	J
r
JrJrJr  SSKJr   SSKr\R$                  R&                  S:H  r\R*                  S	:X  a  S
rOSrS rS rS r\R4                  " S5      r\R4                  " S5      r\R4                  " S5      rS\0rS r " S S5      r S r!S\!l"         " S S5      r# " S S5      r$S r%S r&S r'S r(S r)0 S S _S!S"_S#S#_S$S$_S%S%_S&S&_S'S'_S(S(_S)S)_S*S*_S+S+_S,S,_S-S-_S.S._S/S/_S0S0_S1S2_S3S4S5S6S7S8S9.Er*S:RW                  \*RY                  5       5      r-0 S S _S!S"_S#S#_S$S$_S%S;_S&S<_S'S=_S(S>_S)S=_S*S>_S+S?_S,S@_S-SA_S.S._S/S/_S1S2_SBS3_S5S6S7S8SC.Er.S:RW                  \.RY                  5       5      r/SDSESFSGSH.r0 " SI SJ5      r1SK r2SL r3SM r4SN r5SO r6SP r7SQ r8SR r9SS r:ST r;SU r<\4SV jr=g! \ a    Sr GNf = f)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                 F   / nU R                  5        H  u  p4[        U5      n[        U[        5      (       a  US;  a  [	        S5      eUS:  a  US   U:X  a  MG  [        US   5      nUS:  a  [	        S5      e[        US   US9nUS:  a  US   nOS nUR                  X7Xh45        M     UR                  S S	9  U V	s/ s H  oS   PM	     n
n	U V	s/ s H  oS   PM	     nn	U V	s/ s H  oS   PM	     nn	U V	s/ s H  oS
   PM	     nn	XX4$ s  sn	f s  sn	f s  sn	f s  sn	f )N)r      zentry not a 2- or 3- tupler   r   r   zinvalid offset.alignc                     U S   $ )Nr    )xs    7/usr/lib/python3/dist-packages/numpy/_core/_internal.py<lambda>!_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_listr0      s.   Ikkm
H#u%%&9::q5SVu_#a&k7.//s1vU+q5FEE%45 $  NN~N&$%9aqT9E%&'YtYG'&'YtYG'%&IqdIF&7** &''&s   ?DD'D;Dc                 Z    U S   nUc  [        X5      u  p#pEOq/ n/ n/ nU He  nX   nUR                  US   5        UR                  US   5        [        U5      S:  a  UR                  US   5        MT  UR                  S 5        Mg     [	        UUUUS.U5      $ ! [          a    S n Nf = f)Nr   r   r   )r,   r-   r.   r/   )KeyErrorr0   r"   r   r   )r$   r   r,   r-   r.   r/   nameress           r   
_usefieldsr6   :   s    b	 }*9%*G'D+CNN3q6"NN3q6"3x!|c!f%d#  5$$"$ &+, ,#  s   B B*)B*c                    U R                   nUcv  U R                  nUcT  U R                  c  U R                  $ U R                  R	                  5       nU(       a  U R                  U4$ U R                  $ [        US   5      US   4$ U R                  nU Vs/ s H  oQU   U4-   PM     nn/ nSnU H  n	U	S   U:  a#  U	S   U-
  n
UR                  SSU
 345        X-  nOU	S   U:  a  [        S5      e[        U	5      S:  a  U	S   U	S   4nOU	S   nU	S   R                  (       a/  U[        U	S   R                  S   5      U	S   R                  S   4nOU[        U	S   5      4nXS   R                  -  nUR                  U5        M     U R                  U:  a%  U R                  U-
  n
UR                  SSU
 345        U$ s  snf )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)
descriptorr9   r:   newr,   r   ordered_fieldsresultoffsetfieldr)   r4   tups                r   r>   r>   Z   s   F~&&""*!~~% ))..0&NNC00%>>) !-x{;;E0561Qi1$&N6FF8f(V#CMM2C5z*+MF1X&' ' u:>!HeAh'D8D8eAh&7&7&:;8$$Q')C eAh/0C(###c'  * V#!!F*rRu:&'M9 7s   G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                     Sn/ nSnU[        U 5      :  Ga  [        R                  XS9n UR                  5       u  pVpxUR                  5       nU[        U 5      :  al  [        R                  XS9(       a  [        U 5      nOH[        R                  XS9nU(       d  [        S[        U5      S-   U 4-  5      eUR                  5       nS	nUS
:X  a  Un	OMUS
:X  a  Un	OD[        R                  XU5      n[        R                  Xw5      nXW:w  a  [        SU< SU< 35      eUn	U	SS[        4;   a  S
n	X-   nUS
:X  a  Un
OaUS   S:X  a@  US   S:X  a7  USS R                  5       S
:w  a   SU;  a  [        R                  " S[         SS9  U["        R$                  " U5      4n
UR'                  U
5        U[        U 5      :  a  GM  U(       a  U$ US   $ ! [        [
        4 a     [        S[        U5      S-    SU  S35      S ef = f)Nr   F)poszformat number r   z of "z" is not recognizedz*format number %d of "%s" is not recognizedTr8   z&inconsistent byte-order specification z and |rG   (r2   ),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
startindexrC   islistmoorder1repeatsorder2r   ordernewitems              r   _commastringrj      s   JFF
s4y
 __T_2	/1yy{,Vf
 VVX
D	!~~d~3 Y
\\$\7$DVQ-./ /  VVX
R<Er\E^^F3F^^F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 0G=c                   2    \ rS rSrS rS rS rS rS rSr	g)	dummy_ctype   c                     Xl         g N_cls)selfclss     r   __init__dummy_ctype.__init__   s    	r   c                     U $ ro   r   rr   others     r   __mul__dummy_ctype.__mul__   s    r   c                 $    U R                  U5      $ ro   rp   rw   s     r   __call__dummy_ctype.__call__   s    yyr   c                 4    U R                   UR                   :H  $ ro   rp   rw   s     r   __eq__dummy_ctype.__eq__       yyEJJ&&r   c                 4    U R                   UR                   :g  $ ro   rp   rw   s     r   __ne__dummy_ctype.__ne__   r   r   rp   N)
__name__
__module____qualname____firstlineno__rt   ry   r|   r   r   __static_attributes__r   r   r   rl   rl      s     ''r   rl   c                  \   [         R                  n U b  U $ [        c  SS Kn[	        UR
                  5      n Oj[        S5      R                  nUS:X  a  [        R                  n O>US:X  a  [        R                  n O'US:X  a  [        R                  n O[        R                  n U [         l        U $ )Nr   r(   ilq)_getintp_ctypecachectypesnumpyrl   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                   .    \ rS rSrS r " S S5      rSrg)_missing_ctypes   c                     UR                   $ ro   value)rr   r)   r'   s      r   cast_missing_ctypes.cast   s    yyr   c                       \ rS rSrS rSrg)_missing_ctypes.c_void_p   c                     Xl         g ro   r   )rr   ptrs     r   rt   !_missing_ctypes.c_void_p.__init__  s    Jr   r   N)r   r   r   r   rt   r   r   r   r   c_void_pr      s    	r   r   r   N)r   r   r   r   r   r   r   r   r   r   r   r      s     r   r   c                       \ rS rSrSS jrS rS rS r\S 5       r	\S 5       r
\S	 5       r\S
 5       rS rS rS rS rSrg)_ctypesi  Nc                 N   Xl         [        (       a,  [        U l        U R                  R                  U5      U l        O?[        5       U l        U R                  R                  U5      U l        XR                  l        U R                   R                  S:X  a  SU l        g SU l        g )Nr   TF)	_arrr   r   r   _datar   _objectsndim_zerod)rr   r   r   s      r   rt   _ctypes.__init__  ss    	6!DL..s3DJ +,DL..s3DJ"'JJ99>>QDKDKr   c                 t    U R                   R                  U R                  U5      nU R                  Ul        U$ )ad  
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   )rr   r'   r   s      r   data_as_ctypes.data_as  s.     ll

C099
r   c                     U R                   (       a  gXR                  R                  -  " U R                  R                  6 $ )zp
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rr   r'   s     r   shape_as_ctypes.shape_as*  s,    
 ;;IINN"TYY__55r   c                     U R                   (       a  gXR                  R                  -  " U R                  R                  6 $ )zw
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_as_ctypes.strides_as3  s.    
 ;;IINN"TYY%6%677r   c                 .    U R                   R                  $ )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   rr   s    r   data_ctypes.data<  s    " zzr   c                 4    U R                  [        5       5      $ )aV  
(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   _ctypes.shapeO  s     }}^-..r   c                 4    U R                  [        5       5      $ )a:  
(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   _ctypes.strides[  s     ~/00r   c                 @    U R                  [        R                  5      $ )zM
Overrides the ctypes semi-magic method

Enables `c_func(some_array.ctypes)`
)r   r   r   r   s    r   _as_parameter__ctypes._as_parameter_f  s     ||FOO,,r   c                 N    [         R                  " S[        SS9  U R                  $ )zIDeprecated getter for the `_ctypes.data` property.

.. deprecated:: 1.21
z,"get_data" is deprecated. Use "data" insteadr   rN   )r\   r]   r^   r   r   s    r   get_data_ctypes.get_dataq  s"    
 	D(Q	8yyr   c                 N    [         R                  " S[        SS9  U R                  $ )zJDeprecated getter for the `_ctypes.shape` property.

.. deprecated:: 1.21
z."get_shape" is deprecated. Use "shape" insteadr   rN   )r\   r]   r^   r   r   s    r   	get_shape_ctypes.get_shapez  s"    
 	F(Q	8zzr   c                 N    [         R                  " S[        SS9  U R                  $ )zLDeprecated getter for the `_ctypes.strides` property.

.. deprecated:: 1.21
z2"get_strides" is deprecated. Use "strides" insteadr   rN   )r\   r]   r^   r   r   s    r   get_strides_ctypes.get_strides  s"    
 	J(Q	8||r   c                 N    [         R                  " S[        SS9  U R                  $ )zSDeprecated getter for the `_ctypes._as_parameter_` property.

.. deprecated:: 1.21
z>"get_as_parameter" is deprecated. Use "_as_parameter_" insteadr   rN   )r\   r]   r^   r   r   s    r   get_as_parameter_ctypes.get_as_parameter  s&    
 	L1	
 """r   )r   r   r   r   ro   )r   r   r   r   rt   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r     sz     "&68    $ 	/ 	/ 1 1 - -	#r   r   c                    U R                   n[        U5      n[        U[        5      (       a  U/n[	        5       n[        U[        [
        45      (       aC  U H&  n UR                  U5        UR                  U5        M(     [        [        U5      U-   5      $ [        SU 35      e! [         a$    XT;   a  [        SU 35      Se[        SU 35      Sef = f)zZ
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)datatyperh   oldnames	nameslistseenr4   s         r   	_newnamesr     s    
 ~~HXI%5D%$''DN  & HHTN  T%[9,--
08
99  N<$'=dV%DE4O$';D6%BCM	Ns   B&&.Cc                     U R                   nUR                  UR                   Vs/ s H  o!R                  U   S   PM     snS.n[        XSS9$ s  snf )zReturn 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,   r9   r   )arydtr4   
copy_dtypes       r   _copy_fieldsr     sP     
B88=?XXFXTiioa0XFHJT22 Gs   Ac                     U R                   b'  UR                   b  U R                   UR                   :w  a&  [        SU R                    SUR                    S35      eXL n/ nU R                    H  nU R                  U   nUR                  U   n[        US   US   5      nU=(       a    XuS   L nUSS USS :w  a  [        SU S35      e[	        U5      S:X  a  UR                  XG45        M  UR                  US   U4U45        M     [        X0R                  =(       d    UR                  S	9nU(       aY  UR                  U R                  :X  a?  U R                    H-  nU R                  U   S
   UR                  U   S
   :w  d  M+  Us  $    U $ U$ )aV  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   r9   r	   r   r"   r   isalignedstructr?   )	dt1dt2	identical
new_fieldsr4   field1field2	new_descrr5   s	            r   _promote_fieldsr     s   * 			SYY.399		3I!		{'#))KHJ 	J 
IJ		D!D!!&)VAY7	8)ay"8	 !":#%-dV:>@ @v;!t/0q	40)<=  
"5"5"L9L9L
MC
 S\\S\\1IIDzz$"cjj&6q&99
  
Jr   c                    UR                   (       d  U R                   (       ag  US:X  a  X:X  a  gU R                  bC  U R                   H3  nU R                  U   S   U:X  d  M  U R                  U   S   U:X  d  M3    g   [        S5      eg)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,   r9   rS   )oldtypenewtyperD   r4   s       r   _getfield_is_safer     s|    * G--Q;7-==$NN4(+v5t,Q/7: & ABB
r   c                 j    X:X  a  gUR                   (       d  U R                   (       a  [        S5      eg)aE  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   rS   )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   r8   i2u2i4u4i8u8f2r  )r  r  r	  r   zUCS-2 stringspointers	bitfieldszfunction pointers)u&tXc                   B    \ rS rSrS rS rS rS r\S 5       r	S r
Srg	)
_Streamiv  c                     Xl         SU l        g )N@)r  	byteorder)rr   r  s     r   rt   _Stream.__init__w  s    r   c                 L    U R                   S U nU R                   US  U l         U$ ro   r  )rr   r(   r5   s      r   advance_Stream.advance{  s'    ffRaj
r   c                 r    U R                   S [        U5       U:X  a  U R                  [        U5      5        gg)NTF)r  r   r$  )rr   r   s     r   consume_Stream.consume  s.    66'3q6?aLLQ r   c                    [        U5      (       a  SnU[        U R                  5      :  aT  U" U R                  U   5      (       d:  US-   nU[        U R                  5      :  a  U" U R                  U   5      (       d  M:  U R                  U5      $ U R                  R	                  U5      nU R                  U5      nU R                  [        U5      5        U$ )Nr   r   )callabler   r  r$  index)rr   r   r   r5   s       r   consume_until_Stream.consume_until  s    A;;Ac$&&k/!DFF1I,,E c$&&k/!DFF1I,,<<?"QA,,q/CLLQ Jr   c                      U R                   S   $ )Nr   r#  r   s    r   next_Stream.next  s    vvayr   c                 ,    [        U R                  5      $ ro   )boolr  r   s    r   __bool___Stream.__bool__  s    DFF|r   )r   r  N)r   r   r   r   rt   r$  r'  r,  r   r/  r3  r   r   r   r   r  r  v  s/    

  r   r  c                 4    [        U 5      n[        USS9u  p#U$ )NFis_subdtype)r  __dtype_from_pep3118)specstreamr   r   s       r   _dtype_from_pep3118r;    s    T]F'EBLELr   c                    [        / / / SS9nSnSnSnU (       GaJ  S nU R                  S5      (       a  GO0S nU R                  S5      (       a9  U R                  S5      n[        [	        [
        UR                  S5      5      5      nU R                  S	;   a  U R                  S5      nUS
:X  a  SnXl	        U R                  S;   a  [        n	[        n
O[        n	[        n
U R                  S 5      nU(       a  [        U5      nOSnSnU R                  S5      (       a  [        U SS9u  pmGOU R                  U
;   a  U R                  S:X  a  U R                  S5      nOU R                  S5      nUS:H  nX   nUS;   a
  USU-  -  nSnSSS.R                  U R                  U R                  5      n[!        UU-   5      nUR"                  nOdU R                  [$        ;   a8  [$        U R                     n['        SR)                  U R                  U5      5      e[+        SU R,                  -  5      eSnU R                  S:X  aV  U* U-  nUR.                  * U-  nUU-  nUS:w  a*  US:  d  Ub  [1        U5      S:  a  [3        UU5      nOUU-  n[5        X5      nUS:w  a  [!        Xl445      nUb  [!        Xg45      nU R                  S5      (       a  U R                  S5      nOS nU(       a  UbW  Ub  UUS   ;   a  [7        SU S35      eUS   R9                  U5        US   R9                  U5        US   R9                  U5        X6R.                  -  nUU-  nX2S '   U (       a  GMJ  U R                  S:X  a  US ==   U* U-  -  ss'   US   S /:X  a8  US   S   S:X  a,  US    US   S   R.                  :X  a  U(       d  US   S   nUU4$ [;        U5        [!        U5      nUU4$ )!Nr   r,   r-   r.   r?   r   F}rK   rL   rM   )r  rG   r   r   ^!r@  r   )r  r?  c                 ,    U R                  5       (       + $ ro   )isdigit)r   s    r   r   &__dtype_from_pep3118.<locals>.<lambda>  s    !))+or   zT{Tr6  Zr   r   USVz%drG   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_typecharsr8  rY   r   	alignment_pep3118_unsupported_mapNotImplementedErrorr*   r    r  r?   _prod_add_trailing_padding_lcmRuntimeErrorr"   
_fix_names)r:  r7  
field_specrD   common_alignment
is_paddingr   r   r   type_maptype_map_charsitemsize_strr?   r   typechar	dtypecharnumpy_byteorderdescextra_offsetstart_paddingintra_paddingr4   rets                          r   r8  r8    s.   	J FJ  >># >>#((-E#c5;;s#345E ;;88q)IC	( 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=5+./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                 r    U S   n[        U5       H#  u  p#Ub  M
  Sn SU 3nX1;  a  OUS-   nM  X1U'   M%     g)z;Replace names which are None with the next unused f%d name r,   Nr   r   r   )	enumerate)rV  r,   r   r4   js        r   rU  rU  3  sY    wEU#qc7D AA	 
 a $r   c           	      H   U R                   c  [        S/U /S/U R                  S9nOZU R                   nU R                  n[        UU Vs/ s H
  oSU   S   PM     snU Vs/ s H
  oSU   S   PM     snU R                  S9nUS==   U-  ss'   [	        U5      $ s  snf s  snf )zBInject the specified number of padding bytes at the end of a dtypef0r   r=  r   r?   )r9   rG  r?   r,   r   )r   paddingrV  r9   r,   r4   s         r   rR  rR  B  s    ||&GC^^	

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

 zg% 87s   
B
!Bc                 $    SnU  H  nX-  nM	     U$ )Nr   r   )apr   s      r   rQ  rQ  X  s    	A	 Hr   c                     [         R                  " U 5      (       a  [         R                  " U5      (       d  [        SU  SU S35      eU(       a  XU-  pU(       a  M  U $ )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  ^  s^    MM!q!1!1 556CwqcD E 	E
a%1 !Hr   c                 $    U [        X5      -  U-  $ ro   )rr  rq  s     r   rS  rS  g  s    Q
?Qr   c                 `   SR                  U Vs/ s H  nSR                  U5      PM     snUR                  5        VVs/ s H  u  pgSR                  Xg5      PM     snn-   5      nX4R                  SS5      -   n	SR                  S U	 5       5      n
SR                  XX5      $ s  snf s  snnf )<Format the error message for when __array_ufunc__ gives up. , z{!r}z{}={!r}outr   c              3   ^   #    U  H#  n[        [        U5      R                  5      v   M%     g 7fro   )reprtyper   ).0args     r   	<genexpr>/array_ufunc_errmsg_formatter.<locals>.<genexpr>p  s"     F#T$s)"4"455s   +-zToperand type(s) all returned NotImplemented from __array_ufunc__({!r}, {!r}, {}): {})joinr*   r   rY   )dummyufuncmethodinputskwargsr|  kvargs_stringargstypes_strings              r   array_ufunc_errmsg_formatterr  j  s    ))6B6CV]]3/6B)/9)7 '--a3)799 :K JJub))D99FFFL2VE;=? C9s   B% B*c                     SR                  U R                  U R                  5      nSR                  U[        U5      5      $ )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_formatterr  v  s9    z44j6I6IJI%%+VItE{%CEr   c                    U R                   S:X  a  SnO+SR                  S [        U R                   5       5       5      nU R                  S:X  a  SnObU R                  S:X  a  SnOOSR	                  SR                  S	 [        U R                  5       5       5      [        S
U R                  -  5      S9nSnU R                  c  SU S3nOUS-  nSR	                  U R                  UUUS9$ )zn
Builds a signature string which resembles PEP 457

This is used to construct the first line of the docstring
r   r   rv  c              3   2   #    U  H  nS US-    3v   M     g7f)r   r   Nr   r{  r   s     r   r}  1_ufunc_doc_signature_formatter.<locals>.<genexpr>  s     @/?!a!uI/?s   r   z, /, out=()z, /, out=Nonez%[, {positional}], / [, out={default}]c              3   J   #    U  H  nS R                  US-   5      v   M     g7f)zout{}r   N)r*   r  s     r   r}  r    s%      !@->qs##->s   !#ro   )
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}))r4   in_argsout_argsr  )ninr  rangenoutr*   ry  	signaturer   )r  r  r  r  s       r   _ufunc_doc_signature_formatterr  }  s     yyA~))@uUYY/?@@ zzQ 	q":AAyy !@-25::->!@ @+, B 
	  x}5-- 4::^^	 ;  r   c                      [         (       a  U R                  S   nOU R                  S   nSUR                  ;   $ ! [         a     gf = f)Nr   F)IS_PYPY__mro__r   	Exception)rs   
ctype_bases     r   npy_ctypes_checkr    sM     7RJ RJJ1111 s   8; 
AAc                 8    U[         L a	  [        U S9$ [        XS9$ )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implementationr4   r  r   rZ   r0   r6   r>   compilerP   rW   rV   rX   rj   rl   r   r   r   r   r   r   r   r   r   rJ  r  keysrK  rL  rM  rO  r  r;  r8  rU  rR  rQ  rr  rS  r  r  r  r  r  r   r   r   <module>r     s     	 
  , I I  


!
!V
+==HDD+<,@-d JJ K L	 
J	::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