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__/npyio.cpython-311.pyc

�

�܋f$|��p�ddlZddlZddlZddlZddlZddlZddlZddlZddlmZm	Z
mZddlm
Z
ddlZddlmZddlmZddlmZddlmZmZdd	lmZdd
lmZmZddlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0gd
�Z1ej2ej3d���Z3Gd�d��Z4d�Z5Gd�de
��Z6ed��		d?ej7d�d���Z8d@d�Z9e3e9��dAd���Z:d�Z;e3e;��d���Z<d�Z=e3e=��d���Z>dBd �Z?d!�Z@d"eAfd#�ZBd$ZCdCd&�ZDd'�ZEd$ZCd(d)d*d+ddddddejFd,d-�d.�ZGeed��eHd)ddddddd,df
ddd/�d0�����ZIe3��eI��ZJ			dDd1�ZKe3eK��		dEd7���ZLed��dFd8���ZMeed��eHd)dddddddddd5�NeOe jP����d9ddd:dddddd,fddd;�d<�����ZQe3��eQ��ZRd=�ZSd>�ZTdS)G�N)�
itemgetter�index�methodcaller)�Mapping�)�format)�
DataSource)�	overrides)�packbits�
unpackbits)�_load_from_filelike)�set_array_function_like_doc�
set_module)�LineSplitter�
NameValidator�StringConverter�ConverterError�ConverterLockError�ConversionWarning�_is_string_like�has_nested_fields�
flatten_dtype�
easy_dtype�_decode_line)�asbytes�asstr�	asunicode�	os_fspath�os_PathLike�pickle)
�savetxt�loadtxt�
genfromtxt�
recfromtxt�
recfromcsv�load�save�savez�savez_compressedrr�	fromregexr	�numpy)�modulec�$�eZdZdZd�Zd�Zd�ZdS)�BagObjam
    BagObj(obj)

    Convert attribute look-ups to getitems on the object passed in.

    Parameters
    ----------
    obj : class instance
        Object on which attribute look-up is performed.

    Examples
    --------
    >>> from numpy.lib.npyio import BagObj as BO
    >>> class BagDemo:
    ...     def __getitem__(self, key): # An instance of BagObj(BagDemo)
    ...                                 # will call this method when any
    ...                                 # attribute look-up is required
    ...         result = "Doesn't matter what you want, "
    ...         return result + "you're gonna get this"
    ...
    >>> demo_obj = BagDemo()
    >>> bagobj = BO(demo_obj)
    >>> bagobj.hello_there
    "Doesn't matter what you want, you're gonna get this"
    >>> bagobj.I_can_be_anything
    "Doesn't matter what you want, you're gonna get this"

    c�8�tj|��|_dS�N)�weakref�proxy�_obj)�self�objs  �F/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/lib/npyio.py�__init__zBagObj.__init__Hs���M�#�&�&��	�	�	�c��	t�|d��|S#t$rt|��d�wxYw)Nr3)�object�__getattribute__�KeyError�AttributeError�r4�keys  r6r;zBagObj.__getattribute__LsM��	0��*�*�4��8�8��=�=���	0�	0�	0� ��%�%�4�/�	0���s� #�>c�v�tt�|d�������S)z�
        Enables dir(bagobj) to list the files in an NpzFile.

        This also enables tab-completion in an interpreter or IPython.
        r3)�listr:r;�keys�r4s r6�__dir__zBagObj.__dir__Rs.���F�+�+�D�&�9�9�>�>�@�@�A�A�Ar8N)�__name__�
__module__�__qualname__�__doc__r7r;rD�r8r6r.r.*sP��������:'�'�'�0�0�0�B�B�B�B�Br8r.c�t�t|d��st|��}ddl}d|d<|j|g|�Ri|��S)z�
    Create a ZipFile.

    Allows for Zip64, and the `file` argument can accept file, str, or
    pathlib.Path objects. `args` and `kwargs` are passed to the zipfile.ZipFile
    constructor.
    �readrNT�
allowZip64)�hasattrr�zipfile�ZipFile)�file�args�kwargsrNs    r6�zipfile_factoryrS[sV���4�� � ��������N�N�N��F�<���7�?�4�1�$�1�1�1�&�1�1�1r8c�p�eZdZdZdZdZdZ		dejd�d�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZdS)�NpzFilea,

    NpzFile(fid)

    A dictionary-like object with lazy-loading of files in the zipped
    archive provided on construction.

    `NpzFile` is used to load files in the NumPy ``.npz`` data archive
    format. It assumes that files in the archive have a ``.npy`` extension,
    other files are ignored.

    The arrays and file strings are lazily loaded on either
    getitem access using ``obj['key']`` or attribute lookup using
    ``obj.f.key``. A list of all files (without ``.npy`` extensions) can
    be obtained with ``obj.files`` and the ZipFile object itself using
    ``obj.zip``.

    Attributes
    ----------
    files : list of str
        List of all files in the archive with a ``.npy`` extension.
    zip : ZipFile instance
        The ZipFile object initialized with the zipped archive.
    f : BagObj instance
        An object on which attribute can be performed as an alternative
        to getitem access on the `NpzFile` instance itself.
    allow_pickle : bool, optional
        Allow loading pickled data. Default: False

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

    pickle_kwargs : dict, optional
        Additional keyword arguments to pass on 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.

    Parameters
    ----------
    fid : file or str
        The zipped archive to open. This is either a file-like object
        or a string containing the path to the archive.
    own_fid : bool, optional
        Whether NpzFile should close the file handle.
        Requires that `fid` is a file-like object.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()
    >>> x = np.arange(10)
    >>> y = np.sin(x)
    >>> np.savez(outfile, x=x, y=y)
    >>> _ = outfile.seek(0)

    >>> npz = np.load(outfile)
    >>> isinstance(npz, np.lib.npyio.NpzFile)
    True
    >>> npz
    NpzFile 'object' with keys x, y
    >>> sorted(npz.files)
    ['x', 'y']
    >>> npz['x']  # getitem access
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
    >>> npz.f.x  # attribute lookup
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    N�F��max_header_sizec��t|��}|���|_g|_||_||_||_|jD]T}|�d��r#|j�|dd����:|j�|���U||_	t|��|_|r	||_dSdS)N�.npy���)
rS�namelist�_files�files�allow_picklerX�
pickle_kwargs�endswith�append�zipr.�f�fid)r4re�own_fidr_r`rX�_zip�xs        r6r7zNpzFile.__init__�s���
�s�#�#���m�m�o�o�����
�(���.���*�����	%�	%�A��z�z�&�!�!�
%��
�!�!�!�C�R�C�&�)�)�)�)��
�!�!�!�$�$�$�$�����������	��D�H�H�H�	�	r8c��|Sr0rIrCs r6�	__enter__zNpzFile.__enter__�s���r8c�.�|���dSr0��close)r4�exc_type�	exc_value�	tracebacks    r6�__exit__zNpzFile.__exit__�����
�
�����r8c��|j� |j���d|_|j� |j���d|_d|_dS)z"
        Close the file.

        N)rcrmrerdrCs r6rmz
NpzFile.close�sQ��
�8���H�N�N�����D�H��8���H�N�N�����D�H�����r8c�.�|���dSr0rlrCs r6�__del__zNpzFile.__del__�rrr8c�*�t|j��Sr0)�iterr^rCs r6�__iter__zNpzFile.__iter__�s���D�J���r8c�*�t|j��Sr0)�lenr^rCs r6�__len__zNpzFile.__len__�s���4�:���r8c���d}||jvrd}n||jvrd}|dz
}|r�|j�|��}|�ttj����}|���|tjkrA|j�|��}t
j	||j
|j|j���S|j�|��St|�d����)NFTrZ�r_r`rXz is not a file in the archive)r]r^rc�openrKrzr�MAGIC_PREFIXrm�
read_arrayr_r`rXr<)r4r?�member�bytes�magics     r6�__getitem__zNpzFile.__getitem__�s������$�+����F�F�
�D�J�
�
��F��6�M�C��
	B��H�M�M�#�&�&�E��J�J�s�6�#6�7�7�8�8�E��K�K�M�M�M���+�+�+���
�
�c�*�*���(��6:�6G�7;�7I�9=�9M�O�O�O�O�
�x�}�}�S�)�)�)��c�@�@�@�A�A�Ar8c�&�||jvp||jvSr0)r]r^r>s  r6�__contains__zNpzFile.__contains__	s���t�{�"�7�c�T�Z�&7�8r8c��t|jt��r|j}nt|jdd��}d�|jd|j���}t|j��|jkr|dz
}d|�d|��S)N�namer:z, z...zNpzFile z with keys: )�
isinstancere�str�getattr�joinr^�_MAX_REPR_ARRAY_COUNTrz)r4�filename�array_namess   r6�__repr__zNpzFile.__repr__s����d�h��$�$�	;��x�H�H��t�x���:�:�H��i�i��
�+F�D�,F�+F� G�H�H���t�z�?�?�T�7�7�7��5� �K�?�(�?�?�+�?�?�?r8)FFN)rErFrGrHrcrer�r�_MAX_HEADER_SIZEr7rjrqrmrurxr{r�r�r�rIr8r6rUrUjs�������H�H�T�C�
�C���8=�#��!'�!8������*������������ � � ����B�B�B�<9�9�9�@�@�@�@�@r8rUFT�ASCIIrWc	�4�|dvrtd���t||���}tj��5}t	|d��r|}d}	n2|�t
t|��d����}d}	d}
d	}ttj
��}|�|��}
|
std
���|�
t|t|
����d��|
�|
��s|
�|��r6|���t#||	|||���}|cd
d
d
��S|
tj
krM|r'|rd}tj|||���cd
d
d
��Stj||||���cd
d
d
��S|std���	t)j|fi|��cd
d
d
��S#t,$r}t)jd|�d���|�d
}~wwxYw#1swxYwYd
S)a0
    Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files.

    .. warning:: Loading files that contain object arrays uses the ``pickle``
                 module, which is not secure against erroneous or maliciously
                 constructed data. Consider passing ``allow_pickle=False`` to
                 load data that is known not to contain object arrays for the
                 safer handling of untrusted sources.

    Parameters
    ----------
    file : file-like object, string, or pathlib.Path
        The file to read. File-like objects must support the
        ``seek()`` and ``read()`` methods and must always
        be opened in binary mode.  Pickled files require that the
        file-like object support the ``readline()`` method as well.
    mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional
        If not None, then memory-map the file, using the given mode (see
        `numpy.memmap` for a detailed description of the modes).  A
        memory-mapped array is kept on disk. However, it can be accessed
        and sliced like any ndarray.  Memory mapping is especially useful
        for accessing small fragments of large files without reading the
        entire file into memory.
    allow_pickle : bool, optional
        Allow loading pickled object arrays stored in npy files. Reasons for
        disallowing pickles include security, as loading pickled data can
        execute arbitrary code. If pickles are disallowed, loading object
        arrays will fail. Default: False

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

    fix_imports : bool, optional
        Only useful when loading Python 2 generated pickled files on Python 3,
        which includes npy/npz files containing object arrays. If `fix_imports`
        is True, pickle will try to map the old Python 2 names to the new names
        used in Python 3.
    encoding : str, optional
        What encoding to use when reading Python 2 strings. Only useful when
        loading Python 2 generated pickled files in Python 3, which includes
        npy/npz files containing object arrays. Values other than 'latin1',
        'ASCII', and 'bytes' are not allowed, as they can corrupt numerical
        data. Default: 'ASCII'
    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
    -------
    result : array, tuple, dict, etc.
        Data stored in the file. For ``.npz`` files, the returned instance
        of NpzFile class must be closed to avoid leaking file descriptors.

    Raises
    ------
    OSError
        If the input file does not exist or cannot be read.
    UnpicklingError
        If ``allow_pickle=True``, but the file cannot be loaded as a pickle.
    ValueError
        The file contains an object array, but ``allow_pickle=False`` given.
    EOFError
        When calling ``np.load`` multiple times on the same file handle,
        if all data has already been read

    See Also
    --------
    save, savez, savez_compressed, loadtxt
    memmap : Create a memory-map to an array stored in a file on disk.
    lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file.

    Notes
    -----
    - If the file contains pickle data, then whatever object is stored
      in the pickle is returned.
    - If the file is a ``.npy`` file, then a single array is returned.
    - If the file is a ``.npz`` file, then a dictionary-like object is
      returned, containing ``{filename: array}`` key-value pairs, one for
      each file in the archive.
    - If the file is a ``.npz`` file, the returned value supports the
      context manager protocol in a similar fashion to the open function::

        with load('foo.npz') as data:
            a = data['a']

      The underlying file descriptor is closed when exiting the 'with'
      block.

    Examples
    --------
    Store data to disk, and load it again:

    >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]]))
    >>> np.load('/tmp/123.npy')
    array([[1, 2, 3],
           [4, 5, 6]])

    Store compressed data to disk, and load it again:

    >>> a=np.array([[1, 2, 3], [4, 5, 6]])
    >>> b=np.array([1, 2])
    >>> np.savez('/tmp/123.npz', a=a, b=b)
    >>> data = np.load('/tmp/123.npz')
    >>> data['a']
    array([[1, 2, 3],
           [4, 5, 6]])
    >>> data['b']
    array([1, 2])
    >>> data.close()

    Mem-map the stored array, and then access the second row
    directly from disk:

    >>> X = np.load('/tmp/123.npy', mmap_mode='r')
    >>> X[1, :]
    memmap([4, 5, 6])

    )r��latin1r�z.encoding must be 'ASCII', 'latin1', or 'bytes')�encoding�fix_importsrKF�rbTsPKsPKzNo data left in filer)rfr_r`rXNl)�moderXr}z@Cannot load file containing pickled data when allow_pickle=FalsezFailed to interpret file z as a pickle)�
ValueError�dict�
contextlib�	ExitStackrM�
enter_contextr~rrzrrrK�EOFError�seek�min�
startswith�pop_allrU�open_memmapr�r r&�	Exception�UnpicklingError)rP�	mmap_moder_r�r�rXr`�stackrerf�_ZIP_PREFIX�_ZIP_SUFFIX�Nr��ret�es                r6r&r&sR��x�3�3�3��I�J�J�J��(��D�D�D�M�	�	�	�	�.M�5��4�� � �	��C��G�G��%�%�d�9�T�?�?�D�&A�&A�B�B�C��G�$��#����#�$�$����������	3��1�2�2�2�	���#�a��U���$�$�$�a�(�(�(����K�(�(�	M�E�,<�,<�[�,I�,I�	M�
�M�M�O�O�O��#�w�\�(5�*9�;�;�;�C��3.M�.M�.M�.M�.M�.M�.M�.M�4�f�)�
)�
)��
J��,�&+�O��)�$�Y�:I�K�K�K�?.M�.M�.M�.M�.M�.M�.M�.M�D�(��<�7D�9H�J�J�J�E.M�.M�.M�.M�.M�.M�.M�.M�N �
<� �";�<�<�<�
M��{�3�8�8�-�8�8�W.M�.M�.M�.M�.M�.M�.M�.M��X�
M�
M�
M��,�D��D�D�D�F�F�KL�M�����
M����Y.M�.M�.M�.M����.M�.M�.M�.M�.M�.MsB�DH
�,H
�H
�2H
�G"�"
H
�,H�H
�
H
�
H�Hc��|fSr0rI)rP�arrr_r�s    r6�_save_dispatcherr��s	���6�Mr8c	�l�t|d��rtj|��}n9t|��}|�d��s|dz}t|d��}|5}t
j|��}tj	|||t|������ddd��dS#1swxYwYdS)a<
    Save an array to a binary file in NumPy ``.npy`` format.

    Parameters
    ----------
    file : file, str, or pathlib.Path
        File or filename to which the data is saved.  If file is a file-object,
        then the filename is unchanged.  If file is a string or Path, a ``.npy``
        extension will be appended to the filename if it does not already
        have one.
    arr : array_like
        Array data to be saved.
    allow_pickle : bool, optional
        Allow saving object arrays using Python pickles. Reasons for disallowing
        pickles include security (loading pickled data can execute arbitrary
        code) and portability (pickled objects may not be loadable on different
        Python installations, for example if the stored objects require libraries
        that are not available, and not all pickled data is compatible between
        Python 2 and Python 3).
        Default: True
    fix_imports : bool, optional
        Only useful in forcing objects in object arrays on Python 3 to be
        pickled in a Python 2 compatible way. If `fix_imports` is True, pickle
        will try to map the new Python 3 names to the old module names used in
        Python 2, so that the pickle data stream is readable with Python 2.

    See Also
    --------
    savez : Save several arrays into a ``.npz`` archive
    savetxt, load

    Notes
    -----
    For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`.

    Any data saved to the file is appended to the end of the file.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()

    >>> x = np.arange(10)
    >>> np.save(outfile, x)

    >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file
    >>> np.load(outfile)
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])


    >>> with open('test.npy', 'wb') as f:
    ...     np.save(f, np.array([1, 2]))
    ...     np.save(f, np.array([1, 3]))
    >>> with open('test.npy', 'rb') as f:
    ...     a = np.load(f)
    ...     b = np.load(f)
    >>> print(a, b)
    # [1 2] [1 3]
    �writerZ�wb)r��r_r`N)rMr��nullcontextrrar~�np�
asanyarrayr�write_arrayr�)rPr�r_r��file_ctxres      r6r'r'�s��z�t�W���$��)�$�/�/���������}�}�V�$�$�	!��&�=�D���d�#�#��	�H�S��m�C� � ����3��,�)-�+�)F�)F�)F�	H�	H�	H�	H�H�H�H�H�H�H�H�H�H�H�H�H����H�H�H�H�H�Hs�!;B)�)B-�0B-c/�NK�|Ed{V��|���Ed{V��dSr0��values�rPrQ�kwdss   r6�_savez_dispatcherr�&�=�����O�O�O�O�O�O�O��{�{�}�}���������r8c�*�t|||d��dS)a�Save several arrays into a single file in uncompressed ``.npz`` format.

    Provide arrays as keyword arguments to store them under the
    corresponding name in the output file: ``savez(fn, x=x, y=y)``.

    If arrays are specified as positional arguments, i.e., ``savez(fn,
    x, y)``, their names will be `arr_0`, `arr_1`, etc.

    Parameters
    ----------
    file : str or file
        Either the filename (string) or an open file (file-like object)
        where the data will be saved. If file is a string or a Path, the
        ``.npz`` extension will be appended to the filename if it is not
        already there.
    args : Arguments, optional
        Arrays to save to the file. Please use keyword arguments (see
        `kwds` below) to assign names to arrays.  Arrays specified as
        args will be named "arr_0", "arr_1", and so on.
    kwds : Keyword arguments, optional
        Arrays to save to the file. Each array will be saved to the
        output file with its corresponding keyword name.

    Returns
    -------
    None

    See Also
    --------
    save : Save a single array to a binary file in NumPy format.
    savetxt : Save an array to a file as plain text.
    savez_compressed : Save several arrays into a compressed ``.npz`` archive

    Notes
    -----
    The ``.npz`` file format is a zipped archive of files named after the
    variables they contain.  The archive is not compressed and each file
    in the archive contains one variable in ``.npy`` format. For a
    description of the ``.npy`` format, see :py:mod:`numpy.lib.format`.

    When opening the saved ``.npz`` file with `load` a `NpzFile` object is
    returned. This is a dictionary-like object which can be queried for
    its list of arrays (with the ``.files`` attribute), and for the arrays
    themselves.

    Keys passed in `kwds` are used as filenames inside the ZIP archive.
    Therefore, keys should be valid filenames; e.g., avoid keys that begin with
    ``/`` or contain ``.``.

    When naming variables with keyword arguments, it is not possible to name a
    variable ``file``, as this would cause the ``file`` argument to be defined
    twice in the call to ``savez``.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()
    >>> x = np.arange(10)
    >>> y = np.sin(x)

    Using `savez` with \*args, the arrays are saved with default names.

    >>> np.savez(outfile, x, y)
    >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file
    >>> npzfile = np.load(outfile)
    >>> npzfile.files
    ['arr_0', 'arr_1']
    >>> npzfile['arr_0']
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    Using `savez` with \**kwds, the arrays are saved with the keyword names.

    >>> outfile = TemporaryFile()
    >>> np.savez(outfile, x=x, y=y)
    >>> _ = outfile.seek(0)
    >>> npzfile = np.load(outfile)
    >>> sorted(npzfile.files)
    ['x', 'y']
    >>> npzfile['x']
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    FN��_savezr�s   r6r(r(+s��h�4��t�U�#�#�#�#�#r8c/�NK�|Ed{V��|���Ed{V��dSr0r�r�s   r6�_savez_compressed_dispatcherr��r�r8c�*�t|||d��dS)a�
    Save several arrays into a single file in compressed ``.npz`` format.

    Provide arrays as keyword arguments to store them under the
    corresponding name in the output file: ``savez(fn, x=x, y=y)``.

    If arrays are specified as positional arguments, i.e., ``savez(fn,
    x, y)``, their names will be `arr_0`, `arr_1`, etc.

    Parameters
    ----------
    file : str or file
        Either the filename (string) or an open file (file-like object)
        where the data will be saved. If file is a string or a Path, the
        ``.npz`` extension will be appended to the filename if it is not
        already there.
    args : Arguments, optional
        Arrays to save to the file. Please use keyword arguments (see
        `kwds` below) to assign names to arrays.  Arrays specified as
        args will be named "arr_0", "arr_1", and so on.
    kwds : Keyword arguments, optional
        Arrays to save to the file. Each array will be saved to the
        output file with its corresponding keyword name.

    Returns
    -------
    None

    See Also
    --------
    numpy.save : Save a single array to a binary file in NumPy format.
    numpy.savetxt : Save an array to a file as plain text.
    numpy.savez : Save several arrays into an uncompressed ``.npz`` file format
    numpy.load : Load the files created by savez_compressed.

    Notes
    -----
    The ``.npz`` file format is a zipped archive of files named after the
    variables they contain.  The archive is compressed with
    ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable
    in ``.npy`` format. For a description of the ``.npy`` format, see
    :py:mod:`numpy.lib.format`.


    When opening the saved ``.npz`` file with `load` a `NpzFile` object is
    returned. This is a dictionary-like object which can be queried for
    its list of arrays (with the ``.files`` attribute), and for the arrays
    themselves.

    Examples
    --------
    >>> test_array = np.random.rand(3, 2)
    >>> test_vector = np.random.rand(4)
    >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector)
    >>> loaded = np.load('/tmp/123.npz')
    >>> print(np.array_equal(test_array, loaded['a']))
    True
    >>> print(np.array_equal(test_vector, loaded['b']))
    True

    TNr�r�s   r6r)r)�s��~�4��t�T�"�"�"�"�"r8c�v�ddl}t|d��s)t|��}|�d��s|dz}|}t	|��D]7\}}	d|z}
|
|���vrt
d|
z���|	||
<�8|r|j}n|j}t|d|���}|�
��D]f\}
}	|
dz}
tj|	��}	|�
|
dd	�
��5}tj||	||���ddd��n#1swxYwY�g|���dS)Nrr�z.npzzarr_%dz,Cannot use un-named variables and keyword %s�w)r��compressionrZT)�force_zip64r�)rNrMrra�	enumeraterBr��ZIP_DEFLATED�
ZIP_STOREDrS�itemsr�r�r~rr�rm)rPrQr��compressr_r`rN�namedict�i�valr?r��zipf�fnameres               r6r�r��s����N�N�N��4��!�!�!�������}�}�V�$�$�	!��&�=�D��H��D�/�/�����3���l���(�-�-�/�/�!�!��>��D�F�F�
F����
�
��)��*����(���4�c�{�C�C�C�D��N�N�$�$�<�<���S��f����m�C� � ��
�Y�Y�u�c�t�Y�
4�
4�	<����s�C�,8�-:�
<�
<�
<�
<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<�	<����	<�	<�	<�	<��
	�J�J�L�L�L�L�Ls�4D�D	� D	c�2�|dvrtd|�����dS)z�Just checks if the param ndmin is supported on
        _ensure_ndmin_ndarray. It is intended to be used as
        verification before running anything expensive.
        e.g. loadtxt, genfromtxt
    )rr�z Illegal value of ndmin keyword: N)r���ndmins r6�!_ensure_ndmin_ndarray_check_paramr��s.��
�I����C�E�C�C�D�D�D��r8r�c���|j|krtj|��}|j|kr:|dkrtj|��}n|dkrtj|��j}|S)aThis is a helper function of loadtxt and genfromtxt to ensure
        proper minimum dimension as requested

        ndim : int. Supported values 1, 2, 3
                    ^^ whenever this changes, keep in sync with
                       _ensure_ndmin_ndarray_check_param
    rr�)�ndimr��squeeze�
atleast_1d�
atleast_2d�T)�ar�s  r6�_ensure_ndmin_ndarrayr��sc��	�v��~�~��J�q�M�M��	�v��~�~��A�:�:��
�a� � �A�A�
�a�Z�Z��
�a� � �"�A��Hr8iP��argumentc��	tj|��n!#t$rt|�d���d�wxYw|dkrt|�d����dS)Nz must be an integerrz must be nonnegative)�operatorr�	TypeErrorr�)�valuer�s  r6�_check_nonneg_intr�sz��@���u�������@�@�@��4�4�4�4�5�5�4�?�@�����q�y�y��D�6�6�6�7�7�7��ys��5c#�K�|D]Q}t|t��r|�|��}|D]}|�|d��d}�|V��RdS)a
    Generator that consumes a line iterated iterable and strips out the
    multiple (or multi-character) comments from lines.
    This is a pre-processing step to achieve feature parity with loadtxt
    (we assume that this feature is a nieche feature).
    rrN)r�r��decode�split)�iterable�commentsr��line�cs     r6�_preprocess_commentsr�sx���������d�E�"�"�	)��;�;�x�(�(�D��	'�	'�A��:�:�a��#�#�A�&�D�D��
�
�
�
��r8�,�#�"�jr�)�	delimiter�comment�quote�imaginary_unit�usecols�	skiplines�max_rows�
convertersr��unpack�dtyper�c�&	��d}
|dkrd}d}
|�td���tj|��}d}|jdvr3|dks|dks|d	ks|d
kr|}tjt��}|�$	t|��}n#t$r|g}YnwxYwt
|	��|�d}n�d|vrtd���t|��}d}t|��d
krd}nlt|��dkr?t|d
t��r#t|d
��dkr
|d
}d}n||vrtd|�d|�d����|�|�td���t|��dkrtd���t|��|�t|��nd}tj��}d}	t|tj��rtj|��}t|t��rStjj�|d|���}|�t+|dd��}tj|��}|}d}n"|�t+|dd��}t/|��}n3#t$r&}tdt1|���d���|�d}~wwxYw|5|�$|rt/|��}d}t3|||��}|�t5|||||||||||||
��
�
��n|rt/|��}d}|dkrd}g}|d
kr�|d
krt6}nt9t6|��}t5|||||||||||||
|���}|�|�|����d
}|d
kr||z}t|��|krn|d
k��t|��dkrt|d��d
kr|d=t|��dkr	|d
�ntj|d
����ddd��n#1swxYwYtA�|	�����j!r1�j!d
d
kr tEj#d |�d!�tHd"�#��|
r(�j}|j%��fd$�|j%D��S�j&S�S)%a�
    Read a NumPy array from a text file.

    Parameters
    ----------
    fname : str or file object
        The filename or the file to be read.
    delimiter : str, optional
        Field delimiter of the fields in line of the file.
        Default is a comma, ','.  If None any sequence of whitespace is
        considered a delimiter.
    comment : str or sequence of str or None, optional
        Character that begins a comment.  All text from the comment
        character to the end of the line is ignored.
        Multiple comments or multiple-character comment strings are supported,
        but may be slower and `quote` must be empty if used.
        Use None to disable all use of comments.
    quote : str or None, optional
        Character that is used to quote string fields. Default is '"'
        (a double quote). Use None to disable quote support.
    imaginary_unit : str, optional
        Character that represent the imaginay unit `sqrt(-1)`.
        Default is 'j'.
    usecols : array_like, optional
        A one-dimensional array of integer column numbers.  These are the
        columns from the file to be included in the array.  If this value
        is not given, all the columns are used.
    skiplines : int, optional
        Number of lines to skip before interpreting the data in the file.
    max_rows : int, optional
        Maximum number of rows of data to read.  Default is to read the
        entire file.
    converters : dict or callable, optional
        A function to parse all columns strings into the desired value, or
        a dictionary mapping column number to a parser function.
        E.g. if column 0 is a date string: ``converters = {0: datestr2num}``.
        Converters can also be used to provide a default value for missing
        data, e.g. ``converters = lambda s: float(s.strip() or 0)`` will
        convert empty fields to 0.
        Default: None
    ndmin : int, optional
        Minimum dimension of the array returned.
        Allowed values are 0, 1 or 2.  Default is 0.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = read(...)``.  When used with a structured
        data-type, arrays are returned for each field.  Default is False.
    dtype : numpy data type
        A NumPy dtype instance, can be a structured dtype to map to the
        columns of the file.
    encoding : str, optional
        Encoding used to decode the inputfile. The special value 'bytes'
        (the default) enables backwards-compatible behavior for `converters`,
        ensuring that inputs to the converter functions are encoded
        bytes objects. The special value 'bytes' has no additional effect if
        ``converters=None``. If encoding is ``'bytes'`` or ``None``, the
        default system encoding is used.

    Returns
    -------
    ndarray
        NumPy array.

    Examples
    --------
    First we create a file for the example.

    >>> s1 = '1.0,2.0,3.0\n4.0,5.0,6.0\n'
    >>> with open('example1.csv', 'w') as f:
    ...     f.write(s1)
    >>> a1 = read_from_filename('example1.csv')
    >>> a1
    array([[1., 2., 3.],
           [4., 5., 6.]])

    The second example has columns with different data types, so a
    one-dimensional array with a structured data type is returned.
    The tab character is used as the field delimiter.

    >>> s2 = '1.0\t10\talpha\n2.3\t25\tbeta\n4.5\t16\tgamma\n'
    >>> with open('example2.tsv', 'w') as f:
    ...     f.write(s2)
    >>> a2 = read_from_filename('example2.tsv', delimiter='\t')
    >>> a2
    array([(1. , 10, b'alpha'), (2.3, 25, b'beta'), (4.5, 16, b'gamma')],
          dtype=[('f0', '<f8'), ('f1', 'u1'), ('f2', 'S5')])
    Fr�NTza dtype must be provided.�SUM�S0�U0�M8�m8�zJcomments cannot be an empty string. Use comments=None to disable comments.rrzComment characters 'z ' cannot include the delimiter '�'z�when multiple comments or a multi-character comment is given, quotes are not supported.  In this case quotechar must be set to None.zlen(imaginary_unit) must be 1.����rt�r�r�r�zGfname must be a string, filehandle, list of strings,
