Ë
    &�£jÝ•  ã                   ó  — d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
ZmZ ddlmZ g d	¢Zej"                  Zd
ddd
ddddd
ddddddœZej&                  Z ed«      d„ «       Z ed«       G d„ d«      «       Z G d„ dej.                  «      Z ed«       G d„ de«      «       Zd„ Z ed«      	 	 dd„«       Z ed«      	 	 dd„«       Z ed«      	 	 d d„«       Zd„ Z ed«      	 	 d d„«       Z ed«      	 	 d!d„«       Z y)"z<
This module contains a set of functions for record arrays.
é    N)ÚCounter)Únullcontext)Ú
set_moduleé   )ÚnumericÚnumerictypes)Ú_get_legacy_print_mode)	ÚrecordÚrecarrayÚformat_parserÚ
fromarraysÚfromrecordsÚ
fromstringÚfromfileÚarrayÚfind_duplicateÚ>Ú<Ú=ÚsÚ|)ÚbÚlÚnÚBÚLÚNÚSr   r   r   r   r   ÚIÚiz	numpy.recc                 óp   — t        | «      j                  «       D ��cg c]  \  }}|dkD  r|‘Œ c}}S c c}}w )z@Find duplication in a list, return a list of duplicated elementsr   )r   Úitems)ÚlistÚitemÚcountss      ú5C:\FundamentalWorkbench\vendor\numpy\_core\records.pyr   r   .   sA   € ô
 $ D›M×/Ñ/Ô1ôá1‰LˆD�&Ø�AŠ:ò 	Ø1òð ùó s   �2c                   ó,   — e Zd ZdZdd„Zdd„Zd„ Zd„ Zy)	r   aˆ  
    Class to convert formats, names, titles description to a dtype.

    After constructing the format_parser object, the dtype attribute is
    the converted data-type:
    ``dtype = format_parser(formats, names, titles).dtype``

    Attributes
    ----------
    dtype : dtype
        The converted data-type.

    Parameters
    ----------
    formats : str or list of str
        The format description, either specified as a string with
        comma-separated format descriptions in the form ``'f8, i4, S5'``, or
        a list of format description strings  in the form
        ``['f8', 'i4', 'S5']``.
    names : str or list/tuple of str
        The field names, either specified as a comma-separated string in the
        form ``'col1, col2, col3'``, or as a list or tuple of strings in the
        form ``['col1', 'col2', 'col3']``.
        An empty list can be used, in that case default field names
        ('f0', 'f1', ...) are used.
    titles : sequence
        Sequence of title strings. An empty list can be used to leave titles
        out.
    aligned : bool, optional
        If True, align the fields by padding as the C-compiler would.
        Default is False.
    byteorder : str, optional
        If specified, all the fields will be changed to the
        provided byte-order.  Otherwise, the default byte-order is
        used. For all available string specifiers, see `dtype.newbyteorder`.

    See Also
    --------
    numpy.dtype, numpy.typename

    Examples
    --------
    >>> import numpy as np
    >>> np.rec.format_parser(['<f8', '<i4'], ['col1', 'col2'],
    ...                      ['T1', 'T2']).dtype
    dtype([(('T1', 'col1'), '<f8'), (('T2', 'col2'), '<i4')])

    `names` and/or `titles` can be empty lists. If `titles` is an empty list,
    titles will simply not appear. If `names` is empty, default field names
    will be used.

    >>> np.rec.format_parser(['f8', 'i4', 'S5'], ['col1', 'col2', 'col3'],
    ...                      []).dtype
    dtype([('col1', '<f8'), ('col2', '<i4'), ('col3', '<S5')])
    >>> np.rec.format_parser(['<f8', '<i4', '<S5'], [], []).dtype
    dtype([('f0', '<f8'), ('f1', '<i4'), ('f2', 'S5')])

    Nc                 ón   — | j                  ||«       | j                  ||«       | j                  |«       y ©N)Ú_parseFormatsÚ_setfieldnamesÚ_createdtype)ÚselfÚformatsÚnamesÚtitlesÚalignedÚ	byteorders         r&   Ú__init__zformat_parser.__init__u   s0   € Ø×Ñ˜7 GÔ,Ø×Ñ˜E 6Ô*Ø×Ñ˜)Õ$ó    c                 ó  — |€t        d«      ‚t        |t        «      r8t        j                  t        |«      D ��cg c]  \  }}d|› �|f‘Œ c}}|«      }nt        j                  ||«      }|j                  }|€%t        j                  d|fg|«      }|j                  }|j                  }|D �cg c]
  }||   d   ‘Œ c}| _        |D �cg c]
  }||   d   ‘Œ c}| _	        t        |«      | _        yc c}}w c c}w c c}w )z Parse the field formats NzNeed formats argumentÚfÚf1r   r   )Ú
