403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.19.244.133
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/__pycache__/npyio.cpython-37.pyc
B

��FdA'�@sddlmZmZmZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZ
ddlZddlmZddlmZddlmZmZddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"dd	l#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*ej+dd
kr�ddl,Z,nddl-Z,ddl.m/Z/e,j0Z0dd
ddddddddddddddgZ1Gdd�de2�Z3dd�Z4Gd d!�d!e2�Z5d=d$d�Z6d>d%d�Z7d&d�Z8d'd�Z9d?d(d)�Z:d*d+�Z;e<d,ddddd-dfd.d
�Z=d@d4d�Z>d5d�Z?e<d,ddddddddddd6d-d"d7dd-d"d"dfd8d�Z@d9d�ZAd:d�ZBd;d�ZCd<d�ZDdS)A�)�division�absolute_import�print_functionN)�
itemgetter�index�)�format)�
DataSource)�packbits�
unpackbits)�LineSplitter�
NameValidator�StringConverter�ConverterError�ConverterLockError�ConversionWarning�_is_string_like�has_nested_fields�
flatten_dtype�
easy_dtype�_bytes_to_name)�asbytes�asstr�asbytes_nested�bytes�
basestring�unicode�is_pathlib_path�)�map�savetxt�loadtxt�
genfromtxt�	ndfromtxt�	mafromtxt�
recfromtxt�
recfromcsv�load�loads�save�savez�savez_compressedr
r�	fromregexr	c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�BagObjau
    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(object):
    ...     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"

    cCst�|�|_dS)N)�weakref�proxy�_obj)�self�obj�r3�B/opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/npyio.py�__init__FszBagObj.__init__cCs2yt�|d�|Stk
r,t|��YnXdS)Nr0)�object�__getattribute__�KeyError�AttributeError)r1�keyr3r3r4r7JszBagObj.__getattribute__cCst�|d���S)z�
        Enables dir(bagobj) to list the files in an NpzFile.

        This also enables tab-completion in an interpreter or IPython.
        r0)r6r7�keys)r1r3r3r4�__dir__PszBagObj.__dir__N)�__name__�
__module__�__qualname__�__doc__r5r7r<r3r3r3r4r-(sr-cOs2t|�rt|�}ddl}d|d<|j|f|�|�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.
    rNT�
allowZip64)r�str�zipfile�ZipFile)�file�args�kwargsrCr3r3r4�zipfile_factoryYs
rHc@sreZdZdZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�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: True
    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.

    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.io.NpzFile)
    True
    >>> npz.files
    ['y', 'x']
    >>> 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])

    FTNcCs�t|�}|��|_g|_||_||_x:|jD]0}|�d�rP|j�|dd��q,|j�|�q,W||_t	|�|_
|r|||_nd|_dS)Nz.npy���)rH�namelist�_files�files�allow_pickle�
pickle_kwargs�endswith�append�zipr-�f�fid)r1rT�own_fidrNrOZ_zip�xr3r3r4r5�s


zNpzFile.__init__cCs|S)Nr3)r1r3r3r4�	__enter__�szNpzFile.__enter__cCs|��dS)N)�close)r1�exc_type�	exc_value�	tracebackr3r3r4�__exit__�szNpzFile.__exit__cCs>|jdk	r|j��d|_|jdk	r4|j��d|_d|_dS)z"
        Close the file.

        N)rRrXrTrS)r1r3r3r4rX�s



z
NpzFile.closecCs|��dS)N)rX)r1r3r3r4�__del__�szNpzFile.__del__cCs�d}||jkrd}n||jkr*d}|d7}|r�|j�|�}|�ttj��}|��|tjkr||j�|�}tj	||j
|jd�S|j�|�Sntd|��dS)Nrrz.npy)rNrOz%s is not a file in the archive)
rLrMrR�open�read�lenr�MAGIC_PREFIXrX�
read_arrayrNrOr8)r1r:�memberr�magicr3r3r4�__getitem__�s"	



