
    d                     J	   d Z ddlZddlZddlZddlmZ ddlmZ dZ		 d Z
 G d d	ej        e
          Zd Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Ze                    d          Z eed          re                    d          Ze                    d          Z e                    d          Z! eed          re                    d          Z" eed           re                    d!          Z#e                    d"          Z$e                    d#          Z%e                    d$          Z&e                    d%          Z' eed&          re                    d'          Z( eed(          re                    d)          Z)e                    d*          Z*e                    d+          Z+e                    d,          Z, G d- d.          Z- G d/ d0e          Z. G d1 d2e.
          Z/dQd3Z0dRd4Z1e2d5k    r	  G d6 d7e/          Z3 G d8 d9e/          Z4 e4            Z5 e-e5j6                  Z7 e8d:e7            e8d; e9e7                      e8d<e7j:                    e8d=e7j;                    e8d>e7j3                    e8d?e7j3        j<                    e8d@e7j=                    e8dAe7j>                    e8dBe7j?                    e8dCe7j@                    e8dDe7jA        j@                    e8dEe7jB        jC                   e7D                                D ]ZZE eFeEe-          r5 e8dFdGH            e8dIeEjG                    e8dJeEjB        jC                   C e8dKeEjG        eEjH                   [ G dL dMe/          ZI G dN dOeI          ZJdPeJj6        v sJ dS dS )Sz5Classes for describing columns for ``Table`` objects.    N   )atom)check_name_validityreStructuredTextc                 B      fd} j         |_          j        |_        |S )z<Decorate `oldmethod` to also compare the `_v_pos` attribute.c                 p    	 |j          n# t          $ r Y dS w xY w| j         |j         k    o | |          S )NF)_v_posAttributeError)selfother	oldmethods     2lib/python3.11/site-packages/tables/description.py	newmethodz same_position.<locals>.newmethod   sS    	LLL 	 	 	55	{el*Eyyu/E/EEs    
)__name____doc__)r   r   s   ` r   same_positionr      s?    F F F F F #+I!)I    c                        e Zd ZdZi Z	 ed             Zedd            Zedd            Zedd            Z	edd            Z
edd	            Zed
             Z fdZd Z xZS )Cola  Defines a non-nested column.

    Col instances are used as a means to declare the different properties of a
    non-nested column in a table or nested column.  Col classes are descendants
    of their equivalent Atom classes (see :ref:`AtomClassDescr`), but their
    instances have an additional _v_pos attribute that is used to decide the
    position of the column inside its parent table or nested column (see the
    IsDescription class in :ref:`IsDescriptionClassDescr` for more information
    on column positions).

    In the same fashion as Atom, you should use a particular Col descendant
    class whenever you know the exact type you will need when writing your
    code. Otherwise, you may use one of the Col.from_*() factory methods.

    Each factory method inherited from the Atom class is available with the
    same signature, plus an additional pos parameter (placed in last position)
    which defaults to None and that may take an integer value.  This parameter
    might be used to specify the position of the column in the table.

    Besides, there are the next additional factory methods, available only for
    Col objects.

    The following parameters are available for most Col-derived constructors.

    Parameters
    ----------
    itemsize : int
        For types with a non-fixed size, this sets the size in bytes of
        individual items in the column.
    shape : tuple
        Sets the shape of the column. An integer shape of N is equivalent to
        the tuple (N,).
    dflt
        Sets the default value for the column.
    pos : int
        Sets the position of column in table.  If unspecified, the position
        will be randomly selected.

    c                 J    | j         }|d|                    d                   S )zReturn the column class prefix.Nr   )r   rfind)clscnames     r   prefixz
Col.prefixI   s(     (ekk%((())r   Nc                 n     |j                     } |j                    }| j        |         } |d||d|S )z{Create a Col definition from a PyTables atom.

        An optional position may be specified as the pos argument.

        pos_offset )r   _get_init_args_class_from_prefix)r   r   r   r   r   kwargscolclasss          r   	from_atomzCol.from_atomP   sK     $$&&)&1x;C;;F;;;r   r   c                 r    t           j                            |||          }|                     ||          S )a   Create a `Col` definition from a NumPy scalar type `sctype`.

        Optional shape, default value and position may be specified as
        the `shape`, `dflt` and `pos` arguments, respectively.
        Information in the `sctype` not represented in a `Col` is
        ignored.

        r   )r   Atomfrom_sctyper$   )r   sctypeshapedfltr   newatoms         r   r(   zCol.from_sctype]   s3     )''t<<}}W#}...r   c                 r    t           j                            ||          }|                     |||          S )aj  Create a `Col` definition from a NumPy `dtype`.

        Optional default value and position may be specified as the
        `dflt` and `pos` arguments, respectively.  The `dtype` must have
        a byte order which is irrelevant or compatible with that of the
        system.  Information in the `dtype` not represented in a `Col`
        is ignored.

        r   )r   r'   
from_dtyper$   )r   dtyper+   r   r   r,   s         r   r.   zCol.from_dtypek   s3     )&&ud33}}W#w}???r   c                 r    t           j                            |||          }|                     ||          S )zCreate a `Col` definition from a PyTables `type`.

        Optional shape, default value and position may be specified as
        the `shape`, `dflt` and `pos` arguments, respectively.

        r&   )r   r'   	from_typer$   )r   typer*   r+   r   r,   s         r   r1   zCol.from_typez   s3     )%%dE488}}W#}...r   c                 t    t           j                            ||||          }|                     ||          S )a)  Create a `Col` definition from a PyTables `kind`.

        Optional item size, shape, default value and position may be
        specified as the `itemsize`, `shape`, `dflt` and `pos`
        arguments, respectively.  Bear in mind that not all columns
        support a default item size.

        r&   )r   r'   	from_kindr$   )r   kinditemsizer*   r+   r   r,   s          r   r4   zCol.from_kind   s5     )%%dHeTBB}}W#}...r   c                     dz  }| j         }||v r||         S t          t          dz             G fdd|           |_        |<   S )z-Get a column subclass for the given `prefix`.z%sColz%sAtomc                       e Zd ZdZ fdZ ej                  Z ej                  Zdk    r ej                  ZdS dS ))Col._subclass_from_prefix.<locals>.NewCola&  Defines a non-nested column of a particular type.

            The constructor accepts the same arguments as the equivalent
            `Atom` class, plus an additional ``pos`` argument for
            position information, which is assigned to the `_v_pos`
            attribute.

            c                     |                     dd           }|                     dd           }| j        } j        | g|R i | | j        ur!||                                          }|| _        || _        || _        d S )Nr   r   )popr!   __init__	__class__r   r	   	_v_offset)	r   argsr"   r   offsetclass_from_prefixr#   NewColatombases	          r   r<   z2Col._subclass_from_prefix.<locals>.NewCol.__init__   s    jj--It44$($;!!!$8888888 >//0?H%-DN!!'r   EnumN)	r   
__module____qualname__r   r<   r   __eq___is_equal_to_atom_is_equal_to_enumatom)rB   rC   r   s   r   rB   r9      s         ( ( ( ( ( ( #]8?33F -h.H I I (52)4 )4%%%  r   rB   )r!   getattrr   r   )r   r   r   rA   rB   rC   s    `  @@r   _subclass_from_prefixzCol._subclass_from_prefix   s     & 2%%%$U++4F!233"	4 "	4 "	4 "	4 "	4 "	4 "	4 "	4 "	4S( "	4 "	4 "	4H  $*&!r   c                     t                                                      }|                    d          }|                    d          }||dz   |         }| j        j        }| d| d| j         dS )N()r   z, pos=)super__repr__indexrindexr=   r   r	   )r   atomreprlparrparatomargs	classnamer=   s         r   rP   zCol.__repr__   sw    77##%%~~c""s##D1HTM*N+	<<h<<dk<<<<r   c                 L      fddD             }t           dd          |d<   |S )z3Get a dictionary of instance constructor arguments.c                 2    i | ]}|t          |          S r   rJ   ).0argr   s     r   
<dictcomp>z&Col._get_init_args.<locals>.<dictcomp>   s%    GGGc#wtS))GGGr   )r*   r+   r	   Nr   rZ   )r   r"   s   ` r   r    zCol._get_init_args   s:     HGGG5FGGGh55ur   NN)r   NN)NNN)Nr   NN)r   rE   rF   r   r!   classmethodr   r$   r(   r.   r1   r4   rK   rP   r    __classcell__)r=   s   @r   r   r      s6       & &P 1* * [* 
< 
< 
< [
< / / / [/ @ @ @ [@ 	/ 	/ 	/ [	/ / / / [/ 0 0 [0d= = = = =      r   r   )	metaclassc               #   f  K   g d} t           j                                        D ]}\  }}t          |d          r*|}|                     |                                           ?|                                D ])}|                     |                                           *~|                     g d           t          t           d          r|                     d           t          t           d          r|                     d           | D ] }t          	                    |          }|V  !dS )	zGenerate all column classes.)IntUIntFloatTimer5   )	Complex32	Complex64
Complex128Complex192Atom
Complex192Complex256Atom
Complex256N)
r   atom_mapitemshasattrappendr   valuesextendr   rK   )	cprefixesr5   kdata	atomclasscprefixnewclasss         r   _generate_col_classesry      sO      100I,,.. 5 5u5&!! 	5IY--//0000"\\^^ 5 5	  !1!1!3!344445
 ===>>>t%&& '&&&t%&& '&&&  ,,W55 r   StringBoolrD   rc   Int8Int16Int32Int64rd   UInt8UInt16UInt32UInt64re   Float16AtomFloat16Float32Float64Float96AtomFloat96Float128AtomFloat128Complexrg   rh   ri   rj   rk   rl   rm   rf   Time32Time64c                   :    e Zd ZdZddZd Zd Zdd	Zd
 Zd Z	dS )Descriptiona  This class represents descriptions of the structure of tables.

    An instance of this class is automatically bound to Table (see
    :ref:`TableClassDescr`) objects when they are created.  It provides a
    browseable representation of the structure of the table, made of non-nested
    (Col - see :ref:`ColClassDescr`) and nested (Description) columns.

    Column definitions under a description can be accessed as attributes of it
    (*natural naming*). For instance, if table.description is a Description
    instance with a column named col1 under it, the later can be accessed as
    table.description.col1. If col1 is nested and contains a col2 column, this
    can be accessed as table.description.col1.col2. Because of natural naming,
    the names of members start with special prefixes, like in the Group class
    (see :ref:`GroupClassDescr`).


    .. rubric:: Description attributes

    .. attribute:: _v_colobjects

        A dictionary mapping the names of the columns hanging
        directly from the associated table or nested column to their
        respective descriptions (Col - see :ref:`ColClassDescr` or
        Description - see :ref:`DescriptionClassDescr` instances).

        .. versionchanged:: 3.0
           The *_v_colObjects* attribute has been renamed into
           *_v_colobjects*.

    .. attribute:: _v_dflts

        A dictionary mapping the names of non-nested columns
        hanging directly from the associated table or nested column
        to their respective default values.

    .. attribute:: _v_dtype

        The NumPy type which reflects the structure of this
        table or nested column.  You can use this as the
        dtype argument of NumPy array factories.

    .. attribute:: _v_dtypes

        A dictionary mapping the names of non-nested columns
        hanging directly from the associated table or nested column
        to their respective NumPy types.

    .. attribute:: _v_is_nested

        Whether the associated table or nested column contains
        further nested columns or not.

    .. attribute:: _v_itemsize

        The size in bytes of an item in this table or nested column.

    .. attribute:: _v_name

        The name of this description group. The name of the
        root group is '/'.

    .. attribute:: _v_names

        A list of the names of the columns hanging directly
        from the associated table or nested column. The order of the
        names matches the order of their respective columns in the
        containing table.

    .. attribute:: _v_nested_descr

        A nested list of pairs of (name, format) tuples for all the columns
        under this table or nested column. You can use this as the dtype and
        descr arguments of NumPy array factories.

        .. versionchanged:: 3.0
           The *_v_nestedDescr* attribute has been renamed into
           *_v_nested_descr*.

    .. attribute:: _v_nested_formats

        A nested list of the NumPy string formats (and shapes) of all the
        columns under this table or nested column. You can use this as the
        formats argument of NumPy array factories.

        .. versionchanged:: 3.0
           The *_v_nestedFormats* attribute has been renamed into
           *_v_nested_formats*.

    .. attribute:: _v_nestedlvl

        The level of the associated table or nested column in the nested
        datatype.

    .. attribute:: _v_nested_names

        A nested list of the names of all the columns under this table or
        nested column. You can use this as the names argument of NumPy array
        factories.

        .. versionchanged:: 3.0
           The *_v_nestedNames* attribute has been renamed into
           *_v_nested_names*.

    .. attribute:: _v_pathname

        Pathname of the table or nested column.

    .. attribute:: _v_pathnames

        A list of the pathnames of all the columns under this table or nested
        column (in preorder).  If it does not contain nested columns, this is
        exactly the same as the :attr:`Description._v_names` attribute.

    .. attribute:: _v_types

        A dictionary mapping the names of non-nested columns hanging directly
        from the associated table or nested column to their respective PyTables
        types.

    .. attribute:: _v_offsets

        A list of offsets for all the columns.  If the list is empty, means
        that there are no padding in the data structure.  However, the support
        for offsets is currently limited to flat tables; for nested tables, the
        potential padding is always removed (exactly the same as in pre-3.5
        versions), and this variable is set to empty.

        .. versionadded:: 3.5
           Previous to this version all the compound types were converted
           internally to 'packed' types, i.e. with no padding between the
           component types.  Starting with 3.5, the holes in native HDF5
           types (non-nested) are honored and replicated during dataset
           and attribute copies.
    TNc                 Z
   |st          d          | j        }d|d<   g |d<   i |d<   i |d<   i |d<   i |d<   d	|d
<   g }g }t          |d          s|dz   |d<   g }g }	g }
d	}|                                D ]\  }}|                    d          r%||v rt          j        d|d|            n|||<   @d }t          |          t          t                    k    r%t          |t                    r |            j
        }nxt          |j                  t          t                    k    r"t          |j        t                    r|j
        }n,t          |t                    r|}nt          j        |          }|)t          t          j        |          | j        |          }|||<   t#          |dd           }||	                    |           n|                    ||f           t#          |dd           }||
                    |           |                                 |	                                 d |D             |	z   }d}d	}|D ]}|rt)          |           ||         }|||<   t          |t*          t          f          st-          d|z            ||_        | |_        |dz  }||d         |<   |d                             |           ||j        d<   t          |t2                    s|                                }n|}t          |t*                    r|j        |d         |<   |j        |d         |<   |j        |d         |<   |                    |j                   j        j        dd          }|                    ||j        f           R|                    |j                    |                    ||j!        f           d}|d u p|d         }|rltE          |
          dk    rYtE          |          tE          |          k    r9tE          |          tE          |
          k    r|s|
                                 d}ng |d<   ||d<   | j        dk    rG| #                                 | $                                 t          | d          rt          d          |r>|d         ||
