Ë
    /æj�’  ã                   óä  — d 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
 dd	lmZ dd
l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d„ Z ed«       G d„ d«      «       Z G d„ dej0                  «      Z 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)&a‚  
Record Arrays
=============
Record arrays expose the fields of structured arrays as properties.

Most commonly, ndarrays contain elements of a single type, e.g. floats,
integers, bools etc.  However, it is possible for elements to be combinations
of these using structured types, such as::

  >>> a = np.array([(1, 2.0), (1, 2.0)], dtype=[('x', np.int64), ('y', np.float64)])
  >>> a
  array([(1, 2.), (1, 2.)], dtype=[('x', '<i8'), ('y', '<f8')])

Here, each element consists of two fields: x (and int), and y (a float).
This is known as a structured array.  The different fields are analogous
to columns in a spread-sheet.  The different fields can be accessed as
one would a dictionary::

  >>> a['x']
  array([1, 1])

  >>> a['y']
  array([2., 2.])

Record arrays allow us to access fields as properties::

  >>> ar = np.rec.array(a)

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

  >>> ar.y
  array([2., 2.])

é    N)ÚCounter)Únullcontexté   )Ú
set_moduleé   )Únumeric)Únumerictypes)Ú	os_fspath)Ú_get_legacy_print_mode)ÚrecordÚrecarrayÚformat_parserÚ
fromarraysÚfromrecordsÚ
fromstringÚfromfileÚarrayú>ú<ú=Úsú|)ÚbÚlÚnÚBÚLÚNÚSr   r   r   r   r   ÚIÚic                 ó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      úU/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/numpy/core/records.pyÚfind_duplicater(   N   s<   € ô $ D›M×/Ñ/Ó1÷áˆD�&Ø�AŠ:ò 	óð ùó s   �2Únumpyc                   ó,   — 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, a5'``, or
        a list of format description strings  in the form
        ``['f8', 'i4', 'a5']``.
    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
    --------
    dtype, typename, sctype2char

    Examples
    --------
    >>> np.format_parser(['<f8', '<i4', '<a5'], ['col1', 'col2', 'col3'],
    ...                  ['T1', 'T2', 'T3']).dtype
    dtype([(('T1', 'col1'), '<f8'), (('T2', 'col2'), '<i4'), (('T3', 'col3'), 'S5')])

    `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.format_parser(['f8', 'i4', 'a5'], ['col1', 'col2', 'col3'],
    ...                  []).dtype
    dtype([('col1', '<f8'), ('col2', '<i4'), ('col3', '<S5')])
    >>> np.format_parser(['<f8', '<i4', '<a5'], [], []).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__“   s0   € Ø×Ñ˜7 GÔ,Ø×Ñ˜E 6Ô*Ø×Ñ˜)Õ$ó    c           	      ó  — |€t        d«      ‚t        |t        «      rDt        j                  t        |«      D ��cg c]  \  }}dj                  |«      |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 argumentzf{}Úf1r   r   )Ú
ValueErrorÚ
isinstancer$   ÚsbÚdtypeÚ	enumerateÚformatÚfieldsr2   Ú
_f_formatsÚ_offsetsÚlenÚ_nfields)	r0   r1   r4   r!   Úformat_r=   r@   ÚkeysÚkeys	            r'   r-   zformat_parser._parseFormats˜   sé   € ð ˆ?ÜÐ4Ó5Ð5Ü�gœtÔ$Ü—H‘HÜ>GÈÓ>P×Q±
°°7�%—,‘,˜q“/ 7Ò+ÓQØó‰Eô
 —H‘H˜W gÓ.ˆEØ—‘ˆØˆ>Ü—H‘H˜t U˜m˜_¨gÓ6ˆEØ—\‘\ˆFØ�{‰{ˆØ59Ö:¨c˜6 #™; q›>Ò:ˆŒØ37Ö8¨C˜ ™ Q›Ò8ˆŒÜ˜D›	ˆ�ùó Rùò ;ùÚ8s   »C>
Â;DÃD	c                 ó$  — |r‚t        |«      t        t        fv rn9t        |t        «      r|j                  d«      }nt        dt        |«      z  «      ‚|d| j                   D �cg c]  }|j                  «       ‘Œ c}| _
        ng | _
        | xj                  t        t        | j                  «      | j                  «      D �cg c]  }d|z  ‘Œ	 c}z  c_
        t        | j                  «      }|rt        d|z  «      ‚|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 %sNzf%dzDuplicate field names: %s)Útyper$   Útupler;   ÚstrÚsplitÚ	NameErrorÚreprrD   ÚstripÚ_namesÚrangerC   r(   r:   Ú_titles)r0   r2   r3   r   r!   Ú_dups         r'   r.   zformat_parser._setfieldnames­   sP  € ñ Ü�E‹{œt¤U˜mÑ+ØÜ˜E¤3Ô'ØŸ™ CÓ(‘äÐ 8¼4À»;Ñ FÓGÐGà.3°N°T·]±]Ð.CÖD¨˜1Ÿ7™7�9ÒDˆD�KàˆDŒKð 	�Š¬5´°T·[±[Ó1AØ15·±ó,@ö A a˜ ›	ò Añ 	A�ô ˜dŸk™kÓ*ˆÙÜÐ8¸4Ñ?Ó@Ð@áØ/5°n°t·}±}Ð/EÖF¨!˜AŸG™G�IÒ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)r2   r1   Úoffsetsr3   r   )r<   r=   rQ   rA   rB   rS   Ú_byteorderconvÚnewbyteorder)r0   r5   r=   s      r'   r/   zformat_parser._createdtypeÑ   s^   € Ü—‘Ø—[‘[Ø—‘Ø—}‘}Ø—l‘lñ	
ó ˆð Ð Ü& y°¡|Ñ4ˆIØ×&Ñ& yÓ1ˆEàˆ�
r7   )FN)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r6   r-   r.   r/   © r7   r'   r   r   W   s   „ ñ8ót%ó
"ò*"CóHr7   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.
    r)   c                 óZ   •— t        «       dk  r| j                  «       S t        ‰| �  «       S ©Néq   )r   Ú__str__ÚsuperÚ__repr__©r0   Ú	__class__s    €r'   rd   zrecord.__repr__è   s(   ø€ Ü!Ó# sÒ*Ø—<‘<“>Ð!Ü‰wÑÓ!Ð!r7   c                 ól   •— t        «       dk  rt        | j                  «       «      S t        ‰| �  «       S r`   )r   rL   r%   rc   rb   re   s    €r'   rb   zrecord.__str__í   s,   ø€ Ü!Ó# sÒ*Ü�t—y‘y“{Ó#Ð#Ü‰w‰Ó Ð r7   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|z  «      ‚)N©ÚsetfieldÚgetfieldr=   r=   r   ú%'record' object has no attribute '%s')ÚntÚvoidÚ__getattribute__ÚAttributeErrorr@   Úgetrk   r=   r2   Úviewrf   )r0   Ú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ä ð "%Ø'+ñ",ó -ð -s#   ¦A Á	AÁAÂ&B3 Â3CÃ Cc                 óF  — |dv rt        d|z  «      ‚t        j                  j                  | d«      j                  }|j                  |d «      }|r | j                  |g|d d ¢­Ž S t        | |d «      r!t        j                  j                  | ||«      S t        d|z  «      ‚)Nri   zCannot set '%s' attributer=   r   rl   )	rp   rm   rn   ro   r@   rq   rj   ÚgetattrÚ__setattr__)r0   rs   Úvalrt   ru   s        r'   rz   zrecord.__setattr__  s¦   € ØÐ4Ñ4Ü Ð!<¸tÑ!CÓDÐDÜ—G‘G×,Ñ,¨T°7Ó;×BÑBˆ	Ø�m‰m˜D $Ó'ˆÙØ �4—=‘= Ð/ s¨2¨A wÒ/Ð/ä�t˜T 4Ô(Ü—w‘w×*Ñ*¨4°°sÓ;Ð;ä$ð &)Ø+/ñ&0ó 1ð 1r7   c                 óô   — t         j                  j                  | |«      }t        |t         j                  «      r=|j                  j
                  �'|j                  | j                  |j                  f«      S |S r,   )rm   rn   Ú__getitem__r;   r=   r2   rr   rf   )r0   Úindxrv   s      r'   r}   zrecord.__getitem__  sX   € Ü�g‰g×!Ñ! $¨Ó-ˆô �cœ2Ÿ7™7Ô#¨¯	©	¯©Ð(CØ—8‘8˜TŸ^™^¨S¯Y©YÐ7Ó8Ð8ð ˆJr7   c           	      óÄ   — | j                   j                  }t        d„ |D «       «      }d|z  }|D �cg c]  }||t        | |«      fz  ‘Œ }}dj	                  |«      S c c}w )zPretty-print all fields.c              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr,   )rC   )Ú.0Únames     r'   ú	<genexpr>z record.pprint.<locals>.<genexpr>'  s   è ø€ Ò1 4”S˜—YÑ1ùs   ‚z%% %ds: %%sú
)r=   r2   Úmaxry   Újoin)r0   r2   ÚmaxlenÚfmtr‚   Úrowss         r'   Úpprintzrecord.pprint#  se   € ð —
‘
× Ñ ˆÜÑ1¨5Ô1Ó1ˆØ˜fÑ$ˆØ>CÖD°d��tœW T¨4Ó0Ð1Ó1ÐDˆÐDØ�y‰y˜‹Ðùò Es   ²A)rY   rZ   r[   r\   rd   rb   ro   rz   r}   rŠ   Ú__classcell__©rf   s   @r'   r   r   ß   s2   ø„ ñð
 €HØ€Jô"ô