zNpzFile.__getitem__cCs
t|j�S)N)�iterrM)r1r3r3r4�__iter__�szNpzFile.__iter__cs�fdd��jD�S)zV
        Return a list of tuples, with each tuple (filename, array in file).

        csg|]}|�|f�qSr3r3)�.0rS)r1r3r4�
<listcomp>�sz!NpzFile.items.<locals>.<listcomp>)rM)r1r3)r1r4�items�sz
NpzFile.itemsccs"x|jD]}|||fVqWdS)z8Generator that returns tuples (filename, array in file).N)rM)r1rSr3r3r4�	iteritems�szNpzFile.iteritemscCs|jS)z6Return files in the archive with a ``.npy`` extension.)rM)r1r3r3r4r;�szNpzFile.keyscCs|��S)z1Return an iterator over the files in the archive.)rg)r1r3r3r4�iterkeysszNpzFile.iterkeyscCs|j�|�S)N)rM�__contains__)r1r:r3r3r4rmszNpzFile.__contains__)FTN)r=r>r?r@r5rWr\rXr]rergrjrkr;rlrmr3r3r3r4rIhs=

rIT�ASCIIcCs<d}t|t�rt|d�}d}nt|�r6|�d�}d}n|}|dkrJtd��tjddkrft||d�}ni}z�d	}tt	j
�}	|�|	�}
|�t
|	t|
��d
�|
�|�r�|}d}t||||d�S|
t	j
kr�|r�t	j||d�St	j|||d
�Sn8|s�td��ytj|f|�Stdt|���YnXWd|�r6|��XdS)a�
    Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files.

    Parameters
    ----------
    file : file-like object, string, or pathlib.Path
        The file to read. File-like objects must support the
        ``seek()`` and ``read()`` methods. 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: True
    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 on 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'

    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
    ------
    IOError
        If the input file does not exist or cannot be read.
    ValueError
        The file contains an object array, but allow_pickle=False given.

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

    F�rbT)rn�latin1rz.encoding must be 'ASCII', 'latin1', or 'bytes'rr)�encoding�fix_importssPKr)rUrNrO)�mode)rNrOz>allow_pickle=False, but file does not contain non-pickled dataz'Failed to interpret file %s as a pickleN)�
isinstancerr^r�
ValueError�sys�version_info�dictr`rrar_�seek�min�
startswithrIZopen_memmaprb�pickler'�IOError�reprrX)rEZ	mmap_moderNrrrqrUrTrOZ_ZIP_PREFIX�Nrd�tmpr3r3r4r'
sJf







cCs�d}t|t�r0|�d�s |d}t|d�}d}n8t|�rd|j�d�sT|j|jd}|�d�}d}n|}tjddkr�t	|d�}nd}z t
�|�}tj
||||d	�Wd|r�|��XdS)
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 file name if it does not already
        have one.
    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.
    arr : array_like
        Array data to be saved.

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

    Notes
    -----
    For a description of the ``.npy`` format, see the module docstring
    of `numpy.lib.format` or the NumPy Enhancement Proposal
    http://docs.scipy.org/doc/numpy/neps/npy-format.html

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

    Fz.npy�wbTrr)rrN)rNrO)rtrrPr^r�name�parentrvrwrx�np�
asanyarrayr�write_arrayrX)rEZarrrNrrrUrTrOr3r3r4r)�s*3





cOst|||d�dS)a�

    Save several arrays into a single file in uncompressed ``.npz`` format.

    If arguments are passed in with no keywords, the corresponding variable
    names, in the ``.npz`` file, are 'arr_0', 'arr_1', etc. If keyword
    arguments are given, the corresponding variable names, in the ``.npz``
    file will match the keyword names.

    Parameters
    ----------
    file : str or file
        Either the file name (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 file name if it is not
        already there.
    args : Arguments, optional
        Arrays to save to the file. Since it is not possible for Python to
        know the names of the arrays outside `savez`, the arrays will be saved
        with names "arr_0", "arr_1", and so on. These arguments can be any
        expression.
    kwds : Keyword arguments, optional
        Arrays to save to the file. Arrays will be saved in the file with the
        keyword names.

    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 `numpy.lib.format` or the
    NumPy Enhancement Proposal
    http://docs.scipy.org/doc/numpy/neps/npy-format.html

    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
    --------
    >>> 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_1', 'arr_0']
    >>> 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)
    >>> npzfile.files
    ['y', 'x']
    >>> npzfile['x']
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    FN)�_savez)rErF�kwdsr3r3r4r*sNcOst|||d�dS)a	
    Save several arrays into a single file in compressed ``.npz`` format.

    If keyword arguments are given, then filenames are taken from the keywords.
    If arguments are passed in with no keywords, then stored file names are
    arr_0, arr_1, etc.

    Parameters
    ----------
    file : str or file
        Either the file name (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 file name if it is not
        already there.
    args : Arguments, optional
        Arrays to save to the file. Since it is not possible for Python to
        know the names of the arrays outside `savez`, the arrays will be saved
        with names "arr_0", "arr_1", and so on. These arguments can be any
        expression.
    kwds : Keyword arguments, optional
        Arrays to save to the file. Arrays will be saved in the file with the
        keyword names.

    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
    `numpy.lib.format` or the NumPy Enhancement Proposal
    http://docs.scipy.org/doc/numpy/neps/npy-format.html

    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

    TN)r�)rErFr�r3r3r4r+Ts=cCs�ddl}ddl}t|t�r.|�d�sR|d}n$t|�rR|j�d�sR|j|jd}|}x<t|�D]0\}	}
d|	}||�	�kr�t
d|��|
||<q`W|r�|j}n|j}t
|d|d�}
t|�r�tj�|�nd\}}|j||dd	�\}}t�|�z�x�|��D]�\}}
|d
}t|d�}zpy6tj|t�|
�||d�|��d}|
j||d
�Wn4tk
�r�}ztd||f��Wdd}~XYnXWd|�r�|��Xq�WWdt�|�X|
��dS)Nrz.npzzarr_%dz,Cannot use un-named variables and keyword %s�w)rs�compression)Nr�z
-numpy.npy)�prefix�dir�suffixz.npyr�)rNrO)�arcnamezFailed to write to %s: %s)rC�tempfilertrrPrr�r��	enumerater;ru�ZIP_DEFLATED�
ZIP_STOREDrHr�os�path�split�mkstemprXrjr^rr�r�r��writer}�remove)rErFr��compressrNrOrCr�Znamedict�i�valr:r�ZzipfZfile_dirZfile_prefix�fdZtmpfile�fnamerT�excr3r3r4r��sN