d}|%                    dd           }|||d<   tM          j        |          ntM          j        |          |d<   j'        |d<   fd j(        D             |d<   d S )!Nz cannot create an empty data type/_v_name_v_names	_v_dtypes_v_types_v_dflts_v_colobjectsF_v_is_nested_v_nestedlvlr   _v_zCan't set attr z in description class ptparamsr	   r>   c                     g | ]\  }}|S r   r   )r[   r   names      r   
<listcomp>z(Description.__init__.<locals>.<listcomp>  s    666#t666r   r   zPassing an incorrect value to a table column. Expected a Col (or subclass) instance and got: "%s". Please make use of the Col(), or descendant, constructor to properly initialize columns.TALLOW_PADDING
_v_offsets_v_nested_formats_v_byteorderzpUsing a ``_v_byteorder`` in the description is obsolete. Use the byteorder parameter in the constructor instead.)namesformatsoffsets_v_itemsizer6   _v_dtypec                 6    g | ]}j         |         d          S r   )fields)r[   r   r/   s     r   r   z(Description.__init__.<locals>.<listcomp>]  s%     O O O4d!3A!6 O O Or   ))
ValueError__dict__rp   ro   
startswithwarningswarnr2   IsDescription
issubclasscolumnsr=   
isinstancedictcopyr   r   rJ   rq   sortr   r   	TypeErrorr	   	_v_parentstrdecoder/   r+   
recarrtypebaser*   r   r   len_g_set_nested_names_descr_g_set_path_namesgetnpr6   r   )r   	classdict	nestedlvlvalidater   newdictnestedFormatsnestedDTypecols_with_poscols_no_poscols_offsetsvalid_offsetsr   descrr   r   r@   keysnestedkobjectkkbaserecarrtypeallow_paddingdtype_fieldsr6   r/   s                             @r   r<   zDescription.__init__  s    	A?@@@ - 	 
! 
 