ValueErrorÚ
isinstancer#   ÚsbÚdtypeÚ	enumerateÚfieldsr/   Ú
_f_formatsÚ_offsetsÚlenÚ_nfields)	r-   r.   r1   r    Úformat_r;   r=   ÚkeysÚkeys	            r&   r*   zformat_parser._parseFormatsz   sÿ   € ð ˆ?ÜÐ4Ó5Ð5Ü�gœtÔ$Ü—H‘Hô '0°Ô&8ôá&8™
˜˜7ð ˜˜�W˜gÒ&Ø&8òð ó‰Eô —H‘H˜W gÓ.ˆEØ—‘ˆØˆ>Ü—H‘H˜t U˜m˜_¨gÓ6ˆEØ—\‘\ˆFØ�{‰{ˆÙ59Ó:±T¨c˜6 #™; q›>°TÑ:ˆŒÙ37Ó8±4¨C˜ ™ Q›°4Ñ8ˆŒÜ˜D›	ˆ�ùóùò ;ùÚ8s   »C2
Â/C8Ã
C=c                 ó$  — |r‚t        |«      t        t        fv rn9t        |t        «      r|j                  d«      }nt        dt        |«      › �«      ‚|d| j                   D �cg c]  }|j                  «       ‘Œ c}| _
        ng | _
        | xj                  t        t        | j                  «      | j                  «      D �cg c]  }d|› �‘Œ	 c}z  c_
        t        | j                  «      }|rt        d|› �«      ‚|r1|d| j                   D �cg c]  }|j                  «       ‘Œ c}| _        n	g | _        g }| j                  t        |«      kD  r0| xj                  dg| j                  t        |«      z
  z  z  c_        yyc c}w c c}w c c}w )zQconvert input field names into a list and assign to the _names
        attribute Ú,zillegal input names Nr6   zDuplicate field names: )Útyper#   Útupler9   ÚstrÚsplitÚ	NameErrorÚreprrA   ÚstripÚ_namesÚranger@   r   r8   Ú_titles)r-   r/   r0   r   r    Ú_dups         r&   r+   zformat_parser._setfieldnames’   sn  € ñ Ü�E‹{œt¤U˜mÑ+ØÜ˜E¤3Ô'ØŸ™ CÓ(‘äÐ"6´t¸E³{°mÐ DÓEÐEà.3°N°T·]±]Ñ.CÓDÑ.C¨˜1Ÿ7™7�9Ð.CÑDˆD�KàˆDŒKð 	�Š¬¬s°4·;±;Ó/?Ø15·±ô*@ó Añ *@ A˜!˜A˜3šð *@ñ Añ 	A�ô ˜dŸk™kÓ*ˆÙÜÐ6°t°fÐ=Ó>Ð>áØ/5°n°t·}±}Ñ/EÓFÑ/E¨!˜AŸG™G�IÐ/EÑFˆD�LàˆDŒLØˆFà�=‰=œ3˜v›;Ò&Ø�LŠL˜T˜F d§m¡m´c¸&³kÑ&AÑBÑBŽLð 'ùò+ EùòAùò Gs   Á%FÃFÄFc                 óÔ   — t        j                  | j                  | j                  | j                  | j
                  dœ«      }|�t        |d      }|j                  |«      }|| _        y )N)r/   r.   Úoffsetsr0   r   )r:   r;   rN   r>   r?   rP   Ú_byteorderconvÚnewbyteorder)r-   r2   r;   s      r&   r,   zformat_parser._createdtype¶   s^   € Ü—‘Ø—[‘[Ø—‘Ø—}‘}Ø—l‘lñ	
