File: //home/arjun/.local/lib/python3.10/site-packages/numpy/ma/__pycache__/mrecords.cpython-310.pyc
o
���g`j � @ s$ d Z ddlmZmZmZmZmZmZmZm Z ddlm
Z
ddlZddlZ
ddlmZmZmZmZmZ ddlmZmZ e
jjjZe
jjZg d�Zg d�Zd dd �Zd
d� Z G dd
� d
e�Z!dd� Z"e!Z# d!dd�Zddddddddef dd�Zdd� Z$dd� Z% d"e
j&d�dd�Z'd dd�Z(dS )#a, :mod:`numpy.ma..mrecords`
Defines the equivalent of :class:`numpy.recarrays` for masked arrays,
where fields can be accessed as attributes.
Note that :class:`numpy.ma.MaskedArray` already supports structured datatypes
and the masking of individual fields.
.. moduleauthor:: Pierre Gerard-Marchant
� )�MAError�MaskedArray�masked�nomask�masked_array�getdata�getmaskarray�filledN)�bool_�dtype�ndarray�recarray�array)�
fromarrays�fromrecords)�
MaskedRecords� mrecarrayr r �fromtextfile�addfield)�_data�_mask�
_fieldmaskr c C s� t | �}dd� t|�D �}|du r|}n,t|ttf�r|}nt|t�r)|�d�}ntd|����t |�}||k r@|||d� 7 }g }t||| j �D ](\}}}|t
v rh|d t
v rb|�||d f� qI|�|� qI|�||d f� qIt�
|�S )z�
Checks that field names ``descr`` are not reserved keywords.
If this is the case, a default 'f%i' is substituted. If the argument
`names` is not None, updates the field names to valid names.
c S s g | ]}d | �qS )�f%i� ��.0�ir r �D/home/arjun/.local/lib/python3.10/site-packages/numpy/ma/mrecords.py�
<listcomp>6 � z_checknames.<locals>.<listcomp>N�,zillegal input names r � )�len�range�
isinstance�tuple�list�str�split� NameError�zip�descr�reserved_fields�append�npr ) r+ �names�ndescr�
default_names� new_names�nnames�n�d�tr r r �_checknames- s(
r7 c C s: dd� | j jD �}tj| j|d�}tdgt|� �|_|S )Nc S s g | ]}|d f�qS )z|b1r �r r4 r r r r P r z"_get_fieldmask.<locals>.<listcomp>�r F)r r/ r. �empty�shaper% r"