#% "'w// 	4&/!mGN# '__.. *	, *	,MT5u%% 	7?? MM%)TT44#1 2 2 2 2 %*GDMGUtM2222um44 3  %''/u''4+>+>>>U_m<< ?  -E4(( ) 	%(( "#DIg$6$68I-57 7 7#IdO%400C{""4(((($$c4[111UK66F!##F+++ 	66666D &	 &	A '#A&&&q\FGAJfsK&899 @ !6 9?	!? @ @ @
  FM#F1HC*0GO$Q'J&&q))))*FOI&a%%  XXZZ&#&& */$Q')/
#A&)/
#A&$$V%6777!&!3""B#DEEEE$$V%=>>>""B#8999" !D(EH_,E 	'L!!A%%D		S////D		S.... /
  MM$&GL! (5#$!!**,,,""$$$t^,, O NO O O  
	* !,') )L {{=$77H#+3Z(H\**EEH[))E#
!& O O O O5; O O Or   c                 l   | j         }| j        }|dd         | _        t          t	          ||                    | _        t          |          D ]d\  }}| j        |         }t          |t                    r=|
                                 ||j        f| j        |<   ||j        f| j        |<   d| _        edS )z@Computes the nested names and descriptions for nested datatypes.NT)r   r   _v_nested_nameslistzip_v_nested_descr	enumerater   r   r   r   r   )r   r   fmtsir   
