
    ꢩe                     z    d Z ddlZddlZddlZ ej         ed          ddddd          Zd Zd	dZ	d Z
d ZdS )
zxThis utility lets you look into the data and metadata of your data files.

Pass the flag -h to this for help on usage.

    N)rng	showattrsverbosedumpcolinfoidxinfoc                 <   t           j        rt          t          |                      nt          t	          |                      t           j        r$t          dt          | j                  z              t           j        rt          | t          j
        j                  st          d           t           j        j        d}nt           j        j        }t           j        j        | j        dk    r| j        d         }nt           j        j        }t           j        j        d}nt           j        j        }| j        dk    rt          d| d         z             n=t#          |||          D ]+}t          d                    || |                              ,t          | t          j        j                  rJt           j        r>| j        D ]6}t          t          | j                            |                               7t          | t          j        j                  ryt           j        ro| j        D ]i}| j                            |          }t          |t          j        j                  r*|j        #|j        }t          t          |                     fd S d S d S )N  z  Data dump:r       z[SCALAR] %sz[{}] {})optionsr   printreprstrr   attrsr   
isinstancetbunimplementedUnImplementedr   startstopshapesteprangeformattableTabler   colnamescols_f_colr   Columnindex)leafr   r   r   icolnamecolidxs           5lib/python3.11/site-packages/tables/scripts/ptdump.py	dump_leafr)      sR    d4jjc$ii %d4
###$$$| 4JtR-=-KLL 4n ;$EEK%E;#zRz!};#D;#DD;#D:-48,----5$-- 4 4i&&q$q'223333$'' 3GO 3} 	3 	3G$ty''00112222$'' !GO !} 	! 	!G)""7++C#rx// !CI4Iid3ii   ! ! ! !	! 	!    Fc                    | j         j        dd          }|                                 }|r#t          |t	          j        d                    }|D ]}t          t          |                     t          j	        r$t          dt          |j                  z              |D ]^}|                    |          D ]F}t          j        st          j        rt          |           *t          t          |                     G_d S )Nr   _v_pathname)keyr
   )_v_file_node_kinds_f_walk_groupssortedoperator
attrgetterr   r   r   r   r   _v_attrs_f_list_nodesr   r   r)   )pgroupsort
node_kindswhatgroupkindnodes          r(   
dump_groupr=   F   s   +ABB/J  ""D Dd 3M B BCCC 	% 	%c%jj 	-$tEN+++,,, 	% 	%D++D11 % %? %gl %dOOOO#d))$$$$	%	%		% 	%r*   c                     t          j        d          } |                     dddd           |                     dd	dd
           |                     dddd           |                     dddd           |                     dddd           |                     dddd           |                     ddddd           |                     ddd            | S )!NzThe ptdump utility allows you look into the contents
        of your PyTables files. It lets you see not only the data but also
        the metadata (that is, the *structure* and additional information in
        the form of *attributes*).)descriptionz-vz	--verbose
store_truez"dump more metainformation on nodes)actionhelpz-dz--dumpzdump data information on leavesz-az--showattrsz?show attributes in nodes (only useful when -v or -d are active)z-sz--sortzsort output by node namez-cz	--colinfozMshow info of columns in tables (only useful when -v or -d
        are active)z-iz	--idxinfozKshow info of indexed columns (only useful when -v or -d are
        active)z-Rz--ranger   RANGEzselect a RANGE of rows (in the form "start,stop,step")
        during the copy of *all* the leaves.
        Default values are "None,None,1", which means a copy of all the
        rows.)destmetavarrB   srczfilename[:nodepath]zname of the HDF5 file to dump)rE   rB   )argparseArgumentParseradd_argument)parsers    r(   _get_parserrK   W   ss   $&' ' 'F k,1     h|.     mLN     h|'     k,    
 k,    
 ieW     '<<  > > > Mr*   c                     t                      } |                     t                    }t          |j        t
                    rR	 t          d|j        z   dz             t          _        d|_        n%# t          $ r | 	                    d           Y nw xY w|j
                            dd          }t          |          dk    r|d         d}}n|\  }}|d	k    rd}	 t          j        |d
          }n)# t          $ r}dt          |          z   cY d }~S d }~ww xY w|5  |                    |          }t          |t          j        j                  rt%          ||j                   n?t          |t          j        j                  rt-          |           nt/          d|           d d d            d S # 1 swxY w Y   d S )N)	namespacezslice()r   z'Error when getting the range parameter.:r   / rzCannot open input file: zUnrecognized object:)rK   
parse_argsr   r   r   r   evalr   	ExceptionerrorrF   rsplitlenr   	open_fileget_noder:   Groupr=   r7   r#   Leafr)   r   )rJ   argsrF   filenamenodenameh5filee
nodeobjects           r(   mainrc      s"   ]]Fw//D $(C   	x$(2S899GK DII  	D 	D 	DLLBCCCCC	D (//#q
!
!C
3xx1}} VS( (r>>H3h,, 3 3 3)CFF22222223 
 6 6__X..
j"(.11 	6z49----
BGL11 	6j!!!! (*5556 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6sC   $A1 1BBC3 3
D=DDDB
F55F9<F9)F)__doc__rG   r2   tablesr   	Namespaceslicer   r)   r=   rK   rc   r   r*   r(   <module>rh      s           (
d	
  *! *! *!Z% % % %"+ + +\(6 (6 (6 (6 (6r*   