3
���h� � @ s8 d Z ddlZddlZddlmZmZ ddlmZ ddlm Z
ddlmZm
Z
mZ ddlmZ dd lmZ d
ddgZejZd
ddd
ddddd
dddddd�Ze
jZG dd� dee�Zdd� Zed�G dd� d��ZG dd
� d
e
j�ZG dd� de�Zdd� Zd+dd�Zd,d d!�Z d-d"d#�Z!d$d%� Z"d.d&d'�Z#d/d)d*�Z$dS )0a�
Record Arrays
=============
Record arrays expose the fields of structured arrays as properties.
Most commonly, ndarrays contain elements of a single type, e.g. floats,
integers, bools etc. However, it is possible for elements to be combinations
of these using structured types, such as::
>>> a = np.array([(1, 2.0), (1, 2.0)], dtype=[('x', np.int64), ('y', np.float64)])
>>> a
array([(1, 2.), (1, 2.)], dtype=[('x', '<i8'), ('y', '<f8')])
Here, each element consists of two fields: x (and int), and y (a float).
This is known as a structured array. The different fields are analogous
to columns in a spread-sheet. The different fields can be accessed as
one would a dictionary::
>>> a['x']
array([1, 1])
>>> a['y']
array([2., 2.])
Record arrays allow us to access fields as properties::
>>> ar = np.rec.array(a)
>>> ar.x
array([1, 1])
>>> ar.y
array([2., 2.])
� N)�Counter�OrderedDict� )�numeric)�numerictypes)� isfileobj� os_fspath�contextlib_nullcontext)�
set_module)�get_printoptions�record�recarray�
format_parser�>�<�=�s�|)�b�l�n�B�L�N�Sr r r r r �I�ic @ s e Zd ZdZdd� Zdd� ZdS )�_OrderedCounterz?Counter that remembers the order elements are first encounteredc C s d| j jt| �f S )Nz%s(%r))� __class__�__name__r )�self� r! �3/tmp/pip-build-5_djhm0z/numpy/numpy/core/records.py�__repr__Q s z_OrderedCounter.__repr__c C s | j t| �ffS )N)r r )r r! r! r" |