new_objects         r   r   z%Description._g_set_nested_names_descr_  s     %$QQQx#Ct$4$455 '' 	) 	)GAt+D1J*k22 )44666+/1K*L$Q'+/1K*L$Q'$(!	) 	)r   c                 j  	 d }d 	g }d| _         |                    |  ||           f           |r~|                                \  }}|d         }t          |t                    r[ 	|j         |j                  |_         |                    ||dd         f           |                    | ||          f           nt          |t                    rU 	|j         |j                  |_         |                    |j                   |                    ||dd         f           nt          |t                    sJ ||_        t          |          dk    rO|j        	fd|D             }|
                    d           |d         d         }|                    |           ||dS dS )	zCompute the pathnames for arbitrary nested descriptions.

        This method sets the ``_v_pathname`` and ``_v_pathnames``
        attributes of all the elements (both descriptions and columns)
        in this nested description.

        c                 *      fd j         D             S )Nc                 *    g | ]}j         |         S r   )r   )r[   colnamedescriptions     r   r   zLDescription._g_set_path_names.<locals>.get_cols_in_order.<locals>.<listcomp>z  s1     9 9 9  -g6 9 9 9r   )r   )r   s   `r   get_cols_in_orderz8Description._g_set_path_names.<locals>.get_cols_in_ordery  s1    9 9 9 9#.#79 9 9 9r   c                     | s|S |  d| S )Nr   r   )path1path2s     r   
join_pathsz1Description._g_set_path_names.<locals>.join_paths}  s#     %%e%%%r    r   r   Nc                 (    g | ]} |          S r   r   )r[   pathdescNamer   s     r   r   z1Description._g_set_path_names.<locals>.<listcomp>  s%    LLLt

8T : :LLLr   r   )_v_pathnamerq   r;   r   r   r   r   r   _v_pathnamesr   insertrs   )
r   r   stackdesccolsheadcolPaths
parentColsr   r   s
           @@r   r   zDescription._g_set_path_namesp  s   	9 	9 	9	& 	& 	&&  d--d334555 "	0JD$7D $,, 0 $.:d.>#M#M dDH-...d$5$5d$;$;<====D#&& 0 $.:d.>#M#M DL)))dDH-.... "$,,,,,$(!u::>>  $|HLLLLLtLLLHOOAx000!&r1J%%h///E  "	0 "	0 "	0 "	0 "	0r   Allc              #     K   |dvrt          d          | g}|rk|                    d          }|dv r|V  |j        D ]B}|j        |         }t	          |t
                    r|                    |           :|dv r|V  C|idS dS )a,  Iterate over nested columns.

        If type is 'All' (the default), all column description objects (Col and
        Description instances) are yielded in top-to-bottom order (preorder).

        If type is 'Col' or 'Description', only column descriptions of that
        type are yielded.

        )r   r   r   z@type can only take the parameters 'All', 'Col' or 'Description'.r   )r   r   )r   r   N)r   r;   r   r   r   r   rq   )r   r2   r   r   r   r   s         r   _f_walkzDescription._f_walk  s       444 D E E E  
	)YYq\\F--- ) )#1$7
j+66 )LL,,,,~--((((  
	) 
	) 
	) 
	) 
	)r   c                 Z      fd j         D             }dd                    |          z  S )z3Gives a detailed Description column representation.c                 J    g | ]}d j         z  d|dj        |          S )z  "z": )r   r   )r[   r   r   s     r   r   z(Description.__repr__.<locals>.<listcomp>  sP     ' ' ' t((((!!!T-?-B-BD ' ' 'r   z{
  %s}z,
  )r   join)r   reps   ` r   rP   zDescription.__repr__  sF    ' ' ' '' ' ' W\\#..//r   c                     d| j          dS )z)Gives a brief Description representation.zDescription(rN   )r   )r   s    r   __str__zDescription.__str__  s     6d25555r   )r   TN)r   )
