Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/lib/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/lib/__pycache__/format.cpython-311.pyc

�

�܋fч���dZddlZddlZddlmZmZddlmZmZm	Z	gZ
hd�ZdZe
e��dzZdZd	Zd
Zddd
d�ZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd(d�Zd�Zd�Zefd�Zefd�Z d�Z!efd�Z"d)d �Z#d*ed"�d#�Z$		d+ed"�d%�Z%d,d'�Z&dS)-a�
Binary serialization

NPY format
==========

A simple format for saving numpy arrays to disk with the full
information about them.

The ``.npy`` format is the standard binary file format in NumPy for
persisting a *single* arbitrary NumPy array on disk. The format stores all
of the shape and dtype information necessary to reconstruct the array
correctly even on another machine with a different architecture.
The format is designed to be as simple as possible while achieving
its limited goals.

The ``.npz`` format is the standard format for persisting *multiple* NumPy
arrays on disk. A ``.npz`` file is a zip file containing multiple ``.npy``
files, one for each array.

Capabilities
------------

- Can represent all NumPy arrays including nested record arrays and
  object arrays.

- Represents the data in its native binary form.

- Supports Fortran-contiguous arrays directly.

- Stores all of the necessary information to reconstruct the array
  including shape and dtype on a machine of a different
  architecture.  Both little-endian and big-endian arrays are
  supported, and a file with little-endian numbers will yield
  a little-endian array on any machine reading the file. The
  types are described in terms of their actual sizes. For example,
  if a machine with a 64-bit C "long int" writes out an array with
  "long ints", a reading machine with 32-bit C "long ints" will yield
  an array with 64-bit integers.

- Is straightforward to reverse engineer. Datasets often live longer than
  the programs that created them. A competent developer should be
  able to create a solution in their preferred programming language to
  read most ``.npy`` files that they have been given without much
  documentation.

- Allows memory-mapping of the data. See `open_memmap`.

- Can be read from a filelike stream object instead of an actual file.

- Stores object arrays, i.e. arrays containing elements that are arbitrary
  Python objects. Files with object arrays are not to be mmapable, but
  can be read and written to disk.

Limitations
-----------

- Arbitrary subclasses of numpy.ndarray are not completely preserved.
  Subclasses will be accepted for writing, but only the array data will
  be written out. A regular numpy.ndarray object will be created
  upon reading the file.

.. warning::

  Due to limitations in the interpretation of structured dtypes, dtypes
  with fields with empty names will have the names replaced by 'f0', 'f1',
  etc. Such arrays will not round-trip through the format entirely
  accurately. The data is intact; only the field names will differ. We are
  working on a fix for this. This fix will not require a change in the
  file format. The arrays with such structures can still be saved and
  restored, and the correct dtype may be restored by using the
  ``loadedarray.view(correct_dtype)`` method.

File extensions
---------------

We recommend using the ``.npy`` and ``.npz`` extensions for files saved
in this format. This is by no means a requirement; applications may wish
to use these file formats but use an extension specific to the
application. In the absence of an obvious alternative, however,
we suggest using ``.npy`` and ``.npz``.

Version numbering
-----------------

The version numbering of these formats is independent of NumPy version
numbering. If the format is upgraded, the code in `numpy.io` will still
be able to read and write Version 1.0 files.

Format Version 1.0
------------------

The first 6 bytes are a magic string: exactly ``\x93NUMPY``.

The next 1 byte is an unsigned byte: the major version number of the file
format, e.g. ``\x01``.

The next 1 byte is an unsigned byte: the minor version number of the file
format, e.g. ``\x00``. Note: the version of the file format is not tied
to the version of the numpy package.

The next 2 bytes form a little-endian unsigned short int: the length of
the header data HEADER_LEN.

The next HEADER_LEN bytes form the header data describing the array's
format. It is an ASCII string which contains a Python literal expression
of a dictionary. It is terminated by a newline (``\n``) and padded with
spaces (``\x20``) to make the total of
``len(magic string) + 2 + len(length) + HEADER_LEN`` be evenly divisible
by 64 for alignment purposes.

The dictionary contains three keys:

    "descr" : dtype.descr
      An object that can be passed as an argument to the `numpy.dtype`
      constructor to create the array's dtype.
    "fortran_order" : bool
      Whether the array data is Fortran-contiguous or not. Since
      Fortran-contiguous arrays are a common form of non-C-contiguity,
      we allow them to be written directly to disk for efficiency.
    "shape" : tuple of int
      The shape of the array.

For repeatability and readability, the dictionary keys are sorted in
alphabetic order. This is for convenience only. A writer SHOULD implement
this if possible. A reader MUST NOT depend on this.

Following the header comes the array data. If the dtype contains Python
objects (i.e. ``dtype.hasobject is True``), then the data is a Python
pickle of the array. Otherwise the data is the contiguous (either C-
or Fortran-, depending on ``fortran_order``) bytes of the array.
Consumers can figure out the number of bytes by multiplying the number
of elements given by the shape (noting that ``shape=()`` means there is
1 element) by ``dtype.itemsize``.

Format Version 2.0
------------------

The version 1.0 format only allowed the array header to have a total size of
65535 bytes.  This can be exceeded by structured arrays with a large number of
columns.  The version 2.0 format extends the header size to 4 GiB.
`numpy.save` will automatically save in 2.0 format if the data requires it,
else it will always use the more compatible 1.0 format.

The description of the fourth element of the header therefore has become:
"The next 4 bytes form a little-endian unsigned int: the length of the header
data HEADER_LEN."

Format Version 3.0
------------------

This version replaces the ASCII string (which in practice was latin1) with
a utf8-encoded string, so supports structured types with any unicode field
names.

Notes
-----
The ``.npy`` format, including motivation for creating it and a comparison of
alternatives, is described in the
:doc:`"npy-format" NEP <neps:nep-0001-npy-format>`, however details have
evolved with time and this document is more current.

�N)�	safe_eval�
drop_metadata)�	isfileobj�	os_fspath�pickle>�descr�shape�
fortran_orders�NUMPY��@i�)z<H�latin1)�<Ir)r�utf8)��r�rr��ri'c�8�|dvrd}t||fz���dS)N)rrrNz>we only support format version (1,0), (2,0), and (3,0), not %s)�
ValueError)�version�msgs  �G/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/lib/format.py�_check_versionr�s0���4�4�4�N�����z�)�*�*�*�5�4�c��|dks|dkrtd���|dks|dkrtd���tt||g��zS)a
 Return the magic string for the given file format version.

    Parameters
    ----------
    major : int in [0, 255]
    minor : int in [0, 255]

    Returns
    -------
    magic : str

    Raises
    ------
    ValueError if the version cannot be formatted.
    r�z&major version must be 0 <= major < 256z&minor version must be 0 <= minor < 256)r�MAGIC_PREFIX�bytes)�major�minors  r�magicr#�s[�� 