&r�cCs�dd�}|j}t|tj�r"dd�St|tj�r4tjSt|tj�rFtjSt|tj�rZdd�St|tj�rltjSt|tj�r||St|tj	�r�dd�St|tj
�r�tStSdS)z; Find the correct dtype converter. Adapted from matplotlib cSs&|��d|krt�t|��St|�S)Ns0x)�lower�float�fromhexr)rVr3r3r4�	floatconv�sz_getconv.<locals>.floatconvcSstt|��S)N)�bool�int)rVr3r3r4�<lambda>��z_getconv.<locals>.<lambda>cSstt|��S)N)r�r�)rVr3r3r4r��r�cSstt|��S)N)�complexr)rVr3r3r4r��r�N)
�type�
issubclassr�Zbool_�uint64�int64�integer�
longdoubleZfloatingr�Zbytes_rr)�dtyper��typr3r3r4�_getconv�s&r��#Fc	s��dk	rNt�ttf�r"t��g�ndd��D��dd��D��t�d�����|}	�dk	rbt���|dk	r�yt|�}
Wntk
r�|g}
YnXxN|
D]F}yt	|�Wq�tk
r�}zdt
|�f|_�Wdd}~XYq�Xq�W|
}d}
y�t|�r�t
|�}t|��r�d	}
|�d
��r.ddl}t|�|��}nP|�d��rRddl}t|�|��}n,tjdd
k�rrtt|d��}ntt|��}nt|�}Wntk
�r�td��YnXg��fdd���fdd�����fdd�}�z�t�|�}t|��xt|�D]}t|��q�Wd}y"x|�s*t|�}||�}�qWWn0tk
�r^d}g}tj d|d
d�YnXt!|�pj|�}�|�\}}t!|�dk�r�dd�|D�}n*�fdd�t|�D�}|dk�r�|t"fg}xT|	�p�i�#�D]B\}}|�r
y|�$|�}Wntk
�r�w�YnX|||<�q�Wx�t%t&�'|g|��D]�\}}||��t!��dk�rN�q,|�rf�fdd�|D��t!��|k�r�||d}td|��dd�t(|��D�}�||�}��)|��q,WWd|
�r�|�*�Xt�+�|���j,dk�r�j-dd
�d k�rd!�_-|d"k�rtd#|���j,|k�r,t�.����j,|k�rd|dk�rNt�/���n|d
k�rdt�0��j1�|�r�t!|�dk�r��fd$d�|j2D�S�j1Sn�SdS)%a�
    Load data from a text file.

    Each row in the text file must have the same number of values.

    Parameters
    ----------
    fname : file, str, or pathlib.Path
        File, filename, or generator to read.  If the filename extension is
        ``.gz`` or ``.bz2``, the file is first decompressed. Note that
        generators should return byte strings for Python 3k.
    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, optional
        The characters or list of characters used to indicate the start of a
        comment;
        default: '#'.
    delimiter : str, optional
        The string used to separate values.  By default, this is any
        whitespace.
    converters : dict, optional
        A dictionary mapping column number to a function that will convert
        that column to a float.  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 (but see also `genfromtxt`):
        ``converters = {3: lambda s: float(s.strip() or 0)}``.  Default: None.
    skiprows : int, optional
        Skip the first `skiprows` lines; 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.

        .. versionadded:: 1.11.0

        Also 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

    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.

    .. 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([('M', 21, 72.0), ('F', 35, 58.0)],
          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.])

    NcSsg|]}t|��qSr3)r)rh�commentr3r3r4riWszloadtxt.<locals>.<listcomp>css|]}t�|�VqdS)N)�re�escape)rhr�r3r3r4�	<genexpr>Zszloadtxt.<locals>.<genexpr>�|z\usecols must be an int or a sequence of ints but it contains at least one element of type %sFTz.gzrz.bz2��Uz1fname must be a string, file handle, or generatorc
s|jdkr�|j}t|�dkr(|jgdfS|dtfg}t|�dkrvx2|jddd�D]}||dd||fg}qTW|jgtt�|j��|fSnlg}g}xZ|jD]P}|j|\}}�|�\}}	|�	|�|j
dkr�|�	|	�q�|�t|�|	f�q�W||fSdS)z;Unpack a structured data-type, and produce re-packing info.Nr���r���)�names�shaper`�base�listr�r��prod�fields�extend�ndimrQ)
�dtr��packingZdim�types�field�tprZflat_dtZflat_packing)�flatten_dtype_internalr3r4r��s&


z'loadtxt.<locals>.flatten_dtype_internalcsz|dkr|dS|tkr t|�S|tkr0t|�Sd}g}x4|D],\}}|��||||�|��||7}q>Wt|�SdS)z6Pack items into nested lists based on re-packing info.Nr)�tupler�rQ)rjr��start�ret�lengthZ
subpacking)�
pack_itemsr3r4r��szloadtxt.<locals>.pack_itemscsFt|�}�dk	r&�jt|�dd�d}|�d�}|r>|���SgSdS)z�Chop off comments, strip, and split at delimiter.

        Note that although the file is opened as text, this function
        returns bytes.

        Nr)�maxsplitrs
)rr��strip)�line)�comments�	delimiter�regex_commentsr3r4�
split_line�s

zloadtxt.<locals>.split_line�zloadtxt: Empty input file: "%s")�
stacklevelrcSsg|]}t|��qSr3)r�)rhr�r3r3r4ri�scsg|]}��qSr3r3)rhr�)�defconvr3r4ri�scsg|]}�|�qSr3r3)rhr�)�valsr3r4ri�sz"Wrong number of columns at line %dcSsg|]\}}||��qSr3r3)rh�convr�r3r3r4risr)rr)rr�)rrr�z"Illegal value of ndmin keyword: %scsg|]}�|�qSr3r3)rhr�)�Xr3r4ri s)3rtrrrr��compile�joinr��	TypeError�opindexr�rFrrBrrP�gziprf�GzipFile�bz2�BZ2Filervrwr^rur�r�r��range�next�
StopIteration�warnings�warnr`r�rjrr��	itertools�chainrRrQrX�arrayr�r��squeezeZ
atleast_1d�
atleast_2d�Tr�)r�r�r�r��
convertersZskiprows�usecols�unpackZndmin�user_convertersZusecols_as_listZcol_idx�eZfownr��fhr�r�r�Z
first_vals�
first_linerZdtype_typesr�r�r�Zline_numrjr3)r�r�r�r�r�r�r�r�r4r!�s�g







 