!ò
-ò21òör7   r   c                   óX   ‡ — e Zd ZdZd Z dZ	 	 	 d
d„Zd„ Zd„ Zd„ Zˆ fd„Zd„ Z	dd	„Z
ˆ xZS )r   a-  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
    --------
    core.records.fromrecords : Construct a record array from data.
    record : fundamental data-type for `recarray`.
    format_parser : determine a 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``:

    >>> 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')])

    r)   c           	      óò   — |�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   )ÚsubtypeÚshaper=   Úbufr‘   r’   r1   r2   r3   r5   r4   r�   Údescrr0   s                 r'   r”   zrecarray.__new__¢  s†   € ð ÐÜ—H‘H˜U“O‰Eä! '¨5°&¸'À9ÓM×SÑSˆEàˆ;Ü—?‘? 7¨E´F¸E°?È%�?ÓPˆDð
 ˆô —?‘? 7¨E´F¸E°?Ø-0¸Ø.5¸Uð #ó DˆDð ˆr7   c                 óŽ   — | j                   j                  t        ur)| j                   j                  �| j                   | _         y y y r,   )r=   rJ   r   r2   )r0   rv   s     r'   Ú__array_finalize__zrecarray.__array_finalize__³  s7   € Ø�:‰:�?‰?¤&Ñ(¨T¯Z©Z×-=Ñ-=Ð-Ið Ÿ™ˆD�Jð .JÐ(r7   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|z  «      |‚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=   r   zrecarray has no attribute %s©r=   )Úobjectro   rp   r“   r@   Ú	TypeErrorÚKeyErrorrk   r=   r2   Ú