�q�y�y�E�C�K�K��A�B�B�B��q�y�y�E�C�K�K��A�B�B�B��%����/�/�/�/rc��t|td��}|dd�tkr#d}t|t|dd�fz���|dd�\}}||fS)z� Read the magic string to get the version of the file format.

    Parameters
    ----------
    fp : filelike object

    Returns
    -------
    major : int
    minor : int
    zmagic stringN���z4the magic string is not correct; expected %r, got %r)�_read_bytes�	MAGIC_LENrr)�fp�	magic_strrr!r"s     r�
read_magicr*�sh���B�	�>�:�:�I���"��~��%�%�D�����i����n�=�=�>�>�>��R�S�S�>�L�E�5��%�<�rc��t|��}||urtjdtd���|j�|jS|jS)a�
    Get a serializable descriptor from the dtype.

    The .descr attribute of a dtype object cannot be round-tripped through
    the dtype() constructor. Simple types, like dtype('float32'), have
    a descr which looks like a record array with one field with '' as
    a name. The dtype() constructor interprets this as a request to give
    a default name.  Instead, we construct descriptor that can be passed to
    dtype().

    Parameters
    ----------
    dtype : dtype
        The dtype of the array that will be written to disk.

    Returns
    -------
    descr : object
        An object that can be passed to `numpy.dtype()` in order to
        replicate the input dtype.

    z`metadata on a dtype is not saved to an npy/npz. Use another format (such as pickle) to store it.r��
stacklevel)r�warnings�warn�UserWarning�namesr�str)�dtype�	new_dtypes  r�dtype_to_descrr5�s\��2�e�$�$�I������
�I�!�a�	1�	1�	1�	1�
�{��
�{���y�rc��t|t��rtj|��St|t��r1t|d��}tj||df��Sg}g}g}g}d}|D]�}t
|��dkr|\}}	t|	��}n)|\}}	}
tjt|	��|
f��}|dko|jtjuo|j	du}|srt|t��r|nd|f\}}|�
|��|�
|��|�
|��|�
|��||jz
}��tj|||||d���S)a.
    Returns a dtype based off the given description.

    This is essentially the reverse of `dtype_to_descr()`. It will remove
    the valueless padding fields created by, i.e. simple fields like
    dtype('float32'), and then convert the description to its corresponding
    dtype.

    Parameters
    ----------
    descr : object
        The object retrieved by dtype.descr. Can be passed to
        `numpy.dtype()` in order to replicate the input dtype.

    Returns
    -------
    dtype : dtype
        The dtype constructed by the description.

    rrr�N)r1�formats�titles�offsets�itemsize)�
isinstancer2�numpyr3�tuple�descr_to_dtype�len�type�voidr1�appendr;)
r�dtr9r1r8r:�offset�field�name�	descr_strr	�is_pad�titles
             rr?r?s���*�%����+��{�5�!�!�!�	�E�5�	!�	!�+�
�E�!�H�
%�
%���{�B��a��>�*�*�*�
�F��E��G��G�
�F������u�:�:��?�?�#�O�D�)��	�*�*�B�B�%*�"�D�)�U���n�Y�7�7��?�@�@�B��"�*�K���E�J�!6�K�2�8�t�;K���	#�",�T�5�"9�"9�K�$�$��d�|�K�E�4��M�M�%� � � ��L�L������N�N�2�����N�N�6�"�"�"��"�+�����;��7�f�#*��@�@�A�A�Arc��d|ji}|jjrd|d<n|jjrd|d<nd|d<t	|j��|d<|S)a Get the dictionary of header metadata from a numpy.ndarray.

    Parameters
    ----------
    array : numpy.ndarray

    Returns
    -------
    d : dict
        This has the appropriate entries for writing its string representation
        to the header of the file.
    r	Fr
Tr)r	�flags�c_contiguous�f_contiguousr5r3)�array�ds  r�header_data_from_array_1_0rQRsh��
�%�+��A��{��#�"��/���	��	!�#�!��/���
#��/�����,�,�A�g�J��Hrc��ddl}|�J�t|\}}|�|��}t|��dz}tt
|�|��z|ztzz
}	t|�|�|||z��z}n4#|j	$r'd�
||��}t|��d�wxYw||zd|zzdzS)zO
    Takes a stringified header, and attaches the prefix and padding to it
    rNrz'Header length {} too big for version={}� �
)�struct�_header_size_info�encoder@�ARRAY_ALIGNr'�calcsizer#�pack�error�formatr)	�headerrrU�fmt�encoding�hlen�padlen�
header_prefixrs	         r�_wrap_headerrcns����M�M�M�����%�g�.�M�C��
�]�]�8�
$�
$�F��v�;�;��?�D�
�Y�����)=�)=�=��D��S�
T�F�(��w��&�+�+�c�4�&�=�*I�*I�I�
�
���<�(�(�(�7�>�>�t�W�M�M����o�o�4�'�(�����6�!�D��K�/�%�7�7s�1#B�1Cc��	t|d��S#t$rYnwxYw	t|d��}tjdtd���|S#t
$rYnwxYwt|d��}tjdtd���|S)zT
    Like `_wrap_header`, but chooses an appropriate version given the contents
    rrz>Stored array in format 2.0. It can only beread by NumPy >= 1.9rr,rz@Stored array in format 3.0. It can only be read by NumPy >= 1.17)rcrr.r/r0�UnicodeEncodeError)r]�rets  r�_wrap_header_guess_versionrg�s���
��F�F�+�+�+���
�
�
���
������6�6�*�*��	�
�-�.9�a�	I�	I�	I�	I��
���
�
�
���
�����&�&�
)�
)�F��M�*�+6�1�F�F�F�F��Ms��
��A�
A�Ac
��dg}t|�����D].\}}|�d|�dt|���d����/|�d��d�|��}|d}|dt|��d	kr4ttt||d
rdnd	����z
nd	zz
}|�t|��}nt||��}|�	|��dS)
a� Write the header for an array and returns the version used

    Parameters
    ----------
    fp : filelike object
    d : dict
        This has the appropriate entries for writing its string representation
        to the header of the file.
    version : tuple or None
        None means use oldest that works. Providing an explicit version will
        raise a ValueError if the format does not allow saving this data.
        Default: None
    �{�'z': z, �}r7r	� rr
���N)
�sorted�itemsrC�repr�joinr@�GROWTH_AXIS_MAX_DIGITSrgrc�write)r(rPrr]�key�valuer	s       r�_write_array_headerrv�s!���U�F��Q�W�W�Y�Y�'�'�9�9�
��U��
�
�
�c�c�c�4��;�;�;�;�7�8�8�8�8�
�M�M�#����
�W�W�V�_�_�F�

�g�J�E�
�c��u�:�:��>�>�-�s�4�
�A�o�&�-�b�b�A�.�4�4�0�0��� �"�"�F���+�F�3�3����f�g�.�.���H�H�V�����rc�(�t||d��dS)z� Write the header for an array using the 1.0 format.

    Parameters
    ----------
    fp : filelike object
    d : dict
        This has the appropriate entries for writing its string
        representation to the header of the file.
    rN�rv�r(rPs  r�write_array_header_1_0rz�s����A�v�&�&�&�&�&rc�(�t||d��dS)aQ Write the header for an array using the 2.0 format.
        The 2.0 format allows storing very large structured arrays.

    .. versionadded:: 1.9.0

    Parameters
    ----------
    fp : filelike object
    d : dict
        This has the appropriate entries for writing its string
        representation to the header of the file.
    rNrxrys  r�write_array_header_2_0r|�s����A�v�&�&�&�&�&rc�&�t|d|���S)a�
    Read an array header from a filelike object using the 1.0 file format
    version.

    This will leave the file object located just after the header.

    Parameters
    ----------
    fp : filelike object
        A file object or something with a `.read()` method like a file.

    Returns
    -------
    shape : tuple of int
        The shape of the array.
    fortran_order : bool
        The array data will be written out directly if it is either
        C-contiguous or Fortran-contiguous. Otherwise, it will be made
        contiguous before writing it out.
    dtype : dtype
        The dtype of the file's data.
    max_header_size : int, optional
        Maximum allowed size of the header.  Large headers may not be safe
        to load securely and thus require explicitly passing a larger value.
        See :py:func:`ast.literal_eval()` for details.

    Raises
    ------
    ValueError
        If the data is invalid.

    r�r�max_header_size��_read_array_header�r(rs  r�read_array_header_1_0r��s'��B����A�A�A�Arc�&�t|d|���S)a�
    Read an array header from a filelike object using the 2.0 file format
    version.

    This will leave the file object located just after the header.

    .. versionadded:: 1.9.0

    Parameters
    ----------
    fp : filelike object
        A file object or something with a `.read()` method like a file.
    max_header_size : int, optional
        Maximum allowed size of the header.  Large headers may not be safe
        to load securely and thus require explicitly passing a larger value.
        See :py:func:`ast.literal_eval()` for details.

    Returns
    -------
    shape : tuple of int
        The shape of the array.
    fortran_order : bool
        The array data will be written out directly if it is either
        C-contiguous or Fortran-contiguous. Otherwise, it will be made
        contiguous before writing it out.
    dtype : dtype
        The dtype of the file's data.

    Raises
    ------
    ValueError
        If the data is invalid.

    rr~r�r�s  r�read_array_header_2_0r�s'��F����A�A�A�Arc��ddl}ddlm}g}d}|�||��j��D]F}|d}|d}|r||jkr|dkr�&|�|��||jk}�G|�|��S)a6Clean up 'L' in npz header ints.

    Cleans up the 'L' in strings representing integers. Needed to allow npz
    headers produced in Python2 to be read in Python3.

    Parameters
    ----------
    s : string
        Npy file header.

    Returns
    -------
    header : str
        Cleaned up header.

    rN)�StringIOFr�L)	�tokenize�ior��generate_tokens�readline�NAMErC�NUMBER�
untokenize)�sr�r��tokens�last_token_was_number�token�
token_type�token_strings        r�_filter_headerr�(s���"�O�O�O�������
�F�!���)�)�(�(�1�+�+�*>�?�?�	@�	@���1�X�
��Q�x��!�	!��h�m�+�+���#�#���M�M�%� � � �!+�x��!>������v�&�&�&rc��ddl}t�|��}|�"td�|�����|\}}t||�|��d��}|�||��d}t||d��}	|	�|��}	t|	��|kr tdt|	���d����	t|	��}
n�#t$r�}|dkrst|	��}		t|	��}
tjd	td
���n\#t$r*}d}
t|
�|	����|�d}~wwxYwd}
t|
�|	����|�Yd}~nd}~wwxYwt!|
t"��s$d
}
t|
�|
�����t$|
���krEt)|
�����}d}
t|
�|�����t!|
dt*��rt-d�|
dD����s*d}
t|
�|
d�����t!|
dt.��s*d}
t|
�|
d�����	t1|
d��}n=#t2$r0}d}
t|
�|
d����|�d}~wwxYw|
d|
d|fS)z#
    see read_array_header_1_0
    rNzInvalid version {!r}zarray header lengthzarray headerzHeader info length (z�) is large and may not be safe to load securely.
To allow loading, adjust `max_header_size` or fully trust the `.npy` file using `allow_pickle=True`.
For safety against large resource use or crashes, sandboxing may be necessary.rz�Reading `.npy` or `.npz` file required additional header parsing as it was created on Python 2. Save the file again to speed up loading and avoid this warning.�r,zCannot parse header: {!r}z Header is not a dictionary: {!r}z.Header does not contain the correct keys: {!r}r	c3�@K�|]}t|t��V��dS�N)r<�int)�.0�xs  r�	<genexpr>z%_read_array_header.<locals>.<genexpr>�s,����;�;�1�J�q�#�&�&�;�;�;�;�;�;rzshape is not valid: {!r}r
z'fortran_order is not a valid bool: {!r}rz+descr is not a valid dtype descriptor: {!r})rUrV�getrr\r&rY�unpack�decoder@r�SyntaxErrorr�r.r/r0r<�dict�
EXPECTED_KEYS�keysrnr>�all�boolr?�	TypeError)r(rrrU�hinfo�hlength_typer_�hlength_str�
header_lengthr]rP�e�e2rr�r3s                rr�r�Ksp���M�M�M��!�!�'�*�*�E��}��/�6�6�w�?�?�@�@�@�"��L�(��b�&�/�/�,�"?�"?�AV�W�W�K��M�M�,��<�<�Q�?�M�
��]�N�
;�
;�F�
�]�]�8�
$�
$�F�
�6�{�{�_�$�$��
 �3�v�;�;�
 �
 �
 �!�!�	!�$8��f�������8�8�8��f���#�F�+�+�F�

/��f�%�%��
�
�M� �A�	/�/�/�/�/��	�
=�
=�
=�1�� ����F�!3�!3�4�4�"�<�����
=����.�C��S�Z�Z��/�/�0�0�a�7�/�/�/�/�/�����8����"�a����(�0������A���'�'�'������� � ��a�f�f�h�h����>������D�)�)�*�*�*�
�q��z�5�)�)�1��;�;��'�
�;�;�;�;�;�1�(������A�g�J�/�/�0�0�0��a��(�$�/�/�9�7������A�o�$6�7�7�8�8�8�8��q��z�*�*�����8�8�8�;������A�g�J�/�/�0�0�a�7�����8����
�W�:�q��)�5�0�0sT�"C2�2
F$�<F�D>�!F�>
E2�%E-�-E2�2(F�F$�,L�
L<�+L7�7L<Tc��t|��t|t|��|��|jdkrd}nt	d|jzd��}|jjr,|std���|�i}tj	||fddi|��dS|j
jr~|j
jsrt|��r|j�|��dSt!j|gd�|d	�
��D]*}|�|�d�����+dSt|��r|�|��dSt!j|gd�|d�
��D]*}|�|�d�����+dS)a'
    Write an array to an NPY file, including a header.

    If the array is neither C-contiguous nor Fortran-contiguous AND the
    file_like object is not a real file object, this function will have to
    copy data in memory.

    Parameters
    ----------
    fp : file_like object
        An open, writable file object, or similar object with a
        ``.write()`` method.
    array : ndarray
        The array to write to disk.
    version : (int, int) or None, optional
        The version number of the format. None means use the oldest
        supported version that is able to store the data.  Default: None
    allow_pickle : bool, optional
        Whether to allow writing pickled data. Default: True
    pickle_kwargs : dict, optional
        Additional keyword arguments to pass to pickle.dump, excluding
        'protocol'. These are only useful when pickling objects in object
        arrays on Python 3 to Python 2 compatible format.

    Raises
    ------
    ValueError
        If the array cannot be persisted. This includes the case of
        allow_pickle=False and array being an object array.
    Various other errors
        If the array contains Python objects as part of its dtype, the
        process of pickling them may raise various errors if the objects
        are not picklable.

    rirz5Object arrays cannot be saved when allow_pickle=FalseN�protocolr)�
external_loop�buffered�zerosize_ok�F)rL�
buffersize�order�C)rrvrQr;�maxr3�	hasobjectrr�dumprLrNrMr�T�tofiler=�nditerrs�tobytes)r(rOr�allow_pickle�
pickle_kwargsr��chunks       r�write_arrayr��s���H�7������6�u�=�=�w�G�G�G��~�����
�
���5�>�9�1�=�=�
��{��-��	3��2�3�3�
3�� ��M���E�2�;�;��;�]�;�;�;�;�;�	��	!�-�%�+�*B�-��R�=�=�	-��G�N�N�2���������!M�!M�!M�)��6�6�6�
-�
-��������s�+�+�,�,�,�,�
-�
-�
�R�=�=�	-��L�L����������!M�!M�!M�)��6�6�6�
-�
-��������s�+�+�,�,�,�,�
-�
-rF�rc��|rd}t|��}t|��t|||���\}}}t|��dkrd}n+tj�|tj���}|jrP|std���|�i}	tj|fi|��}	�n,#t$r}
td|
�d	���|
�d}
~
wwxYwt|��rt	j|||�
��}	n�t	j||���}	|jdkr�t"t%t"|j��z}t'd||��D]\}t%|||z
��}
t)|
|jz��}t+||d��}t	j|||
�
��|	|||
z�<�]|r%|ddd�|	_|	���}	n||	_|	S)
a�
    Read an array from an NPY file.

    Parameters
    ----------
    fp : file_like object
        If this is not a real file object, then this may take extra memory
        and time.
    allow_pickle : bool, optional
        Whether to allow writing pickled data. Default: False

        .. versionchanged:: 1.16.3
            Made default False in response to CVE-2019-6446.

    pickle_kwargs : dict
        Additional keyword arguments to pass to pickle.load. These are only
        useful when loading object arrays saved on Python 2 when using
        Python 3.
    max_header_size : int, optional
        Maximum allowed size of the header.  Large headers may not be safe
        to load securely and thus require explicitly passing a larger value.
        See :py:func:`ast.literal_eval()` for details.
        This option is ignored when `allow_pickle` is passed.  In that case
        the file is by definition trusted and the limit is unnecessary.

    Returns
    -------
    array : ndarray
        The array from the data on disk.

    Raises
    ------
    ValueError
        If the data is invalid, or allow_pickle=False and the file contains
        an object array.

    lr�rr)r3z6Object arrays cannot be loaded when allow_pickle=FalseNz#Unpickling a python object failed: z8
You may need to pass the encoding= option to numpy.load)r3�countz
array datarm)r*rr�r@r=�multiply�reduce�int64r�rr�load�UnicodeErrorr�fromfile�ndarrayr;�BUFFER_SIZE�min�ranger�r&�
frombufferr	�	transpose)r(r�r�rrr	r
r3r�rO�err�max_read_count�i�
read_count�	read_size�datas                r�
read_arrayr��s=��N� � ����n�n�G��7����"4����#:�#:�#:��E�=�%�
�5�z�z�Q��������%�%�e�5�;�%�?�?��
��/ ��	3��2�3�3�
3�� ��M�	B��K��4�4�m�4�4�E�E���	B�	B�	B��,�25�#�#� 8�9�9�>A�
B�����	B�����R�=�=�	O��N�2�U�%�@�@�@�E�E��M�%�u�5�5�5�E��~��!�!�!,��K���0P�0P�!P���q�%��8�8�O�O�A�!$�^�U�Q�Y�!?�!?�J� #�J���$?� @� @�I�&�r�9�l�C�C�D�,1�,<�T��CM�-O�-O�-O�E�!�A�j�L�.�)�)��	 ����"��+�E�K��O�O�%�%�E�E��E�K��Ls�B+�+
C�5C	�	C�r+c�6�t|��rtd���d|vr�t|��tj|��}|jrd}t|���t
t|��||���}tt|��|dz��5}	t|	||��|	���}
ddd��n#1swxYwYn�tt|��d��5}	t|	��}t|��t|	||���\}}}|jrd}t|���|	���}
ddd��n#1swxYwY|rd	}nd
}|dkrd}tj||||||
�
��}|S)a�
    Open a .npy file as a memory-mapped array.

    This may be used to read an existing file or create a new one.

    Parameters
    ----------
    filename : str or path-like
        The name of the file on disk.  This may *not* be a file-like
        object.
    mode : str, optional
        The mode in which to open the file; the default is 'r+'.  In
        addition to the standard file modes, 'c' is also accepted to mean
        "copy on write."  See `memmap` for the available mode strings.
    dtype : data-type, optional
        The data type of the array if we are creating a new file in "write"
        mode, if not, `dtype` is ignored.  The default value is None, which
        results in a data-type of `float64`.
    shape : tuple of int
        The shape of the array if we are creating a new file in "write"
        mode, in which case this parameter is required.  Otherwise, this
        parameter is ignored and is thus optional.
    fortran_order : bool, optional
        Whether the array should be Fortran-contiguous (True) or
        C-contiguous (False, the default) if we are creating a new file in
        "write" mode.
    version : tuple of int (major, minor) or None
        If the mode is a "write" mode, then this is the version of the file
        format used to create the file.  None means use the oldest
        supported version that is able to store the data.  Default: None
    max_header_size : int, optional
        Maximum allowed size of the header.  Large headers may not be safe
        to load securely and thus require explicitly passing a larger value.
        See :py:func:`ast.literal_eval()` for details.

    Returns
    -------
    marray : memmap
        The memory-mapped array.

    Raises
    ------
    ValueError
        If the data or the mode is invalid.
    OSError
        If the file is not found or cannot be opened correctly.

    See Also
    --------
    numpy.memmap

    zZFilename must be a string or a path-like object.  Memmap cannot use existing file handles.�wz6Array can't be memory-mapped: Python objects in dtype.)rr
r	�bN�rbr�r�r�zw+r�)r3r	r��moderE)rrrr=r3r�r�r5�openrrv�tellr*r��memmap)
�filenamer�r3r	r
rrrrPr(rEr��marrays
             r�open_memmapr�LsO��n����G��F�G�G�	G��d�{�{�	�w������E�"�"���?�	"�J�C��S�/�/�!�� ��'�'�'��
�
�
���)�H�%�%�t�C�x�
0�
0�	�B���A�w�/�/�/��W�W�Y�Y�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
�)�H�%�%�t�
,�
,�		�� ��n�n�G��7�#�#�#�*<����+B�+B�+B�'�E�=�%���
&�N�� ��o�o�%��W�W�Y�Y�F�		�		�		�		�		�		�		�		�		�		�		����		�		�		�		���������t�|�|���
�\�(�%�u�E�
�&�"�"�"�F��Ms%�&C�C�C�8A!E%�%E)�,E)�ran out of datac�Z�t��}		|�|t|��z
��}||z
}t|��dkst|��|krnn#t$rYnwxYw�dt|��|kr$d}t	|||t|��fz���|S)a+
    Read from file-like object until size bytes are read.
    Raises ValueError if not EOF is encountered before size bytes are read.
    Non-blocking objects only supported if they derive from io objects.

    Required as e.g. ZipExtFile in python 2.6 can return less data than
    requested.
    Trz)EOF: reading %s, expected %d bytes got %d)r �readr@�BlockingIOErrorr)r(�size�error_templater��rrs      rr&r&�s����7�7�D�
�	�����s�4�y�y�(�)�)�A��A�I�D��1�v�v��{�{�c�$�i�i�4�/�/��0���	�	�	��D�	����
��4�y�y�D���9������c�$�i�i�@�@�A�A�A��s�AA#�#
A0�/A0r�)NTN)FN)r�NNFN)r�)'�__doc__r=r.�numpy.lib.utilsrr�numpy.compatrrr�__all__r�rr@r'rXr�rrrV�_MAX_HEADER_SIZErr#r*r5r?rQrcrgrvrzr|r�r�r�r�r�r�r�r&�rr�<module>r�sw��b�b�F
��������4�4�4�4�4�4�4�4�����������

��4�3�3�
����C�����!�	�������

��������+�+�+�
0�0�0�,���(%�%�%�N6A�6A�6A�p
�
�
�88�8�8�0���0!�!�!�!�F
'�
'�
'�
'�
'�
'�/?�"A�"A�"A�"A�H/?�$A�$A�$A�$A�N '� '� '�F5E�M1�M1�M1�M1�^E-�E-�E-�E-�Pg�/�g�g�g�g�g�T8<�-1�h� 0�h�h�h�h�h�V�����r

Hacked By AnonymousFox1.0, Coded By AnonymousFox