r   rE   rF   r   r<   r   r   r   rP   r  r   r   r   r   r     s        E ENvP vP vP vPp) ) )"I0 I0 I0X) ) ) )80 0 06 6 6 6 6r   r   c                       e Zd ZdZd ZdS )MetaIsDescriptionz?Helper metaclass to return the class variables as a dictionary.c                     di i}d|v r|d         |d<   |D ]1}d|j         v r&|d                             |j         d                    2|D ](}|                    d          s||         |d         |<   )t                              | |||          S )z5Return a new class with a "columns" attribute filled.r   r   __)r   updater   r2   __new__)mcsrW   basesr   r   br   s          r   r  zMetaIsDescription.__new__  s     b#	!!!*9!5GI 	A 	AAAJ&&	"))!*Y*?@@@ 	5 	5A LL&& 5(1!	"1% ||CE7;;;r   N)r   rE   rF   r   r  r   r   r   r  r    s)        II< < < < <r   r  c                       e Zd ZdZdS )r   a  Description of the structure of a table or nested column.

    This class is designed to be used as an easy, yet meaningful way to
    describe the structure of new Table (see :ref:`TableClassDescr`) datasets
    or nested columns through the definition of *derived classes*. In order to
    define such a class, you must declare it as descendant of IsDescription,
    with as many attributes as columns you want in your table. The name of each
    attribute will become the name of a column, and its value will hold a
    description of it.

    Ordinary columns can be described using instances of the Col class (see
    :ref:`ColClassDescr`). Nested columns can be described by using classes
    derived from IsDescription, instances of it, or name-description
    dictionaries. Derived classes can be declared in place (in which case the
    column takes the name of the class) or referenced by name.

    Nested columns can have a _v_pos special attribute which sets the
    *relative* position of the column among sibling columns *also having
    explicit positions*.  The pos constructor argument of Col instances is used
    for the same purpose.  Columns with no explicit position will be placed
    afterwards in alphanumeric order.

    Once you have created a description object, you can pass it to the Table
    constructor, where all the information it contains will be used to define
    the table structure.

    .. rubric:: IsDescription attributes

    .. attribute:: _v_pos

        Sets the position of a possible nested column description among its
        sibling columns.  This attribute can be specified *when declaring*
        an IsDescription subclass to complement its *metadata*.

    .. attribute:: columns

        Maps the name of each column in the description to its own descriptive
        object. This attribute is *automatically created* when an IsDescription
        subclass is declared.  Please note that declared columns can no longer
        be accessed as normal class variables after its creation.

    N)r   rE   rF   r   r   r   r   r   r     s        ) ) ) )r   r   c                    i }d}| j         D ]}| j        |         dd         \  }}|j        j        }|j        j        }|dv r|d|fvrt          d          |}|dv rt                              |||          }	nh|dk    rP|j        d	v rG|j        d