issubclassrJ   rm   rn   rr   )r0   rs   rt   ru   Úerv   s         r'   ro   zrecarray.__getattribute__¹  sò   € ð	Ü×*Ñ*¨4°Ó6Ð6øÜò 	Ùð	úô ×,Ñ,¨T°7Ó;×BÑBˆ	ð	OØ˜D‘/ " 1Ð%‰CøÜœ8Ð$ò 	OÜ Ð!?À$Ñ!FÓGÈQÐNûð	Oúàˆ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|z  «      |‚d }~ww xY w)Nr=   r   z record array has no attribute %s)r    rJ   rm   rn   r2   r<   r=   r   Ú__dict__r�   rz   r“   ro   r@   Ú__delattr__Ú	Exceptionrž   rŸ   rp   rj   )r0   rs   r{   ÚnewattrÚretrt   ru   r¡   s           r'   rz   zrecarray.__setattr__Û  sP  € ð �7Š?œz¨#¯(©(´B·G±GÔ<ÀÇÁÐAVÜ—(‘(œ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Ð$ò 	Ü Ø2°TÑ9óàðûð	ú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œ   )rJ   )rc   r}   r;   r“   r=   r2   rr   rJ   r    rm   rn   )r0   r~   rv   rf   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Ó-Ð-ð ˆJr7   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, rI   )Ú	separatorÚprefixÚsuffixz
[], shape=r„   ú ra   )r=   rJ   r   r    rm   rn   r<   Úsizer–   Úarray2stringrO   rC   r   )r0   Ú
repr_dtyper«   rˆ   ÚlstÚlfs         r'   rd   zrecarray.__repr__  së   € à—Z‘Zˆ
Ø�:‰:�?‰?œfÑ$¬J°t·z±z·±ÌÏÉÔ,Pð �‰¤&Ñ(ÜŸX™X¤r§w¡w°
Ð&;Ó<�
Ø!ˆFØ,‰Cð
 ˆFØ=ˆCð �9‰9�qŠ=˜DŸJ™J¨$Ò.Ü—/‘/Ø ¨V¸CôA‰Cð /ô
 %)¨¯©Ô$4Ð6ˆCà�#”c˜&“k‘/Ñ!ˆÜ!Ó# sÒ*Ø�r‘ˆBØ�c˜2˜zÐ*Ñ*Ð*r7   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=   r   )
