Your IP : 18.188.211.246


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

�

��bg�x��
�dZdZddlZddlmcmZddlm	Z	m
Z
dd�Zd�Zd�Z
d�Zdd
�ZGd�d��ZGd
�d��Zd�ZGd�de��ZGd�de��ZGd�de��ZGd�d��Zdd�ZdS)zBA collection of functions designed to help I/O with ascii files.

zrestructuredtext en�N)�asbytes�	asunicodec�d�t|��tur|�d}|�|��}|S)akDecode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.
    encoding : str
         Encoding used to decode `line`.

    Returns
    -------
    decoded_line : str

    N�latin1)�type�bytes�decode)�line�encodings  �I/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/lib/_iotools.py�_decode_liner
s6��$�D�z�z�U������H��{�{�8�$�$���K�c�D�	|dzn#ttf$rYdSwxYwdS)z2
    Check whether obj behaves like a string.
    �FT��	TypeError�
ValueError��objs r�_is_string_liker%s>����b������z�"�����u�u������4����c�D�	|dzn#ttf$rYdSwxYwdS)z8
    Check whether obj behaves like a bytes object.
    rFTrrs r�_is_bytes_liker0s>����c�	�	�	���z�"�����u�u������4rc�>�|jpdD]}||j�dS�dS)a�
    Returns whether one or several fields of a dtype are nested.

    Parameters
    ----------
    ndtype : dtype
        Data-type of a structured array.

    Raises
    ------
    AttributeError
        If `ndtype` does not have a `names` attribute.

    Examples
    --------
    >>> dt = np.dtype([('name', 'S4'), ('x', float), ('y', float)])
    >>> np.lib._iotools.has_nested_fields(dt)
    False

    �NTF)�names)�ndtype�names  r�has_nested_fieldsr;s8��*��"������$�<��)��4�4�*��5rFc��|j}|�9|r/|jgttj|j����zS|jgSg}|D]:}|j|}t|d|��}|�|���;|S)aX
    Unpack a structured data-type by collapsing nested fields and/or fields
    with a shape.

    Note that the field names are lost.

    Parameters
    ----------
    ndtype : dtype
        The datatype to collapse
    flatten_base : bool, optional
       If True, transform a field with a shape into several fields. Default is
       False.

    Examples
    --------
    >>> dt = np.dtype([('name', 'S4'), ('x', float), ('y', float),
    ...                ('block', int, (2, 3))])
    >>> np.lib._iotools.flatten_dtype(dt)
    [dtype('S4'), dtype('float64'), dtype('float64'), dtype('int64')]
    >>> np.lib._iotools.flatten_dtype(dt, flatten_base=True)
    [dtype('S4'),
     dtype('float64'),
     dtype('float64'),
     dtype('int64'),
     dtype('int64'),
     dtype('int64'),
     dtype('int64'),
     dtype('int64'),
     dtype('int64')]

    Nr)	r�base�int�np�prod�shape�fields�
flatten_dtype�extend)r�flatten_baser�types�field�info�flat_dts       rr'r'Vs���B
�L�E��}��	>��K�=�3�r�w�v�|�'<�'<�#=�#=�=�=���}�����	"�	"�E��=��'�D�#�D��G�\�:�:�G��L�L��!�!�!�!��rc�<�eZdZdZd�Z		dd�Zd�Zd�Zd	�Zd
�Z	dS)�LineSplittera�
    Object to split a string at a given delimiter or at given places.

    Parameters
    ----------
    delimiter : str, int, or sequence of ints, optional
        If a string, character used to delimit consecutive fields.
        If an integer or a sequence of integers, width(s) of each field.
    comments : str, optional
        Character used to mark the beginning of a comment. Default is '#'.
    autostrip : bool, optional
        Whether to strip each individual field. Default is True.

    c����fd�S)a�
        Wrapper to strip each member of the output of `method`.

        Parameters
        ----------
        method : function
            Function that takes a single argument and returns a sequence of
            strings.

        Returns
        -------
        wrapped : function
            The result of wrapping `method`. `wrapped` takes a single input
            argument and returns a list of strings that are stripped of
            white-space.

        c�.��d��|��D��S)Nc�6�g|]}|�����Sr)�strip)�.0�_s  r�
<listcomp>z<LineSplitter.autostrip.<locals>.<lambda>.<locals>.<listcomp>�s ��?�?�?�A�a�g�g�i�i�?�?�?rr)�input�methods �r�<lambda>z(LineSplitter.autostrip.<locals>.<lambda>�s���?�?������?�?�?�rr)�selfr8s `r�	autostripzLineSplitter.autostrip�s���$@�?�?�?�?rN�#Tc�&�t|��}t|��}||_|�t|t��r|pd}|j}n�t|d��rW|j}tjdgt|��z��}d�t|dd�|dd���D��}n/t|��r|jt|��}}n	|jd}}||_
|r|�|��|_n||_||_dS)N�__iter__rc�4�g|]\}}t||����Sr��slice)r4�i�js   rr6z)LineSplitter.__init__.<locals>.<listcomp>�s$��J�J�J��!�Q��q�!���J�J�Jr����)r
�comments�
isinstance�str�_delimited_splitter�hasattr�_variablewidth_splitterr#�cumsum�list�zipr"�_fixedwidth_splitter�	delimiterr;�	_handymanr)r:rPrFr;rrQ�idxs       r�__init__zLineSplitter.__init__�s�� ��+�+�	���)�)�� ��
�
��*�Y��"<�"<��!�)�T�I��0�I�I�
�Y�
�
+�
+�		F��4�I��)�Q�C�$�y�/�/�1�2�2�C�J�J�3�s�3�B�3�x��Q�R�R��3I�3I�J�J�J�I�I�
��^�^�	F��-�s�9�~�~�"�Y�Y�'+�&>��	�Y�"����	'�!�^�^�I�6�6�D�N�N�&�D�N� ��
�
�
rc��|j� |�|j��d}|�d��}|sgS|�|j��S)z2Chop off comments, strip, and split at delimiter. Nrz 
)rF�splitr3rP�r:r
s  rrIz LineSplitter._delimited_splitter�sT���=�$��:�:�d�m�,�,�Q�/�D��z�z�'�"�"���	��I��z�z�$�.�)�)�)rc����|j� ��|j��d���d����sgS|j��fd�t	dt������D��}�fd�|D��S)Nrz
c�6��g|]}t||�z����Srr@)r4rB�fixeds  �rr6z5LineSplitter._fixedwidth_splitter.<locals>.<listcomp>�s'���J�J�J�!�%��1�u�9�%�%�J�J�Jrc� ��g|]
}�|��Srr�r4�sr
s  �rr6z5LineSplitter._fixedwidth_splitter.<locals>.<listcomp>�����(�(�(�A��Q��(�(�(r)rFrUr3rP�range�len)r:r
�slicesrYs ` @rrOz!LineSplitter._fixedwidth_splitter�s������=�$��:�:�d�m�,�,�Q�/�D��z�z�&�!�!���	��I����J�J�J�J�u�Q��D�	�	�5�/I�/I�J�J�J��(�(�(�(��(�(�(�(rc���|j� ��|j��d��sgS|j}�fd�|D��S)Nrc� ��g|]
}�|��Srrr[s  �rr6z8LineSplitter._variablewidth_splitter.<locals>.<listcomp>�r]r)rFrUrP)r:r
r`s ` rrKz$LineSplitter._variablewidth_splitter�sQ����=�$��:�:�d�m�,�,�Q�/�D��	��I����(�(�(�(��(�(�(�(rc�R�|�t||j����S�N)rQr
rrVs  r�__call__zLineSplitter.__call__�s ���~�~�l�4���?�?�@�@�@r)Nr<TN)
�__name__�
__module__�__qualname__�__doc__r;rSrIrOrKrerrrr/r/�s�������
�
�@�@�@�(@D��!�!�!�!�:*�*�*�)�)�)�)�)�)�A�A�A�A�Arr/c�L�eZdZdZgd�Zed��Z		d
d�Zdd�Zdd	�Z	dS)�
NameValidatora"
    Object to validate a list of strings to use as field names.

    The strings are stripped of any non alphanumeric character, and spaces
    are replaced by '_'. During instantiation, the user can define a list
    of names to exclude, as well as a list of invalid characters. Names in
    the exclusion list are appended a '_' character.

    Once an instance has been created, it can be called with a list of
    names, and a list of valid names will be created.  The `__call__`
    method accepts an optional keyword "default" that sets the default name
    in case of ambiguity. By default this is 'f', so that names will
    default to `f0`, `f1`, etc.

    Parameters
    ----------
    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` becomes `file_` if supplied.
    deletechars : str, optional
        A string combining invalid characters that must be deleted from the
        names.
    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.

        The default value is True.
    replace_space : '_', optional
        Character(s) used in replacement of white spaces.

    Notes
    -----
    Calling an instance of `NameValidator` is the same as calling its
    method `validate`.

    Examples
    --------
    >>> validator = np.lib._iotools.NameValidator()
    >>> validator(['file', 'field2', 'with space', 'CaSe'])
    ('file_', 'field2', 'with_space', 'CaSe')

    >>> validator = np.lib._iotools.NameValidator(excludelist=['excl'],
    ...                                           deletechars='q',
    ...                                           case_sensitive=False)
    >>> validator(['excl', 'field2', 'no_q', 'with space', 'CaSe'])
    ('EXCL', 'FIELD2', 'NO_Q', 'WITH_SPACE', 'CASE')

    )�return�file�printz~!@#$%^&*()-=+~\|]}[{';: /?.>,<Nr5c��|�g}|�|j��||_|�|j}nt	|��}|�d��||_|�|dur	d�|_nT|dus|�d��r	d�|_n2|�d��r	d�|_nd	|z}t|���||_
dS)
N�"Tc��|Srdr��xs rr9z(NameValidator.__init__.<locals>.<lambda>,s��A�rF�uc�*�|���Srd)�upperrrs rr9z(NameValidator.__init__.<locals>.<lambda>.���A�G�G�I�I�r�lc�*�|���Srd)�lowerrrs rr9z(NameValidator.__init__.<locals>.<lambda>0rwrz%unrecognized case_sensitive value %s.)r(�defaultexcludelist�excludelist�defaultdeletechars�set�add�deletechars�case_converter�
startswithr�
replace_space)r:r|r��case_sensitiver��delete�msgs       rrSzNameValidator.__init__s������K����4�2�3�3�3�&������,�F�F���%�%�F��
�
�3����!����"��$�(>�(>�"-�+�D�����%�%�.�*C�*C�C�*H�*H�%�"5�"5�D���
�
&�
&�s�
+�
+�	"�"5�"5�D���9�N�J�C��S�/�/�!�*����r�f%ic��
�|�|�dSg}t|t��r|g}|�?t|��}||krt|��dg||z
zz}n||kr
|d|�}|j�
|j}|j}|j}g}t��}	d}
|D]�}||���	��}|r|�
d|��}d��
fd�|D����}|dkr||
z}||vr|
dz
}
||
z}||v�|
dz
}
n	||vr|dz
}|	�|d��}|dkr|�
|d|zz��n|�
|��|dz|	|<��t|��S)	a
        Validate a list of strings as field names for a structured array.

        Parameters
        ----------
        names : sequence of str
            Strings to be validated.
        defaultfmt : str, optional
            Default format string, used if validating a given string
            reduces its length to zero.
        nbfields : integer, optional
            Final number of validated names, used to expand or shrink the
            initial list of names.

        Returns
        -------
        validatednames : list of str
            The list of validated field names.

        Notes
        -----
        A `NameValidator` instance can be called directly, which is the
        same as calling `validate`. For examples, see `NameValidator`.

        Nrr� c���g|]}|�v�|��	Srr)r4�cr�s  �rr6z*NameValidator.validate.<locals>.<listcomp>ls#���D�D�D�!�q��/C�/C�A�/C�/C�/CrrEr5z_%d)rGrHr_rMr�r|r�r��dictr3�replace�join�get�append�tuple)r:r�
defaultfmt�nbfields�nbnamesr|r�r��validatednames�seen�nbempty�item�cntr�s             @r�validatezNameValidator.validate7s����6
�M�� ��t��E��e�S�!�!�	��I�E����%�j�j�G��(�"�"��U���r�d�h��.@�&A�A����H�$�$��i�x�i�(���&���&���,���*�
����v�v�����	!�	!�D�!�>�$�'�'�-�-�/�/�D��
8��|�|�C��7�7���7�7�D�D�D�D�t�D�D�D�E�E�D��r�z�z�!�G�+���e�m�m��q�L�G�%��/�D��e�m�m��1������$�$������(�(�4��#�#�C��Q�w�w��%�%�d�U�S�[�&8�9�9�9�9��%�%�d�+�+�+��q��D��J�J��^�$�$�$rc�2�|�|||���S)N)r�r�)r�)r:rr�r�s    rrezNameValidator.__call__}s���}�}�U�z�H�}�M�M�Mr)NNNr5�r�N)
rfrgrhrir{r~r}rSr�rerrrrkrk�s�������1�1�f5�4�4����C�D�D��59�47�+�+�+�+�6D%�D%�D%�D%�LN�N�N�N�N�Nrrkc�h�|���}|dkrdS|dkrdStd���)a�
    Tries to transform a string supposed to represent a boolean to a boolean.

    Parameters
    ----------
    value : str
        The string that is transformed to a boolean.

    Returns
    -------
    boolval : bool
        The boolean representation of `value`.

    Raises
    ------
    ValueError
        If the string is not 'True' or 'False' (case independent)

    Examples
    --------
    >>> np.lib._iotools.str2bool('TRUE')
    True
    >>> np.lib._iotools.str2bool('false')
    False

    �TRUET�FALSEFzInvalid boolean)rvr)�values r�str2boolr��s>��6
�K�K�M�M�E������t�	�'�	�	��u��*�+�+�+rc��eZdZdZdS)�ConverterErrorzR
    Exception raised when an error occurs in a converter for string values.

    N�rfrgrhrirrrr�r�����������	�Drr�c��eZdZdZdS)�ConverterLockErrorzR
    Exception raised when an attempt is made to upgrade a locked converter.

    Nr�rrrr�r��r�rr�c��eZdZdZdS)�ConversionWarningz�
    Warning issued when a string converter has a problem.

    Notes
    -----
    In `genfromtxt` a `ConversionWarning` is issued if raising exceptions
    is explicitly suppressed with the "invalid_raise" keyword.

    Nr�rrrr�r��s��������	�Drr�c��eZdZdZejedfejedfgZ	ej
ej��jej
ej��jkre	�
ejedf��e	�ejeejfejeejdzfejejejfejedfejeejfejeejdzfejedfejedfg��ed���Zed���Zed���Zedd
���Z ed���Z!		dd�Z"d
�Z#d�Z$d�Z%d�Z&d�Z'd�Z(		dd�Z)d	S)�StringConverterab
    Factory class for function transforming a string into another object
    (int, float).

    After initialization, an instance can be called to transform a string
    into another object. If the string is recognized as representing a
    missing value, a default value is returned.

    Attributes
    ----------
    func : function
        Function used for the conversion.
    default : any
        Default value to return when the input corresponds to a missing
        value.
    type : type
        Type of the output.
    _status : int
        Integer representing the order of the conversion.
    _mapper : sequence of tuples
        Sequence of tuples (dtype, function, default value) to evaluate in
        order.
    _locked : bool
        Holds `locked` parameter.

    Parameters
    ----------
    dtype_or_func : {None, dtype, function}, optional
        If a `dtype`, specifies the input data type, used to define a basic
        function and a default value for missing data. For example, when
        `dtype` is float, the `func` attribute is set to `float` and the
        default value to `np.nan`.  If a function, this function is used to
        convert a string to another object. In this case, it is recommended
        to give an associated default value as input.
    default : any, optional
        Value to return by default, that is, when the string to be
        converted is flagged as missing. If not given, `StringConverter`
        tries to supply a reasonable default value.
    missing_values : {None, sequence of str}, optional
        ``None`` or sequence of strings indicating a missing value. If ``None``
        then missing values are indicated by empty entries. The default is
        ``None``.
    locked : bool, optional
        Whether the StringConverter should be locked to prevent automatic
        upgrade or not. Default is False.

    FrDyz???c�4�tj|��jS)z(Returns the dtype of the input variable.)r#�array�dtype��cls�vals  r�	_getdtypezStringConverter._getdtypes���x��}�}�"�"rc�>�tj|��jjS)z4Returns the type of the dtype of the input variable.)r#r�r�rr�s  r�_getsubdtypezStringConverter._getsubdtype
s���x��}�}�"�'�'rc�>�|jtjkr|S|jS)z9Returns dtype for datetime64 and type of dtype otherwise.)rr#�
datetime64)r�r�s  r�_dtypeortypezStringConverter._dtypeortypes ���:���&�&��L��z�rNc�|�t|d��r3|j�d|�|��||f��dSt|d��r�t	|dt
tf��r"|D]}|j�d|���dS|�dgt|��z}nEt
|��}|�dgt|��t|��z
z��t||��D]8\}}|j�d|�|��||f���7dSdS)a�
        Upgrade the mapper of a StringConverter by adding a new function and
        its corresponding default.

        The input function (or sequence of functions) and its associated
        default value (if any) is inserted in penultimate position of the
        mapper.  The corresponding type is estimated from the dtype of the
        default value.

        Parameters
        ----------
        func : var
            Function, or sequence of functions

        Examples
        --------
        >>> import dateutil.parser
        >>> import datetime
        >>> dateparser = dateutil.parser.parse
        >>> defaultdate = datetime.date(2000, 1, 1)
        >>> StringConverter.upgrade_mapper(dateparser, default=defaultdate)
        rerDNr>r)
rJ�_mapper�insertr�rGr�rMr_r�rN)r��func�defaultr5�fct�dfts      r�upgrade_mapperzStringConverter.upgrade_mappersZ��2�4��$�$�	J��K���r�C�$4�$4�W�$=�$=�t�W�#M�N�N�N��F�
�T�:�
&�
&�	J��$�q�'�E�4�=�1�1�
��.�.�A��K�&�&�r�1�-�-�-�-������&�3�t�9�9�,����w�-�-������v��T���S��\�\�)A�B�C�C�C���g�.�.�
J�
J���S���"�"�2��(8�(8��(=�(=�s�C�'H�I�I�I�I�	J�	J�
J�
Jrc��t|j��D]\}\}}}|j|kr	||||ffcS�t|j��D],\}\}}}tj|j|��r	||||ffcS�-t
�rd)�	enumerater�rr#�
issubdtype�LookupError)r�r�rB�deftyper��default_defs      r�_find_map_entryzStringConverter._find_map_entryGs���09���/E�/E�	7�	7�+�A�+���{��z�W�$�$��7�D�+�6�6�6�6�6�%�09���/E�/E�	7�	7�+�A�+���{��}�U�Z��1�1�
7��7�D�+�6�6�6�6�6�
7��rc���t|��|_|�2t|_d|_|pd|_t
jd��}�n�	d|_t
j|��}n�#t$r{t|d��s!d}t|t|��z���||_|�)	|�d��}n#t$rd}YnwxYw|�|��}YnwxYw	|�
|��\|_\}}}	|�|	|_n7||_n/#t$r"||_|jd\}}}d|_YnwxYw|j�||_|j|jddkrjt!|j
tj��rtj|_n9t!|j
tj��rtj|_nd	�|_|�	d
h|_nOt)|t*��r|�d��}t/t1|��d
gz��|_|j|_|�|��|_
d|_||_dS)NrF�boolrezOThe input argument `dtype` is neither a function nor a dtype (got '%s' instead)�0rDrEc�:�tt|����Srd)r"�floatrrs rr9z*StringConverter.__init__.<locals>.<lambda>�s��#�e�A�h�h�-�-�rr�,)r��_lockedr�r��_statusr�r#r�rrJrrr�r�r�r��
issubclass�uint64�int64�missing_valuesrGrHrUr~rM�_strict_call�_callingfunctionr��_checked�_initial_default)
r:�
dtype_or_funcr�r��lockedr��errmsgr5r�r�s
          rrSzStringConverter.__init__Us����F�|�|���� � �D�I��D�L�"�+�e�D�L��H�V�$�$�E�E�
0� ��	����/�/�����
0�
0�
0��}�j�9�9�B�I�F�#�F�T�-�-@�-@�$@�A�A�A�)��	��?�'�"&�)�)�C�.�.����%�'�'�'�"&����'�������w�/�/����
0����$
+�7;�7K�7K�E�7R�7R�4���4�q�$���?�#.�D�L�L�#*�D�L�L���
!�
!�
!�&���!�\�"�-�
��4�� �����	
!�����y� � ��	��y�D�L��O�A�.�.�.��e�j�"�)�4�4�8� "�	�D�I�I���
�B�H�5�5�8� "��D�I�I� 7� 7�D�I��!�#%�$�D����.�#�.�.�
;�!/�!5�!5�c�!:�!:��"%�d�>�&:�&:�b�T�&A�"B�"B�D�� $� 1����%�%�e�,�,��	���
� '����sI�
A&�&AC+�+C�C+�C�
C+�C�C+�*C+�/!D"�")E�
Ec�\�	|�|��S#t$r
|jcYSwxYwrd)r�rr��r:r�s  r�_loose_callzStringConverter._loose_call�sB��	 ��9�9�U�#�#�#���	 �	 �	 ��<����	 ���s��+�+c�V�	|�|��}|jtur2	tj||j���n#t
$rt�wxYw|S#t$rE|���|jvr|j	sd|_
|jcYSt
d|z���wxYw)N)r�FzCannot convert string '%s')r�r"r#r�r�
OverflowErrorrr3r�r�r�r�)r:r��	new_values   rr�zStringConverter._strict_call�s���	C��	�	�%�(�(�I�
�y�C���%��H�U�$�)�4�4�4�4�4��$�%�%�%�$�$�%��������	C�	C�	C��{�{�}�}�� 3�3�3��|�*�$)�D�M��|�#�#�#��9�E�A�B�B�B�	C���s(�#A�A�A�A�A�:B(�B(c�,�|�|��Srd)r�r�s  rrezStringConverter.__call__�s���$�$�U�+�+�+rc�2�|jrd}t|���t|j��}|j}||krd}t|���||dz
kr|dz
}|j|\|_|_}||_|j�|j|_	dS||_	dS)Nz*Converter is locked and cannot be upgradedz*Could not find a valid conversion functionrE)
r�r�r_r�r�r�rr�r�r�)r:r��
_statusmaxr�r�s     r�_do_upgradezStringConverter._do_upgrade�s����<�	-�A�F�$�V�,�,�,����&�&�
��,���j� � �A�F� ��(�(�(�
�z�A�~�
%�
%��q�L�G�(,��W�(=�%��	�4�9�g����� �,��0�D�L�L�L�"�D�L�L�Lrc��d|_	|�|��S#t$r,|���|�|��cYSwxYw)a�
        Find the best converter for a given string, and return the result.

        The supplied string `value` is converted by testing different
        converters in order. First the `func` method of the
        `StringConverter` instance is tried, if this fails other available
        converters are tried.  The order in which these other converters
        are tried is determined by the `_status` attribute of the instance.

        Parameters
        ----------
        value : str
            The string to convert.

        Returns
        -------
        out : any
            The result of converting `value` with the appropriate converter.

        T)r�r�rr��upgrader�s  rr�zStringConverter.upgrade�si��*��
�	'��$�$�U�+�+�+���	'�	'�	'��������<�<��&�&�&�&�&�	'���s��3A�Ac���d|_t|d��s|f}|j}	|D]
}||���dS#t$r-|���|�|��YdSwxYw)NTr>)r�rJr�rr��iterupgrade)r:r�r��_ms    rr�zStringConverter.iterupgrade�s�����
��u�j�)�)�	��H�E��(��	$��
!�
!����R� � � � �
!�
!���	$�	$�	$����������U�#�#�#�#�#�#�	$���s�5�3A,�+A,rc��||_||_|�5||_|�|�|����|_nU	||pd��}n#ttf$rd}YnwxYw|�|�|����|_|�t��|_	dStj|��s|g}td�|D����st
d���|j	�
|��dS)a�
        Set StringConverter attributes directly.

        Parameters
        ----------
        func : function
            Conversion function.
        default : any, optional
            Value to return by default, that is, when the string to be
            converted is flagged as missing. If not given,
            `StringConverter` tries to supply a reasonable default value.
        testing_value : str, optional
            A string representing a standard input value of the converter.
            This string is used to help defining a reasonable default
            value.
        missing_values : {sequence of str, None}, optional
            Sequence of strings indicating a missing value. If ``None``, then
            the existing `missing_values` are cleared. The default is `''`.
        locked : bool, optional
            Whether the StringConverter should be locked to prevent
            automatic upgrade or not. Default is False.

        Notes
        -----
        `update` takes the same parameters as the constructor of
        `StringConverter`, except that `func` does not accept a `dtype`
        whereas `dtype_or_func` in the constructor does.

        N�1c3�@K�|]}t|t��V��dSrd)rGrH)r4�vs  r�	<genexpr>z)StringConverter.update.<locals>.<genexpr>1s,����B�B�a�z�!�S�)�)�B�B�B�B�B�Brz)missing_values must be strings or unicode)r�r�r�r�r�rrrr~r�r#�iterable�all�update)r:r�r��
testing_valuer�r��testers       rr�zStringConverter.update�s+��>��	������"�D�L��)�)�$�.�.��*A�*A�B�B�D�I�I�
���m�2�s�3�3�����z�*�
�
�
�����
�����)�)�$�.�.��*@�*@�A�A�D�I��!�#&�%�%�D�����;�~�.�.�
2�"0�!1���B�B�>�B�B�B�B�B�
M�� K�L�L�L���&�&�~�6�6�6�6�6s�
A�A+�*A+rd)NNNF)NNrF)*rfrgrhri�nx�bool_r��int_r"r�r��itemsizer�r�r(�float64r��nan�
complex128�complex�
longdouble�integer�floating�complexfloating�str_r�bytes_r�classmethodr�r�r�r�r�rSr�r�rer�r�r�r�rrrr�r��sJ������.�.�^��(�E�*����b�!�$�G�
�r�x�����!�H�B�H�R�X�$6�$6�$?�?�?������#�r�*�+�+�+��N�N�R�Z����/��]�G�R�V�b�[�9��]�B�M�2�6�:��Z��b�)��[�%���0��'��"�&�2�+�>��W�i��/��Y���/������#�#��[�#��(�(��[�(��	�	��[�	��&J�&J�&J��[�&J�P����[��IM��G(�G(�G(�G(�R � � �C�C�C�2,�,�,�#�#�#�('�'�'�8
$�
$�
$�8<�).�77�77�77�77�77�77rr�r�c�4�	tj|��}|��td	i|��}t|t��r|�d��}|j�ct|jgt|��z��}|||���}tjtt||������}�n`||t|j��|���|_�n9|j��td	i|��}td�tt|j����D����}|j|kr/|dkr)|dgt|j��z|���|_n�||j|���|_n�#t$r�td	i|��}t|��}|�dgt|��z}n*t|t��r|�d��}||||���}tjt||�����}YnwxYw|S)
a6
    Convenience function to create a `np.dtype` object.

    The function processes the input `dtype` and matches it with the given
    names.

    Parameters
    ----------
    ndtype : var
        Definition of the dtype. Can be any string or dictionary recognized
        by the `np.dtype` function, or a sequence of types.
    names : str or sequence, optional
        Sequence of strings to use as field names for a structured dtype.
        For convenience, `names` can be a string of a comma-separated list
        of names.
    defaultfmt : str, optional
        Format string used to define missing names, such as ``"f%i"``
        (default) or ``"fields_%02i"``.
    validationargs : optional
        A series of optional arguments used to initialize a
        `NameValidator`.

    Examples
    --------
    >>> np.lib._iotools.easy_dtype(float)
    dtype('float64')
    >>> np.lib._iotools.easy_dtype("i4, f8")
    dtype([('f0', '<i4'), ('f1', '<f8')])
    >>> np.lib._iotools.easy_dtype("i4, f8", defaultfmt="field_%03i")
    dtype([('field_000', '<i4'), ('field_001', '<f8')])

    >>> np.lib._iotools.easy_dtype((int, float, float), names="a,b,c")
    dtype([('a', '<i8'), ('b', '<f8'), ('c', '<f8')])
    >>> np.lib._iotools.easy_dtype(float, names="a,b,c")
    dtype([('a', '<f8'), ('b', '<f8'), ('c', '<f8')])

    Nr�)r�)r�r�c3� K�|]	}d|zV��
dSr�r)r4rBs  rr�zeasy_dtype.<locals>.<genexpr>zs&����"O�"O��5�1�9�"O�"O�"O�"O�"O�"Orr�r)�formatsrr)r#r�rkrGrHrUrr�rr_rMrNr^rr�)rrr��validationargsr�r�numbered_namesr�s        r�
easy_dtyper6sA��L$M���&�!�!����$�6�6�~�6�6�H��%��%�%�
)����C�(�(���|�#����
��E�
�
� :�;�;�� ���:�>�>�>����$�s�5�'�':�':�";�";�<�<��� (�x���F�L�8I�8I�3=� ?� ?� ?�����\�
%�$�6�6�~�6�6�H�"�"O�"O�e�C���<M�<M�6N�6N�"O�"O�"O�O�O�N����/�/�j�E�6I�6I�'�x���s�6�<�/@�/@�(@�3=� ?� ?� ?���� (�x����L�L�L�����E�=�=�=� �2�2�>�2�2���v�;�;���=��D�3�v�;�;�&�E�E�
��s�
#�
#�	%��K�K��$�$�E�����j�I�I�I����$�v�U�;�;�;�<�<����=����F�Ms�E<�<BH�Hrd)F)Nr�)ri�
__docformat__�numpyr#�numpy.core.numeric�core�numericr��numpy.compatrrr
rrrr'r/rkr��	Exceptionr�r��UserWarningr�r�rrrr�<module>rs����&�
��������������+�+�+�+�+�+�+�+�����4���������6,�,�,�,�^]A�]A�]A�]A�]A�]A�]A�]A�@YN�YN�YN�YN�YN�YN�YN�YN�x!,�!,�!,�H	�	�	�	�	�Y�	�	�	�	�	�	�	�	��	�	�	�
	�
	�
	�
	�
	��
	�
	�
	�q7�q7�q7�q7�q7�q7�q7�q7�hK�K�K�K�K�Kr

?>