403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.25
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/numpy/core/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/numpy/core/__pycache__/records.cpython-311.pyc
�

���c����"�dZddlZddlmZddlmZddlmZddlm	Z
ddlmZdd	l
mZdd
lmZgd�ZejZdd
ddd
ddddd
ddddd�Ze
jZd�Zed��Gd�d����ZGd�de
j��ZGd�de��Zd�Zed��		d$d���Zed��		d$d���Zed��		d%d���Zd �Zed��		d%d!���Z ed��		d&d#���Z!dS)'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�)�numeric)�numerictypes)�	os_fspath)�
set_module)�_get_legacy_print_mode)�record�recarray�
format_parser�
fromarrays�fromrecords�
fromstring�fromfile�array�>�<�=�s�|)�b�l�n�B�L�N�Srrrrr�I�ic�X�d�t|�����D��S)z@Find duplication in a list, return a list of duplicated elementsc�$�g|]
\}}|dk�|��S�r�)�.0�item�countss   �4/usr/lib/python3/dist-packages/numpy/core/records.py�
<listcomp>z"find_duplicate.<locals>.<listcomp>Ps-������D�&��A�:�:�	
��:�:�)r�items)�lists r(�find_duplicater-Ns5����#�D�M�M�/�/�1�1����r*�numpyc�.�eZdZdZdd�Zd	d�Zd�Zd�ZdS)
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')])

    FNc��|�||��|�||��|�|��dS�N)�
_parseFormats�_setfieldnames�_createdtype)�self�formats�names�titles�aligned�	byteorders      r(�__init__zformat_parser.__init__�sH�����7�G�,�,�,����E�6�*�*�*����)�$�$�$�$�$r*c���|�td���t|t��r-tjd�t|��D��|��}ntj||��}|j���tjd|fg|��}|j�|j}�fd�|D��|_�fd�|D��|_	t|��|_dS)z Parse the field formats NzNeed formats argumentc�B�g|]\}}d�|��|f��S)zf{})�format)r%r �format_s   r(r)z/format_parser._parseFormats.<locals>.<listcomp>�s+��Q�Q�Q�
��7�%�,�,�q�/�/�7�+�Q�Q�Qr*�f1c�,��g|]}�|d��S�rr$�r%�key�fieldss  �r(r)z/format_parser._parseFormats.<locals>.<listcomp>�s!���:�:�:�c�6�#�;�q�>�:�:�:r*c�,��g|]}�|d��Sr#r$rCs  �r(r)z/format_parser._parseFormats.<locals>.<listcomp>�s!���8�8�8�C����Q��8�8�8r*)�
ValueError�
isinstancer,�sb�dtype�	enumeraterEr7�
_f_formats�_offsets�len�_nfields)r5r6r9rJ�keysrEs     @r(r2zformat_parser._parseFormats�s�����?��4�5�5�5��g�t�$�$�	/��H�Q�Q�i��>P�>P�Q�Q�Q����E�E�
�H�W�g�.�.�E�����>��H�t�U�m�_�g�6�6�E��\�F��{��:�:�:�:�T�:�:�:���8�8�8�8�4�8�8�8��
��D�	�	��
�
�
r*c���|r�t|��ttfvrnJt|t��r|�d��}nt
dt|��z���d�|d|j�D��|_	ng|_	|xj	d�tt|j	��|j��D��z
c_	t|j	��}|rtd|z���|rd�|d|j�D��|_n	g|_g}|jt|��kr+|xjdg|jt|��z
zz
c_dSdS)zQconvert input field names into a list and assign to the _names
        attribute �,zillegal input names %sc�6�g|]}|�����Sr$��strip�r%rs  r(r)z0format_parser._setfieldnames.<locals>.<listcomp>�s ��D�D�D��1�7�7�9�9�D�D�Dr*Nc��g|]}d|z��S)zf%dr$)r%r s  r(r)z0format_parser._setfieldnames.<locals>.<listcomp>�s.��A�A�A�a���	�A�A�Ar*zDuplicate field names: %sc�6�g|]}|�����Sr$rTrVs  r(r)z0format_parser._setfieldnames.<locals>.<listcomp>�s ��F�F�F�!�A�G�G�I�I�F�F�Fr*)�typer,�tuplerH�str�split�	NameError�reprrO�_names�rangerNr-rG�_titles)r5r7r8�_dups    r(r3zformat_parser._setfieldnames�s����
	��E�{�{�t�U�m�+�+���E�3�'�'�
H����C�(�(���� 8�4��;�;� F�G�G�G�D�D�e�N�T�]�N�.C�D�D�D�D�K�K��D�K�	
���A�A�5��T�[�1A�1A�15��,@�,@�A�A�A�	A����d�k�*�*���	A��8�4�?�@�@�@��	�F�F�v�n�t�}�n�/E�F�F�F�D�L�L��D�L��F��=�3�v�;�;�&�&��L�L�T�F�d�m�c�&�k�k�&A�B�B�L�L�L�L�'�&r*c���tj|j|j|j|jd���}|�(t|d}|�|��}||_dS)N)r7r6�offsetsr8r)rIrJr_rLrMra�_byteorderconv�newbyteorder)r5r:rJs   r(r4zformat_parser._createdtype�se�����[����}��l�	
�
����� �&�y��|�4�I��&�&�y�1�1�E���
�
�
r*)FN)F)�__name__�
__module__�__qualname__�__doc__r;r2r3r4r$r*r(r
r
Wsi������8�8�t%�%�%�%�
"�"�"�"�*"C�"C�"C�H����r*r
c�L��eZdZdZdZdZ�fd�Z�fd�Zd�Zd�Zd�Zd�Z	�xZ
S)	rzEA data-type scalar that allows field access as attribute lookup.
    r.c���t��dkr|���St�����S�N�q)r