or generator. Got �	 instead.)r�r�r�r�r�r�r�r�r�r��filelike�byte_converters�S)
r�r�r�r�r�r�r�r�r�r�r	r
�c_byte_converters)�axisr�z#loadtxt: input contained no data: "r��)�category�
stacklevelc� ��g|]
}�|��SrIrI)�.0�fieldr�s  �r6�
<listcomp>z_read.<locals>.<listcomp>Cs���5�5�5�5�C��J�5�5�5r8)'r�r�r��kindr:rAr�r��tuplerzr�r�r�r�r��os�PathLike�fspath�lib�_datasourcer~r��closingrw�typer�r
�_loadtxt_chunksizer�rb�astype�concatenater��shape�warnings�warn�UserWarning�namesr�)r�r�r�r�r�r�r�r�r�r�r�r�r�r
�read_dtype_via_object_chunksr��fh_closing_ctxr	�fh�datar�r�chunks�
chunk_size�next_arr�skiprows�dtr�s                           @r6�_readr/2s����x�O��7��������}��3�4�4�4��H�U�O�O�E�#'� ��z�U����T�M�M�U�d�]�]�e�t�m�m�u��}�}�(-�$���� � ����	 ��7�m�m�G�G���	 �	 �	 ��i�G�G�G�	 ����&�e�,�,�,��������=�=��$���
���>�>�����x�=�=�A����H�H�
��]�]�a�
�
��(�1�+�s�+�+�
 ��H�Q�K�0@�0@�A�0E�0E�"�1�+������H�$�$��/�8�/�/�"+�/�/�/���������'�(�(�
(�
�>���a����9�:�:�:��i� � � ����(�#�#�#�#����+�-�-�N��H�@��e�R�[�)�)�	%��I�e�$�$�E��e�S�!�!�	���#�(�(���x�(�H�H�B���"�2�z�8�<�<��'�/��3�3�N��D��H�H���"�5�*�h�?�?����;�;�D����@�@�@��
8�!%�e���
8�
8�
8�9�9�>?�	@�����@����

�>5�>5����
!��D�z�z�� ��'��h��A�A�D�'�/�%��	�7�%�-��9�x�%�U�!�H� /�
1�1�1�C�C��
"��D�z�z�� %��+�s�2�2�$(�!��F��a�-�-��a�<�<�!3�J�J�!$�%7��!B�!B�J�.��I�w�e�#1�#�y�8�)��%��$3�&7�9�9�9���
�
�h�o�o�.J�K�K�L�L�L����q�=�=��
�*�H��x�=�=�:�-�-��1�a�-�-�8�6�{�{�Q���3�v�b�z�?�?�a�#7�#7��2�J��6�{�{�a����Q�i����n�V�!�4�4�4��}>5�>5�>5�>5�>5�>5�>5�>5�>5�>5�>5����>5�>5�>5�>5�H ��5�
1�
1�
1�C�
�y���9�Q�<�1����M�>�e�>�>�>�$��
�
�
�
��	�
�Y��
�8��5�5�5�5�B�H�5�5�5�5��5�L��
s>�4B�
B�B�?B8I8�8
J(�!J#�#J(�-EP�P�P)�	quotechar�likec��|�t|||||||||||	|
���St|t��r|�d��|�tj}|}
|
�+t|
ttf��r|
g}
d�|
D��}
t|t��r|�d��}t|||
|||||||	|
|���}|S)a'
    Load data from a text file.

    Parameters
    ----------
    fname : file, str, pathlib.Path, list of str, generator
        File, filename, list, or generator to read.  If the filename
        extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note
        that generators must return bytes or strings. The strings
        in a list or produced by a generator are treated as lines.
    dtype : data-type, optional
        Data-type of the resulting array; default: float.  If this is a
        structured data-type, the resulting array will be 1-dimensional, and
        each row will be interpreted as an element of the array.  In this
        case, the number of columns used must match the number of fields in
        the data-type.
    comments : str or sequence of str or None, optional
        The characters or list of characters used to indicate the start of a
        comment. None implies no comments. For backwards compatibility, byte
        strings will be decoded as 'latin1'. The default is '#'.
    delimiter : str, optional
        The character used to separate the values. For backwards compatibility,
        byte strings will be decoded as 'latin1'. The default is whitespace.

        .. versionchanged:: 1.23.0
           Only single character delimiters are supported. Newline characters
           cannot be used as the delimiter.

    converters : dict or callable, optional
        Converter functions to customize value parsing. If `converters` is
        callable, the function is applied to all columns, else it must be a
        dict that maps column number to a parser function.
        See examples for further details.
        Default: None.

        .. versionchanged:: 1.23.0
           The ability to pass a single callable to be applied to all columns
           was added.

    skiprows : int, optional
        Skip the first `skiprows` lines, including comments; default: 0.
    usecols : int or sequence, optional
        Which columns to read, with 0 being the first. For example,
        ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns.
        The default, None, results in all columns being read.

        .. versionchanged:: 1.11.0
            When a single column has to be read it is possible to use
            an integer instead of a tuple. E.g ``usecols = 3`` reads the
            fourth column the same way as ``usecols = (3,)`` would.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = loadtxt(...)``.  When used with a
        structured data-type, arrays are returned for each field.
        Default is False.
    ndmin : int, optional
        The returned array will have at least `ndmin` dimensions.
        Otherwise mono-dimensional axes will be squeezed.
        Legal values: 0 (default), 1 or 2.

        .. versionadded:: 1.6.0
    encoding : str, optional
        Encoding used to decode the inputfile. Does not apply to input streams.
        The special value 'bytes' enables backward compatibility workarounds
        that ensures you receive byte arrays as results if possible and passes
        'latin1' encoded strings to converters. Override this value to receive
        unicode arrays and pass strings as input to converters.  If set to None
        the system default is used. The default value is 'bytes'.

        .. versionadded:: 1.14.0
    max_rows : int, optional
        Read `max_rows` rows of content after `skiprows` lines. The default is
        to read all the rows. Note that empty rows containing no data such as
        empty lines and comment lines are not counted towards `max_rows`,
        while such lines are counted in `skiprows`.

        .. versionadded:: 1.16.0

        .. versionchanged:: 1.23.0
            Lines containing no data, including comment lines (e.g., lines
            starting with '#' or as specified via `comments`) are not counted
            towards `max_rows`.
    quotechar : unicode character or None, optional
        The character used to denote the start and end of a quoted item.
        Occurrences of the delimiter or comment characters are ignored within
        a quoted item. The default value is ``quotechar=None``, which means
        quoting support is disabled.

        If two consecutive instances of `quotechar` are found within a quoted
        field, the first is treated as an escape character. See examples.

        .. versionadded:: 1.23.0
    ${ARRAY_FUNCTION_LIKE}

        .. versionadded:: 1.20.0

    Returns
    -------
    out : ndarray
        Data read from the text file.

    See Also
    --------
    load, fromstring, fromregex
    genfromtxt : Load data with missing values handled as specified.
    scipy.io.loadmat : reads MATLAB data files

    Notes
    -----
    This function aims to be a fast reader for simply formatted files.  The
    `genfromtxt` function provides more sophisticated handling of, e.g.,
    lines with missing values.

    Each row in the input text file must have the same number of values to be
    able to read all values. If all rows do not have same number of values, a
    subset of up to n columns (where n is the least number of values present
    in all rows) can be read by specifying the columns via `usecols`.

    .. versionadded:: 1.10.0

    The strings produced by the Python float.hex method can be used as
    input for floats.

    Examples
    --------
    >>> from io import StringIO   # StringIO behaves like a file object
    >>> c = StringIO("0 1\n2 3")
    >>> np.loadtxt(c)
    array([[0., 1.],
           [2., 3.]])

    >>> d = StringIO("M 21 72\nF 35 58")
    >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'),
    ...                      'formats': ('S1', 'i4', 'f4')})
    array([(b'M', 21, 72.), (b'F', 35, 58.)],
          dtype=[('gender', 'S1'), ('age', '<i4'), ('weight', '<f4')])

    >>> c = StringIO("1,0,2\n3,0,4")
    >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True)
    >>> x
    array([1., 3.])
    >>> y
    array([2., 4.])

    The `converters` argument is used to specify functions to preprocess the
    text prior to parsing. `converters` can be a dictionary that maps
    preprocessing functions to each column:

    >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n")
    >>> conv = {
    ...     0: lambda x: np.floor(float(x)),  # conversion fn for column 0
    ...     1: lambda x: np.ceil(float(x)),  # conversion fn for column 1
    ... }
    >>> np.loadtxt(s, delimiter=",", converters=conv)
    array([[1., 3.],
           [3., 5.]])

    `converters` can be a callable instead of a dictionary, in which case it
    is applied to all columns:

    >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE")
    >>> import functools
    >>> conv = functools.partial(int, base=16)
    >>> np.loadtxt(s, converters=conv)
    array([[222., 173.],
           [192., 222.]])

    This example shows how `converters` can be used to convert a field
    with a trailing minus sign into a negative number.

    >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94')
    >>> def conv(fld):
    ...     return -float(fld[:-1]) if fld.endswith(b'-') else float(fld)
    ...
    >>> np.loadtxt(s, converters=conv)
    array([[ 10.01, -31.25],
           [ 19.22,  64.31],
           [-17.57,  63.94]])

    Using a callable as the converter can be particularly useful for handling
    values with different formatting, e.g. floats with underscores:

    >>> s = StringIO("1 2.7 100_000")
    >>> np.loadtxt(s, converters=float)
    array([1.e+00, 2.7e+00, 1.e+05])

    This idea can be extended to automatically handle values specified in
    many different formats:

    >>> def conv(val):
    ...     try:
    ...         return float(val)
    ...     except ValueError:
    ...         return float.fromhex(val)
    >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2")
    >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None)
    array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00])

    Note that with the default ``encoding="bytes"``, the inputs to the
    converter function are latin-1 encoded byte strings. To deactivate the
    implicit encoding prior to conversion, use ``encoding=None``

    >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94')
    >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x)
    >>> np.loadtxt(s, converters=conv, encoding=None)
    array([[ 10.01, -31.25],
           [ 19.22,  64.31],
           [-17.57,  63.94]])

    Support for quoted fields is enabled with the `quotechar` parameter.
    Comment and delimiter characters are ignored when they appear within a
    quoted item delineated by `quotechar`:

    >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n')
    >>> dtype = np.dtype([("label", "U12"), ("value", float)])
    >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"')
    array([('alpha, #42', 10.), ('beta, #64',  2.)],
          dtype=[('label', '<U12'), ('value', '<f8')])

    Quoted fields can be separated by multiple whitespace characters:

    >>> s = StringIO('"alpha, #42"       10.0\n"beta, #64" 2.0\n')
    >>> dtype = np.dtype([("label", "U12"), ("value", float)])
    >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"')
    array([('alpha, #42', 10.), ('beta, #64',  2.)],
          dtype=[('label', '<U12'), ('value', '<f8')])

    Two consecutive quote characters within a quoted field are treated as a
    single escaped character:

    >>> s = StringIO('"Hello, my name is ""Monty""!"')
    >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"')
    array('Hello, my name is "Monty"!', dtype='<U26')

    Read subset of columns when all rows do not contain equal number of values:

    >>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20")
    >>> np.loadtxt(d, usecols=(0, 1))
    array([[ 1.,  2.],
           [ 2.,  4.],
           [ 3.,  9.],
           [ 4., 16.]])

    N)