�%.18e� �
r��# c	Cst|t�rt|�}t|�}d}t|�r.t|�}t|�r�d}|�d�rZddl}	|	�|d�}
q�t	j
ddkrtt|d�}
q�t|d�}
nt|d	�r�|}
ntd
���z`t
�|�}|jdkr�|jjdkr�t
�|�j}d}q�t|jj�}n
|jd}t
�|�}t|�ttfk�r6t|�|k�r tdt|���t|��tt|��}
n�t|t��r�|�d
�}td|�}|dk�r�|�r|d||fg|}n
|g|}|�|�}
n4|�r�|d|k�r�|�n|�s�||k�r�|�n|}
ntd|f��t|�dk�r
|�dd|�}|
� t!|||��|�rhx�|D]L}g}x&|D]}|�"|j#�|�"|j$��q$W|
� t!|
t|�|���qWn\xZ|D]R}y|
� t!|
t|�|��Wn,t%k
�r�t%dt|j�|
f��YnX�qnWt|�dk�r�|�dd|�}|
� t!|||��Wd|�r
|
�&�XdS)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 : 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) a single specifier, `fmt='%.4e'`, resulting in numbers formatted
                like `' (%s+%sj)' % (fmt, fmt)`
            b) a full string specifying every real and imaginary part, e.g.
                `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns
            c) 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


    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
           <http://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

    FTz.gzrNr�rr�r�z%fname must be a string or file handlerzfmt has wrong shape.  %s�%z'fmt has wrong number of %% formats:  %sz	 (%s+%sj)r�zinvalid fmt: %rr�z?Mismatch between array dtype ('%s') and format specifier ('%s'))'rtrrrrBrrPr�r^rvrw�hasattrrur�Zasarrayr�r�r�r�r�r`�descrr�Ziscomplexobjr�r�r�r9r�r�count�replacer�rrQ�real�imagr�rX)r�r��fmtr��newline�headerZfooterr��own_fhr�r�ZncolZiscomplex_XrZn_fmt_chars�error�rowZrow2�numberr3r3r4r 's�s











"
cCs�d}t|d�st|d�}d}z�t|d�s6t�t|��}t|tj�sLt�|�}|�|�	��}|r�t|dt
�s�t�||jd�}tj||d�}||_ntj||d�}|S|r�|�
�XdS)	a�
    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 : str or file
        File name or file object to read.
    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.

    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
    `doc.structured_arrays`.

    Examples
    --------
    >>> f = open('test.dat', 'w')
    >>> f.write("1312 foo\n1534  bar\n444   qux")
    >>> f.close()

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

    Fr_roT�matchr)r�N)r�r^r�r�rrtr�r��findallr_r�r�r�rX)rEZregexpr�r�seqZnewdtype�outputr3r3r4r,�s$7



�_zf%icIs<|dk	r$|rtd��|dkr$td��|dk	r4t|�}t|t�rFt|�}t|tttf�r^t|�}|rrddlm}m	}|pxi}t|t
�s�tdt|���d}ydt
|�r�t|�}t|t�r�tjdd	kr�ttjj�|d
��}nttjj�|d��}d}nt|�}Wn&tk
�r"td
t|���YnXt|||d�j}t||||
d�}xt��D]�t|��qNWd}yNxH|�s�t|�}�dk�r�||k�r�d�|�|�dd��}||�}�qhWWn0tk
�r�d}g}tj d|d	d�YnX�dk�r
|d�!�}||k�r
|d=|	dk	�rnydd�|	�d�D�}	Wn@t"k
�rlyt|	�}	Wntk
�rf|	g}	YnXYnXt#|	�px|�} �dk�r�|dd�|D���d}n2t$���r�|dd���d�D���n��r�|����dk	�r�t%���||||
d���dk	�rt���|	�r�xJt&|	�D]>\�}!t$|!��r4��'|!�|	�<n|!dk�r|!t#|�|	�<�qW�dk	�r�t#��| k�r��j(�t�)�fdd�|	D���t�j*��n*�dk	�r�t#��| k�r�fdd�|	D��n�dk	�r�dk	�r�t�j*��|�p�d}"dd�t| �D�}t|"t
��r�x�|"�+�D]�\}#}$t$|#��rNy��'|#�}#Wntk
�rL�wYnX|	�rzy|	�'|#�}#Wntk
�rxYnXt|$ttf��r�dd�|$D�}$n
t|$�g}$|#dk�r�x(|D]}%|%�,|$��q�Wn||#�,|$��qWn�t|"ttf��r(x�t-|"|�D]&\}&}'t|&�}&|&|'k�r�|'�.|&��q�WnRt|"t/��rZ|"�d�}(x:|D]}'|'�,|(��qDWn x|D]}'|'�,t|"�g��q`W|})|)dk�r�g})dg| }t|)t
��r$x�|)�+�D]r\}#}$t$|#��r�y��'|#�}#Wntk
�r��w�YnX|	�ry|	�'|#�}#Wntk
�rYnX|$||#<�q�WnHt|)ttf��rbt#|)�}*|*| k�rT|)|d|*�<n|)d| �}n
|)g| }�dk�r�dd�t-||�D�}nRt0�dd �}+t#|+�dk�r�t-|+||�},d!d�|,D�}nt-||�},�fd"d�|,D�}g}-x�|�+�D]�\}.�t$|.��r.y��'|.�}.|.�Wntk
�r*�w�YnXn6|	�r`y|	�'|.��Wntk
�r\�w�YnXn|.�t#|��rx||.}/nd}/|�j1�d|/|�|�d#�|-�.��f��q�W|�1|-�g��j.}0|�r�g}1|1j.}2g}3|3j.}4x�t&t2�3|g|��D]�\�}5||5��
t#�
�}6|6dk�r�q�|	�rfy�
fd$d�|	D��
Wn.t4k
�rb|4��d|6f��w�YnXn"|6| k�r�|4��d|6f��q�|0t�
��|�r�|2td%d�t-�
|�D���t#��|k�r�P�q�W|�r�|�5��dk�	r�x�t&|�D]�\�}7�fd&d��D�}8y|7�6|8�Wn�t7k
�	r�d'�}9t8t9����}8xdt&|8�D]X\}.}&y|7�:|&�Wn>t;tfk
�	r�|9d(7}9|9|.d�|&f;}9t;|9��YnX�	qHWYnX�q�Wt#|3�}:|:dk�
rft#��|:|�d)| �	|dk�
rt#��fd*d�|3D��};|3d|:|;�}3||;8}�	fd+d�|3D�}9t#|9��
rf|9�<dd,�d-�|9�}9|�
rVt|9��ntj |9t=d	d�|dk�
r��d|��|�
r�|1d|�}1|�
r�tt-�fd.d�t&|�D����ntt-�fd/d�t&|�D�����}<�dk�r�d0d�|D�}=d1d�t&|=�D�}>x,|>D]$�d2t>�fd3d4�|<D��|=�<�q
W�dk�r�t?d5d�|D��}?t#|?�dk�rrt|?�dtj@}@}An2�fd6d�t&|=�D�}@|�r·fd7d�t&|=�D�}An(tt-�|=��}@tt-�tj@gt#|=���}AtjA|<|@d8�}B|�
r�tjA|1|Ad8�}C�n���r�j*�r��_*t#|+�dk�r�d9d:d4�|+D�k�rNtB���r>tCd;��ntjA|<�d8�}Bn"tjA|<d<d�|+D�d8����D��}B|�
r�tjA|1t�)d=d�|+D��d8�}D|��}A|D�D|A�}Cn�|�
r^d}Eg�x|t&d>d�|D��D]f\�}F�|k�
r |E|F�jkM}E|FtjEk�
rd2t>�fd?d4�|<D��}F��.d@|Ff�n��.d@�f��q�W|E�
s^t#��dk�
rTt�)���n
t�)|F��t�A|<��}B|�
r��j*�
r�dAd��j*D�}Antj@}AtjA|1|Ad8�}C|Bj)j*�|�r��rxZt-��
p�d|�D]F\}G��fdBd��jFD�}x&|D]}H|C|G|B|G|HkO<�
q�W�
q�W|�r$|B�D|�}B|C|B_G|�r4|B�H�jIS|B�H�S)Ca�
    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 byte strings in Python 3k.  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 valid line
        after the first `skip_header` lines.
        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 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 variables
        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 = loadtxt(...)``
    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

    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
           <http://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("1,1.3,abcde")
    >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'),
    ... ('mystring','S5')], delimiter=",")
    >>> data
    array((1, 1.3, '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, '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, 'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])

    An example with fixed-width columns

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

    NzPThe 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)Fr�ZrbUroTzRfname must be a string, filehandle, list of strings, or generator. Got %s instead.)r�r��	autostrip)�excludelist�deletechars�case_sensitive�
replace_spacer�z"genfromtxt: Empty input file: "%s")r�cSsg|]}|���qSr3)r�)rhrr3r3r4ri<szgenfromtxt.<locals>.<listcomp>�,cSsg|]}t|����qSr3)rr�)rhrr3r3r4riFscSsg|]}|���qSr3)r�)rhrr3r3r4riJs)�
defaultfmtr�rrrrcsg|]}�|�qSr3r3)rhr)r�r3r4ribscsg|]}�|�qSr3r3)rhr)r�r3r4rifsr3cSsg|]}tdg��qS)r�)r�)rhrr3r3r4rioscSsg|]}t|��qSr3)rB)rhrr3r3r4ri�s�,cSsg|]\}}td||d��qS)N)�missing_values�default)r)rh�miss�fillr3r3r4ri�s)Zflatten_basecSs"g|]\}}}t|d||d��qS)T)�lockedrr)r)rhr�rrr3r3r4ri�scs g|]\}}t�d||d��qS)T)rrr)r)rhrr)r�r3r4ri�s)r�
testing_valuerrcsg|]}�|�qSr3r3)rhr)�valuesr3r4riscSsg|]\}}|��|k�qSr3)r�)rh�v�mr3r3r4riscsg|]}t��|��qSr3)r)rh�_m)r�r3r4ri&sz0Converter #%i is locked and cannot be upgraded: z"(occurred line #%i for value '%s')z-    Line #%%i (got %%i columns instead of %i)cs g|]}|d��kr|�qS)rr3)rhr)�nbrows�skip_headerr3r4ri;scsg|]\}}�||f�qSr3r3)rhr��nb)�templater3r4riDszSome errors were detected !r�cs,g|]$\}��fdd�tt|���D��qS)csg|]}��|��qSr3)Z_loose_call)rh�_r)r�r3r4riZsz)genfromtxt.<locals>.<listcomp>.<listcomp>)rr)rhr�)�rows)r�r4riZscs,g|]$\}��fdd�tt|���D��qS)csg|]}��|��qSr3)Z_strict_call)rhr$)r�r3r4ri^sz)genfromtxt.<locals>.<listcomp>.<listcomp>)rr)rhr�)r%)r�r4ri^scSsg|]
}|j�qSr3)r�)rhr�r3r3r4riescSs&g|]\}}|td�tjfkr|�qS)�S)r�r��string_)rhr�rr3r3r4rigsz|S%ic3s|]}t|��VqdS)N)r`)rhr)r�r3r4r�kszgenfromtxt.<locals>.<genexpr>cSsg|]}|jr|j�qSr3)Z_checkedr�)rh�cr3r3r4rioscsg|]\}}�||f�qSr3r3)rhr�r�)rr3r4risscsg|]\}}�|tjf�qSr3)r�r�)rhr�r�)rr3r4rivs)r��Ocss|]}|jVqdS)N)�char)rhrr3r3r4r��sz4Nested fields involving objects are not supported...cSsg|]}d|f�qS)r�r3)rhrr3r3r4ri�scSsg|]}dtjf�qS)r�)r�r�)rh�tr3r3r4ri�scSsg|]
}|j�qSr3)r�)rhr�r3r3r4ri�sc3s|]}t|��VqdS)N)r`)rhr)r�r3r4r��sr�cSsg|]}|tjf�qSr3)r�r�)rhrr3r3r4ri�scsg|]}|dkr�|��qS)r�r3)rhr)r�r3r4ri�s)Jrurrtrr�r�rZnumpy.marr
rxr�r�rrBrrvrwrfr��lib�_datasourcer^rZ	_handymanr
r�r�r�r�r�r�r�r�r9r`rrr�rr�r�r�rjr�rRrQrr�updater�r��
IndexErrorrXZiterupgraderrr�upgrader�insertr�max�setr�r�r�NotImplementedError�viewr'rZ_maskr�r�)Ir�r�r�r�r!Zskip_footerr�rZfilling_valuesr�r�rrrrrrr��usemaskZlooseZ
invalid_raiseZmax_rowsrr
r�Zown_fhdZfhdr�Zvalidate_namesZfirst_valuesr�ZfvalZnbcols�currentZuser_missing_valuesr:r�r�value�entryZ
user_valueZuser_filling_values�nZ
dtype_flatZzipitZ	uc_update�jrZappend_to_rows�masksZappend_to_masks�invalidZappend_to_invalidr�Znbvalues�	converterZcurrent_column�errmsgZ	nbinvalidZnbinvalid_skipped�dataZcolumn_typesZ	strcolidxr�ZddtypeZmdtyper
Z
outputmaskZrowmasksZ
ishomogeneousZttyper�Zmvalr3)r�rr�r�r�r�r r%r!r#rr4r"Ks�"













































 