�__str__�super�__repr__�r5�	__class__s �r(rqzrecord.__repr__�s8���!�#�#�s�*�*��<�<�>�>�!��w�w���!�!�!r*c���t��dkr!t|�����St�����Srm)r
r[r&rprorrs �r(rozrecord.__str__�s>���!�#�#�s�*�*��t�y�y�{�{�#�#�#��w�w��� � � r*c��|dvr tj�||��S	tj�||��S#t$rYnwxYwtj�|d��j}|�|d��}|rW|j|dd��}	|j}n#t$r|cYSwxYw|j�!|�	|j
|jf��S|Std|z���)N��setfield�getfieldrJrJ��%'record' object has no attribute '%s')�nt�void�__getattribute__�AttributeErrorrE�getrxrJr7�viewrs)r5�attr�	fielddict�res�obj�dts      r(r}zrecord.__getattribute__�s)���4�4�4��7�+�+�D�$�7�7�7�	��7�+�+�D�$�7�7�7���	�	�	��D�	�����G�,�,�T�7�;�;�B�	��m�m�D�$�'�'���	-��$�-��R�a�R��)�C�
��Y����!�
�
�
��
�
�
�
�����x�#��x�x����� ;�<�<�<��J� �"%�'+�",�-�-�
-s#�A�
A�A�&B.�.B=�<B=c�\�|dvrtd|z���tj�|d��j}|�|d��}|r|j|g|dd��R�St||d��r!tj�|||��Std|z���)NrvzCannot set '%s' attributerJryrz)	r~r{r|r}rErrw�getattr�__setattr__)r5r��valr�r�s     r(r�zrecord.__setattr__s����4�4�4� �!<�t�!C�D�D�D��G�,�,�T�7�;�;�B�	��m�m�D�$�'�'���	1� �4�=��/�s�2�A�2�w�/�/�/�/��t�T�4�(�(�
1��w�*�*�4��s�;�;�;�$�&)�+/�&0�1�1�1r*c���tj�||��}t|tj��r-|jj�!|�|j|jf��S|Sr1)r{r|�__getitem__rHrJr7r�rs)r5�indxr�s   r(r�zrecord.__getitem__sZ���g�!�!�$��-�-���c�2�7�#�#�	��	��(C��8�8�T�^�S�Y�7�8�8�8��Jr*c�����jj}td�|D����}d|z���fd�|D��}d�|��S)zPretty-print all fields.c3�4K�|]}t|��V��dSr1)rN)r%�names  r(�	<genexpr>z record.pprint.<locals>.<genexpr>'s(����1�1�4�S��Y�Y�1�1�1�1�1�1r*z%% %ds: %%sc�:��g|]}�|t�|��fz��Sr$)r�)r%r��fmtr5s  ��r(r)z!record.pprint.<locals>.<listcomp>)s-���D�D�D�d��t�W�T�4�0�0�1�1�D�D�Dr*�
)rJr7�max�join)r5r7�maxlen�rowsr�s`   @r(�pprintz
record.pprint#sb�����
� ���1�1�5�1�1�1�1�1���f�$��D�D�D�D�D�e�D�D�D���y�y����r*)rgrhrirjrqror}r�r�r��
__classcell__�rss@r(rr�s����������
�H��J�"�"�"�"�"�
!�!�!�!�!�
-�-�-�21�1�1����������r*rc�X��eZdZdZdZdZ			dd�Zd�Zd	�Zd
�Z�fd�Zd�Z	dd
�Z
�xZS)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.NrF�Cc	��|�tj|��}nt||||
|	��j}|�&t�||t
|f|���}
n(t�||t
|f||||���}
|
S)N)�order)�buffer�offset�stridesr�)rIrJr
�ndarray�__new__r)�subtype�shaperJ�bufr�r�r6r7r8r:r9r��descrr5s              r(r�zrecarray.__new__�s������H�U�O�O�E�E�!�'�5�&�'�9�M�M�S�E��;��?�?�7�E�F�E�?�%�?�P�P�D�D��?�?�7�E�F�E�?�-0��.5�U�#�D�D�D��r*c�d�|jjtur|jj�|j|_dSdSdSr1)rJrYrr7)r5r�s  r(�__array_finalize__zrecarray.__array_finalize__�s8���:�?�&�(�(�T�Z�-=�-I���D�J�J�J�)�(�-I�-Ir*c��	t�||��S#t$rYnwxYwt�|d��j}	||dd�}n,#t
tf$r}td|z��|�d}~wwxYw|j|�}|jj	�Mt|jjtj
��r'|�|jj|jf���S|S|�t��S)NrJryzrecarray has no attribute %s�rJ)�objectr}r~r�rE�	TypeError�KeyErrorrxrJr7�
issubclassrYr{r|r�)r5r�r�r��er�s      r(r}zrecarray.__getattribute__�s��	��*�*�4��6�6�6���	�	�	��D�	�����,�,�T�7�;�;�B�	�	O��D�/�"�1�"�%�C�C���8�$�	O�	O�	O� �!?�$�!F�G�G�Q�N�����	O�����d�m�S�!���9�?�&��#�)�.�"�'�2�2�
D��x�x�t�z���	�&B�x�C�C�C��J��8�8�G�$�$�$s$��
*�*�A�B�0B�Bc��|dkrAt|jtj��r"|j�tjt|f��}||jv}	t�
|||��}t�|d��j
pi}||vr|S|r/	t�||��nJ#t$r|cYSwxYwn7#t$r*t�|d��j
pi}||vr�YnwxYw	||dd�}n,#t t"f$r}t%d|z��|�d}~wwxYw|j|g|�R�S)NrJryz record array has no attribute %s)r�rYr{r|r7rIrJr�__dict__r�r�r�r}rE�__delattr__�	Exceptionr�r�r~rw)r5r�r��newattr�retr�r�r�s        r(r�zrecarray.__setattr__�s����7�?�?�z�#�(�B�G�<�<�?���AV��(�F�C�=�)�)�C��d�m�+��	��$�$�T�4��5�5�C� �0�0��w�?�?�F�L�"�I��9�$�$��
��
���&�&�t�T�2�2�2�2�� �����J�J�J�����
���	�	�	��0�0��w�?�?�F�L�"�I��9�$�$��%�$�	����	��D�/�"�1�"�%�C�C���8�$�	�	�	� �2�T�9����
�����	�����t�}�S�'�3�'�'�'�'s<�C�B5�5C�C�1C<�;C<�D�D:�"D5�5D:c���t���|��}t|t��r�|jj�o|�t|����}t|jjtj
��r'|�|jj|jf���S|S|�t���S|S)Nr�)rY)rpr�rHr�rJr7r�rYr�r{r|)r5r�r�rss   �r(r�zrecarray.__getitem__�s�����g�g�!�!�$�'�'���c�7�#�#�
	��y��*��h�h�t�D�z�z�*�*���c�i�n�b�g�6�6�H��8�8�4�:�?�C�I�*F�8�G�G�G��
��x�x�W�x�-�-�-��Jr*c���|j}|jjtus$t|jjtj��s3|jtur t
jtj|f��}d}d}nd}d}|jdks|jdkrt
j	|d|d�	��}nd
t|j����}ddt|��zz}t��d
krd|z}||||fzS)Nz
rec.array(zrec.array(%s,%sdtype=%s)zarray(z)array(%s,%sdtype=%s).view(numpy.recarray)rrBz, rR)�	separator�prefix�suffixz
[], shape=r�� rn)
rJrYrr�r{r|rI�sizer��array2stringr^rNr
)r5�
repr_dtyper�r��lst�lfs      r(rqzrecarray.__repr__
s���Z�
��:�?�f�$�$�J�t�z����,P�,P�$���&�(�(��X�r�w�
�&;�<�<�
�!�F�,�C�C�
�F�=�C��9�q�=�=�D�J�$�.�.��/���V�C�A�A�A�C�C�/�
%)���$4�$4�$4�6�C�
�#�c�&�k�k�/�
!��!�#�#�s�*�*��r��B��c�2�z�*�*�*r*c�`�t|t��r(t�|d��j}||}t�|d��j}||dd�}|�2|j|�}|jj�|S|�t��S|j	|g|�R�S)NrJry)
rH�intr�r}r7rErxrJr�rw)r5r�r�r7r�r�r�s       r(�fieldzrecarray.field.s����d�C� � �	��,�,�T�7�;�;�A�E���;�D��,�,�T�7�;�;�B�	���o�b�q�b�!���;��$�-��%�C��y��*��
��8�8�G�$�$�$� �4�=��+�s�+�+�+�+r*)
NNrNNNNNFr�r1)rgrhrirjr�r�r}r�r�rqr�r�r�s@r(rr4s��������f�f�T�H��J�HL�15�58�����"$�$�$�%�%�%�D(�(�(�B�����"+�+�+�B,�,�,�,�,�,�,�,r*rc�N�|dkrtjdtd���dS|S)Nrz�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�z��
�
N�
�a�		)�	)�	)�	)�
�t��r*z	numpy.recFc��d�|D��}t|��}|�|dj}nt|t��r|f}|�|�d�|D��}|�t	j|��}nt
|||||��j}|j}	t|��t|��krtd���|dj}
t|
��}|dkr|d|�}t||��}t|��D]R\}
}||
j}|jd|j|z
�}|	|
}||krtd|
�d|�d����|||<�S|S)	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')])
    c�6�g|]}tj|����Sr$)rI�asarray)r%�xs  r(r)zfromarrays.<locals>.<listcomp>}s ��2�2�2�1���A���2�2�2r*Nrc��g|]	}|j��
Sr$r�)r%r�s  r(r)zfromarrays.<locals>.<listcomp>�s��2�2�2��3�9�2�2�2r*z>mismatch between the number of fields and the number of arrayszarray-shape mismatch in array z ("z"))
r�r�rHr�rIrJr
r7rNrGrrK�ndim)�	arrayListrJr�r6r7r8r9r:r�r_�d0�nn�_array�kr��	testshaper�s                 r(rrLs���b3�2�	�2�2�2�I�
'�u�-�-�E��}��!��"���	�E�3�	�	�������5�=�3�2�	�2�2�2������������g�u�f�g�y�I�I�O��
�[�F��5�z�z�S��^�^�#�#��+�,�,�	,�
�q���B�	�R���B�	�A�v�v��d��s�d���
�e�U�
#�
#�F��I�&�&�����3�
�1�X�]���I�n�s�x�"�}�n�-�	��a�y�������L�a�L�L�D�L�L�L�M�M�M���t����Mr*c	�R��|�Y|�Wtj|t�����fd�t�jd��D��}t|||||||���S|�tjt|f��}	nt|||||��j}		tj||	���}
|�|
j|kr||
_n�#ttf$r�t|��}|�t|��}t|t��r|f}t|��dkrtd���t||	��}t|j��D]}t#||��||<�t%jdt(d	�
��|cYSwxYw|
�t��}
|
S)aCreate 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')])
    Nr�c�l��g|]0}tj�d|f�������1S).)rIr�tolist)r%r r�s  �r(r)zfromrecords.<locals>.<listcomp>�s7���P�P�P�a�2�8�C��Q��K�.�.�0�0�1�1�P�P�Pr*���)r6r�r7r8r9r:rzCan 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 errorryr�)rIrr�r`r�rrJrr
r�rGr�rNrHr�rr�rZr�r�r�r�)�recListrJr�r6r7r8r9r:�arrlistr��retvalr�r�r�r�s              @r(rr�s����X��5�=��h�w�f�-�-�-��P�P�P�P�5���2��;O�;O�P�P�P���'�7�%�u�!'��I�O�O�O�	O�
����&�%��)�)����g�u�f�g�y�I�I�O��!���'��/�/�/��*�����!6�!6� �F�L���+
�z�"����*�5�1�1���=���L�L�E��e�S�!�!�	��H�E��u�:�:��>�>��<�=�=�=��%��'�'���v�{�#�#�	*�	*�A��g�a�j�)�)�F�1�I�I�	�
�
G��a�	)�	)�	)�	)��
�
�
�%����.�+�+�h�
�
�C��Js�B?�?CF
�	F
c	��|�|�td���|�tj|��}	nt|||||��j}	|	j}
t|��}|dvrt
|��|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'
    Nz2fromstring() needs a 'dtype' or 'formats' argument)Nr�)r�r�)r�rIrJr
�itemsizer�rNr)�
datastringrJr�r�r6r7r8r9r:r�r�r�s            r(rrs���p
�}����L�M�M�M�����������g�u�f�g�y�I�I�O���~�H�
'�u�-�-�E��
����Z���6�)�h�6��
�e�U�
�6�
B�
B�
B�F��Mr*c���|���}	|�dd��|���|z
|�|d��S#|�|d��wxYw)Nrry)�tell�seek)�fd�poss  r(�get_remaining_sizer�Ks]��
�'�'�)�)�C��
����1�
�
�
��w�w�y�y�3��
����Q����������Q�������s�,A�A1c	��|�|�td���t|��}|�d}nt|t��r|f}t	|d��rt|��}	nt
t|��d��}	|	5}|dkr|�|d��t|��}
|�tj|��}nt|||||��j}|j
}tj|���t j���}
|
|z}|dkrlt%|��}|
|z||�d	��<t)|��}tj|���t j���}
|
|z}||
krt+d
���t-||��}|�|j��}||krt3d���	ddd��n#1swxYwY|S)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�rbrrr�r�z:Not enough bytes left in file for specified shape and typez%Didn't read as many bytes as expected)r�r�rHr��hasattrr�openrr�r�rIrJr
r�r�prodr{�intpr,�indexrZrGrr��data�OSError)r�rJr�r�r6r7r8r9r:�ctxr�r�r��	shapeprod�	shapesize�nbytesr��
nbytesreads                  r(rrTsI��\
�}����J�K�K�K�
'�u�-�-�E��}����	�E�3�	�	������r�:���(��"�o�o����9�R�=�=�$�'�'��	�C���A�:�:��G�G�F�A����!�"�%�%�����H�U�O�O�E�E�!�'�5�&�'�9�M�M�S�E��>���H�U�O�O�(�(�r�w�(�7�7�	���(�	��q�=�=���K�K�E�%)�i�Z�%7�E�%�+�+�b�/�/�"��%�L�L�E������,�,�2�7�,�;�;�I��X�%���D�=�=��P�R�R�
R��%��'�'���[�[���-�-�
������A�B�B�B� �;C�C�C�C�C�C�C�C�C�C�C����C�C�C�C�@�Ms�?E$G0�0G4�7G4Tc�*�t|td��tf��st|d��r|�|�t	d���i}|�tj|��}n#|�t|||||	��j}n|||||	d�}|�%|�t	d���t|||||���St|t��rt||f||d�|��St|ttf��rBt|dttf��rt|f||d	�|��St|f||d	�|��St|t��r=|�!|j|kr|�|��}n|}|
r|���}|St|d��rt#||||�
��St|t$��rU|�!|j|kr|�|��}n|}|
r|���}|�t��St'|dd��}
|
�t|
t(��st	d���tj|��}|� |j|kr|�|��}|�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)r6r7r8r9r:z"Must define a shape if obj is None)r�r�r�)r�r�r)rJr�)rJr�r��__array_interface__zUnknown input type)rHrYr[r�rGrIrJr
r�bytesrr,rZrrr��copyrr�r��dictr)r�rJr�r�r�r6r7r8r9r:r��kwds�new�	interfaces              r(rr�s���j
�C�$�t�*�*�c�*�	+�	+�:�w�s�J�/G�/G�:��?�u�}��9�:�:�	:��D����������	�	��g�u�f�%�y�2�2�27�	��#�� �"�&�	����{��=��A�B�B�B���u�#�f�g�N�N�N�N�	�C��	�	�%"��#�u�I�E�&�I�I�D�I�I�I�	�C�$���	'�	'�""��c�!�f�u�d�m�,�,�	E��s�E�%�u�E�E��E�E�E��c�D��e�D�D�t�D�D�D�	�C��	"�	"�"���#�)�u�"4�"4��(�(�5�/�/�C�C��C��	��(�(�*�*�C��
�	��j�	!�	!�"���5��f�E�E�E�E�	�C��	!�	!�"���#�)�u�"4�"4��(�(�5�/�/�C�C��C��	��(�(�*�*�C��x�x��!�!�!��C�!6��=�=�	���J�y�$�$?�$?���1�2�2�2��h�s�m�m����#�)�u�"4�"4��(�(�5�/�/�C��x�x��!�!�!r*)NNNNNFN)NNrNNNFN)
NNrNNNNFNT)"rjr��collectionsr�
contextlibr�rrIrr{�numpy.compatr�numpy.core.overridesr	�
arrayprintr
�__all__r�re�
sctypeDict�numfmtr-r
r|rrr�rrrr�rrr$r*r(�<module>r	s���"�"�F����������"�"�"�"�"�"������� � � � � � �"�"�"�"�"�"�+�+�+�+�+�+�.�.�.�.�.�.�����
�*����������������
�
��(
��������G���D�D�D�D�D�D�D���D�NK�K�K�K�K�R�W�K�K�K�jI,�I,�I,�I,�I,�w�I,�I,�I,�X	�	�	���K���:>�AE�[�[�[���[�|��K���EI�6:�Q�Q�Q���Q�h��K���EI�AE�H�H�H���H�T�����K���;?�?C�a�a�a���a�H��K���GK�GK�Q"�Q"�Q"���Q"�Q"�Q"r*

Youez - 2016 - github.com/yon3zu
LinuXploit