r�r�r�r�r-r�r�r�r�r�r�c�f�g|].}t|t��r|�d��n|��/S)r�)r�r�r�)rrhs  r6rzloadtxt.<locals>.<listcomp>XsK��P�P�P�BC�*�Q��"6�"6�=�A�H�H�X����A�P�P�Pr8)r�r�r�r�r�r�r�r�r�r�r�)�_loadtxt_with_liker�r�r�r��float64r�r/)r�r�r�r�r�r-r�r�r�r�r�r0r1r�r�s               r6r"r"Js��v��!��%�u�x�9�!�H�g�����	
�
�
�	
��)�U�#�#�#�����"�"�"��}��
���G����g��U�|�,�,�	 ��i�G�P�P�GN�P�P�P���)�U�#�#�/��$�$�X�.�.�	�
��U�G�y�%��7��U�X�!��4�4�4�C�
�Jr8c	��|fSr0rI)	r��X�fmtr��newline�header�footerr�r�s	         r6�_savetxt_dispatcherr<hs��
�4�Kr8�%.18e� �
r�# c		���t|t��rt|��}t|��}Gd�d��}	d}
t|t��rt	|��}t|��rLt
|d�����tj	j
�|d|���}d}
n.t|d��r|	||pd��}ntd	���	tj
|��}|jd
ks|jdkrtd|jz���|jd
krB|jj�tj|��j}d
}n't'|jj��}n
|jd
}tj|��}
t-|��t.t0fvrht'|��|krt3dt5|��z���t|���t9t|����}n�t|t4��rs|�d��}td|z��}|d
kr,|
rd|�d|�d�g|z}n|g|z}|�|��}n,|
r|d|zkr|�|
s||kr|�|}ntd|�����t'|��d
kr4|�dd|z��}|�||z|z��|
r|D]{}g}|D]6}|� |j!��|� |j"���7|t1|��z|z}|�|�dd�����|nl|D]i}	|t1|��z|z}n;#tF$r.}tGdt5|j���d|�d���|�d}~wwxYw|�|���jt'|��d
kr4|�dd|z��}|�||z|z��|
r|���dSdS#|
r|���wwxYw)a�
    Save an array to a text file.

    Parameters
    ----------
    fname : filename or file handle
        If the filename ends in ``.gz``, the file is automatically saved in
        compressed gzip format.  `loadtxt` understands gzipped files
        transparently.
    X : 1D or 2D array_like
        Data to be saved to a text file.
    fmt : str or sequence of strs, optional
        A single format (%10.5f), a sequence of formats, or a
        multi-format string, e.g. 'Iteration %d -- %10.5f', in which
        case `delimiter` is ignored. For complex `X`, the legal options
        for `fmt` are:

        * a single specifier, `fmt='%.4e'`, resulting in numbers formatted
          like `' (%s+%sj)' % (fmt, fmt)`
        * a full string specifying every real and imaginary part, e.g.
          `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns
        * a list of specifiers, one per column - in this case, the real
          and imaginary part must have separate specifiers,
          e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns
    delimiter : str, optional
        String or character separating columns.
    newline : str, optional
        String or character separating lines.

        .. versionadded:: 1.5.0
    header : str, optional
        String that will be written at the beginning of the file.

        .. versionadded:: 1.7.0
    footer : str, optional
        String that will be written at the end of the file.

        .. versionadded:: 1.7.0
    comments : str, optional
        String that will be prepended to the ``header`` and ``footer`` strings,
        to mark them as comments. Default: '# ',  as expected by e.g.
        ``numpy.loadtxt``.

        .. versionadded:: 1.7.0
    encoding : {None, str}, optional
        Encoding used to encode the outputfile. Does not apply to output
        streams. If the encoding is something other than 'bytes' or 'latin1'
        you will not be able to load the file in NumPy versions < 1.14. Default
        is 'latin1'.

        .. versionadded:: 1.14.0


    See Also
    --------
    save : Save an array to a binary file in NumPy ``.npy`` format
    savez : Save several arrays into an uncompressed ``.npz`` archive
    savez_compressed : Save several arrays into a compressed ``.npz`` archive

    Notes
    -----
    Further explanation of the `fmt` parameter
    (``%[flag]width[.precision]specifier``):

    flags:
        ``-`` : left justify

        ``+`` : Forces to precede result with + or -.

        ``0`` : Left pad the number with zeros instead of space (see width).

    width:
        Minimum number of characters to be printed. The value is not truncated
        if it has more characters.

    precision:
        - For integer specifiers (eg. ``d,i,o,x``), the minimum number of
          digits.
        - For ``e, E`` and ``f`` specifiers, the number of digits to print
          after the decimal point.
        - For ``g`` and ``G``, the maximum number of significant digits.
        - For ``s``, the maximum number of characters.

    specifiers:
        ``c`` : character

        ``d`` or ``i`` : signed decimal integer

        ``e`` or ``E`` : scientific notation with ``e`` or ``E``.

        ``f`` : decimal floating point

        ``g,G`` : use the shorter of ``e,E`` or ``f``

        ``o`` : signed octal

        ``s`` : string of characters

        ``u`` : unsigned decimal integer

        ``x,X`` : unsigned hexadecimal integer

    This explanation of ``fmt`` is not complete, for an exhaustive
    specification see [1]_.

    References
    ----------
    .. [1] `Format Specification Mini-Language
           <https://docs.python.org/library/string.html#format-specification-mini-language>`_,
           Python Documentation.

    Examples
    --------
    >>> x = y = z = np.arange(0.0,5.0,1.0)
    >>> np.savetxt('test.out', x, delimiter=',')   # X is an array
    >>> np.savetxt('test.out', (x,y,z))   # x,y,z equal sized 1D arrays
    >>> np.savetxt('test.out', x, fmt='%1.4e')   # use exponential notation

    c�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dS)	�savetxt.<locals>.WriteWrapz0Convert to bytes on bytestream inputs.

        c�:�||_||_|j|_dSr0)r(r��first_write�do_write)r4r(r�s   r6r7z#savetxt.<locals>.WriteWrap.__init__�s���D�G�$�D�M� �,�D�M�M�Mr8c�8�|j���dSr0)r(rmrCs r6rmz savetxt.<locals>.WriteWrap.close�s���G�M�M�O�O�O�O�Or8c�0�|�|��dSr0)rF�r4�vs  r6r�z savetxt.<locals>.WriteWrap.write�s���M�M�!�����r8c���t|t��r|j�|��dS|j�|�|j����dSr0)r�r�r(r��encoder�rIs  r6�write_bytesz&savetxt.<locals>.WriteWrap.write_bytes�sV���!�U�#�#�
7���
�
�a� � � � � ���
�
�a�h�h�t�}�5�5�6�6�6�6�6r8c�T�|j�t|����dSr0)r(r�rrIs  r6�write_normalz'savetxt.<locals>.WriteWrap.write_normals"���G�M�M�)�A�,�,�'�'�'�'�'r8c��	|�|��|j|_dS#t$r%|�|��|j|_YdSwxYwr0)rOr�r�rMrIs  r6rEz&savetxt.<locals>.WriteWrap.first_writesh��
.��!�!�!�$�$�$�!�.��
�
�
���
.�
.�
.�� � ��#�#�#�!�-��
�
�
�
�
.���s�!%�+A�AN)
rErFrGrHr7rmr�rMrOrErIr8r6�	WriteWraprC�sx������	�	�	-�	-�	-�
	�	�	�	�	�	�	7�	7�	7�	(�	(�	(�	.�	.�	.�	.�	.r8rQF�wtrTr�r�z%fname must be a string or file handlerr�z.Expected 1D or 2D array, got %dD array insteadrNzfmt has wrong shape.  %s�%z'fmt has wrong number of %% formats:  %sz (�+zj)z
invalid fmt: r?z+-�-zMismatch between array dtype ('z') and format specifier ('z'))$r�r�rrrrr~rmr�rrrMr��asarrayr�r�r%r�r�rzr!�iscomplexobjrrArr=r�r��map�count�replacer�rb�real�imagr�)r�r7r8r�r9r:r;r�r�rQ�own_fhr(�ncol�iscomplex_Xr�n_fmt_chars�error�row�row2�number�srJr�s                       r6r!r!ns���x�#�u�����C�j�j���i� � �I�.�.�.�.�.�.�.�.�B�F��%��%�%�!��%� � ���u���	B��U�D�����!�!�!�
�V�
�
$�
$�U�D�8�
$�
D�
D�����	���	 �	 �B�
�Y�u�h�2�(�
3�
3����@�A�A�A�F��J�q�M�M��
�6�Q�;�;�!�&�1�*�*��@�1�6�I�K�K�
K�
�V�q�[�[��w�}�$��M�!�$�$�&������1�7�=�)�)����7�1�:�D��o�a�(�(����9�9��u�
�%�%��3�x�x�4���$�%?�#�c�(�(�%J�K�K�K��9�%�%�*�*�3�u�c�?�?�;�;�F�F�
��S�
!�
!�	9��)�)�C�.�.�K��H�3�N�O�O�E��a����)�)�*-�#�#�s�s�s�3�6��=�C�C��'�D�.�C�"����,�,����
���T��!:�!:���"�
��t�(;�(;�������*�#�#�7�8�8�8��v�;�;��?�?��^�^�D�$��/�:�:�F��H�H�X��&��0�1�1�1��	��
/�
/����!�-�-�F��K�K���,�,�,��K�K���,�,�,�,��U�4�[�[�(�7�2��������4��-�-�.�.�.�.�

/��
�
��E���s���+�g�5�A�A�� �E�E�E�#�)�'*�1�7�|�|�|�|�V�V�V�%=�>�>�CD�E�����E�������������v�;�;��?�?��^�^�D�$��/�:�:�F��H�H�X��&��0�1�1�1��	��H�H�J�J�J�J�J�	�	��6�	��H�H�J�J�J�J�	���s2�1JQ�N"�!Q�"
O�,)O�O�A Q�Q-c��d}t|d��s=tj|��}tjj�|d|���}d}	t|tj��stj|��}|j	�td���|���}t|t��r%t|t��rt|��}n9t|t��r$t|t��rt|��}t|d��st!j|��}|�|��}|r^t|d	t&��sCtj||j	d	��}tj||�
��}||_ntj||�
��}||r|���SS#|r|���wwxYw)aq
    Construct an array from a text file, using regular expression parsing.

    The returned array is always a structured array, and is constructed from
    all matches of the regular expression in the file. Groups in the regular
    expression are converted to fields of the structured array.

    Parameters
    ----------
    file : path or file
        Filename or file object to read.

        .. versionchanged:: 1.22.0
            Now accepts `os.PathLike` implementations.
    regexp : str or regexp
        Regular expression used to parse the file.
        Groups in the regular expression correspond to fields in the dtype.
    dtype : dtype or list of dtypes
        Dtype for the structured array; must be a structured datatype.
    encoding : str, optional
        Encoding used to decode the inputfile. Does not apply to input streams.

        .. versionadded:: 1.14.0

    Returns
    -------
    output : ndarray
        The output array, containing the part of the content of `file` that
        was matched by `regexp`. `output` is always a structured array.

    Raises
    ------
    TypeError
        When `dtype` is not a valid dtype for a structured array.

    See Also
    --------
    fromstring, loadtxt

    Notes
    -----
    Dtypes for structured arrays can be specified in several forms, but all
    forms specify at least the data type and field name. For details see
    `basics.rec`.

    Examples
    --------
    >>> from io import StringIO
    >>> text = StringIO("1312 foo\n1534  bar\n444   qux")

    >>> regexp = r"(\d+)\s+(...)"  # match [digits, whitespace, anything]
    >>> output = np.fromregex(text, regexp,
    ...                       [('num', np.int64), ('key', 'S3')])
    >>> output
    array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')],
          dtype=[('num', '<i8'), ('key', 'S3')])
    >>> output['num']
    array([1312, 1534,  444])

    FrKrrTNz$dtype must be a structured datatype.�matchr�r�)rMrrr�rrr~r�r�r%r�rKr�r�rr�re�compile�findallr�arrayrm)	rP�regexpr�r�r]�content�seq�newdtype�outputs	         r6r*r*fs���|�F��4�� � ���y������v�!�&�&�t�T�H�&�E�E������%���*�*�	$��H�U�O�O�E��;���B�C�C�C��)�)�+�+���g�u�%�%�	#�*�V�S�*A�*A�	#��V�_�_�F�F�
���
%�
%�	#�*�V�U�*C�*C�	#��6�]�]�F��v�w�'�'�	(��Z��'�'�F��n�n�W�%�%���	0�z�#�a�&�%�0�0�	0��x��e�k�!�n� 5�6�6�H��X�c��2�2�2�F� �F�L�L��X�c��/�/�/�F���	��J�J�L�L�L�L�	��6�	��J�J�L�L�L�L�	���s
�E;G$�$G=�_zf%i)r�r1c�|"���
��S�T�U�V�W�X�Y�Z�[�\�|�Qt||fid��d|�d|�d��d|�d|�d|�d	|�d
|	�d�
�d|�d
|�d|
�d|�d|�d��d|�d|�d|�d|�d|�d|�d|��St|��|�&|rtd���|dkrtd���|rddlm}m}|pi}t
|t��stdt|��z���|dkrd}d }nd!}t
|t��rt|��}t
|t��r<tjj�|d"|�#��}t#j|��}n|}t#j|��}	t)|��}n3#t$r&} td$t|���d%���| �d} ~ wwxYw|5t+||||�&��}!t-||||
�'��}"	t/���D]�Vt1|���d}#|#sdt3t1|��|��}$�
d ur6|�4||$vr0d(�|$�|��dd���}$|!|$��}#|#�dn-#t8$r d(}$g}#t;jd)|zd*�+��YnwxYw�
d ur#|#d���}%|�|%|vr|#d=|	�U	d,�|	�d-��D��}	n4#t@$r'	tC|	��}	n#t$r|	g}	YnwxYwYnwxYwtE|	p|#��}&�
d ur|"d.�|#D�����
d(}$nEtG�
��r)|"d/��
�d-��D�����
n
�
r|"�
���
��tI���
||||
�0����
�tC�
���
|	r�tK|	��D]H\�V}'tG|'��r�
�&|'��|	�V<�-|'dkr|'tE|#��z|	�V<�I��OtE���|&kr<�j'�Ttj(�Tfd1�|	D�����tC�j)���
n<�
�!tE�
��|&kr�
fd2�|	D���
n�
���tC�j)���
|pd3}(t
|(tT��r|(�+d4��}(d5�t/|&��D��}t
|(t��r�|(�,��D]�\})}*tG|)��r'	�
�&|)��})n#t$rY�7wxYw|	r'	|	�&|)��})n#t$rYnwxYwt
|*tBtZf��r
d6�|*D��}*nt|*��g}*|)�|D]}+|+�.|*�����||)�.|*����n�t
|(tBtZf��r?t_|(|��D]-\},}-t|,��},|,|-vr|-�0|,���.nmt
|(t��r0|(�d-��}.|D]}-|-�.|.���n(|D]%}-|-�.t|(��g���&|}/|/�g}/dg|&z}t
|/t��r|/�,��D]i\})}*tG|)��r'	�
�&|)��})n#t$rY�7wxYw|	r'	|	�&|)��})n#t$rYnwxYw|*||)<�jnJt
|/tBtZf��r(tE|/��}0|0|&kr|/|d|0�<n|/d|&�}n|/g|&z}��d7�t_||��D��}n`tc�d �8��}1tE|1��dkrt_|1||��}2d9�|2D��}nt_||��}2�fd:�|2D��}g}3|�,��D]�\}4�StG|4��r)	�
�&|4��}4|4�Vn;#t$rY�9wxYw|	r'	|	�&|4���Vn#t$rY�bwxYw|4�VtE|$��r	|#|4}5nd}5�StTurtd}6n|rd;�}7tgj4|7�S�<��}6n�S}6|�V�5|6d |5|�V|�V�=��|3�0�V|6f����|�5|3��g�Y�Yj0}8|r	g}9|9j0}:g};|;j0}<tKtmj7|$g|����D]�\�V}=|!|=���\tE�\��}>|>dkr�&|	r3	�\fd>�|	D���\n=#tp$r|<�V�zdz|>f��Y�WwxYw|>|&kr|<�V�zdz|>f���u|8t[�\����|r0|:t[d?�t_�\|��D������tE�Y��|krn��ddd��n#1swxYwY���tK|��D]�\�V}?�Vfd@��YD��}@	|?�9|@���*#tt$r�dA�Vz}Atwty�V���Y��}@tK|@��D]Q\}4},	|?�=|,���#t|tf$r"|AdBz
}A|A|4dz�z|,fz}At}|A���wxYwY��wxYwtE|;��}B|Bdkr�tE�Y��|Bz|z
�WdC|&z�[|dkr.tE�W�fdD�|;D����}C|;d|B|Cz
�};||Cz}�[fdE�|;D��}AtE|A��rX|A�?ddF��dG�|A��}A|rt|A���t;j|At�d*�+��|dkr�Yd|��Y|r|9d|�}9|r0tCt_�YfdH�tK|��D������Yn/tCt_�YfdI�tK|��D������Y�Y}D����dJ�|D��}EdK�tK|E��D���Z|r\�ZrZt;jdLtjAd*�+���ZfdM��U	�UfdN�|DD��}D�ZD]�VtjB|E�V<�n#t�$rYnwxYw|Edd�}FtK|E��D]F\�V}GtjD|GtjE��r"t��VfdO�|DD����}H|G|Hf|F�V<�G�
�tdP�t_||E��D��}ItE|I��dkr|I\}J|Jt�}L}Kn��fdQ�tK|F��D��}K|r�fdR�tK|F��D��}LnPtCt_�
|F����}KtCt_�
t�gtE|F��z����}LtjH|D|K�S���X|rtjH|9|L�S��}M�n�
r�j)��
�_)tE|1��dkr�dTdU�|1D��vr5t����rt�dV���tjH|D��S���Xn5tjH|DdW�|1D���S���Y�Y�K����X|rRtjH|9tj(dX�|1D�����S��}N|���}L|N�K|L��}M�n-|r�d }Og�TtKdY�|D����D]�\�V}P�V|vrb|O|P�j	kz}OtjD|PtjE��r|Pt��VfdZ�|DD����f}P�T�0d(|Pf���k�T�0d(�f����|Os<tE�T��dkrtj(�T���ntj(|P���tjH|D����X|r6�j)�d[��j)D��}Lnt�}LtjH|9|L�S��}M�Xj(j)�
|rJ�
rHt_�
|��D]7\}Q�S�Sfd\��SjLD��}|D]}R|M|Qxx�X|Q|Rkzcc<��8|r�X�K|���X|M�X_Mt��X|�]���X|r8�
��XjOStE�
��dkr�X�
dS�Xfd^��
D��S�XS)_a�
    Load data from a text file, with missing values handled as specified.

    Each line past the first `skip_header` lines is split at the `delimiter`
    character, and characters following the `comments` character are discarded.

    Parameters
    ----------
    fname : file, str, pathlib.Path, list of str, generator
        File, filename, list, or generator to read.  If the filename
        extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note
        that generators must return bytes or strings. The strings
        in a list or produced by a generator are treated as lines.
    dtype : dtype, optional
        Data type of the resulting array.
        If None, the dtypes will be determined by the contents of each
        column, individually.
    comments : str, optional
        The character used to indicate the start of a comment.
        All the characters occurring on a line after a comment are discarded.
    delimiter : str, int, or sequence, optional
        The string used to separate values.  By default, any consecutive
        whitespaces act as delimiter.  An integer or sequence of integers
        can also be provided as width(s) of each field.
    skiprows : int, optional
        `skiprows` was removed in numpy 1.10. Please use `skip_header` instead.
    skip_header : int, optional
        The number of lines to skip at the beginning of the file.
    skip_footer : int, optional
        The number of lines to skip at the end of the file.
    converters : variable, optional
        The set of functions that convert the data of a column to a value.
        The converters can also be used to provide a default value
        for missing data: ``converters = {3: lambda s: float(s or 0)}``.
    missing : variable, optional
        `missing` was removed in numpy 1.10. Please use `missing_values`
        instead.
    missing_values : variable, optional
        The set of strings corresponding to missing data.
    filling_values : variable, optional
        The set of values to be used as default when the data are missing.
    usecols : sequence, optional
        Which columns to read, with 0 being the first.  For example,
        ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns.
    names : {None, True, str, sequence}, optional
        If `names` is True, the field names are read from the first line after
        the first `skip_header` lines. This line can optionally be preceded
        by a comment delimiter. If `names` is a sequence or a single-string of
        comma-separated names, the names will be used to define the field names
        in a structured dtype. If `names` is None, the names of the dtype
        fields will be used, if any.
    excludelist : sequence, optional
        A list of names to exclude. This list is appended to the default list
        ['return','file','print']. Excluded names are appended with an
        underscore: for example, `file` would become `file_`.
    deletechars : str, optional
        A string combining invalid characters that must be deleted from the
        names.
    defaultfmt : str, optional
        A format used to define default field names, such as "f%i" or "f_%02i".
    autostrip : bool, optional
        Whether to automatically strip white spaces from the variables.
    replace_space : char, optional
        Character(s) used in replacement of white spaces in the variable
        names. By default, use a '_'.
    case_sensitive : {True, False, 'upper', 'lower'}, optional
        If True, field names are case sensitive.
        If False or 'upper', field names are converted to upper case.
        If 'lower', field names are converted to lower case.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = genfromtxt(...)``.  When used with a
        structured data-type, arrays are returned for each field.
        Default is False.
    usemask : bool, optional
        If True, return a masked array.
        If False, return a regular array.
    loose : bool, optional
        If True, do not raise errors for invalid values.
    invalid_raise : bool, optional
        If True, an exception is raised if an inconsistency is detected in the
        number of columns.
        If False, a warning is emitted and the offending lines are skipped.
    max_rows : int,  optional
        The maximum number of rows to read. Must not be used with skip_footer
        at the same time.  If given, the value must be at least 1. Default is
        to read the entire file.

        .. versionadded:: 1.10.0
    encoding : str, optional
        Encoding used to decode the inputfile. Does not apply when `fname` is
        a file object.  The special value 'bytes' enables backward compatibility
        workarounds that ensure that you receive byte arrays when possible
        and passes latin1 encoded strings to converters. Override this value to
        receive unicode arrays and pass strings as input to converters.  If set
        to None the system default is used. The default value is 'bytes'.

        .. versionadded:: 1.14.0
    ndmin : int, optional
        Same parameter as `loadtxt`

        .. versionadded:: 1.23.0
    ${ARRAY_FUNCTION_LIKE}

        .. versionadded:: 1.20.0

    Returns
    -------
    out : ndarray
        Data read from the text file. If `usemask` is True, this is a
        masked array.

    See Also
    --------
    numpy.loadtxt : equivalent function when no data is missing.

    Notes
    -----
    * When spaces are used as delimiters, or when no delimiter has been given
      as input, there should not be any missing data between two fields.
    * When the variables are named (either by a flexible dtype or with `names`),
      there must not be any header in the file (else a ValueError
      exception is raised).
    * Individual values are not stripped of spaces by default.
      When using a custom converter, make sure the function does remove spaces.

    References
    ----------
    .. [1] NumPy User Guide, section `I/O with NumPy
           <https://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_.

    Examples
    --------
    >>> from io import StringIO
    >>> import numpy as np

    Comma delimited file with mixed dtype

    >>> s = StringIO(u"1,1.3,abcde")
    >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'),
    ... ('mystring','S5')], delimiter=",")
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', 'S5')])

    Using dtype = None

    >>> _ = s.seek(0) # needed for StringIO example only
    >>> data = np.genfromtxt(s, dtype=None,
    ... names = ['myint','myfloat','mystring'], delimiter=",")
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', 'S5')])

    Specifying dtype and names

    >>> _ = s.seek(0)
    >>> data = np.genfromtxt(s, dtype="i8,f8,S5",
    ... names=['myint','myfloat','mystring'], delimiter=",")
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', 'S5')])

    An example with fixed-width columns

    >>> s = StringIO(u"11.3abcde")
    >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'],
    ...     delimiter=[1,3,5])
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('intvar', '<i8'), ('fltvar', '<f8'), ('strvar', 'S5')])

    An example to show comments

    >>> f = StringIO('''
    ... text,# of chars
    ... hello world,11
    ... numpy,5''')
    >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',')
    array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')],
      dtype=[('f0', 'S12'), ('f1', 'S12')])

    Nr�r�r��skip_header�skip_footerr��missing_values�filling_valuesr�r%�excludelist�deletechars�
replace_space�	autostrip�case_sensitive�
defaultfmtr��usemask�loose�
invalid_raiser�r�r�zPThe keywords 'skip_footer' and 'max_rows' can not be specified at the same time.rz'max_rows' must be at least 1.r)�MaskedArray�make_mask_descrzNThe input argument 'converter' should be a valid dictionary (got '%s' instead)r�TFrrz\fname must be a string, a filehandle, a sequence of strings,
or an iterator of strings. Got r)r�r�r{r�)rxryr|rzrz"genfromtxt: Empty input file: "%s"r�)rc�6�g|]}|�����SrI��strip�rrrs  r6rzgenfromtxt.<locals>.<listcomp>�s ��A�A�A��1�7�7�9�9�A�A�Ar8r�c�P�g|]#}t|�������$SrI)r�r�r�s  r6rzgenfromtxt.<locals>.<listcomp>�s&��#I�#I�#I�q�C����	�	�N�N�#I�#I�#Ir8c�6�g|]}|�����SrIr�r�s  r6rzgenfromtxt.<locals>.<listcomp>�s ��#H�#H�#H�!�A�G�G�I�I�#H�#H�#Hr8)r}r%rxryr|rzc� ��g|]
}�|��SrIrI)rrr�descrs  �r6rzgenfromtxt.<locals>.<listcomp>s���!<�!<�!<�q�%��(�!<�!<�!<r8c� ��g|]
}�|��SrIrI)rrrr%s  �r6rzgenfromtxt.<locals>.<listcomp>s���3�3�3�a��q��3�3�3r8rIr�c�.�g|]}tdg����S�r)rAr�s  r6rzgenfromtxt.<locals>.<listcomp>#s ��<�<�<��$��t�*�*�<�<�<r8c�,�g|]}t|����SrI)r�r�s  r6rzgenfromtxt.<locals>.<listcomp>9s��/�/�/�a�3�q�6�6�/�/�/r8c�8�g|]\}}td||�����S)N)rv�default�r)r�miss�fills   r6rzgenfromtxt.<locals>.<listcomp>{sA��S�S�S�*�t�T�*�$�t�T�R�R�R�S�S�Sr8)�flatten_basec�<�g|]\}}}t|d||�����S�T)�lockedrvr�r�)rr.r�r�s    r6rzgenfromtxt.<locals>.<listcomp>�sI��=�=�=�"2�2�t�T�.�b��=A�4�Q�Q�Q�=�=�=r8c�<��g|]\}}t�d||�����Sr�r�)rr�r�r�s   �r6rzgenfromtxt.<locals>.<listcomp>�sH���9�9�9�".�4��.�e�D�=A�4�Q�Q�Q�9�9�9r8c��t|��tur||��S||�d����S�Nr�)rr�rL)rh�convs  r6�
tobytes_firstz!genfromtxt.<locals>.tobytes_first�s<���A�w�w�%�'�'�#�t�A�w�w���4����� 2� 2�3�3�3r8)r�)r��
testing_valuer�rvc� ��g|]
}�|��SrIrI)rrrr�s  �r6rzgenfromtxt.<locals>.<listcomp>�s���9�9�9�A�f�Q�i�9�9�9r8c�@�g|]\}}|���|v��SrIr�)rrJ�ms   r6rzgenfromtxt.<locals>.<listcomp>�s>��'J�'J�'J�+1�A�q�()�w�w�y�y�A�~�'J�'J�'Jr8c�@��g|]}t���|����SrI)r)r�_mr�s  �r6rzgenfromtxt.<locals>.<listcomp>�s)���?�?�?�B�m�j��m�m�B�/�/�?�?�?r8z0Converter #%i is locked and cannot be upgraded: z"(occurred line #%i for value '%s')z-    Line #%%i (got %%i columns instead of %i)c�2��g|]}|d��zk�|��S)rrI)rrr�nbrowsrts  ��r6rzgenfromtxt.<locals>.<listcomp>�s9���%E�%E�%E�1�()�!��v��/C�(C�(C�&'�(C�(C�(Cr8c�$��g|]\}}�||fz��
SrIrI)rr��nb�templates   �r6rzgenfromtxt.<locals>.<listcomp>	s6���*�*�*��q�"��a��W�$�*�*�*r8zSome errors were detected !r?c�j���g|].\}��fd�tt|�����D����/S)c�:��g|]}��|����SrI)�_loose_call�r�_rr�s  �r6rz)genfromtxt.<locals>.<listcomp>.<listcomp>	s'���K�K�K�B�4�#�#�B�'�'�K�K�Kr8�rXr�rr�r��rowss  @�r6rzgenfromtxt.<locals>.<listcomp>	sS����:�:�:��q�$�L�K�K�K�#�j��m�m�T�2J�2J�K�K�K�:�:�:r8c�j���g|].\}��fd�tt|�����D����/S)c�:��g|]}��|����SrI)�_strict_callr�s  �r6rz)genfromtxt.<locals>.<listcomp>.<listcomp>	s'���L�L�L�R�4�$�$�R�(�(�L�L�Lr8r�r�s  @�r6rzgenfromtxt.<locals>.<listcomp>	sS����:�:�:��q�$�M�L�L�L�3�z�!�}�}�d�3K�3K�L�L�L�:�:�:r8c��g|]	}|j��
SrI�r�rr�s  r6rzgenfromtxt.<locals>.<listcomp>"	s��9�9�9�d��	�9�9�9r8c�8�g|]\}}|tjk�|��SrI)r��str_)rr�rJs   r6rzgenfromtxt.<locals>.<listcomp>$	s.��&�&�&�6�A�q��R�W����$��r8z�Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default.c���t|��}�D] }||�d��||<�!t|��Sr�)rArLr)�row_tuprbr��	strcolidxs   �r6�encode_unicode_colsz'genfromtxt.<locals>.encode_unicode_cols.	sD����7�m�m��"�5�5�A� ��V�]�]�8�4�4�C��F�F��S�z�z�!r8c�&��g|]
}�|����SrIrI)r�rr�s  �r6rzgenfromtxt.<locals>.<listcomp>5	s%���=�=�=�1�+�+�A�.�.�=�=�=r8c3�B�K�|]}t|���V��dSr0�rz�rrbr�s  �r6�	<genexpr>zgenfromtxt.<locals>.<genexpr>@	s-�����:�:�c�c�#�a�&�k�k�:�:�:�:�:�:r8c�&�h|]\}}|j�|��SrI)�_checked)rr��c_types   r6�	<setcomp>zgenfromtxt.<locals>.<setcomp>E	s4������A�v��:�����r8c�$��g|]\}}�|z|f��
SrIrI�rr�r.r}s   �r6rzgenfromtxt.<locals>.<listcomp>M	s<���H�H�H�%�q�"�&��>�2�.�H�H�Hr8c�.��g|]\}}�|ztf��SrI��boolr�s   �r6rzgenfromtxt.<locals>.<listcomp>P	s<���L�L�L�")�1�b� *�A�~�t�4�L�L�Lr8rh�Oc3�$K�|]}|jV��dSr0)�charr�s  r6r�zgenfromtxt.<locals>.<genexpr>b	s$����2�2�!�q�v�2�2�2�2�2�2r8z4Nested fields involving objects are not supported...c��g|]}d|f��Sr�rIr�s  r6rzgenfromtxt.<locals>.<listcomp>i	s��,I�,I�,I��b�!�W�,I�,I�,Ir8c� �g|]}dtf��Sr�r�)r�ts  r6rzgenfromtxt.<locals>.<listcomp>n	s��*J�*J�*J�!�B��:�*J�*J�*Jr8c��g|]	}|j��
SrIr�r�s  r6rzgenfromtxt.<locals>.<listcomp>x	s��*L�*L�*L��4�9�*L�*L�*Lr8c3�B�K�|]}t|���V��dSr0r�r�s  �r6r�zgenfromtxt.<locals>.<genexpr>}	s-�����/L�/L���C��F���/L�/L�/L�/L�/L�/Lr8c� �g|]}|tf��SrIr�r�s  r6rzgenfromtxt.<locals>.<listcomp>�	s��=�=�=�A�q�$�i�=�=�=r8c�2��g|]}|dk��|����Sr�rI)rrrr�s  �r6rzgenfromtxt.<locals>.<listcomp>�	s1���*�*�*�!�!"�b���#�d�1�g�g�!(��r8r�c� ��g|]
}�|��SrIrI)rrrqs  �r6rzgenfromtxt.<locals>.<listcomp>�	s���5�5�5�e�F�5�M�5�5�5r8)P�_genfromtxt_with_liker�r��numpy.mar�r�r�r�r�rrrr�r�rrr~r�rr�rwrr�range�nextrr�r��
StopIterationr"r#r�r=rArzrrr�rr�r�r%r�r�r�r�extendrcrbrr�	functools�partial�update�	itertools�chain�
IndexError�iterupgraderrXr�upgrader�insertr�VisibleDeprecationWarning�bytes_�UnicodeEncodeError�
issubdtype�	character�maxr�rlr�NotImplementedError�viewrv�_maskr�r�)]r�r�r�r�rtrur�rvrwr�r%rxryrzr{r|r}r�r~rr�r�r�r�r1r�r��user_convertersr
re�fid_ctx�fhdr��
split_line�validate_names�first_values�
first_line�fval�nbcols�current�user_missing_valuesr?r�r�r��entry�
user_value�user_filling_values�n�
dtype_flat�zipit�	uc_updater�r��	user_convr��append_to_rows�masks�append_to_masks�invalid�append_to_invalidr��nbvalues�	converter�current_column�errmsg�	nbinvalid�nbinvalid_skippedr)�column_types�sized_column_types�col_type�n_chars�base�uniform_type�ddtype�mdtype�
outputmask�rowmasks�
ishomogeneous�ttyper��mvalr�r�r�r�r�rqr�r�r�r�s] `  `     `     `                                                                  @@@@@@@@@@r6r#r#�sT����������������F��$��%�
�
�
�$�u�
�/7�x�
�CL�9�
�#��
�1<��
�"�z�
�3A�.�
�*�>�	
�4;�7�	
�CH�%�	
�
$��
�
2=��
�(�-�

�4=�9�

�*�>�
�7A�j�
��6�
�$+�7�
�38�%�
�(�-�
�3;�(�
�FN�X�
��%�
�	
�&�e�,�,�,����	3��2�3�3�
3��a�<�<��=�>�>�>��:�9�9�9�9�9�9�9�9� �&�B�O��o�t�,�,�:��
!�#'��#8�#8�
9�:�:�	:��7�����������%��%�%�!��%� � ���%����.��f� �%�%�e�T�H�%�E�E���$�S�)�)������(��-�-����3�i�i���������
E�.2�5�k�k�
E�
E�
E�
�
��	���������

�V�V�!�I��,5��J�J�J�
�&�;�3>�6D�5B�D�D�D��	V��;�'�'�
�
���S�	�	�	�	� �L�"�
6�)�$�s�)�)�X�>�>�
��T�M�M��(<��:�-�-��G�G�J�$4�$4�X�$>�$>�q�r�r�$B�C�C�#�)�z�*�5�5��
#�
6����	V�	V�	V��J��L��M�>��F�ST�U�U�U�U�U�U�		V�����D�=�=���?�(�(�*�*�D��#��8�#�#�$�Q����
*�A�A�g�m�m�C�.@�.@�A�A�A����!�
*�
*�
*�*�"�7�m�m�G�G�� �*�*�*�&�k�G�G�G�*������
*����
�W�,��-�-���D�=�=�"�N�#I�#I�L�#I�#I�#I�J�J�E��J�J�
�U�
#�
#�	*�"�N�#H�#H�u�{�{�3�7G�7G�#H�#H�#H�I�I�E�E�
�	*�"�N�5�)�)�E����u��5�+6�+6�.<�-:�	<�<�<�E�����K�K�E��	&� )�'� 2� 2�
=�
=���G�"�7�+�+�=�!&���W�!5�!5�G�A�J�J��q�[�[�!(�3�|�+<�+<�!<�G�A�J���!��E�
�
�V�(;�(;������!<�!<�!<�!<�G�!<�!<�!<�=�=���U�[�)�)����#�#�e�*�*�v�*=�*=�3�3�3�3�7�3�3�3�����e�&7����%�%�E�-�2����)�5�1�1�	G�"5�"<�"<�X�"F�"F��=�<�e�F�m�m�<�<�<���)�4�0�0�+	9�1�7�7�9�9�
4�
4�
��c�"�3�'�'�!�!�#�k�k�#�.�.����%�!�!�!� ��!�������%�m�m�C�0�0����%�����������c�D�%�=�1�1�'�/�/�3�/�/�/�C�C��s�8�8�,�C��;� .�)�)�����C�(�(�(�(�)�#�3�'�.�.�s�3�3�3�3�5
4�8�+�d�E�]�
;�
;�
	9�"%�&9�>�"J�"J�
(�
(�����E�
�
����%�%��L�L��'�'�'��
(�
�+�S�
1�
1�	9�,�2�2�3�7�7�J�'�
)�
)�����Z�(�(�(�(�
)�(�
9�
9�����c�"5�6�6�7�8�8�8�8�-���&�"$����&����)�4�0�0�	<�1�7�7�9�9�
*�
*�
��c�"�3�'�'�!�!�#�k�k�#�.�.����%�!�!�!� ��!�������%�m�m�C�0�0����%����������'*��s�#�#�
*�"�+�d�E�]�
;�
;�	<��'�(�(�A��V���%8��r��r�"�"�!4�W�f�W�!=���2�2�V�;�N��=�S�S�.1�.�.�.Q�.Q�S�S�S�J�J�'�u�4�@�@�@�J��:����"�"��J���G�G��=�=�6;�=�=�=�
�
�
�N�N�;�;��9�9�9�9�27�9�9�9�
��	�(�.�.�0�0�%	-�%	-�I�Q���q�!�!�

�����A���A��A�A��!�����H������
���
�
�a�(�(�A�A��!�����H��������:���
%� ,�Q��
�
� $�
��u�}�}�#�	�	� �	
!�4�4�4�&�-�m�$�G�G�G�	�	� �	��q�M� � ��4�/<�)7��):�0>�q�0A�
!�
D�
D�
D�
���a��^�,�,�,�,����y�)�)�)�������	+��E�#�l�O���#�N��#�9�?�J�>�3�#G�#G�H�H�	�	�I�Q���Z��%�%�F��6�{�{�H��1�}�}���	
��9�9�9�9��9�9�9�F�F��!����%�%�q�;���':�H�&E�F�F�F��H������V�#�#�!�!�1�{�?�Q�#6��"A�B�B�B���N�5��=�=�)�)�)��
L����'J�'J�58��9G�6I�6I�'J�'J�'J�!K�!K�L�L�L��4�y�y�H�$�$���%�kV�V�V�V�V�V�V�V�V�V�V����V�V�V�V�r
�}�'�
�3�3�
	5�
	5�N�Q�	�?�?�?�?�$�?�?�?�N�
5��%�%�n�5�5�5�5��%�	
5�	
5�	
5�K�a�O��!$�Z��]�]�D�!9�!9��"+�N�";�";�5�5�J�Q��5�!�)�)�%�0�0�0�0��*�J�7�5�5�5��"F�F���1�q�5�;�#6��">�>��,�V�4�4�4�5����5�5�	
5�����G���I��1�}�}��T���Y�&��4��B�V�K����?�?� #�%E�%E�%E�%E�%E��%E�%E�%E�!F�!F���<�y�+<�<�<�=�G��,�,�K�*�*�*�*�!(�*�*�*���v�;�;�	G��M�M�!�:�;�;�;��Y�Y�v�&�&�F��
G� ��(�(�(��
�f�&7�A�F�F�F�F��Q����M�k�\�M�"���	)��-�K�<�-�(�E�
�<���:�:�:�:�#,�Z�#8�#8�:�:�:�
;�<�<�����:�:�:�:�#,�Z�#8�#8�:�:�:�
;�<�<��
�D��}�9�9�j�9�9�9��&�&�Y�|�%<�%<�&�&�&�	��	0�y�	0��M�"��,��	
<�
<�
<�
<�

"�
"�
"�
"�
"�
0�=�=�=�=��=�=�=��#�0�0�A�&(�i�L��O�O�0��&�
�
�
���
����*�!�!�!�_��$�\�2�2�	<�	<�K�A�x��}�X�r�|�4�4�
<��:�:�:�:�T�:�:�:�:�:��)1�7�(;�"�1�%���=���!$�Z��!>�!>����D��4�y�y�A�~�~� $�
��$0�$����H�H�H�H�)2�3E�)F�)F�H�H�H���L�L�L�L�L�-6�7I�-J�-J�L�L�L�F���#�e�%7�8�8�9�9�F��#�e�d�V�c�2D�.E�.E�%E�F�F�G�G�F���$�f�-�-�-���	7���%�v�6�6�6�J���	 �U�[�,��E�K��z�?�?�Q���
�2�2�z�2�2�2�2�2�$�U�+�+�9�-�N�P�P�P� �X�d�%�8�8�8�F�F��x��,I�,I�j�,I�,I�,I�J�J�J�����5�)�)���
3��8����*J�*J�z�*J�*J�*J�!K�!K�M�M�M��)���/�/��%�]�]�6�2�2�
���
0� $�
��� )�*L�*L��*L�*L�*L� M� M�2�2�H�A�u��O�+�+�%�%�5�:�*=�>�
��=����=�=�N�%*�C�/L�/L�/L�/L�t�/L�/L�/L�,L�,L�$M�E����b�%�[�1�1�1�1����b�%�[�1�1�1�1�$�0��5�z�z�A�~�~� "�������!#�������X�d�E�*�*�F��
;��;�*�=�=���=�=�=�F�F�!�F��X�e�6�:�:�:�
��L��E��;�5�;���z�2�2�	;�	;�L�T�4�*�*�*�*�t�/B�*�*�*�N�&�
;�
;���4� � � �V�D�\�T�%9�:� � � � �
;��"����[�)�)��!���
"�6��
7�
7�
7�F�
�	6��=��8�O�
��Z�Z�1�_�_��%��(�#�#�6�5�5�5�u�5�5�5�5��Ms��4F�
F4�!F/�/F4�9'i�!B	I+�*i�+'J�i�J�,i�K"�!i�"
L�-K=�<L�=
L
�
L�L
�
L�i�L�H	i�T3�2i�3
U�=i�?U�i�U�i�
U)�&i�(U)�)Fi�1\�i�
\�i�\�i�\0�/i�0
\=�:i�<\=�=C;i�9a�i�
a�i�a�i�$a:�9i�:
b�i�b�Di�f&�%i�&g�i�g�A=i�i�i�?j�Al%�k,�+l%�,3l	�l%�$l%�s7�7
t�tc���|�dd��|�dd��}t|fi|��}|rddlm}|�|��}n|�tj��}|S)a�
    Load ASCII data from a file and return it in a record array.

    If ``usemask=False`` a standard `recarray` is returned,
    if ``usemask=True`` a MaskedRecords array is returned.

    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.

    See Also
    --------
    numpy.genfromtxt : generic function

    Notes
    -----
    By default, `dtype` is None, which means that the data-type of the output
    array will be determined from the data.

    r�Nr~Fr��
MaskedRecords)�
setdefault�getr#�numpy.ma.mrecordsrr�r��recarray)r�rRr~rqrs     r6r$r$�	s���*���g�t�$�$�$��j�j��E�*�*�G�
��
(�
(��
(�
(�F��*�3�3�3�3�3�3����]�+�+������R�[�)�)���Mr8c�v�|�dd��|�dd��|�dd��|�dd��t|fi|��}|�d	d
��}|rddlm}|�|��}n|�tj��}|S)
a8
    Load ASCII data stored in a comma-separated file.

    The returned array is a record array (if ``usemask=False``, see
    `recarray`) or a masked record array (if ``usemask=True``,
    see `ma.mrecords.MaskedRecords`).

    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.

    See Also
    --------
    numpy.genfromtxt : generic function to load ASCII data.

    Notes
    -----
    By default, `dtype` is None, which means that the data-type of the output
    array will be determined from the data.

    r|�lowerr%Tr�r�r�Nr~Frr)rr#rrrr�r�r)r�rRrqr~rs     r6r%r%�	s���.���&��0�0�0�
���g�t�$�$�$�
���k�3�'�'�'�
���g�t�$�$�$�
��
(�
(��
(�
(�F��j�j��E�*�*�G��*�3�3�3�3�3�3����]�+�+������R�[�)�)���Mr8)NFTr�)NN)TT)TN)r�)NNNNNNN)r=r>r?rrr@Nr0)Urrir�r�r"r1r�r�rr�opindexr�collections.abcrr+r�rrrr	�
numpy.corer
�numpy.core.multiarrayrr�numpy.core._multiarray_umathr
�numpy.core.overridesrr�_iotoolsrrrrrrrrrrr�numpy.compatrrrrrr �__all__r��array_function_dispatchr.rSrUr�r&r�r'r�r(r�r)r�r��intr�rr�r�r5r/�floatr"r4r<r!r*r��sorted�defaultdeletecharsr#r�r$r%rIr8r6�<module>r0s4��	�	�	�	�	�	�	�	�������������������������?�?�?�?�?�?�?�?�?�?�#�#�#�#�#�#�����������#�#�#�#�#�#� � � � � � �6�6�6�6�6�6�6�6�<�<�<�<�<�<�H�H�H�H�H�H�H�H�����������������������������������������������,�)�+�
�%�g�7�7�7��.B�.B�.B�.B�.B�.B�.B�.B�b2�2�2�m@�m@�m@�m@�m@�g�m@�m@�m@�`��G���?C��yM�.4�.E�yM�yM�yM�yM���yM�x������)�*�*�GH�GH�GH�+�*�GH�T���
��*�+�+�S$�S$�,�+�S$�l���
��5�6�6�>#�>#�7�6�>#�B"�"�"�"�JE�E�E�
�s�
�
�
�
�0��8�8�8�8����&��"�3�c��d�a��D��U��
�W�U�U�U�U�U�p���G�������a��e��g��V�CG��V�V�V�V�����V�r/�,�,�.�.�w�7�7��EI�;?�!%�������,�-�-�GI�/3�t�t�t�.�-�t�n��G���_�_�_���_�N���G���!�C�4��!��"�4���t��7�7�6�6�-�*J�#K�#K�L�L� �E�$���e�4�!�D�7�Z���Z�Z�Z�Z�����Z�z2�/�/�1�1�*�=�=�����@#�#�#�#�#r8

Hacked By AnonymousFox1.0, Coded By AnonymousFox