$







$

cKsd|d<t|f|�S)z�
    Load ASCII data stored in a file and return it as a single array.

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

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

    Fr6)r")r�rGr3r3r4r#�s
cKsd|d<t|f|�S)a
    Load ASCII data stored in a text file and return a masked array.

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

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

    Tr6)r")r�rGr3r3r4r$�s
cKsP|�dd�|�dd�}t|f|�}|r@ddlm}|�|�}n|�tj�}|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�Nr6Fr)�
MaskedRecords)�
setdefault�getr"�numpy.ma.mrecordsrAr5r��recarray)r�rGr6r
rAr3r3r4r%�scKst|�dd�|�dd�|�dd�|�dd�t|f|�}|�d	d
�}|rdddlm}|�|�}n|�tj�}|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.

    rr�r�Tr�rr�Nr6Fr)rA)rBr"rCrDrAr5r�rE)r�rGr
r6rAr3r3r4r&
s)NTTrn)TT)TN)r�r�r�r�r�r�)E�
__future__rrrrvr�r�r�r�r.�operatorrrr��numpyr�r�rr-r	Znumpy.core.multiarrayr
rZ_iotoolsrr
rrrrrrrrr�numpy.compatrrrrrrrrwr|�cPickleZfuture_builtinsrr(�__all__r6r-rHrIr'r)r*r+r�r�r�r!r r,r"r#r$r%r&r3r3r3r4�<module>sr4$

1#
)
PQ@
:;
LX{ 

Youez - 2016 - github.com/yon3zu
LinuXploit