r;   Úintr“   ro   r2   r@   rk   r=   rr   rj   )r0   rs   r{   r2   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Ò+Ð+r7   )
NNr   NNNNNFÚCr,   )rY   rZ   r[   r\   r”   rš   ro   rz   r}   rd   rµ   r‹   rŒ   s   @r'   r   r   4  sE   ø„ ñfðT €HØ€JàHLØ15Ø58óò"$ò%òD(ôBò"+÷B,r7   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õ		)ð
 àˆr7   z	numpy.recc                 óÖ  — | 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.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.core.records.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.core.records.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–   r;   r´   r=   r   r2   rC   r:   r   r>   Úndim)Ú	arrayListr=   r–   r1   r2   r3   r4   r5   Úxrv   r˜   rQ   Úd0ÚnnÚ_arrayÚkÚ	testshaper‚   s                     r'   r   r   L  s‰  € ðb )2Ö2 1”—‘˜A•Ð2€IÐ2ô ' uÓ-€Eà€}Ø˜!‘×"Ñ"‰Ü	�Eœ3Ô	Ø�ˆà€˜5˜=ð )2Ö2 �3—9“9Ð2ˆÐ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           	      ó^  — |€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-                  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.core.records.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œ   éÿÿÿÿ.)r1   r–   r2   r3   r4   r5   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 errorr   r¹   )r<   r   r�   rR   r–   Útolistr   r=   r   r   rž   r:   r¾   rC   r;   r´   r   r®   rK   r»   r¼   r½   rr   )ÚrecListr=   r–   r1   r2   r3   r4   r5   rv   r!   Úarrlistr˜   ÚretvalrÆ   rÇ   ru   s                   r'   r   r   «  s�  € ðX €˜5˜=Ü�h‰h�w¤fÔ-ˆÜ;@ÀÇÁÈ2ÁÓ;OÖP°a”2—8‘8˜C  Q ™K×.Ñ.Ó0Õ1ÐPˆÐPÜ˜'¨7¸%ÀuØ!'°ÀIôOð 	Oð ÐÜ—‘œ& %˜Ó)‰ä˜g u¨f°g¸yÓI×OÑOˆð!Ü—‘˜'¨Ô/ˆð* Ð §¡°Ò!6Ø ˆF�Là
�+‰+”hÓ
€Cà€JùòI Qøô ”zÐ"ò ä*¨5Ó1ˆØˆ=Ü˜“LˆEÜ�eœSÔ!Ø�HˆEÜˆu‹:˜Š>ÜÐ<Ó=Ð=Ü˜% Ó'ˆÜ�v—{‘{Ó#ò 	*ˆAÜ˜g a™jÓ)ˆF�1ŠIð	*ô 	�‰ðGä aõ	)ð Šð%ús   º/C<Â5D ÄB(F,Æ+F,c	                 óü   — |€|€t        d«      ‚|�t        j                  |«      }	nt        |||||«      j                  }	|	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.core.records.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.core.records.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.core.records.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)NrÊ   )r—   r‘   )rž   r<   r=   r   Úitemsizer¾   rC   r   )Ú
datastringr=   r–   r‘   r1   r2   r3   r4   r5   r˜   rÐ   rÆ   s               r'   r   r      sŠ   € ðp €}˜˜ÜÐLÓMÐMàÐÜ—‘˜“‰ä˜g u¨f°g¸yÓI×OÑOˆà�~‰~€Hô ' uÓ-€Eà�
ÑÜ�Z“ 6Ñ)¨hÑ6ˆä�e˜U¨
¸6ÔB€FØ€Mr7   c                 óÀ   — | j                  «       }	 | j                  dd«       | j                  «       |z
  | j                  |d«       S # | j                  |d«       w xY w)Nr   r   )ÚtellÚseek)ÚfdÚposs     r'   Úget_remaining_sizer×   K  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        | «      d«      }	|	5 } |dkD  r| j                  |d«       t        | «      }