k    rt          j
        d           t          |j        |          \  }	}
||	_        ||	_        nt          d|z            |	||<   t          ||          |fS )zEGet a description instance and byteorder from a (nested) NumPy dtype.|N   z><=zDstructured arrays with mixed byteorders are not supported yet, sorrybiufSUcr   V)r   r   r   z/nested descriptions will be converted to scalarr   zXstructured arrays with columns with type description ``%s`` are not supported yet, sorry)r   r   r   r5   	byteorderNotImplementedErrorr   r.   r*   r   r   descr_from_dtyper	   r>   r   )dtype_r   r   
fbyteorderr   r/   r@   r5   r  col_s              r   r  r  )  sP    FJ  d+BQB/vzJ(	#y!111)34 4 4 #J9..FF.CCCCS[[U[J66{b  EG G G%ej8DDDFCCJ"CMM%/1678 8 8 tv111:==r   c                    t          | t                    rt          | |          } nt          |           t          t                    k    r4t          | t                    rt           |             j        |          } nSt          | t                    rt          | j        |          } n't          | t                    st          d| z            | j        }|r|dk    r|	                    |          }|S )zGet a (nested) NumPy dtype from a description instance and byteorder.

    The descr parameter can be a Description or IsDescription
    instance, sub-class of IsDescription or a dictionary.

    r   zinvalid description: %rr  )