ó ˆð Ð Ü& y°¡|Ñ4ˆIØ×&Ñ& yÓ1ˆEàˆ�
r4   )FN)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r3   r*   r+   r,   © r4   r&   r   r   8   s   „ ñ9óv%ó
"ò0"CóHr4   r   c                   óL   ‡ — e Zd ZdZd Z dZˆ fd„Zˆ fd„Zd„ Zd„ Zd„ Zd„ Z	ˆ xZ
S )	r
   zEA data-type scalar that allows field access as attribute lookup.
    Únumpyc                 óZ   •— t        «       dk  r| j                  «       S t        ‰| �  «       S ©Néq   )r	   Ú__str__ÚsuperÚ__repr__©r-   Ú	__class__s    €r&   rb   zrecord.__repr__Í   s(   ø€ Ü!Ó# sÒ*Ø—<‘<“>Ð!Ü‰wÑÓ!Ð!r4   c                 ól   •— t        «       dk  rt        | j                  «       «      S t        ‰| �  «       S r^   )r	   rI   r$   ra   r`   rc   s    €r&   r`   zrecord.__str__Ò   s,   ø€ Ü!Ó# sÒ*Ü�t—y‘y“{Ó#Ð#Ü‰w‰Ó Ð r4   c                 ó  — |dv r t         j                  j                  | |«      S 	 t         j                  j                  | |«      S # t        $ r Y nw xY wt         j                  j                  | d«      j                  }|j                  |d «      }|rf | j                  |d d Ž }	 |j                  }n# t        $ r |cY S w xY w|j                  �'|j                  | j                  |j                  f«      S |S t        d|› d�«      ‚)N©ÚsetfieldÚgetfieldr;   r;   é   ú"'record' object has no attribute 'Ú')ÚntÚvoidÚ__getattribute__ÚAttributeErrorr=   Úgetri   r;   r/   Úviewrd   )r-   ÚattrÚ	fielddictÚresÚobjÚdts         r&   ro   zrecord.__getattribute__×   sù   € ØÐ4Ñ4Ü—7‘7×+Ñ+¨D°$Ó7Ð7ð	Ü—7‘7×+Ñ+¨D°$Ó7Ð7øÜò 	Ùð	úä—G‘G×,Ñ,¨T°7Ó;×BÑBˆ	Ø�m‰m˜D $Ó'ˆÙØ�$—-‘-  R a Ð)ˆCðØ—Y‘Y‘øÜ!ò à’
ðúð �x‰xÐ#Ø—x‘x §¡°·±Ð ;Ó<Ð<ØˆJä Ð#EÀdÀVÈ1Ð!MÓNÐNs#   ¦A Á	AÁAÂ&B3 Â3CÃ Cc                 óJ  — |dv rt        d|› d�«      ‚t        j                  j                  | d«      j                  }|j                  |d «      }|r | j                  |g|d d ¢­Ž S t        | |d «      r!t        j                  j                  | ||«      S t        d|› d�«      ‚)Nrg   zCannot set 'z' attributer;   rj   rk   rl   )	rp   rm   rn   ro   r=   rq   rh   ÚgetattrÚ__setattr__)r-   rs   Úvalrt   ru   s        r&   rz   zrecord.__setattr__ï   s¤   € ØÐ4Ñ4Ü  <°¨v°[Ð!AÓBÐBÜ—G‘G×,Ñ,¨T°7Ó;×BÑBˆ	Ø�m‰m˜D $Ó'ˆÙØ �4—=‘= Ð/ s¨2¨A wÒ/Ð/Ü�T˜4 Ô&Ü—7‘7×&Ñ& t¨T°3Ó7Ð7ä Ð#EÀdÀVÈ1Ð!MÓNÐNr4   c                 óô   — t         j                  j                  | |«      }t        |t         j                  «      r=|j                  j
                  �'|j                  | j                  |j                  f«      S |S r)   )rm   rn   Ú__getitem__r9   r;   r/   rr   rd   )r-   Úindxrv   s      r&   r}   zrecord.__getitem__û   sX   € Ü�g‰g×!Ñ! $¨Ó-ˆô �cœ2Ÿ7™7Ô#¨¯	©	¯©Ð(CØ—8‘8˜TŸ^™^¨S¯Y©YÐ7Ó8Ð8ð ˆJr4   c           	      óÂ   — | j                   j                  }t        d„ |D «       «      }|D �cg c]  }|d|› �›dt        | |«      › �‘Œ }}dj	                  |«      S c c}w )zPretty-print all fields.c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr)   )r@   )Ú.0Únames     r&   Ú	<genexpr>z record.pprint.<locals>.<genexpr>	  s   è ø€ Ð1©5 4”S˜—Y©5ùs   ‚r   z: Ú
)r;   r/   Úmaxry   Újoin)r-   r/   Úmaxlenr‚   Úrowss        r&   Úpprintzrecord.pprint  sg   € ð —
‘
× Ñ ˆÜÑ1©5Ó1Ó1ˆÙGLÓMÁu¸t�4˜˜&˜�zÐ" "¤W¨T°4Ó%8Ð$9Ò:ÀuˆÐMØ�y‰y˜‹Ðùò Ns   ­A)rV   rW   rX   rY   rb   r`   ro   rz   r}   r‰   Ú__classcell__©rd   s   @r&   r
   r
   Ä   s4   ø„ ñð
 €HØ€Jô"ô
!ò
Oò0
Oòör4   r
   c                   óT   ‡ — e Zd ZdZ	 	 	 d
d„ZdZd„ Zd„ Zd„ Zˆ fd„Z	d„ Z
dd	„Zˆ xZS )r   aS  Construct an ndarray that allows field access using attributes.

    Arrays may have a data-types containing fields, analogous
    to columns in a spread sheet.  An example is ``[(x, int), (y, float)]``,
    where each entry in the array is a pair of ``(int, float)``.  Normally,
    these attributes are accessed using dictionary lookups such as ``arr['x']``
    and ``arr['y']``.  Record arrays allow the fields to be accessed as members
    of the array, using ``arr.x`` and ``arr.y``.

    Parameters
    ----------
    shape : tuple
        Shape of output array.
    dtype : data-type, optional
        The desired data-type.  By default, the data-type is determined
        from `formats`, `names`, `titles`, `aligned` and `byteorder`.
    formats : list of data-types, optional
        A list containing the data-types for the different columns, e.g.
        ``['i4', 'f8', 'i4']``.  `formats` does *not* support the new
        convention of using types directly, i.e. ``(int, float, int)``.
        Note that `formats` must be a list, not a tuple.
        Given that `formats` is somewhat limited, we recommend specifying
        `dtype` instead.
    names : tuple of str, optional
        The name of each column, e.g. ``('x', 'y', 'z')``.
    buf : buffer, optional
        By default, a new array is created of the given shape and data-type.
        If `buf` is specified and is an object exposing the buffer interface,
        the array will use the memory from the existing buffer.  In this case,
        the `offset` and `strides` keywords are available.

    Other Parameters
    ----------------
    titles : tuple of str, optional
        Aliases for column names.  For example, if `names` were
        ``('x', 'y', 'z')`` and `titles` is
        ``('x_coordinate', 'y_coordinate', 'z_coordinate')``, then
        ``arr['x']`` is equivalent to both ``arr.x`` and ``arr.x_coordinate``.
    byteorder : {'<', '>', '='}, optional
        Byte-order for all fields.
    aligned : bool, optional
        Align the fields in memory as the C-compiler would.
    strides : tuple of ints, optional
        Buffer (`buf`) is interpreted according to these strides (strides
        define how many bytes each array element, row, column, etc.
        occupy in memory).
    offset : int, optional
        Start reading buffer (`buf`) from this offset onwards.
    order : {'C', 'F'}, optional
        Row-major (C-style) or column-major (Fortran-style) order.

    Returns
    -------
    rec : recarray
        Empty array of the given shape and type.

    See Also
    --------
    numpy.rec.fromrecords : Construct a record array from data.
    numpy.record : fundamental data-type for `recarray`.
    numpy.rec.format_parser : determine data-type from formats, names, titles.

    Notes
    -----
    This constructor can be compared to ``empty``: it creates a new record
    array but does not fill it with data.  To create a record array from data,
    use one of the following methods:

    1. Create a standard ndarray and convert it to a record array,
       using ``arr.view(np.recarray)``
    2. Use the `buf` keyword.
    3. Use `np.rec.fromrecords`.

    Examples
    --------
    Create an array with two fields, ``x`` and ``y``:

    >>> import numpy as np
    >>> x = np.array([(1.0, 2), (3.0, 4)], dtype=[('x', '<f8'), ('y', '<i8')])
    >>> x
    array([(1., 2), (3., 4)], dtype=[('x', '<f8'), ('y', '<i8')])

    >>> x['x']
    array([1., 3.])

    View the array as a record array:

    >>> x = x.view(np.recarray)

    >>> x.x
    array([1., 3.])

    >>> x.y
    array([2, 4])

    Create a new, empty record array:

    >>> np.recarray((2,),
    ... dtype=[('x', int), ('y', float), ('z', int)]) #doctest: +SKIP
    rec.array([(-1073741821, 1.2249118382103472e-301, 24547520),
           (3471280, 1.2134086255804012e-316, 0)],
          dtype=[('x', '<i4'), ('y', '<f8'), ('z', '<i4')])

    Nc           	      óò   — |�t        j                  |«      }nt        ||||
|	«      j                  }|€!t        j	                  | |t
        |f|¬«      }|S t        j	                  | |t
        |f||||¬«      }|S )N)Úorder)ÚbufferÚoffsetÚstridesrŽ   )r:   r;   r   ÚndarrayÚ__new__r
   )ÚclsÚshaper;   Úbufr�   r‘   r.   r/   r0   r2   r1   rŽ   Údescrr-   s                 r&   r“   zrecarray.__new__�  sŒ   € ð ÐÜ—H‘H˜U“O‰Eä!Ø˜ ¨°óç‰eð ð ˆ;Ü—?‘? 3¨´¸¨Àe�?ÓLˆDð ˆô	 —?‘?Ø�UœV U˜O°CØ w°eð #ó ˆDð ˆr4   c                 ó<  — | j                   j                  t        ur€t        | j                   j                  t        j
                  «      rQ| j                   j                  �:t        j                  | t        j                   t        | j                   f«      «       y y y y r)   )
r;   rG   r
   Ú
issubclassrm   rn   r/   r’   Ú
_set_dtyper:   )r-   rv   s     r&   Ú__array_finalize__zrecarray.__array_finalize__—  sk   € Ø�J‰J�O‰O¤6Ñ)Ü˜4Ÿ:™:Ÿ?™?¬B¯G©GÔ4Ø—
‘
× Ñ Ð,ô ×Ñ˜t¤R§X¡X¬v°t·z±zÐ.BÓ%CÕDð -ð 5ð *r4   c                 ó&  — 	 t         j                  | |«      S # t        $ r Y nw xY wt        j                  | d«      j                  }	 ||   d d }n&# t
        t        f$ r}t        d|› �«      |‚d }~ww xY w | j                  |Ž }|j                  j                  �bt        |j                  j                  t        j                  «      r2|j                  | j                  j                  |j                  f¬«      S |S |j                  t        «      S )Nr;   rj   zrecarray has no attribute ©r;   )Úobjectro   rp   r’   r=   Ú	TypeErrorÚKeyErrorri   r;   r/   r™   rG   rm   rn   rr   )r-   rs   rt   ru   Úerv   s         r&   ro   zrecarray.__getattribute__Ÿ  sô   € ð	Ü×*Ñ*¨4°Ó6Ð6øÜò 	Ùð	úô ×,Ñ,¨T°7Ó;×BÑBˆ	ð	MØ˜D‘/ " 1Ð%‰CøÜœ8Ð$ò 	MÜ Ð#=¸d¸VÐ!DÓEÈ1ÐLûð	Múàˆd�m‰m˜SÐ!ˆð �9‰9�?‰?Ð&Ü˜#Ÿ)™)Ÿ.™.¬"¯'©'Ô2Ø—x‘x t§z¡z§¡¸¿	¹	Ð&B�xÓCÐCØˆJà—8‘8œGÓ$Ð$s$   ‚ ˜	$£$ÁA ÁA4Á A/Á/A4c                 óŠ  — |dk(  rKt        |j                  t        j                  «      r'|j                  �t        j                  t        |f«      }|| j                  v}	 t        j                  | ||«      }t        j                  | d«      j                  xs i }||vr|S |r	 t        j                  | |«       	 ||   d d } | j&                  |g|¢­Ž S # t        $ r |cY S w xY w# t        $ r, t        j                  | d«      j                  xs i }||vr‚ Y Œaw xY w# t         t"        f$ r}t%        d|› �«      |‚d }~ww xY w)Nr;   rj   zrecord array has no attribute )r™   rG   rm   rn   r/   r:   r;   r
   Ú__dict__rž   rz   r’   ro   r=   Ú__delattr__Ú	ExceptionrŸ   r    rp   rh   )r-   rs   r{   ÚnewattrÚretrt   ru   r¡   s           r&   rz   zrecarray.__setattr__Á  sT  € ð
 �GŠOÜ�s—x‘x¤§¡Ô)Ø�I‰IÐ!ä—(‘(œF C˜=Ó)ˆCà˜dŸm™mÐ+ˆð	Ü×$Ñ$ T¨4°Ó5ˆCô  ×0Ñ0°°wÓ?×FÑFÒLÈ"ˆIØ˜9Ñ$Ø�
ÙðÜ×&Ñ& t¨TÔ2ð	Ø˜D‘/ " 1Ð%ˆCð
 ˆt�}‰}˜SÐ' 3Ò'Ð'øô !ò Ø’Jðûô ò 	Ü×0Ñ0°°wÓ?×FÑFÒLÈ"ˆIØ˜9Ñ$Øñ %ð	ûô" œ8Ð$ò 	Ü Ø0°°Ð7óàðûð	ús<   Á C' Â$C Â;D ÃC$Ã#C$Ã'2DÄDÄEÄ.D=Ä=Ec                 ó–  •— t         ‰| �  |«      }t        |t        «      r¨|j                  j
                  �||j                  t        | «      «      }t        |j                  j                  t        j                  «      r2|j                  | j                  j                  |j                  f¬«      S |S |j                  t        ¬«      S |S )Nr�   )rG   )ra   r}   r9   r’   r;   r/   rr   rG   r™   rm   rn   )r-   r~   rv   rd   s      €r&   r}   zrecarray.__getitem__æ  s“   ø€ Ü‰gÑ! $Ó'ˆô �cœ7Ô#Ø�y‰y�‰Ð*Ø—h‘hœt D›zÓ*�Ü˜cŸi™iŸn™n¬b¯g©gÔ6ØŸ8™8¨4¯:©:¯?©?¸C¿I¹IÐ*F˜8ÓGÐGØ�
à—x‘x¤W�xÓ-Ð-ð ˆJr4   c                 ó$  — | j                   }| j                   j                  t        u s.t        | j                   j                  t        j
                  «      s<|j                  t        u r%t        j                   t        j
                  |f«      }d}d}nd}d}| j                  dkD  s| j                  dk(  rt        j                  | d|d¬	«      }nd
t        | j                  «      › �}ddt        |«      z  z   }t        «       dk  rd|z   }||||fz  S )Nz
rec.array(zrec.array(%s,%sdtype=%s)zarray(z)array(%s,%sdtype=%s).view(numpy.recarray)r   )r   z, rF   )Ú	separatorÚprefixÚsuffixz
[], shape=r„   Ú r_   )r;   rG   r
   r™   rm   rn   r:   Úsizer•   Úarray2stringrL   r@   r	   )r-   Ú
repr_dtyper«   ÚfmtÚlstÚlfs         r&   rb   zrecarray.__repr__÷  sí   € à—Z‘Zˆ
à�J‰J�O‰OœvÑ%Ü˜4Ÿ:™:Ÿ?™?¬B¯G©GÔ4ð �‰¤&Ñ(ÜŸX™X¤r§w¡w°
Ð&;Ó<�
Ø!ˆFØ,‰Cð
 ˆFØ=ˆCð �9‰9�qŠ=˜DŸJ™J¨$Ò.Ü—/‘/Ø ¨V¸CôA‰Cð œt D§J¡JÓ/Ð0Ð1ˆCà�Cœ#˜f›+Ñ%Ñ%ˆÜ!Ó# sÒ*Ø�r‘ˆBØ�c˜2˜zÐ*Ñ*Ð*r4   c                 ó^  — t        |t        «      r%t        j                  | d«      j                  }||   }t        j                  | d«      j
                  }||   d d }|€< | j                  |Ž }|j                  j                  �|S |j                  t        «      S  | j                  |g|¢­Ž S )Nr;   rj   )
r9   Úintr’   ro   r/   r=   ri   r;   rr   rh   )r-   rs   r{   r/   rt   ru   rv   s          r&   Úfieldzrecarray.field  s¢   € Ü�dœCÔ Ü×,Ñ,¨T°7Ó;×AÑAˆEØ˜‘;ˆDä×,Ñ,¨T°7Ó;×BÑBˆ	à˜‰o˜b˜qÐ!ˆàˆ;Ø�$—-‘- Ð%ˆCØ�y‰y�‰Ð*Ø�
Ø—8‘8œGÓ$Ð$à �4—=‘= Ð+ sÒ+Ð+r4   )
NNr   NNNNNFÚCr)   )rV   rW   rX   rY   r“   rš   r›   ro   rz   r}   rb   r¶   rŠ   r‹   s   @r&   r   r     sE   ø„ ñgðR EIØ15Ø58óð( €JòEò%òD#(ôJò""+÷H,r4   r   c                 óJ   — | dk(  rt        j                  dt        d¬«       y | S )Nr   z¹Passing `shape=0` to have the shape be inferred is deprecated, and in future will be equivalent to `shape=(0,)`. To infer the shape and suppress this warning, pass `shape=None` instead.é   ©Ú
stacklevel)ÚwarningsÚwarnÚFutureWarning)r•   s    r&   Ú_deprecate_shape_0_as_Noner¿   -  s,   € Ø�‚zÜ�‰ðNô  aõ		)ð
 àˆr4   c                 óÖ  — | D �cg c]  }t        j                  |«      ‘Œ } }t        |«      }|€| d   j                  }nt	        |t
        «      r|f}|€|€| D �	cg c]  }	|	j                  ‘Œ }}	|�t        j                  |«      }
nt        |||||«      j                  }
|
j                  }t        |
«      t        | «      k7  rt        d«      ‚|
d   j                  }t        |«      }|dkD  r|d|  }t        ||
«      }t        | «      D ]Q  \  }}	|
|   j                  }|	j                  d|	j                  |z
   }||   }||k7  rt        d|› d|› d�«      ‚|	||<   ŒS |S c c}w c c}	w )a¨  Create a record array from a (flat) list of arrays

    Parameters
    ----------
    arrayList : list or tuple
        List of array-like objects (such as lists, tuples,
        and ndarrays).
    dtype : data-type, optional
        valid dtype for all arrays
    shape : int or tuple of ints, optional
        Shape of the resulting array. If not provided, inferred from
        ``arrayList[0]``.
    formats, names, titles, aligned, byteorder :
        If `dtype` is ``None``, these arguments are passed to
        `numpy.rec.format_parser` to construct a dtype. See that function for
        detailed documentation.

    Returns
    -------
    np.recarray
        Record array consisting of given arrayList columns.

    Examples
    --------
    >>> x1=np.array([1,2,3,4])
    >>> x2=np.array(['a','dd','xyz','12'])
    >>> x3=np.array([1.1,2,3,4])
    >>> r = np.rec.fromarrays([x1,x2,x3],names='a,b,c')
    >>> print(r[1])
    (2, 'dd', 2.0) # may vary
    >>> x1[1]=34
    >>> r.a
    array([1, 2, 3, 4])

    >>> x1 = np.array([1, 2, 3, 4])
    >>> x2 = np.array(['a', 'dd', 'xyz', '12'])
    >>> x3 = np.array([1.1, 2, 3,4])
    >>> r = np.rec.fromarrays(
    ...     [x1, x2, x3],
    ...     dtype=np.dtype([('a', np.int32), ('b', 'S3'), ('c', np.float32)]))
    >>> r
    rec.array([(1, b'a', 1.1), (2, b'dd', 2. ), (3, b'xyz', 3. ),
               (4, b'12', 4. )],
              dtype=[('a', '<i4'), ('b', 'S3'), ('c', '<f4')])
    Nr   z>mismatch between the number of fields and the number of arrayszarray-shape mismatch in array z ("z"))r:   Úasarrayr¿   r•   r9   rµ   r;   r   r/   r@   r8   r   r<   Úndim)Ú	arrayListr;   r•   r.   r/   r0   r1   r2   Úxrv   r—   rN   Úd0ÚnnÚ_arrayÚkÚ	testshaper‚   s                     r&   r   r   9  s†  € ñb )2Ó2©	 1”—‘˜A•¨	€IÐ2ô ' uÓ-€Eà€}Ø˜!‘×"Ñ"‰Ü	�Eœ3Ô	Ø�ˆà€˜5˜=ñ )2Ó2©	 �3—9“9¨	ˆÐ2àÐÜ—‘˜“‰ä˜g u¨f°g¸yÓI×OÑOˆØ�[‰[€Fô ˆ5ƒz”S˜“^Ò#Üð +ó ,ð 	,ð 
ˆq‰�‰€BÜ	ˆR‹€BØ	ˆA‚vØ�d˜�s�ˆä�e˜UÓ#€Fô ˜IÖ&‰ˆˆ3Ø�1‰X�]‰]ˆØ—I‘I˜n˜sŸx™x¨"™}Ð-ˆ	Ø�a‰yˆØ˜ÒÜÐ=¸a¸SÀÀDÀ6ÈÐLÓMÐMàˆˆtŠð 'ð €MùòW 3ùò 3s   …E!ÁE&c           	      ór  — |€z|€xt        j                  | t        ¬«      }t        |j                  d   «      D �	cg c]*  }	t        j                  |d|	f   j                  «       «      ‘Œ, }
}	t        |
||||||¬«      S |�t        j                  t        |f«      }nt        |||||«      j                  }	 t        j                  | |¬«      }|�!|j                  |k7  r|j                  |«      }	 |j/                  t"        «      }|S c c}	w # t        t        f$ rœ t        |«      }|€t        | «      }t        |t         «      r|f}t        |«      dkD  rt        d«      ‚t#        ||«      }t        |j$                  «      D ]  }t'        | |   «      ||<   Œ t)        j*                  dt,        d¬	«       |cY S w xY w)
a  Create a recarray from a list of records in text form.

    Parameters
    ----------
    recList : sequence
        data in the same field may be heterogeneous - they will be promoted
        to the highest data type.
    dtype : data-type, optional
        valid dtype for all arrays
    shape : int or tuple of ints, optional
        shape of each array.
    formats, names, titles, aligned, byteorder :
        If `dtype` is ``None``, these arguments are passed to
        `numpy.format_parser` to construct a dtype. See that function for
        detailed documentation.

        If both `formats` and `dtype` are None, then this will auto-detect
        formats. Use list of tuples rather than list of lists for faster
        processing.

    Returns
    -------
    np.recarray
        record array consisting of given recList rows.

    Examples
    --------
    >>> r=np.rec.fromrecords([(456,'dbe',1.2),(2,'de',1.3)],
    ... names='col1,col2,col3')
    >>> print(r[0])
    (456, 'dbe', 1.2)
    >>> r.col1
    array([456,   2])
    >>> r.col2
    array(['dbe', 'de'], dtype='<U3')
    >>> import pickle
    >>> pickle.loads(pickle.dumps(r))
    rec.array([(456, 'dbe', 1.2), (  2, 'de', 1.3)],
              dtype=[('col1', '<i8'), ('col2', '<U3'), ('col3', '<f8')])
    r�   éÿÿÿÿ.)r.   r•   r/   r0   r1   r2   r   zCan only deal with 1-d array.zxfromrecords expected a list of tuples, may have received a list of lists instead. In the future that will raise an errorrj   rº   )r:   r   rž   rO   r•   Útolistr   r;   r
   r   ÚreshaperŸ   r8   r¿   r@   r9   rµ   r   r®   rH   r¼   r½   r¾   rr   )ÚrecListr;   r•   r.   r/   r0   r1   r2   rv   r    Úarrlistr—   ÚretvalrÇ   rÈ   ru   s                   r&   r   r   ˜  s¯  € ðX €˜5˜=Ü�h‰h�w¤fÔ-ˆä49¸#¿)¹)ÀB¹-Ô4Hó
Ù4H¨qŒB�H‰H�S˜˜a˜‘[×'Ñ'Ó)Õ*Ð4Hð 	ð 
ô ˜'¨7¸%ÀuØ!'°ÀIôOð 	Oð ÐÜ—‘œ& %˜Ó)‰äØ�U˜F G¨Yó
ç
‰%ð 	ð+Ü—‘˜'¨Ô/ˆð* Ð §¡°Ò!6Ø—^‘^ EÓ*‰Fà
�+‰+”hÓ
€Cà€JùòQ
øô ”zÐ"ò ä*¨5Ó1ˆØˆ=Ü˜“LˆEÜ�eœSÔ!Ø�HˆEÜˆu‹:˜Š>ÜÐ<Ó=Ð=Ü˜% Ó'ˆÜ�v—{‘{Ö#ˆAÜ˜g a™jÓ)ˆF�1ŠIð $ô 	�‰ðGä aõ	)ð Šð%ús   º/DÂ5D ÄB(F6Æ5F6c	                 ó2  — |€|€t        d«      ‚|�t        j                  |«      }	nt        |||||«      j                  }	|	j                  rt        d|	› d�«      ‚|	j                  }
t        |«      }|dv rt        | «      |z
  |
z  }t        ||	| |¬«      }|S )aÜ  Create a record array from binary data

    Note that despite the name of this function it does not accept `str`
    instances.

    Parameters
    ----------
    datastring : bytes-like
        Buffer of binary data
    dtype : data-type, optional
        Valid dtype for all arrays
    shape : int or tuple of ints, optional
        Shape of each array.
    offset : int, optional
        Position in the buffer to start reading from.
    formats, names, titles, aligned, byteorder :
        If `dtype` is ``None``, these arguments are passed to
        `numpy.format_parser` to construct a dtype. See that function for
        detailed documentation.


    Returns
    -------
    np.recarray
        Record array view into the data in datastring. This will be readonly
        if `datastring` is readonly.

    See Also
    --------
    numpy.frombuffer

    Examples
    --------
    >>> a = b'\x01\x02\x03abc'
    >>> np.rec.fromstring(a, dtype='u1,u1,u1,S3')
    rec.array([(1, 2, 3, b'abc')],
            dtype=[('f0', 'u1'), ('f1', 'u1'), ('f2', 'u1'), ('f3', 'S3')])

    >>> grades_dtype = [('Name', (np.str_, 10)), ('Marks', np.float64),
    ...                 ('GradeLevel', np.int32)]
    >>> grades_array = np.array([('Sam', 33.3, 3), ('Mike', 44.4, 5),
    ...                         ('Aadi', 66.6, 6)], dtype=grades_dtype)
    >>> np.rec.fromstring(grades_array.tobytes(), dtype=grades_dtype)
    rec.array([('Sam', 33.3, 3), ('Mike', 44.4, 5), ('Aadi', 66.6, 6)],
            dtype=[('Name', '<U10'), ('Marks', '<f8'), ('GradeLevel', '<i4')])

    >>> s = '\x01\x02\x03abc'
    >>> np.rec.fromstring(s, dtype='u1,u1,u1,S3')
    Traceback (most recent call last):
       ...
    TypeError: a bytes-like object is required, not 'str'
    z2fromstring() needs a 'dtype' or 'formats' argumentú%Cannot create record array for dtype ú1. Arrays containing references are not supported.)NrË   )r–   r�   )
rŸ   r:   r;   r   Ú	hasobjectr8   Úitemsizer¿   r@   r   )Ú
datastringr;   r•   r�   r.   r/   r0   r1   r2   r—   rÕ   rÇ   s               r&   r   r   ñ  s±   € ðp €}˜˜ÜÐLÓMÐMàÐÜ—‘˜“‰ä˜g u¨f°g¸yÓI×OÑOˆà‡‚ÜØ3°E°7ð ;?ð ?ó
ð 	
ð
 �~‰~€Hô ' uÓ-€Eà�
ÑÜ�Z“ 6Ñ)¨hÑ6ˆä�e˜U¨
¸6ÔB€FØ€Mr4   c                 óÀ   — | j                  «       }	 | j                  dd«       | j                  «       |z
  | j                  |d«       S # | j                  |d«       w xY w)Nr   rj   )ÚtellÚseek)ÚfdÚposs     r&   Úget_remaining_sizerÜ   B  sG   € Ø
�'‰'‹)€CðØ
�‰��1ŒØ�w‰w‹y˜3‰à
�‰��Q�øˆ�‰��Q�ús   ’$A	 Á	Ac	                 óÒ  — |€|€t        d«      ‚t        |«      }|€d}nt        |t        «      r|f}t	        | d«      rt        | «      }	nt        t        j                  | «      d«      }	|	5 } |dkD  r| j                  |d«       t        | «      }
|�t        j                  |«      }nt        |||||«      j                  }|j                  rt        d|› d	�«      ‚|j                   }t        j"                  |«      j%                  t&        j(                  ¬
«      }||z  }|dk  rat+        |«      }|
| z  ||j-                  d«      <   t/        |«      }t        j"                  |«      j%                  t&        j(                  ¬
«      }||z  }||
kD  rt        d«      ‚t1        ||«      }| j3                  |j4                  «      }||k7  rt7        d«      ‚	 ddd«       |S # 1 sw Y   S xY w)a   Create an array from binary file data

    Parameters
    ----------
    fd : str or file type
        If file is a string or a path-like object then that file is opened,
        else it is assumed to be a file object. The file object must
        support random access (i.e. it must have tell and seek methods).
    dtype : data-type, optional
        valid dtype for all arrays
    shape : int or tuple of ints, optional
        shape of each array.
    offset : int, optional
        Position in the file to start reading from.
    formats, names, titles, aligned, byteorder :
        If `dtype` is ``None``, these arguments are passed to
        `numpy.format_parser` to construct a dtype. See that function for
        detailed documentation

    Returns
    -------
    np.recarray
        record array consisting of data enclosed in file.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> a = np.empty(10,dtype='f8,i4,S5')
    >>> a[5] = (0.5,10,'abcde')
    >>>
    >>> fd=TemporaryFile()
    >>> a = a.view(a.dtype.newbyteorder('<'))
    >>> a.tofile(fd)
    >>>
    >>> _ = fd.seek(0)
    >>> r=np.rec.fromfile(fd, formats='f8,i4,S5', shape=10,
    ... byteorder='<')
    >>> print(r[5])
    (0.5, 10, b'abcde')
    >>> r.shape
    (10,)
    Nz0fromfile() needs a 'dtype' or 'formats' argument)rË   ÚreadintoÚrbr   r   rÒ   rÓ   r�   rË   z;Not enough bytes left in file for specified shape and type.z%Didn't read as many bytes as expected)rŸ   r¿   r9   rµ   Úhasattrr   ÚopenÚosÚfspathrÙ   rÜ   r:   r;   r   rÔ   r8   rÕ   r   Úprodrm   Úintpr#   ÚindexrH   r   rÞ   ÚdataÚOSError)rÚ   r;   r•   r�   r.   r/   r0   r1   r2   Úctxr®   r—   rÕ   Ú	shapeprodÚ	shapesizeÚnbytesrÇ   Ú
nbytesreads                     r&   r   r   K  sç  € ð\ €}˜˜ÜÐJÓKÐKô ' uÓ-€Eà€}Ø‰Ü	�Eœ3Ô	Ø�ˆäˆr�:Ôô ˜"‹o‰ô ”2—9‘9˜R“= $Ó'ˆá	�Ø�AŠ:Ø�G‰G�F˜AÔÜ! "Ó%ˆàÐÜ—H‘H˜U“O‰Eä!Ø˜ ¨°óç‰eð ð �?Š?ÜØ7¸°wð ?Bð Bóð ð
 —>‘>ˆä—H‘H˜U“O×(Ñ(¬r¯w©wÐ(Ó7ˆ	Ø Ñ(ˆ	Ø�qŠ=Ü˜“KˆEØ%)¨i¨ZÑ%7ˆE�%—+‘+˜b“/Ñ"Ü˜%“LˆEÜŸ™ ›×,Ñ,´2·7±7Ð,Ó;ˆIà˜XÑ%ˆà�DŠ=Üð&óð ô ˜% Ó'ˆØ—[‘[ §¡Ó-ˆ
Ø˜ÒÜÐAÓBÐBð  ÷O 
ðT €M÷U 
ðT €Mús   Á,E%GÇG&c                 ón  — t        | t        d«      t        f«      st        | d«      r|€|€t	        d«      ‚i }|�t        j                  |«      }n$|�t        |||||	«      j                  }n|||||	dœ}| €|€t	        d«      ‚t        ||| ||¬«      S t        | t        «      rt        | |f||dœ|¤ŽS t        | t        t        f«      r7t        | d   t        t        f«      rt        | f||d	œ|¤ŽS t        | f||d	œ|¤ŽS t        | t        «      r9|�!| j                  |k7  r| j                  |«      }n| }|
r|j!                  «       }|S t        | d«      rt#        | |||¬
«      S t        | t$        «      rL|�!| j                  |k7  r| j                  |«      }n| }|
r|j!                  «       }|j                  t        «      S t'        | dd«      }|�t        |t(        «      st	        d«      ‚t        j*                  | «      } |� | j                  |k7  r| j                  |«      } | j                  t        «      S )aŽ
  
    Construct a record array from a wide-variety of objects.

    A general-purpose record array constructor that dispatches to the
    appropriate `recarray` creation function based on the inputs (see Notes).

    Parameters
    ----------
    obj : any
        Input object. See Notes for details on how various input types are
        treated.
    dtype : data-type, optional
        Valid dtype for array.
    shape : int or tuple of ints, optional
        Shape of each array.
    offset : int, optional
        Position in the file or buffer to start reading from.
    strides : tuple of ints, optional
        Buffer (`buf`) is interpreted according to these strides (strides
        define how many bytes each array element, row, column, etc.
        occupy in memory).
    formats, names, titles, aligned, byteorder :
        If `dtype` is ``None``, these arguments are passed to
        `numpy.format_parser` to construct a dtype. See that function for
        detailed documentation.
    copy : bool, optional
        Whether to copy the input object (True), or to use a reference instead.
        This option only applies when the input is an ndarray or recarray.
        Defaults to True.

    Returns
    -------
    np.recarray
        Record array created from the specified object.

    Notes
    -----
    If `obj` is ``None``, then call the `~numpy.recarray` constructor. If
    `obj` is a string, then call the `fromstring` constructor. If `obj` is a
    list or a tuple, then if the first object is an `~numpy.ndarray`, call
    `fromarrays`, otherwise call `fromrecords`. If `obj` is a
    `~numpy.recarray`, then make a copy of the data in the recarray
    (if ``copy=True``) and use the new formats, names, and titles. If `obj`
    is a file, then call `fromfile`. Finally, if obj is an `ndarray`, then
    return ``obj.view(recarray)``, making a copy of the data if ``copy=True``.

    Examples
    --------
    >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    >>> a
    array([[1, 2, 3],
           [4, 5, 6],
           [7, 8, 9]])

    >>> np.rec.array(a)
    rec.array([[1, 2, 3],
               [4, 5, 6],
               [7, 8, 9]],
              dtype=int64)

    >>> b = [(1, 1), (2, 4), (3, 9)]
    >>> c = np.rec.array(b, formats = ['i2', 'f2'], names = ('x', 'y'))
    >>> c
    rec.array([(1, 1.), (2, 4.), (3, 9.)],
              dtype=[('x', '<i2'), ('y', '<f2')])

    >>> c.x
    array([1, 2, 3], dtype=int16)

    >>> c.y
    array([1.,  4.,  9.], dtype=float16)

    >>> r = np.rec.array(['abc','def'], names=['col1','col2'])
    >>> print(r.col1)
    abc

    >>> r.col1
    array('abc', dtype='<U3')

    >>> r.col2
    array('def', dtype='<U3')
    NrÞ   zIMust define formats (or dtype) if object is None, string, or an open file)r.   r/   r0   r1   r2   z"Must define a shape if obj is None)r–   r�   r‘   )r•   r�   r   )r;   r•   )r;   r•   r�   Ú__array_interface__zUnknown input type)r9   rG   rI   rà   r8   r:   r;   r   r   Úbytesr   r#   rH   r   r   rr   Úcopyr   r’   ry   Údictr   )rv   r;   r•   r�   r‘   r.   r/   r0   r1   r2   rñ   ÚkwdsÚnewÚ	interfaces                 r&   r   r   º  s8  € ôl 
�Cœ$˜t›*¤cÐ*Ô	+¬w°s¸JÔ/GØˆ?˜u˜}Üð 9ó :ð 	:ð €DØÐÜ—‘˜“‰Ø	Ð	Ü˜g u¨fØ% yó2ß27±%ñ 	ð #ØØ Ø"Ø&ñ	ˆð €{Øˆ=ÜÐAÓBÐBÜ˜˜u¨#°fÀgÔNÐNä	�CœÔ	Ü˜#˜uÐI¨E¸&ÑIÀDÑIÐIä	�Cœ$¤˜Ô	'Ü�c˜!‘fœu¤d˜mÔ,Ü˜sÐE¨%°uÑEÀÑEÐEä˜cÐD¨°eÑD¸tÑDÐDä	�CœÔ	"ØÐ #§)¡)¨uÒ"4Ø—(‘(˜5“/‰CàˆCÙØ—(‘(“*ˆCØˆ
ä	��jÔ	!Ü˜ 5°¸fÔEÐEä	�CœÔ	!ØÐ #§)¡)¨uÒ"4Ø—(‘(˜5“/‰CàˆCÙØ—(‘(“*ˆCØ�x‰xœÓ!Ð!ô ˜CÐ!6¸Ó=ˆ	ØÐ¤J¨y¼$Ô$?ÜÐ1Ó2Ð2Ü�h‰h�s‹mˆØÐ #§)¡)¨uÒ"4Ø—(‘(˜5“/ˆCØ�x‰xœÓ!Ð!r4   )NNNNNFN)NNr   NNNFN)
NNr   NNNNFNT)!rY   râ   r¼   Úcollectionsr   Ú
contextlibr   Únumpy._utilsr   Ú r   r:   r   rm   Ú
arrayprintr	   Ú__all__r’   rT   Ú
sctypeDictÚnumfmtr   r   rn   r
   r   r¿   r   r   r   rÜ   r   r   rZ   r4   r&   Ú<module>rþ      s”  ðñó 
Û Ý Ý "å #ç /Ý .ò€ð �*‰*€àØØØØØØØØØØØØØñ€ð( 
�‰€ñ ˆKÓñó ðñ ˆKÓ÷Hð Hó ðHôVGˆR�W‰Wô Gñd ˆKÓôS,ˆwó S,ó ðS,òl	ñ ˆKÓØ:>ØAEò[ó ð[ñ| ˆKÓØEIØ6:òUó ðUñp ˆKÓØEIØAEòNó ðNò`ñ ˆKÓØ;?Ø?Còkó ðkñ\ ˆKÓØGKØGKòR"ó ñR"r4   