|�t        j                  |«      }nt        |||||«      j                  }|j                  }t        j                  |«      j                  t         j"                  ¬«      }||z  }|dk  rat%        |«      }|
| z  ||j'                  d	«      <   t)        |«      }t        j                  |«      j                  t         j"                  ¬«      }||z  }||
kD  rt+        d
«      ‚t-        ||«      }| j/                  |j0                  «      }||k7  rt3        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,a5')
    >>> a[5] = (0.5,10,'abcde')
    >>>
    >>> fd=TemporaryFile()
    >>> a = a.newbyteorder('<')
    >>> a.tofile(fd)
    >>>
    >>> _ = fd.seek(0)
    >>> r=np.core.records.fromfile(fd, formats='f8,i4,a5', shape=10,
    ... byteorder='<')
    >>> print(r[5])
    (0.5, 10, 'abcde')
    >>> r.shape
    (10,)
    Nz0fromfile() needs a 'dtype' or 'formats' argument)rÊ   ÚreadintoÚrbr   r   rœ   rÊ   z:Not enough bytes left in file for specified shape and typez%Didn't read as many bytes as expected)rž   r¾   r;   r´   Úhasattrr   Úopenr
   rÔ   r×   r<   r=   r   rÐ   r   Úprodrm   Úintpr$   ÚindexrK   r:   r   rÙ   ÚdataÚOSError)rÕ   r=   r–   r‘   r1   r2   r3   r4   r5   Úctxr®   r˜   rÐ   Ú	shapeprodÚ	shapesizeÚnbytesrÆ   Ú
nbytesreads                     r'   r   r   T  sº  € ð\ €}˜˜ÜÐJÓKÐKô ' uÓ-€Eà€}Ø‰Ü	�Eœ3Ô	Ø�ˆäˆr�:Ôô ˜"‹o‰ô ”9˜R“= $Ó'ˆà	ð C�Ø�AŠ:Ø�G‰G�F˜AÔÜ! "Ó%ˆàÐÜ—H‘H˜U“O‰Eä! '¨5°&¸'À9ÓM×SÑSˆEà—>‘>ˆä—H‘H˜U“O×(Ñ(¬r¯w©wÐ(Ó7ˆ	Ø Ñ(ˆ	Ø�qŠ=Ü˜“KˆEØ%)¨i¨ZÑ%7ˆE�%—+‘+˜b“/Ñ"Ü˜%“LˆEÜŸ™ ›×,Ñ,´2·7±7Ð,Ó;ˆIà˜XÑ%ˆà�DŠ=ÜØPóRð Rô ˜% Ó'ˆØ—[‘[ §¡Ó-ˆ
Ø˜ÒÜÐAÓBÐBð  ÷;Cð@ €M÷ACð@ €Mús   Á"E
F7Æ7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]])
    array([[1, 2, 3],
           [4, 5, 6],
           [7, 8, 9]])

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

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

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

    >>> c.y
    rec.array([ 1.0,  4.0,  9.0], 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)r1   r2   r3   r4   r5   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)r;   rJ   rL   rÛ   r:   r<   r=   r   r   Úbytesr   r$   rK   r   r   rr   Úcopyr   r“   ry   Údictr   )rv   r=   r–   r‘   r’   r1   r2   r3   r4   r5   rê   ÚkwdsÚnewÚ	interfaces                 r'   r   r   ¹  s8  € ôj 
�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œÓ!Ð!r7   )NNNNNFN)NNr   NNNFN)
NNr   NNNNFNT)"r\   r»   Úcollectionsr   Ú
contextlibr   Ú_utilsr   Ú r   r<   r	   rm   Únumpy.compatr
   Ú
arrayprintr   Ú__all__r“   rW   Ú
sctypeDictÚnumfmtr(   r   rn   r   r   r¾   r   r   r   r×   r   r   r]   r7   r'   ú<module>rø      so  ðñ"óF Ý Ý "å Ý Ý  Ý "Ý .ò€ð �*‰*€àØØØØØØØØØØØØØñ€ð( 
�‰€òñ ˆGÓ÷Dð Dó ðDôNKˆR�W‰Wô KôjI,ˆwô I,òX	ñ ˆKÓØ:>ØAEò[ó ð[ñ| ˆKÓØEIØ6:òQó ðQñh ˆKÓØEIØAEòHó ðHòTñ ˆKÓØ;?Ø?Còaó ðañH ˆKÓØGKØGKòQ"ó ñQ"r7   