r   r   r   r2   r   r   r   r   r   newbyteorder)r   r  r   r  s       r   dtype_from_descrr  L  s     % <EH555
u++m,,
,
,.. -EEGGOh???	E=	)	) <EMH==={++ <2U:;;;^F 0Y#%%$$Y//Mr   __main__c                   :    e Zd ZdZ e            Z e            ZdS )Infor  N)r   rE   rF   r	   	UInt32ColName
Float64ColValuer   r   r   r  r  i  s)        y{{
r   r  c                       e Zd ZdZe                    dddd          Ze                    ddd	          Z e	d
          Z
 edd
          Z e            Z G d de          ZdS )Testz'A description that has several columns.int32r  r   r&   floatr   r     r+   r*   r+    c                       e Zd ZdZ e            Z ed          Ze	                    dddd          Z
 ed          Z G d d	e          Zd
S )	Test.infor   r   r&   r%  r&  )r+   r*   r   r)  c                       e Zd Ze                    ddd          Z ed          Z e            Z	 e
            Z G d de          ZdS )	Test.info.info2r%  r   r&  r(  r)  c                   ~    e Zd Z e            Z e            Ze                    ddd          Z	 e
d          ZdS )Test.info.info2.info3r%  r   r&  r(  r)  N)r   rE   rF   r  r   r   valuer   r4   y4UInt8Colz4r   r   r   info3r0    sM        $9;;D&JLLEwQfEEB!q)))BBBr   r5  N)r   rE   rF   r   r4   y3r3  z3r  r   r   r1  r   r5  r   r   r   info2r.    s}        ]]7&]AAX1%%% y{{"
* * * * *M * * * * *r   r8  N)r   rE   rF   r	   r  r   r   r1  r   r4   y2r3  z2r   r8  r   r   r   infor,  x  s        F9;;DJ1%%%EwQf!DDBq!!!B
* 
* 
* 
* 
* 
* 
* 
* 
* 
*r   r;  N)r   rE   rF   r   r   r1   xr4   yr3  z	StringColcolorr  r   r;  r   r   r   r#  r#  n  s        55MM'1aQM//MM'M88H!	!#&&&tvv	* 	* 	* 	* 	*= 	* 	* 	* 	* 	*r   r#  z&Description representation (short) ==>z%Description representation (long) ==>zColumn names ==>zColumn x ==>zColumn Info ==>zColumn Info.value ==>zNested column names  ==>zDefaults ==>zNested Formats ==>zNested Descriptions ==>zNested Descriptions (info) ==>zTotal size ==>z******begin object*************r*  )endzname -->ztotalsize-->zleaf -->c                   "    e Zd Z e            ZdS )testDescParentN)r   rE   rF   Int32Colcr   r   r   rC  rC    s        HJJr   rC  c                       e Zd ZdS )testDescN)r   rE   rF   r   r   r   rG  rG    s        r   rG  rE  )Nr^   )Kr   r   r   numpyr   r   r   r   r   __docformat__r   r'   r2   r   ry   rK   r?  BoolColEnumColIntColInt8ColInt16ColrD  Int64ColUIntColr3  	UInt16Colr  	UInt64ColFloatColrp   
Float16Col
Float32Colr   
Float96ColFloat128Col
ComplexColComplex32ColComplex64ColComplex128ColComplex192ColComplex256ColTimeCol	Time32Col	Time64Colr   r  r   r  r  r   r  r#  klassr   r   printreprr   r<  r!  r   r   r   r   r;  r   r6   r   r   r   r   r/   rC  rG  r   r   r   <module>rd     s{   ; ;             % % % % % % # 9
 
 
x x x x x$)t x x x xv  > %%h//	

#
#F
+
+

#
#F
+
+		"	"5	)	)

#
#F
+
+$$W--$$W--$$W--

#
#F
+
+$$W--%%h//	%%h//	%%h//	$$W--
74 6**955J&&y11
&&y11

74 6**955J
74   8++J77K&&y11
((55((55)),77
74!"" <--l;;M
74!"" <--l;;M

#
#F
+
+%%h//	%%h//	
D6 D6 D6 D6 D6 D6 D6 D6N< < < < < < < <,* * * * */ * * * *Z >  >  >  >F   4 z    }   
* * * * *} * * *v DFFE;u}%%D	E
2D999	E
144::>>>	E
dm,,,	E.$&!!!	E
TY'''	E
!49?333	E
$d&:;;;	E.$-(((	E
 6777	E
#T%9:::	E
*DI,EFFF	E
DM2333 ,,.. 
< 
<:fk** 		<E3====E*fn--- E.&/":;;;; E*fnfl;;;;           >    ("""""M L #"r   