
    `Vg             
         U d Z ddlmZ ddlmZ ddlZddlmZmZ ddl	Z	ddl
Z
ddlZddlmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlZddlZddlmZmZ dd	lm Z m!Z" dd
l#m$Z$ ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m7Z7 ddl8m9Z9 ddl:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZE ddlFmGZG ddlHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQ ddlRmSZS ddlTmUZUmVZVmWZW ddlXmYc mZZ[ ddl\m]Z]m^Z^ ddl_m`Z` ddlambZb ddlcmdZdmeZe ddlfmgZg ddlhmiZimjZj erddlkmlZlmmZmmnZn ddlcmoZo dZpdZqd  Zrd! Zsd" Zte]Zudvd#Zvd$Zwd%exd&<   d'Zyd%exd(<   d)Zzd%exd*<   d+d+d,d,d-Z{eIdgiZ|d.Z}d%exd/<   d0Z~d%exd1<    ej                  d2      5   ej                   d3d4e}ej                  5        ej                   d6de~ ej                  g d7      5       ddd       dad4ad8 Z	 	 	 	 	 	 	 	 	 	 	 	 dw	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dxd9Z	 	 	 	 	 	 	 	 	 dy	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dzd:Zd{d;Z G d< d=      Z G d> d?      Z G d@ dA      Z G dB dCe      Z G dD dEe      Z G dF dGe      Z G dH dIe      Z G dJ dK      Z G dL dMe      Z G dN dOe      Z G dP dQe      Z G dR dSe      Z G dT dUe      Z G dV dWe      Z G dX dYe      Z G dZ d[e      Z G d\ d]e      Z G d^ d_e      Z G d` dae      Z G db dce      Zd|d}ddZd~deZe	 d	 	 	 	 	 	 	 ddf       Zedddg       Z	 d	 	 	 	 	 	 	 ddhZddiZddjZ	 	 	 	 	 	 ddkZddlZ	 	 	 	 	 	 	 	 ddmZddnZddoZddpZddqZddrZddsZ G dt du      Zy# 1 sw Y   xY w)zY
High level interface to PyTables for reading and writing pandas data structures
to disk
    )annotations)suppressN)datetzinfo)dedent)
TYPE_CHECKINGAnyCallableFinalHashableIteratorLiteralSequencecastoverload)config
get_option)libwriters)	timezones)AnyArrayLike	ArrayLikeDtypeArgFilePathShapenpt)import_optional_dependency)patch_pickle)AttributeConflictWarningClosedFileErrorIncompatibilityWarningPerformanceWarningPossibleDataLossError)cache_readonly)find_stack_level)ensure_objectis_bool_dtypeis_categorical_dtypeis_complex_dtypeis_datetime64_dtypeis_datetime64tz_dtypeis_extension_array_dtypeis_list_likeis_string_dtypeis_timedelta64_dtypeneeds_i8_conversion)array_equivalent)		DataFrameDatetimeIndexIndex
MultiIndexPeriodIndexSeriesTimedeltaIndexconcatisna)
Int64Index)CategoricalDatetimeArrayPeriodArray)PyTablesExprmaybe_expression)extract_array)ensure_index)ArrayManagerBlockManager)stringify_path)adjoinpprint_thing)ColFileNode)Blockz0.15.2UTF-8c                \    t        | t        j                        r| j                  d      } | S )z(if we have bytes, decode them to unicoderL   )
isinstancenpbytes_decode)ss    S/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/pandas/io/pytables.py_ensure_decodedrT      s#    !RYYHHWH    c                    | t         } | S N)_default_encodingencodings    rS   _ensure_encodingr[      s    $OrU   c                <    t        | t              rt        |       } | S )z
    Ensure that an index / column name is a str (python 3); otherwise they
    may be np.string dtype. Non-string dtypes are passed through unchanged.

    https://github.com/pandas-dev/pandas/issues/13492
    )rN   strnames    rS   _ensure_strr`      s     $4yKrU   c                    |dz   }t        | t        t        f      r-| D cg c]!  }|t        |      rt	        ||dz         n|# } }nt        |       rt	        | |      } | t        |       r| S dS c c}w )z
    Ensure that the where is a Term or a list of Term.

    This makes sure that we are capturing the scope of variables that are
    passed create the terms here with a frame_level=2 (we are 2 levels down)
       Nscope_level)rN   listtupler@   Termlen)whererd   levelterms       rS   _ensure_termrl      s     !OE%$' 
 2B$1GD519-TQ
 

 
%	 U.MSZ59T9
s   &A2z
where criteria is being ignored as this version [%s] is too old (or
not-defined), read the file in and write it out to a new file to upgrade (with
the copy_to method)
r   incompatibility_doczu
the [%s] attribute of the existing index is [%s] which conflicts with the new
[%s], resetting the attribute to None
attribute_conflict_docz
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->%s,key->%s] [items->%s]
performance_docfixedtable)frp   trq   z;
: boolean
    drop ALL nan rows when appending to a table

dropna_docz~
: format
    default format writing format, if None, then
    put will default to 'fixed' and append will default to 'table'

format_doczio.hdfdropna_tableF)	validatordefault_format)rp   rq   Nc                     t         =dd l} | a t        t              5  | j                  j
                  dk(  ad d d        t         S t         S # 1 sw Y   t         S xY w)Nr   strict)
_table_modtablesr   AttributeErrorfile_FILE_OPEN_POLICY!_table_file_open_policy_is_strict)r|   s    rS   _tablesr      sX     

 n% 	--9 .	
 :	
 s   A

Ac           
        	
 |r	
f
d}n	
f
d}t        |       } t        | t              r!t        | |||      5 } ||       ddd       y ||        y# 1 sw Y   yxY w)z+store this object, close it if we opened itc                :   
 | j                  
	
      S )N)formatindexmin_itemsizenan_repdropnadata_columnserrorsrZ   )appendstorer   r   rZ   r   r   r   keyr   r   values    rS   <lambda>zto_hdf.<locals>.<lambda>  s3    %,,%% ' 
 rU   c                :   
 | j                  
	
      S )N)r   r   r   r   r   r   rZ   r   putr   s    rS   r   zto_hdf.<locals>.<lambda>  s3    %))%% $ 
 rU   )mode	complevelcomplibN)rE   rN   r]   HDFStore)path_or_bufr   r   r   r   r   r   r   r   r   r   r   r   r   rZ   rr   r   s    ``    ````````  rS   to_hdfr      su    $ 
 

 
 !-K+s#di
 	eH	 	
 	
+	 	s   	A//A8c
           
     F   |dvrt        d| d      |t        |d      }t        | t              r| j                  st        d      | }d}nht        |       } t        | t              st        d	      	 t        j                  j                  |       }|st        d
|  d      t        | f||d|
}d}	 |[|j                         }t        |      dk(  rt        d      |d   }|dd D ]  }t!        ||      rt        d       |j"                  }|j%                  |||||||	|      S # t        t         f$ r d}Y w xY w# t         t        t&        f$ rG t        | t              s5t)        t*              5  |j-                          ddd        # 1 sw Y    xY w w xY w)a)	  
    Read from the store, close it if we opened it.

    Retrieve pandas object stored in file, optionally based on where
    criteria.

    .. warning::

       Pandas uses PyTables for reading and writing HDF5 files, which allows
       serializing object-dtype data with pickle when using the "fixed" format.
       Loading pickled data received from untrusted sources can be unsafe.

       See: https://docs.python.org/3/library/pickle.html for more.

    Parameters
    ----------
    path_or_buf : str, path object, pandas.HDFStore
        Any valid string path is acceptable. Only supports the local file system,
        remote URLs and file-like objects are not supported.

        If you want to pass in a path object, pandas accepts any
        ``os.PathLike``.

        Alternatively, pandas accepts an open :class:`pandas.HDFStore` object.

    key : object, optional
        The group identifier in the store. Can be omitted if the HDF file
        contains a single pandas object.
    mode : {'r', 'r+', 'a'}, default 'r'
        Mode to use when opening the file. Ignored if path_or_buf is a
        :class:`pandas.HDFStore`. Default is 'r'.
    errors : str, default 'strict'
        Specifies how encoding and decoding errors are to be handled.
        See the errors argument for :func:`open` for a full list
        of options.
    where : list, optional
        A list of Term (or convertible) objects.
    start : int, optional
        Row number to start selection.
    stop  : int, optional
        Row number to stop selection.
    columns : list, optional
        A list of columns names to return.
    iterator : bool, optional
        Return an iterator object.
    chunksize : int, optional
        Number of rows to include in an iteration when using an iterator.
    **kwargs
        Additional keyword arguments passed to HDFStore.

    Returns
    -------
    item : object
        The selected object. Return type depends on the object stored.

    See Also
    --------
    DataFrame.to_hdf : Write a HDF file from a DataFrame.
    HDFStore : Low-level access to HDF files.

    Examples
    --------
    >>> df = pd.DataFrame([[1, 1.0, 'a']], columns=['x', 'y', 'z'])  # doctest: +SKIP
    >>> df.to_hdf('./store.h5', 'data')  # doctest: +SKIP
    >>> reread = pd.read_hdf('./store.h5')  # doctest: +SKIP
    )rr+azmode zG is not allowed while performing a read. Allowed modes are r, r+ and a.Nrb   rc   z&The HDFStore must be open for reading.Fz5Support for generic buffers has not been implemented.zFile z does not exist)r   r   Tr   z]Dataset(s) incompatible with Pandas data types, not table, or no datasets found in HDF5 file.z?key must be provided when HDF5 file contains multiple datasets.)ri   startstopcolumnsiterator	chunksize
auto_close)
ValueErrorrl   rN   r   is_openOSErrorrE   r]   NotImplementedErrorospathexists	TypeErrorFileNotFoundErrorgroupsrh   _is_metadata_of_v_pathnameselectKeyErrorr   r}   close)r   r   r   r   ri   r   r   r   r   r   kwargsr   r   r   r   candidate_only_groupgroup_to_checks                    rS   read_hdfr   2  s   ^ ##D6 - .
 	

 U2+x(""BCC
$[1+s+%G 	WW^^K0F #eK=$HIII4I&I 
%;\\^F6{a D  $*!9  #)* &~7KL$;  '22C||!  	
 		
A :& 	F	T 	8, +x0.)  	 	s=   6D. 8AE =0E .EE3F 8F		F F		F c                    | j                   |j                   k  ry| }|j                   dkD  r=|j                  }||k(  r|j                  dk(  ry|j                  }|j                   dkD  r=y)zDCheck if a given group is a metadata group for a given parent_group.Frb   metaT)_v_depth	_v_parent_v_name)groupparent_groupcurrentparents       rS   r   r     sk    ~~...G


Q
""\!goo&?##	 

Q

 rU   c                  2   e Zd ZU dZded<   ded<   ded<   ded	<   	 	 	 	 d7	 	 	 	 	 	 	 d8dZd9dZed        Zed9d       Z	d:dZ
d;dZd;dZd<dZd=dZd>dZd9dZd?dZd@dZdAdBdZdCdZdDdZd ZdEdFdZd@dZedGd       ZdHdIdZd:d Z	 	 	 	 	 	 	 dJ	 	 	 dKd!Z	 	 	 dL	 	 	 	 	 dMd"Z	 	 dN	 	 	 	 	 	 	 dOd#Z	 	 	 	 	 	 	 	 dP	 dQd$Z	 	 	 	 	 	 	 	 	 	 	 	 dR	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dSd%Z dLd;d&Z!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dT	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dUd'Z"	 	 	 dV	 	 	 dWd(Z#	 	 	 dL	 	 	 	 	 	 	 dXd)Z$dYd*Z%dZd[d+Z&d\d,Z'd]d-Z(	 	 	 	 	 	 	 d^	 	 	 	 	 	 	 d_d.Z)d9d/Z*d0 Z+d`d1Z,	 	 	 	 da	 	 	 	 	 	 	 dbd2Z-	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dc	 	 	 	 	 	 	 	 	 	 	 	 	 ddd3Z.ded4Z/dfd5Z0dgd6Z1y
)hr   aa	  
    Dict-like IO interface for storing pandas objects in PyTables.

    Either Fixed or Table format.

    .. warning::

       Pandas uses PyTables for reading and writing HDF5 files, which allows
       serializing object-dtype data with pickle when using the "fixed" format.
       Loading pickled data received from untrusted sources can be unsafe.

       See: https://docs.python.org/3/library/pickle.html for more.

    Parameters
    ----------
    path : str
        File path to HDF5 file.
    mode : {'a', 'w', 'r', 'r+'}, default 'a'

        ``'r'``
            Read-only; no data can be modified.
        ``'w'``
            Write; a new file is created (an existing file with the same
            name would be deleted).
        ``'a'``
            Append; an existing file is opened for reading and writing,
            and if the file does not exist it is created.
        ``'r+'``
            It is similar to ``'a'``, but the file must already exist.
    complevel : int, 0-9, default None
        Specifies a compression level for data.
        A value of 0 or None disables compression.
    complib : {'zlib', 'lzo', 'bzip2', 'blosc'}, default 'zlib'
        Specifies the compression library to be used.
        As of v0.20.2 these additional compressors for Blosc are supported
        (default if no compressor specified: 'blosc:blosclz'):
        {'blosc:blosclz', 'blosc:lz4', 'blosc:lz4hc', 'blosc:snappy',
         'blosc:zlib', 'blosc:zstd'}.
        Specifying a compression library which is not available issues
        a ValueError.
    fletcher32 : bool, default False
        If applying compression use the fletcher32 checksum.
    **kwargs
        These parameters will be passed to the PyTables open_file method.

    Examples
    --------
    >>> bar = pd.DataFrame(np.random.randn(10, 4))
    >>> store = pd.HDFStore('test.h5')
    >>> store['foo'] = bar   # write to HDF5
    >>> bar = store['foo']   # retrieve
    >>> store.close()

    **Create or load HDF5 file in-memory**

    When passing the `driver` option to the PyTables open_file method through
    **kwargs, the HDF5 file is loaded or created in-memory and will only be
    written when closed:

    >>> bar = pd.DataFrame(np.random.randn(10, 4))
    >>> store = pd.HDFStore('test.h5', driver='H5FD_CORE')
    >>> store['foo'] = bar
    >>> store.close()   # only now, data is written to disk
    zFile | None_handler]   _modeint
_complevelbool_fletcher32Nc                   d|v rt        d      t        d      }|;||j                  j                  vr#t        d|j                  j                   d      |||j                  j                  }t        |      | _        |d}|| _        d | _        |r|nd| _	        || _
        || _        d | _         | j                  d	d|i| y )
Nr   z-format is not a defined argument for HDFStorer|   zcomplib only supports z compression.r   r   r    )r   r   filtersall_complibsdefault_complibrE   _pathr   r   r   _complibr   _filtersopen)selfr   r   r   r   
fletcher32r   r|   s           rS   __init__zHDFStore.__init__"  s     vLMM+H57&..2M2M#M()D)D(E]S  ?y4nn44G#D)
<D
'0)a%		&t&v&rU   c                    | j                   S rW   r   r   s    rS   
__fspath__zHDFStore.__fspath__D  s    zzrU   c                j    | j                          | j                  J | j                  j                  S )zreturn the root node)_check_if_openr   rootr   s    rS   r   zHDFStore.rootG  s0     	||'''||   rU   c                    | j                   S rW   r   r   s    rS   filenamezHDFStore.filenameN      zzrU   c                $    | j                  |      S rW   )getr   r   s     rS   __getitem__zHDFStore.__getitem__R  s    xx}rU   c                (    | j                  ||       y rW   r   )r   r   r   s      rS   __setitem__zHDFStore.__setitem__U  s    erU   c                $    | j                  |      S rW   )remover   s     rS   __delitem__zHDFStore.__delitem__X  s    {{3rU   c                    	 | j                  |      S # t        t        f$ r Y nw xY wt        dt	        |       j
                   d| d      )z$allow attribute access to get stores'z' object has no attribute ')r   r   r    r}   type__name__)r   r_   s     rS   __getattr__zHDFStore.__getattr__[  sW    	88D>!/* 		T
##$$?vQG
 	
s    %%c                ^    | j                  |      }||j                  }||k(  s|dd |k(  ryy)zx
        check for existence of this key
        can match the exact pathname or the pathnm w/o the leading '/'
        Nrb   TF)get_noder   )r   r   noder_   s       rS   __contains__zHDFStore.__contains__e  s<    
 }}S!##Ds{d12h#orU   c                4    t        | j                               S rW   )rh   r   r   s    rS   __len__zHDFStore.__len__q  s    4;;=!!rU   c                N    t        | j                        }t        |        d| dS )N
File path: 
)rG   r   r   )r   pstrs     rS   __repr__zHDFStore.__repr__t  s'    DJJ't*]4&33rU   c                    | S rW   r   r   s    rS   	__enter__zHDFStore.__enter__x  s    rU   c                $    | j                          y rW   )r   )r   exc_type	exc_value	tracebacks       rS   __exit__zHDFStore.__exit__{  s    

rU   c                   |dk(  r(| j                         D cg c]  }|j                   c}S |dk(  rC| j                  J | j                  j                  dd      D cg c]  }|j                   c}S t	        d| d      c c}w c c}w )a#  
        Return a list of keys corresponding to objects stored in HDFStore.

        Parameters
        ----------

        include : str, default 'pandas'
                When kind equals 'pandas' return pandas objects.
                When kind equals 'native' return native HDF5 Table objects.

                .. versionadded:: 1.1.0

        Returns
        -------
        list
            List of ABSOLUTE path-names (e.g. have the leading '/').

        Raises
        ------
        raises ValueError if kind has an illegal value
        pandasnative/Table)	classnamez8`include` should be either 'pandas' or 'native' but is 'r   )r   r   r   
walk_nodesr   )r   includens      rS   keyszHDFStore.keys~  s    , h+/;;=9aAMM99 <<+++'+||'>'>sg'>'V"#  FwiqQ
 	
 :s   B B
c                4    t        | j                               S rW   )iterr  r   s    rS   __iter__zHDFStore.__iter__  s    DIIK  rU   c              #  V   K   | j                         D ]  }|j                  |f  yw)'
        iterate on key->group
        N)r   r   r   gs     rS   itemszHDFStore.items  s,       	#A--""	#s   ')c              #     K   t        j                  dt        t                      | j	                         E d{    y7 w)r  zTiteritems is deprecated and will be removed in a future version. Use .items instead.
stacklevelN)warningswarnFutureWarningr%   r  r   s    rS   	iteritemszHDFStore.iteritems  s3      	"')		
 ::<s   8AA Ac                Z   t               }| j                  |k7  rP| j                  dv r|dv rn6|dv r2| j                  r&t        d| j                   d| j                   d      || _        | j                  r| j                          | j                  rN| j                  dkD  r?t               j                  | j                  | j                  | j                        | _
        t        r| j                  rd	}t        |       |j                  | j                  | j                  fi || _        y
)a9  
        Open the file in the specified mode

        Parameters
        ----------
        mode : {'a', 'w', 'r', 'r+'}, default 'a'
            See HDFStore docstring or tables.open_file for info about modes
        **kwargs
            These parameters will be passed to the PyTables open_file method.
        )r   w)r   r   )r  zRe-opening the file [z] with mode [z] will delete the current file!r   )r   zGCannot open HDF5 file, which is already opened, even in read-only mode.N)r   r   r   r#   r   r   r   Filtersr   r   r   r   r   	open_filer   )r   r   r   r|   msgs        rS   r   zHDFStore.open  s    ::zzZ'DK,?<<//

|= U8 8 
 DJ <<JJL??t2#I--4;K;K . DM -*  S/!'v''

DJJI&IrU   c                ^    | j                   | j                   j                          d| _         y)z0
        Close the PyTables file handle
        N)r   r   r   s    rS   r   zHDFStore.close  s%     <<#LL rU   c                Z    | j                   yt        | j                   j                        S )zF
        return a boolean indicating whether the file is open
        F)r   r   isopenr   s    rS   r   zHDFStore.is_open  s&    
 <<DLL''((rU   c                    | j                   c| j                   j                          |rFt        t              5  t	        j
                  | j                   j                                ddd       yyy# 1 sw Y   yxY w)a  
        Force all buffered modifications to be written to disk.

        Parameters
        ----------
        fsync : bool (default False)
          call ``os.fsync()`` on the file handle to force writing to disk.

        Notes
        -----
        Without ``fsync=True``, flushing may not guarantee that the OS writes
        to disk. With fsync, the operation will block until the OS claims the
        file has been written; however, other caching layers may still
        interfere.
        N)r   flushr   r   r   fsyncfileno)r   r   s     rS   r  zHDFStore.flush  sf      <<#LL g& 4HHT\\00234 4  $4 4s   .A11A:c                    t               5  | j                  |      }|t        d| d      | j                  |      cddd       S # 1 sw Y   yxY w)z
        Retrieve pandas object stored in file.

        Parameters
        ----------
        key : str

        Returns
        -------
        object
            Same type as object stored in file.
        NNo object named  in the file)r   r   r   _read_groupr   r   r   s      rS   r   zHDFStore.get
  sV     ^ 	+ MM#&E}!1#lCDD##E*	+ 	+ 	+s   3AAc	                   | j                  |      }	|	t        d| d      t        |d      }| j                  |	      j	                          fd}
t        | |
|j                  |||||
      }|j                         S )a  
        Retrieve pandas object stored in file, optionally based on where criteria.

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.

        Parameters
        ----------
        key : str
            Object being retrieved from file.
        where : list or None
            List of Term (or convertible) objects, optional.
        start : int or None
            Row number to start selection.
        stop : int, default None
            Row number to stop selection.
        columns : list or None
            A list of columns that if not None, will limit the return columns.
        iterator : bool or False
            Returns an iterator.
        chunksize : int or None
            Number or rows to include in iteration, return an iterator.
        auto_close : bool or False
            Should automatically close the store when finished.

        Returns
        -------
        object
            Retrieved object from file.
        r#  r$  rb   rc   c                .    j                  | ||      S )N)r   r   ri   r   )read)_start_stop_wherer   rR   s      rS   funczHDFStore.select.<locals>.funcW  s    66U&'6RRrU   ri   nrowsr   r   r   r   r   )r   r   rl   _create_storer
infer_axesTableIteratorr/  
get_result)r   r   ri   r   r   r   r   r   r   r   r-  itrR   s        `      @rS   r   zHDFStore.select  s    \ c"=-cU,?@@ U2&		S ''!
 }}rU   c                    t        |d      }| j                  |      }t        |t              st	        d      |j                  |||      S )a  
        return the selection as an Index

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.


        Parameters
        ----------
        key : str
        where : list of Term (or convertible) objects, optional
        start : integer (defaults to None), row number to start selection
        stop  : integer (defaults to None), row number to stop selection
        rb   rc   z&can only read_coordinates with a tableri   r   r   )rl   
get_storerrN   r  r   read_coordinates)r   r   ri   r   r   tbls         rS   select_as_coordinateszHDFStore.select_as_coordinatesj  sL    4 U2ooc"#u%DEE##%u4#HHrU   c                    | j                  |      }t        |t              st        d      |j	                  |||      S )a~  
        return a single column from the table. This is generally only useful to
        select an indexable

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.

        Parameters
        ----------
        key : str
        column : str
            The column of interest.
        start : int or None, default None
        stop : int or None, default None

        Raises
        ------
        raises KeyError if the column is not found (or key is not a valid
            store)
        raises ValueError if the column can not be extracted individually (it
            is part of a data block)

        z!can only read_column with a table)columnr   r   )r7  rN   r  r   read_column)r   r   r<  r   r   r9  s         rS   select_columnzHDFStore.select_column  s>    F ooc"#u%?@@fEEErU   c
                   t        |d      }t        |t        t        f      rt	        |      dk(  r|d   }t        |t
              r| j                  |||||||	      S t        |t        t        f      st        d      t	        |      st        d      ||d   }|D 
cg c]  }
| j                  |
       c}
| j                  |      }d}t        j                  ||fgt        |            D ]d  \  }}
|t        d|
 d	      |j                  st        d
|j                   d      ||j                   }K|j                   |k7  s[t        d       D cg c]  }t        |t"              s| }}t        |D ch c]  }|j$                  d   d    c}      d   fd}t'        | |||||||||	
      }|j)                  d      S c c}
w c c}w c c}w )a  
        Retrieve pandas objects from multiple tables.

        .. warning::

           Pandas uses PyTables for reading and writing HDF5 files, which allows
           serializing object-dtype data with pickle when using the "fixed" format.
           Loading pickled data received from untrusted sources can be unsafe.

           See: https://docs.python.org/3/library/pickle.html for more.

        Parameters
        ----------
        keys : a list of the tables
        selector : the table to apply the where criteria (defaults to keys[0]
            if not supplied)
        columns : the columns I want back
        start : integer (defaults to None), row number to start selection
        stop  : integer (defaults to None), row number to stop selection
        iterator : bool, return an iterator, default False
        chunksize : nrows to include in iteration, return an iterator
        auto_close : bool, default False
            Should automatically close the store when finished.

        Raises
        ------
        raises KeyError if keys or selector is not found or keys is empty
        raises TypeError if keys is not a list or tuple
        raises ValueError if the tables are not ALL THE SAME DIMENSIONS
        rb   rc   r   )r   ri   r   r   r   r   r   r   zkeys must be a list/tuplez keys must have a non-zero lengthNzInvalid table []zobject [z>] is not a table, and cannot be used in all select as multiplez,all tables must have exactly the same nrows!c           	         D cg c]  }|j                  || |       }}t        |d      j                         S c c}w )Nri   r   r   r   F)axisverify_integrity)r)  r9   _consolidate)r*  r+  r,  rs   objsrC  r   tblss        rS   r-  z)HDFStore.select_as_multiple.<locals>.func  sR      VWFOD  $TEBOOQQs   A r.  T)coordinates)rl   rN   re   rf   rh   r]   r   r   r   r7  	itertoolschainzipr   is_tablepathnamer/  r  non_index_axesr2  r3  )r   r  ri   selectorr   r   r   r   r   r   krR   r/  rs   x_tblsr-  r4  rC  rG  s       `             @@rS   select_as_multiplezHDFStore.select_as_multiple  s   V U2dT5M*s4yA~7DdC ;;!#%  	 	 $u.7884y?@@AwH -11q"1OOH% OOa]OSt_E 	QDAqy1566::qzzl +) ) 
 }E! !OPP	Q  !9qJq%$899 U;Q%%a(+;<Q?
	R !
 }}}..i 2* : <s   %G!G7GG!c                    |t        d      xs d}| j                  |      }| j                  |||||||||	|
||||       y)a  
        Store object in HDFStore.

        Parameters
        ----------
        key : str
        value : {Series, DataFrame}
        format : 'fixed(f)|table(t)', default is 'fixed'
            Format to use when storing object in HDFStore. Value can be one of:

            ``'fixed'``
                Fixed format.  Fast writing/reading. Not-appendable, nor searchable.
            ``'table'``
                Table format.  Write as a PyTables Table structure which may perform
                worse but allow more flexible operations like searching / selecting
                subsets of the data.
        index : bool, default True
            Write DataFrame index as a column.
        append : bool, default False
            This will force Table format, append the input data to the existing.
        data_columns : list of columns or True, default None
            List of columns to create as data columns, or True to use all columns.
            See `here
            <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#query-via-data-columns>`__.
        encoding : str, default None
            Provide an encoding for strings.
        track_times : bool, default True
            Parameter is propagated to 'create_table' method of 'PyTables'.
            If set to False it enables to have the same h5 files (same hashes)
            independent on creation time.
        dropna : bool, default False, optional
            Remove missing values.

            .. versionadded:: 1.1.0
        Nio.hdf.default_formatrp   )r   r   r   r   r   r   r   r   rZ   r   track_timesr   )r   _validate_format_write_to_group)r   r   r   r   r   r   r   r   r   r   r   rZ   r   rV  r   s                  rS   r   zHDFStore.put,  sg    h > 78CGF&&v.%%# 	 	
rU   c                   t        |d      }	 | j                  |      }t        j                  |||      rj                  j                  d       yj                  st        d      |j                  |||      S # t        $ r  t        $ r  t        $ rB}|t        d      || j                  |      }||j                  d       Y d}~yY d}~d}~ww xY w)	a:  
        Remove pandas object partially by specifying the where condition

        Parameters
        ----------
        key : str
            Node to remove or delete rows from
        where : list of Term (or convertible) objects, optional
        start : integer (defaults to None), row number to start selection
        stop  : integer (defaults to None), row number to stop selection

        Returns
        -------
        number of rows removed (or None if not a Table)

        Raises
        ------
        raises KeyError if key is not a valid store

        rb   rc   Nz5trying to remove a node with a non-None where clause!T	recursivez7can only remove with where on objects written as tablesr6  )rl   r7  r   AssertionError	Exceptionr   r   	_f_removecomall_noner   rL  delete)r   r   ri   r   r   rR   errr   s           rS   r   zHDFStore.removet  s    * U2	$A. <<ud+GG- :: M  88%u48@@?  	 	 	   K
 ==%D.  	s   A? ?C3CCc                    |	t        d      |t        d      }|t        d      xs d}| j                  |      }| j                  |||||||||
|||||||       y)a  
        Append to Table in file.

        Node must already exist and be Table format.

        Parameters
        ----------
        key : str
        value : {Series, DataFrame}
        format : 'table' is the default
            Format to use when storing object in HDFStore.  Value can be one of:

            ``'table'``
                Table format. Write as a PyTables Table structure which may perform
                worse but allow more flexible operations like searching / selecting
                subsets of the data.
        index : bool, default True
            Write DataFrame index as a column.
        append       : bool, default True
            Append the input data to the existing.
        data_columns : list of columns, or True, default None
            List of columns to create as indexed data columns for on-disk
            queries, or True to use all columns. By default only the axes
            of the object are indexed. See `here
            <https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#query-via-data-columns>`__.
        min_itemsize : dict of columns that specify minimum str sizes
        nan_rep      : str to use as str nan representation
        chunksize    : size to chunk the writing
        expectedrows : expected TOTAL row size of this table
        encoding     : default None, provide an encoding for str
        dropna : bool, default False, optional
            Do not write an ALL nan row to the store settable
            by the option 'io.hdf.dropna_table'.

        Notes
        -----
        Does *not* check if data being appended overlaps with existing
        data in the table, so be careful
        Nz>columns is not a supported keyword in append, try data_columnszio.hdf.dropna_tablerU  rq   )r   axesr   r   r   r   r   r   r   expectedrowsr   r   rZ   r   )r   r   rW  rX  )r   r   r   r   rd  r   r   r   r   r   r   r   r   re  r   r   rZ   r   s                     rS   r   zHDFStore.append  s    v P  > 56F> 78CGF&&v.%%%! 	 	
rU   c           	        |t        d      t        |t              st        d      ||vrt        d      t	        t        t        j                              t        t        t                       z
        d   }d}	g }
|j                         D ](  \  }}||	t        d      |}	|
j                  |       * |	Wj                  |   }|j                  t        |
            }t        |j!                  |            }|j#                  |      ||	<   |||   }|rKfd|j%                         D        }t'        |      }|D ]  }|j)                  |      } j*                  |   |j-                  dd      }|j                         D ]e  \  }}||k(  r|nd}j/                  ||	      }|)|j                         D ci c]  \  }}||v s|| c}}nd} | j0                  ||f||d
| g yc c}}w )a  
        Append to multiple tables

        Parameters
        ----------
        d : a dict of table_name to table_columns, None is acceptable as the
            values of one node (this will get all the remaining columns)
        value : a pandas object
        selector : a string that designates the indexable table; all of its
            columns will be designed as data_columns, unless data_columns is
            passed, in which case these are used
        data_columns : list of columns to create as data columns, or True to
            use all columns
        dropna : if evaluates to True, drop rows from all tables if any single
                 row in each table has all NaN. Default False.

        Notes
        -----
        axes parameter is currently not accepted

        Nztaxes is currently not accepted as a parameter to append_to_multiple; you can create the tables independently insteadzQappend_to_multiple must have a dictionary specified as the way to split the valuez=append_to_multiple requires a selector that is in passed dictr   z<append_to_multiple can only have one value in d that is Nonec              3  \   K   | ]#  }|   j                  d       j                   % yw)all)howN)r   r   ).0colsr   s     rS   	<genexpr>z.HDFStore.append_to_multiple.<locals>.<genexpr>P  s)     ODE$K&&5&177Os   ),r   rC  )r   r   )r   rN   dictr   re   setrangendim	_AXES_MAPr   r  extendrd  
differencer4   sortedget_indexertakevaluesnextintersectionlocpopreindexr   )r   dr   rO  r   rd  r   r   rC  
remain_keyremain_valuesrP  vorderedorddidxsvalid_indexr   r   dcvalr   filtereds     `                    rS   append_to_multiplezHDFStore.append_to_multiple  s4   > B 
 !T") 
 1O 
 Cejj)*S4;1G-HHI!L 
 GGI 	(DAqy)$V  
$$Q'	( !jj&G%%eM&:;D'--d34D#LL.AjM X;L OAHHJODt*K >)66u=>IIk*Ezz.$7 GGI 	RDAq!"hDB ----C  + 1=0B0B0DQeqeQ 
 DKK3QRhQ&Q	R Rs   G6G6c                    t                | j                  |      }|yt        |t              st	        d      |j                  |||       y)a  
        Create a pytables index on the table.

        Parameters
        ----------
        key : str
        columns : None, bool, or listlike[str]
            Indicate which columns to create an index on.

            * False : Do not create any indexes.
            * True : Create indexes on all columns.
            * None : Create indexes on all columns.
            * listlike : Create indexes on the given columns.

        optlevel : int or None, default None
            Optimization level, if None, pytables defaults to 6.
        kind : str or None, default None
            Kind of index, if None, pytables defaults to "medium".

        Raises
        ------
        TypeError: raises if the node is not a table
        Nz1cannot create table index on a Fixed format store)r   optlevelkind)r   r7  rN   r  r   create_index)r   r   r   r  r  rR   s         rS   create_table_indexzHDFStore.create_table_indexf  sG    > 		OOC 9!U#OPP	wErU   c                   t                | j                          | j                  J t        J | j                  j	                         D cg c]  }t        |t        j                  j                        sYt        |j                  dd      s@t        |dd      s3t        |t        j                  j                        r|j                  dk7  r| c}S c c}w )z
        Return a list of all the top-level nodes.

        Each node returned is not a pandas storage object.

        Returns
        -------
        list
            List of objects.
        Npandas_typerq   )r   r   r   r{   walk_groupsrN   linkLinkgetattr_v_attrsrq   r  r   r  s     rS   r   zHDFStore.groups  s     		||'''%%% \\--/
q*//"6"67AJJt<q'40"1j&6&6&<&<=!))wBV 
 	
 
s   BCc              #  L  K   t                | j                          | j                  J t        J | j                  j	                  |      D ]  }t        |j                  dd      g }g }|j                  j                         D ]w  }t        |j                  dd      }|At        |t        j                  j                        sA|j                  |j                         ]|j                  |j                         y |j                  j                  d      ||f  yw)aS  
        Walk the pytables group hierarchy for pandas objects.

        This generator will yield the group path, subgroups and pandas object
        names for each group.

        Any non-pandas PyTables objects that are not a group will be ignored.

        The `where` group itself is listed first (preorder), then each of its
        child groups (following an alphanumerical order) is also traversed,
        following the same procedure.

        Parameters
        ----------
        where : str, default "/"
            Group where to start walking.

        Yields
        ------
        path : str
            Full path to a group (without trailing '/').
        groups : list
            Names (strings) of the groups contained in `path`.
        leaves : list
            Names (strings) of the pandas objects contained in `path`.
        Nr  r   )r   r   r   r{   r  r  r  _v_childrenrx  rN   r   Groupr   r   r   rstrip)r   ri   r  r   leaveschildr  s          rS   walkzHDFStore.walk  s     6 		||'''%%%))%0 	>Aqzz=$7CFF--/ 1%ennmTJ&!%)9)9)?)?@emm4MM%--01 =='',ff==	>s   CD$AD$c                f   | j                          |j                  d      sd|z   }| j                  J t        J 	 | j                  j	                  | j
                  |      }t        |t        j                        sJ t        |             |S # t        j                  j                  $ r Y yw xY w)z9return the node with the key or None if it does not existr   N)r   
startswithr   r{   r   r   
exceptionsNoSuchNodeErrorrN   rJ   r   )r   r   r   s      rS   r   zHDFStore.get_node  s    ~~c")C||'''%%%	<<((C8D $
0<$t*<0	 $$44 		s   &B B0/B0c                    | j                  |      }|t        d| d      | j                  |      }|j                          |S )z<return the storer object for a key, raise if not in the filer#  r$  )r   r   r0  r1  )r   r   r   rR   s       rS   r7  zHDFStore.get_storer  sH    c"=-cU,?@@&	rU   c	                :   t        |||||      }	|t        | j                               }t        |t        t        f      s|g}|D ]  }
| j                  |
      }||
|	v r|r|	j                  |
       | j                  |
      }t        |t              r`d}|r0|j                  D cg c]  }|j                  s|j                   }}|	j                  |
||t        |dd      |j                         |	j                  |
||j                          |	S c c}w )a;  
        Copy the existing store to a new file, updating in place.

        Parameters
        ----------
        propindexes : bool, default True
            Restore indexes in copied file.
        keys : list, optional
            List of keys to include in the copy (defaults to all).
        overwrite : bool, default True
            Whether to overwrite (remove and replace) existing nodes in the new store.
        mode, complib, complevel, fletcher32 same as in HDFStore.__init__

        Returns
        -------
        open file handle of the new store
        )r   r   r   r   NFr   )r   r   rZ   rY   )r   re   r  rN   rf   r7  r   r   r  rd  
is_indexedr_   r   r  rZ   r   )r   r~   r   propindexesr  r   r   r   	overwrite	new_storerP  rR   datar   r   s                  rS   copyzHDFStore.copy  s   8 tW	j
	 <		$D$.6D 	@A"A}	> !((+{{1~a'.3E"12 HA1<< H H$$#%,Q%E!" %  MM!TAJJM?-	@0  !Is   (D:Dc                X   t        | j                        }t        |        d| d}| j                  rt	        | j                               }t        |      rwg }g }|D ]\  }	 | j                  |      }|F|j                  t        |j                  xs |             |j                  t        |xs d             ^ |t        d||      z  }|S |dz  }|S |d	z  }|S # t        $ r  t        $ r;}|j                  |       t        |      }	|j                  d|	 d       Y d}~d}~ww xY w)
zg
        Print detailed information on the store.

        Returns
        -------
        str
        r   r   Nzinvalid_HDFStore nodez[invalid_HDFStore node: r@     EmptyzFile is CLOSED)rG   r   r   r   ru  r  rh   r7  r   rM  r\  r]  rF   )
r   r   outputlkeysr  rx  rP  rR   detaildstrs
             rS   infozHDFStore.info1  s9    DJJ'J<}TF"5<<499;'E5z JAJ OOA.= KKQZZ_1(EF"MM,q7S<S*TUJ &T622 	 '!  &&F * $ JA+F3(@a&HIIJs   !ACD).1D$$D)c                L    | j                   st        | j                   d      y )Nz file is not open!)r   r    r   r   s    rS   r   zHDFStore._check_if_open[  s%    ||!TZZL0B"CDD rU   c                x    	 t         |j                            }|S # t        $ r}t        d| d      |d}~ww xY w)zvalidate / deprecate formatsz#invalid HDFStore format specified [r@  N)_FORMAT_MAPlowerr   r   )r   r   rb  s      rS   rW  zHDFStore._validate_format_  sK    	V 0F   	VA&KLRUU	Vs    	949c                   !t        t        t        f      st        d      fd}t	        t        j                  dd            }t	        t        j                  dd            }|tSt                t        J t        dd      s$t        t        j                  j                        rd}d}n*t        d	      t        t              rd
}nd}dk(  r|dz  }d|vrt        t        d}		 |	|   }
 |
| ||      S |qo|dk(  r3t        dd      }|[|j                  dk(  rd}nI|j                  dkD  r:d}n7|dk(  r2t        dd      }|#|j                  dk(  rd}n|j                  dkD  rd}t        t         t"        t$        t&        t(        d}	 ||   }
 |
| ||      S # t        $ r} |d      |d}~ww xY w# t        $ r} |d      |d}~ww xY w)z"return a suitable class to operateNz(value must be None, Series, or DataFramec           
     D    t        d|  d dt               d       S )Nz(cannot properly create the storer for: [z
] [group->,value->z	,format->)r   r   )rs   r   r   r   s    rS   errorz&HDFStore._create_storer.<locals>.errorw  s4    :1#Z'$u+ixA rU   r  
table_typerq   frame_tablegeneric_tablezKcannot create a storer if the object is not existing nor a value are passedseriesframe_table)r  r  _STORER_MAPrZ   r   series_tabler   rb   appendable_seriesappendable_multiseriesappendable_frameappendable_multiframe)r  r  r  r  r  worm
_TABLE_MAP)rN   r7   r2   r   rT   r  r  r   r{   rq   r  SeriesFixed
FrameFixedr   nlevelsGenericTableAppendableSeriesTableAppendableMultiSeriesTableAppendableFrameTableAppendableMultiFrameTable	WORMTable)r   r   r   r   rZ   r   r  ptttr  clsrb  r   r  s    ```          rS   r0  zHDFStore._create_storeri  s    Z	7J%KFGG	 WU^^]DIJWU^^\4HI :}	!---5'40J:++115 'B(B#1 
 eV,!B B W$(NB "%0:FK4!"o tUXfEE : '#E7D9E( ==A-!4B"]]Q.!9B=(#E7D9E( ==A-!3B"]]Q.!8B *!6&@ 4%>

	/R.C 4&AAI  4M*34B  	/%3.	/s0   6F- G -	G6	F??G	G	GGc                   t        |dd       r|dk(  s|ry | j                  ||      }| j                  |||||      }|rQ|j                  r|j                  r|dk(  r|j                  rt        d      |j                  s!|j                          n|j                          |j                  s|rt        d      |j                  ||||||	|
||||||       t        |t              r|r|j                  |       y y y )	Nemptyrq   r  rp   zCan only append to Tablesz0Compression not supported on Fixed format stores)objrd  r   r   r   r   r   r   re  r   r   r   rV  )r   )r  _identify_groupr0  rL  	is_existsr   set_object_infowriterN   r  r  )r   r   r   r   rd  r   r   r   r   r   r   r   re  r   r   r   rZ   r   rV  r   rR   s                        rS   rX  zHDFStore._write_to_group  s   . 5'4(f.?6$$S&1vuxPVW ::!**71Bq{{ !<==;;!!#zzgOPP 	
!%%%# 	 	
  aENN5N) %*rU   c                d    | j                  |      }|j                          |j                         S rW   )r0  r1  r)  )r   r   rR   s      rS   r%  zHDFStore._read_group  s&    &	vvxrU   c                    | j                  |      }| j                  J |!|s| j                  j                  |d       d}|| j                  |      }|S )z@Identify HDF5 group based on key, delete/create group if needed.NTrZ  )r   r   remove_node_create_nodes_and_group)r   r   r   r   s       rS   r  zHDFStore._identify_group  sb    c" ||''' VLL$$Ud$;E=005ErU   c                
   | j                   J |j                  d      }d}|D ]\  }t        |      s|}|j                  d      s|dz  }||z  }| j	                  |      }|| j                   j                  ||      }|}^ S )z,Create nodes from key and return group name.r   )r   splitrh   endswithr   create_group)r   r   pathsr   pnew_pathr   s          rS   r  z HDFStore._create_nodes_and_group  s     ||'''		# 
	Aq6H==%CMHMM(+E}11$:D
	 rU   )r   NNF)r   r]   r   
int | Noner   r   returnNoner  r]   r   r]   )r   r]   r  r  )r_   r]   )r   r]   r  r   r  r   )r  r   r  r  )r   )r  r]   r  	list[str])r  zIterator[str])r  zIterator[tuple[str, list]])r   )r   r]   r  r  r  r   F)r   r   r  r  )NNNNFNF)r   r]   r   r   NNNr   r]   r   r  r   r  NN)r   r]   r<  r]   r   r  r   r  )NNNNNFNF)r   r   )NTFNNNNNNrz   TF)r   r]   r   DataFrame | Seriesr   r  r   int | dict[str, int] | Noner    Literal[True] | list[str] | Noner   r]   rV  r   r   r   r  r  )NNTTNNNNNNNNNNrz   )r   r]   r   r  r   r  r   r  r   bool | Noner   r  r   r]   r  r  )NNF)r~  rn  r  r  )r   r]   r  r  r  
str | Noner  r  )r  re   )r   )ri   r]   r  z*Iterator[tuple[str, list[str], list[str]]])r   r]   r  zNode | None)r   r]   r  GenericFixed | Table)r  TNNNFT)r  r   r   r  r   r   r  r   )r   r]   r  r]   )NNrL   rz   )r   zDataFrame | Series | NonerZ   r]   r   r]   r  r  )NTFNNNNNNFNNNrz   T)r   r]   r   r  r   r  r   r  r   r]   rV  r   r  r  )r   rJ   )r   r]   r   r   r  rJ   )r   r]   r  rJ   )2r   
__module____qualname____doc____annotations__r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r  r	  r  r  r   r   r   r  r   r   r:  r>  rS  r   r   r   r  r  r   r  r   r7  r  r  r   rW  r0  rX  r%  r  r  r   rU   rS   r   r     s|   ?B JO
  $  '  ' 	 '  ' 
 'D ! !   

"4 
D!#
 +JZ ) )4,+0  II I\  II 	I
 IH !&F&F &F 	&F
 &FV  x/ x/|  $489= F
F
 "F
 F
 2F
 7F
 F
 F
 F
  
!F
P7Az  $48"9=%V
V
 "V
 V
 2V
 V
  7!V
$ %V
& 
'V
z _R_R 
_RH #&F&F 	&F
 &F 
&FP
8.>`    $ ; 	; ; ; 
;z%TE +/ZB )	ZB
 ZB ZB 
ZBB  $48 '<*<* "<* <* 2<*$ %<*& '<*( 
)<*|
$rU   r   c                  r    e Zd ZU dZded<   ded<   ded<   	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd	Zd
 ZddZdddZy)r2  aa  
    Define the iteration interface on a table

    Parameters
    ----------
    store : HDFStore
    s     : the referred storer
    func  : the function to execute the query
    where : the where of the query
    nrows : the rows to iterate on
    start : the passed start value (default is None)
    stop  : the passed stop value (default is None)
    iterator : bool, default False
        Whether to use the default iterator.
    chunksize : the passed chunking value (default is 100000)
    auto_close : bool, default False
        Whether to automatically close the store at the end of iteration.
    r  r   r   r   r  rR   Nc                ,   || _         || _        || _        || _        | j                  j                  r|d}|d}||}t        ||      }|| _        || _        || _        d | _	        |s|	|	d}	t        |	      | _        |
| _        y d | _        |
| _        y )Nr   順 )r   rR   r-  ri   rL  minr/  r   r   rH  r   r   r   )r   r   rR   r-  ri   r/  r   r   r   r   r   s              rS   r   zTableIterator.__init__H  s     
	
 66??}}|ud#D

	y, "	 ^DN % "DN$rU   c              #  ^  K   | j                   }| j                  t        d      || j                  k  rgt	        || j
                  z   | j                        }| j                  d d | j                  ||       }|}|t        |      sb| || j                  k  rg| j                          y w)Nz*Cannot iterate until get_result is called.)	r   rH  r   r   r  r   r-  rh   r   )r   r   r   r   s       rS   r	  zTableIterator.__iter__r  s     **#IJJ		!w/;DIIdD$*:*:74*HIEG}CJK 		! 	

s   BB-B-c                R    | j                   r| j                  j                          y y rW   )r   r   r   r   s    rS   r   zTableIterator.close  s    ??JJ rU   c                   | j                   Rt        | j                  t              st	        d      | j                  j                  | j                        | _        | S |rbt        | j                  t              st	        d      | j                  j                  | j                  | j                  | j                        }n| j                  }| j                  | j                  | j                  |      }| j                          |S )Nz0can only use an iterator or chunksize on a table)ri   z$can only read_coordinates on a tabler6  )r   rN   rR   r  r   r8  ri   rH  r   r   r-  r   )r   rH  ri   resultss       rS   r3  zTableIterator.get_result  s    >>%dffe, RSS#vv66TZZ6HDK dffe, FGGFF++jj

 , E JJE ))DJJ		59

rU   )NNFNF)r   r   rR   r  r   r   r   r  r   r   r  r  r  r  )rH  r   )	r   r  r  r  r  r   r	  r   r3  r   rU   rS   r2  r2  0  sz    & O  $ (%(%  (% (% (% (% 
(%T rU   r2  c                     e Zd ZU dZdZded<   dZded<   g dZded<   ded	<   	 	 	 	 	 	 	 	 	 	 	 	 	 d$	 	 	 	 	 d%dZe	d&d       Z
e	d'd       Zd(dZd'dZd)dZd*dZe	d*d       Z	 	 	 	 	 	 	 	 d+dZd Ze	d        Ze	d        Ze	d        Ze	d        Zd Zd,d-dZd-dZd.dZd,dZd/dZd-dZd-d Zd-d!Zd0d"Z d0d#Z!y
)1IndexCola  
    an index column description class

    Parameters
    ----------
    axis   : axis which I reference
    values : the ndarray like converted values
    kind   : a string description of this type
    typ    : the pytables type
    pos    : the position in the pytables

    Tr   is_an_indexableis_data_indexable)freqtz
index_namer]   r_   cnameNc                   t        |t              st        d      || _        || _        || _        || _        |xs || _        || _        || _	        || _
        |	| _        |
| _        || _        || _        || _        || _        || j#                  |       t        | j                  t              sJ t        | j                  t              sJ y )Nz`name` must be a str.)rN   r]   r   rx  r  typr_   r  rC  posr
  r  r  r  rq   r   metadataset_pos)r   r_   rx  r  r  r  rC  r  r
  r  r  r  rq   r   r  s                  rS   r   zIndexCol.__init__  s    $ $$455		]d
		$
	 ?LL $))S)))$**c***rU   c                .    | j                   j                  S rW   )r  itemsizer   s    rS   r  zIndexCol.itemsize  s     xx   rU   c                     | j                    dS )N_kindr^   r   s    rS   	kind_attrzIndexCol.kind_attr      ))E""rU   c                T    || _         || j                  || j                  _        yyy)z,set the position of this column in the TableN)r  r  _v_pos)r   r  s     rS   r  zIndexCol.set_pos  s)    ?txx3!DHHO  4?rU   c           
        t        t        t        | j                  | j                  | j
                  | j                  | j                  f            }dj                  t        g d|      D cg c]  \  }}| d|  c}}      S c c}}w )N,)r_   r  rC  r  r  ->)
rf   maprG   r_   r  rC  r  r  joinrK  r   tempr   r   s       rS   r   zIndexCol.__repr__  s}    tyy$**dii499UV
 xx #&&NPT"UC %r%!
 	
   -B
c                0     t         fddD              S )compare 2 col itemsc              3  T   K   | ]  }t        |d       t        |d       k(   ! y wrW   r  rj  r   otherr   s     rS   rl  z"IndexCol.__eq__.<locals>.<genexpr>  0      
 D!T"geQ&==
   %()r_   r  rC  r  rh  r   r(  s   ``rS   __eq__zIndexCol.__eq__  s     
5
 
 	
rU   c                &    | j                  |       S rW   )r-  r,  s     rS   __ne__zIndexCol.__ne__  s    ;;u%%%rU   c                    t        | j                  d      syt        | j                  j                  | j                        j
                  S )z%return whether I am an indexed columnrk  F)hasattrrq   r  rk  r  r  r   s    rS   r  zIndexCol.is_indexed  s4     tzz6*tzz

3>>>rU   c                   t        |t        j                        sJ t        |             |j                  j
                  || j                     }t        | j                        }t        ||||      }i }t        | j                        |d<   | j                  t        | j                        |d<   t        }t        |j                        st        |j                        rt        }n|j                  dk(  rd|v rd }	  ||fi |}t#        || j$                        }	|	|	fS # t         $ r d|v rd|d<    ||fi |}Y 7w xY w)zV
        Convert the data from this selection to the appropriate pandas type.
        Nr_   r
  i8c                    t        dd| i|S )Nordinalr   )r6   )rQ  kwdss     rS   r   z"IndexCol.convert.<locals>.<lambda>*  s     ))!) rU   )rN   rO   ndarrayr   dtypefieldsr  rT   r  _maybe_convertr  r
  r4   r*   r+   r3   r   _set_tzr  )
r   rx  r   rZ   r   val_kindr   factorynew_pd_indexfinal_pd_indexs
             rS   convertzIndexCol.convert  s2    &"**-;tF|;- <<*DJJ'F"499-(FC(9v99 ,TYY7F6N5:v||,0Efll0S#G\\T!f&6
G
	5"64V4L !tww7~--  	5 !%v"64V4L	5s   ?	D" "E ?E c                    | j                   S )zreturn the valuesrx  r   s    rS   	take_datazIndexCol.take_data:  s    {{rU   c                .    | j                   j                  S rW   )rq   r  r   s    rS   attrszIndexCol.attrs>      zz"""rU   c                .    | j                   j                  S rW   rq   descriptionr   s    rS   rI  zIndexCol.descriptionB      zz%%%rU   c                D    t        | j                  | j                  d      S )z!return my current col descriptionN)r  rI  r  r   s    rS   colzIndexCol.colF  s     t''T::rU   c                    | j                   S zreturn my cython valuesrB  r   s    rS   cvalueszIndexCol.cvaluesK  s     {{rU   c                ,    t        | j                        S rW   )r  rx  r   s    rS   r	  zIndexCol.__iter__P  s    DKK  rU   c                   t        | j                        dk(  rst        |t              r|j	                  | j
                        }|E| j                  j                  |k  r+t               j                  || j                        | _        yyyy)z
        maybe set a string col itemsize:
            min_itemsize can be an integer or a dict with this columns name
            with an integer size
        stringN)r  r  )rT   r  rN   rn  r   r_   r  r  r   	StringColr  )r   r   s     rS   maybe_set_sizezIndexCol.maybe_set_sizeS  su     499%1,-+//		:'DHH,=,=,L"9..$((.S -M'	 2rU   c                     y rW   r   r   s    rS   validate_nameszIndexCol.validate_names`      rU   c                    |j                   | _         | j                          | j                  |       | j                  |       | j	                  |       | j                          y rW   )rq   validate_colvalidate_attrvalidate_metadatawrite_metadataset_attr)r   handlerr   s      rS   validate_and_setzIndexCol.validate_and_setc  sL    ]]
6"w'G$rU   c           	         t        | j                        dk(  r`| j                  }|R|| j                  }|j                  |k  r)t	        d| d| j
                   d|j                   d      |j                  S y)z:validate this column: return the compared against itemsizerR  Nz#Trying to store a string with len [z] in [z)] column but
this column has a limit of [zC]!
Consider using min_itemsize to preset the sizes on these columns)rT   r  rL  r  r   r  )r   r  cs      rS   rY  zIndexCol.validate_colk  s     499%1A}##}}H::($=hZ H JJ< (JJ< (<<  zz!rU   c                    |rPt        | j                  | j                  d       }|,|| j                  k7  rt	        d| d| j                   d      y y y )Nzincompatible kind in col [ - r@  )r  rE  r  r  r   )r   r   existing_kinds      rS   rZ  zIndexCol.validate_attr~  s]    #DJJEM(]dii-G0s499+QO  .H( rU   c                   | j                   D ]  }t        | |d      }|j                  | j                  i       }|j	                  |      }||v rp|n||k7  ri|dv rCt
        |||fz  }t        j                  |t        t                      d||<   t        | |d       t        d| j                   d| d| d| d	      |||||<    y)	z
        set/update the info for this indexable with the key/value
        if there is a conflict raise/warn as needed
        N)r
  r  r  zinvalid info for [z] for [z], existing_value [z] conflicts with new value [r@  )_info_fieldsr  
setdefaultr_   r   rn   r  r  r   r%   setattrr   )r   r  r   r   idxexisting_valuewss          rS   update_infozIndexCol.update_info  s    
 $$ 	%CD#t,E//$))R0C WWS\Ncze/Ne4K00/32NNBMM4AQAS
  $CHD#t, %,TYYKwse D++9*: ;&&+WA/  $(B$CH5	%rU   c                v    |j                  | j                        }|| j                  j                  |       yy)z!set my state from the passed infoN)r   r_   __dict__update)r   r  ri  s      rS   set_infozIndexCol.set_info  s0    hhtyy!?MM  % rU   c                Z    t        | j                  | j                  | j                         y)zset the kind for this columnN)rh  rE  r  r  r   s    rS   r]  zIndexCol.set_attr  s    

DNNDII6rU   c                    | j                   dk(  rE| j                  }|j                  | j                        }||t	        ||      st        d      yyyy)z:validate that kind=category does not change the categoriescategoryNzEcannot append a categorical with different categories to the existing)r   r  read_metadatar  r1   r   )r   r^  new_metadatacur_metadatas       rS   r[  zIndexCol.validate_metadata  sh    99
"==L"00<L( ,(|D ;  E - )	 #rU   c                j    | j                   '|j                  | j                  | j                          yy)zset the meta dataN)r  r\  r  )r   r^  s     rS   r\  zIndexCol.write_metadata  s)    ==$""4::t}}= %rU   )NNNNNNNNNNNNN)r_   r]   r  r  r  r  r  r  )r  r   r  r  r(  r	   r  r   r  )rx  
np.ndarrayrZ   r]   r   r]   r  zCtuple[np.ndarray, np.ndarray] | tuple[DatetimeIndex, DatetimeIndex]rW   r  )r^  AppendableTabler   r   r  r  )r   r   r  r  )r^  rz  r  r  )"r   r  r  r  r  r  r	  rf  r   r  r  r  r  r   r-  r/  r  r@  rC  rE  rI  rL  rO  r	  rT  rV  r_  rY  rZ  rl  rp  r]  r[  r\  r   rU   rS   r  r    s|    !OT "t"/L
IJ
  *+*+ *+  
!*+X ! ! # #"	

& ? ?+. +.58+.BE+.	L+.Z # # & & ; ;  !T&%B&7>rU   r  c                  B    e Zd ZdZedd       Z	 	 	 	 	 	 	 	 ddZddZy)	GenericIndexColz:an index which is not represented in the data of the tablec                     yNFr   r   s    rS   r  zGenericIndexCol.is_indexed      rU   c                    t        |t        j                        sJ t        |             t	        t        j
                  t        |                  }||fS )z
        Convert the data from this selection to the appropriate pandas type.

        Parameters
        ----------
        values : np.ndarray
        nan_rep : str
        encoding : str
        errors : str
        )rN   rO   r7  r   r;   arangerh   )r   rx  r   rZ   r   r   s         rS   r@  zGenericIndexCol.convert  sB     &"**-;tF|;-299S[12e|rU   c                     y rW   r   r   s    rS   r]  zGenericIndexCol.set_attr  rW  rU   Nr  )rx  ry  rZ   r]   r   r]   r  ztuple[Int64Index, Int64Index]r  )r   r  r  r  r  r  r@  r]  r   rU   rS   r|  r|    sA    D  58BE	&$rU   r|  c                  8    e Zd ZdZdZdZddgZ	 	 	 	 	 	 	 	 	 	 	 	 d	 	 	 	 	 d fdZedd       Z	edd       Z
ddZdd	Zdd
Zd Zedd       Zed        Zedd       Zedd       Zed        Zed        Zed        Zed        ZddZd dZddZ xZS )!DataCola3  
    a data holding column, by definition this is not indexable

    Parameters
    ----------
    data   : the actual data
    cname  : the column name in the table to hold the data (typically
                values)
    meta   : a string description of the metadata
    metadata : the actual metadata
    Fr  r  c                V    t         |   |||||||||	|
|       || _        || _        y )N)r_   rx  r  r  r  r  r  r  rq   r   r  )superr   r8  r  )r   r_   rx  r  r  r  r  r  r  rq   r   r  r8  r  	__class__s                 rS   r   zDataCol.__init__  sH      	 	 	
 
	rU   c                     | j                    dS )N_dtyper^   r   s    rS   
dtype_attrzDataCol.dtype_attr	  s    ))F##rU   c                     | j                    dS )N_metar^   r   s    rS   	meta_attrzDataCol.meta_attr	  r  rU   c           
        t        t        t        | j                  | j                  | j
                  | j                  | j                  f            }dj                  t        g d|      D cg c]  \  }}| d|  c}}      S c c}}w )Nr  )r_   r  r8  r  shaper  )
rf   r  rG   r_   r  r8  r  r  r  rK  r   s       rS   r   zDataCol.__repr__!	  s    tyy$**djj$))TZZX

 xx #&&QSW"XC %r%!
 	
r"  c                0     t         fddD              S )r$  c              3  T   K   | ]  }t        |d       t        |d       k(   ! y wrW   r&  r'  s     rS   rl  z!DataCol.__eq__.<locals>.<genexpr>0	  r)  r*  )r_   r  r8  r  r+  r,  s   ``rS   r-  zDataCol.__eq__.	  s     
6
 
 	
rU   c                    |J | j                   J t        |      \  }}|| _        || _         t        |      | _        y rW   )r8  _get_data_and_dtype_namer  _dtype_to_kindr  )r   r  
dtype_names      rS   set_datazDataCol.set_data5	  sG    zz!!!3D9j	
":.	rU   c                    | j                   S )zreturn the datar  r   s    rS   rC  zDataCol.take_data?	  s    yyrU   c                n   |j                   }|j                  }|j                  }|j                  dk(  rd|j                  f}t        |t              r5|j                  }| j                  ||j                   j                        }|S t        |      st        |      r| j                  |      }|S t        |      r| j                  |      }|S t        |      r t!               j#                  ||d         }|S t%        |      r| j'                  ||      }|S | j                  ||j                        }|S )zW
        Get an appropriately typed and shaped pytables.Col object for values.
        rb   r  r   r  r  )r8  r  r  rq  sizerN   r<   codesget_atom_datar_   r*   r+   get_atom_datetime64r/   get_atom_timedelta64r)   r   
ComplexColr.   get_atom_string)r  rx  r8  r  r  r  atoms          rS   	_get_atomzDataCol._get_atomC	  s/   
  >>;;! $Efk*LLE$$U1A1A$BD  !'+@+G**51D  "%(++E2D  e$9''q'JD  U#&&uh7D  $$U$<DrU   c                >    t               j                  ||d         S )Nr   r  r   rS  r  r  r  s      rS   r  zDataCol.get_atom_stringc	  s    y""HE!H"EErU   c                    |j                  d      r|dd }d| d}n)|j                  d      rd}n|j                         }| d}t        t               |      S )z0return the PyTables column class for this columnuint   NUIntrH   periodInt64Col)r  
capitalizer  r   )r  r  k4col_namekcaps        rS   get_atom_coltypezDataCol.get_atom_coltypeg	  s_     ??6"abBbT~H__X&!H??$Ds|Hwy(++rU   c                :     | j                  |      |d         S )Nr  r   r  r  r  r  r  s      rS   r  zDataCol.get_atom_datav	  s!    .s###.U1X>>rU   c                <    t               j                  |d         S Nr   r  r   r  r  r  s     rS   r  zDataCol.get_atom_datetime64z	      y!!a!11rU   c                <    t               j                  |d         S r  r  r  s     rS   r  zDataCol.get_atom_timedelta64~	  r  rU   c                0    t        | j                  dd       S )Nr  )r  r  r   s    rS   r  zDataCol.shape	  s    tyy'400rU   c                    | j                   S rN  r  r   s    rS   rO  zDataCol.cvalues	  s     yyrU   c                   |rt        | j                  | j                  d      }|#|t        | j                        k7  rt        d      t        | j                  | j                  d      }||| j                  k7  rt        d      yyy)zAvalidate that we have the same order as the existing & same dtypeNz4appended items do not match existing items in table!z@appended items dtype do not match existing items dtype in table!)r  rE  r  re   rx  r   r  r8  )r   r   existing_fieldsexisting_dtypes       rS   rZ  zDataCol.validate_attr	  s    %djj$..$GO*$t{{BS/S !WXX$TZZ$GN)n

.J V  /K) rU   c           	        t        |t        j                        sJ t        |             |j                  j
                  || j                     }| j                  J | j                  t        |      \  }}t        |      }n|}| j                  }| j                  }t        |t        j                        sJ t        | j                        }| j                  }	| j                  }
| j                  }|J t        |      }|dk(  rt!        ||d      }n|dk(  rt        j"                  |d      }n|dk(  r>	 t        j"                  |D cg c]  }t%        j&                  |       c}t(              }n|dk(  r|	}|j/                         }|t1        g t        j2                        }n\t5        |      }|j7                         rA||    }||d	k7  xx   |j9                  t:              j=                         j>                  z  cc<   tA        jB                  |||

      }n	 |j9                  |d      }t        |      dk(  rtG        ||||      }| jH                  |fS c c}w # t*        $ rE t        j"                  |D cg c]  }t%        j,                  |       nc c}w c}t(              }Y }w xY w# tD        $ r |j9                  dd      }Y w xY w)aR  
        Convert the data from this selection to the appropriate pandas type.

        Parameters
        ----------
        values : np.ndarray
        nan_rep :
        encoding : str
        errors : str

        Returns
        -------
        index : listlike to become an Index
        data : ndarraylike to become a column
        
datetime64Tcoercetimedelta64m8[ns]r8  r   rs  )
categoriesr  Fr  OrR  r   rZ   r   )%rN   rO   r7  r   r8  r9  r  r  r  r  r  rT   r   r  r  r  r;  asarrayr   fromordinalobjectr   fromtimestampravelr4   float64r:   anyastyper   cumsum_valuesr<   
from_codesr   _unconvert_string_arrayrx  )r   rx  r   rZ   r   	convertedr  r  r   r  r  r  r8  r  r  r  masks                    rS   r@  zDataCol.convert	  s     &"**-;tF|;- <<*DJJ'Fxx###:: %=V$D!Iz!*-DIJ99D)RZZ000 tyy)==,,WW%%%
+ L 	2d;Im#

9H=If_JJ2;<QT%%a(<F	 Z!JOO%E
 !
 #2RZZ8
J'88:!+TE!2J%2+&$++c*:*A*A*C*K*KK&#..*gI>%,,U,?	
 4 H,/7XfI {{I%%Y = JJ4=>qT''*>>f	B  >%,,Su,=	>sB   ;I& I!*I& #J7 !I& &J4J
J43J47KKc                "   t        | j                  | j                  | j                         t        | j                  | j                  | j
                         | j                  J t        | j                  | j                  | j                         y)zset the data for this columnN)rh  rE  r  rx  r  r   r8  r  r   s    rS   r]  zDataCol.set_attr	  sZ    

DNNDKK8

DNNDII6zz%%%

DOOTZZ8rU   )NNNNNNNNNNNN)r_   r]   r8  zDtypeArg | Noner  r  r  rx  )r  r   r  r  )rx  r   r  rH   )r  r]   r  z	type[Col]r  r]   r  rH   r  )rx  ry  rZ   r]   r   r]   )r   r  r  r  r  r	  rf  r   r  r  r  r   r-  r  rC  classmethodr  r  r  r  r  r  r  rO  rZ  r@  r]  __classcell__r  s   @rS   r  r    sV   
 O)$L
 !%  
@ $ $ # #

/  > F F , , ? ? 2 2 2 2 1 1  c&J9rU   r  c                  ^    e Zd ZdZdZd	dZed        Zed
d       Zed        Z	ed        Z
y)DataIndexableColz+represent a data column that can be indexedTc                `    t        | j                        j                         st        d      y )N-cannot have non-object label DataIndexableCol)r4   rx  	is_objectr   r   s    rS   rV  zDataIndexableCol.validate_names

  s(    T[[!++-LMM .rU   c                6    t               j                  |      S )N)r  r  r  s      rS   r  z DataIndexableCol.get_atom_string
  s    y""H"55rU   c                0     | j                  |             S )Nr  r  r  s      rS   r  zDataIndexableCol.get_atom_data
  s    .s###.00rU   c                2    t               j                         S rW   r  r  s     rS   r  z$DataIndexableCol.get_atom_datetime64
      y!!##rU   c                2    t               j                         S rW   r  r  s     rS   r  z%DataIndexableCol.get_atom_timedelta64
  r  rU   Nr  r  )r   r  r  r  r	  rV  r  r  r  r  r  r   rU   rS   r  r  
  sa    5N
 6 6 1 1 $ $ $ $rU   r  c                      e Zd ZdZy)GenericDataIndexableColz(represent a generic pytables data columnN)r   r  r  r  r   rU   rS   r  r   
  s    2rU   r  c                     e Zd ZU dZded<   dZded<   ded<   ded	<   ded
<   ded<   ded<   ded<   dZded<   	 	 d-	 	 	 	 	 	 	 	 	 d.dZed/d       Z	ed0d       Z
ed        Zd1dZd2dZd3dZed        Zed        Zed        Zed        Zed4d       Zed/d       Zed         Zd2d!Zd2d"Zed#        Zed/d$       Zed%        Zd5d&Zd6d2d(Zd/d)Z	 	 	 	 d7	 	 	 d8d*Zd+ Z	 d9	 	 	 	 	 d:d,Z y');Fixedz
    represent an object in my store
    facilitate read/write of various types of objects
    this is an abstract base class

    Parameters
    ----------
    parent : HDFStore
    group : Node
        The group node where the table resides.
    r]   pandas_kindrp   format_typetype[DataFrame | Series]obj_typer   rq  rZ   r   r   rJ   r   r   Fr   rL  c                    t        |t              sJ t        |             t        J t        |t        j                        sJ t        |             || _        || _        t        |      | _        || _	        y rW   )
rN   r   r   r{   rJ   r   r   r[   rZ   r   )r   r   r   rZ   r   s        rS   r   zFixed.__init__=
  sg     &(+9T&\9+%%%%1>4;>1
(2rU   c                v    | j                   d   dk  xr& | j                   d   dk  xr | j                   d   dk  S )Nr   rb   
      )versionr   s    rS   is_old_versionzFixed.is_old_versionL
  s:    ||A!#UQ2(=U$,,q/TUBUUrU   c                    t        t        | j                  j                  dd            }	 t	        d |j                  d      D              }t        |      dk(  r|dz   }|S # t        $ r d}Y |S w xY w)zcompute and set our versionpandas_versionNc              3  2   K   | ]  }t        |        y wrW   )r   )rj  rQ  s     rS   rl  z Fixed.version.<locals>.<genexpr>U
  s     ?qCF?s   .r  )r   )r   r   r   )rT   r  r   r  rf   r  rh   r}   )r   r  s     rS   r  zFixed.versionP
  sx     "'$***=*=?OQU"VW	 ?GMM#,>??G7|q !D.   	 G	 s   4A" "A10A1c                V    t        t        | j                  j                  dd             S )Nr  )rT   r  r   r  r   s    rS   r  zFixed.pandas_type\
  s     wtzz':':M4PQQrU   c                   | j                          | j                  }|Wt        |t        t        f      r.dj                  |D cg c]  }t        |       c}      }d| d}| j                  dd| dS | j                  S c c}w )(return a pretty representation of myselfr  [r@  12.12z	 (shape->))r1  r  rN   re   rf   r  rG   r  )r   rR   rQ  jshapes       rS   r   zFixed.__repr__`
  s    JJ=!dE]+A">q<?">?xqM&&u-Yqc;; #?s   Bc                    t        | j                        | j                  _        t        t              | j                  _        y)zset my pandas type & versionN)r]   r  rE  r  _versionr  r   s    rS   r  zFixed.set_object_infok
  s)    !$T%5%5!6

$'M

!rU   c                0    t        j                   |       }|S rW   r  )r   new_selfs     rS   r  z
Fixed.copyp
  s    99T?rU   c                    | j                   S rW   )r/  r   s    rS   r  zFixed.shapet
  r   rU   c                .    | j                   j                  S rW   r   r   r   s    rS   rM  zFixed.pathnamex
  rJ  rU   c                .    | j                   j                  S rW   )r   r   r   s    rS   r   zFixed._handle|
  s    {{"""rU   c                .    | j                   j                  S rW   )r   r   r   s    rS   r   zFixed._filters
  s    {{###rU   c                .    | j                   j                  S rW   )r   r   r   s    rS   r   zFixed._complevel
  s    {{%%%rU   c                .    | j                   j                  S rW   )r   r   r   s    rS   r   zFixed._fletcher32
  s    {{&&&rU   c                .    | j                   j                  S rW   )r   r  r   s    rS   rE  zFixed.attrs
  rF  rU   c                     yzset our object attributesNr   r   s    rS   	set_attrszFixed.set_attrs
      rU   c                     y)zget our object attributesNr   r   s    rS   	get_attrszFixed.get_attrs
  r  rU   c                    | j                   S )zreturn my storabler   r   s    rS   storablezFixed.storable
  s     zzrU   c                     yr~  r   r   s    rS   r  zFixed.is_exists
  r  rU   c                0    t        | j                  dd       S )Nr/  )r  r  r   s    rS   r/  zFixed.nrows
  s    t}}gt44rU   c                
    |yy)z%validate against an existing storableNTr   r,  s     rS   validatezFixed.validate
  s    =rU   Nc                     y)+are we trying to operate on an old version?Nr   )r   ri   s     rS   validate_versionzFixed.validate_version
  r  rU   c                B    | j                   }|y| j                          y)zr
        infer the axes of my storer
        return a boolean indicating if we have a valid storer or not
        FT)r  r  )r   rR   s     rS   r1  zFixed.infer_axes
  s"    
 MM9rU   c                    t        d      )Nz>cannot read on an abstract storer: subclasses should implementr   r   ri   r   r   r   s        rS   r)  z
Fixed.read
  s     "L
 	
rU   c                    t        d      )Nz?cannot write on an abstract storer: subclasses should implementr"  r   r   s     rS   r  zFixed.write
  s    !M
 	
rU   c                    t        j                  |||      r(| j                  j                  | j                  d       yt        d      )zs
        support fully deleting the node in its entirety (only) - where
        specification must be None
        TrZ  Nz#cannot delete on an abstract storer)r_  r`  r   r  r   r   )r   ri   r   r   s       rS   ra  zFixed.delete
  s>     <<ud+LL$$TZZ4$@=>>rU   )rL   rz   )
r   r   r   rJ   rZ   r]   r   r]   r  r  r  )r  ztuple[int, int, int]r  r  )r  r  r  )r  zLiteral[True] | NonerW   NNNNr   r  r   r  r  )r   r  r   r  r  r  )!r   r  r  r  r  r  rL  r   r  r  r  r  r   r  r  r  rM  r   r   r   r   rE  r  r  r  r  r/  r  r  r1  r)  r  ra  r   rU   rS   r  r  &
  s    
 K&&
IMKKHd    	
  
 V V 	 	 R R	 2
   & & # # $ $ & & ' ' # #     5 5	  	
 		

 	

 HL?!+?:D?	?rU   r  c                  V   e Zd ZU dZedediZej                         D  ci c]  \  }}||
 c}}} Zg Z	de
d<   ddZd Zd Zdd	Zedd
       ZddZddZddZdddZ	 d	 	 	 	 	 	 	 ddZddZddZ	 d	 	 	 	 	 	 	 ddZ	 d	 	 	 	 	 	 	 d dZd!dZ	 d"	 	 	 	 	 	 	 d#dZyc c}}} w )$GenericFixedza generified fixed versiondatetimer  r  
attributesc                :    | j                   j                  |d      S )N )_index_type_mapr   )r   r  s     rS   _class_to_aliaszGenericFixed._class_to_alias
  s    ##''R00rU   c                f    t        |t              r|S | j                  j                  |t              S rW   )rN   r   _reverse_index_mapr   r4   )r   aliass     rS   _alias_to_classzGenericFixed._alias_to_class
  s*    eT"L&&**5%88rU   c           	     R   | j                  t        t        |dd                  }|t        k(  rdd}|}n|t        k(  rdd}|}n|}i }d|v r|d   |d<   |t
        u rt        }d|v r=t        |d   t              r|d   j                  d      |d<   n|d   |d<   |t        u sJ ||fS )	Nindex_classr.  c                    t        j                  | j                  |      }t        j                  |d       }| |j	                  d      j                  |      }|S )Nr
  r^   UTC)r=   _simple_newrx  r3   tz_localize
tz_convert)rx  r
  r  dtaresults        rS   rr   z*GenericFixed._get_index_factory.<locals>.f
  sO    #//DI&223TB>#//6AA"EFrU   c                ^    t        j                  | |      }t        j                  |d       S )Nr8  r^   )r>   r:  r6   )rx  r
  r  parrs       rS   rr   z*GenericFixed._get_index_factory.<locals>.f
  s'    "..vDA"..t$??rU   r
  r  zutf-8r  )
r4  rT   r  r3   r6   r4   r8   rN   bytesrQ   )r   rE  r6  rr   r=  r   s         rS   _get_index_factoryzGenericFixed._get_index_factory
  s    **GE="=>
 -' GK'@ G!GU?"6]F6Ne#(5=%+u-$T{11':t  %T{t-///rU   c                8    |t        d      |t        d      y)zE
        raise if any keywords are passed which are not-None
        Nzqcannot pass a column specification when reading a Fixed format store. this store must be selected in its entiretyzucannot pass a where specification when reading from a Fixed format store. this store must be selected in its entirety)r   )r   r   ri   s      rS   validate_readzGenericFixed.validate_read  s=     T  Y  rU   c                     y)NTr   r   s    rS   r  zGenericFixed.is_exists&  s    rU   c                p    | j                   | j                  _         | j                  | j                  _        yr  )rZ   rE  r   r   s    rS   r  zGenericFixed.set_attrs*  s"    "mm

 KK

rU   c                   t        t        | j                  dd            | _        t	        t        | j                  dd            | _        | j                  D ]-  }t        | |t	        t        | j                  |d                   / y)retrieve our attributesrZ   Nr   rz   )r[   r  rE  rZ   rT   r   r,  rh  )r   r  s     rS   r  zGenericFixed.get_attrs/  sg    (Z)NO%gdjj(H&MN 	LAD!_WTZZD-IJK	LrU   c                $    | j                          y rW   )r  )r   r  r   s      rS   r  zGenericFixed.write7  s    rU   Nc                   ddl }t        | j                  |      }|j                  }t        |dd      }t	        ||j
                        r	|d   || }nt        t        |dd            }	t        |dd      }
|
t        j                  |
|	      }n||| }|	dk(  rt        |d	d      }t        ||d
      }n|	dk(  rt        j                  |d      }|r|j                  S |S )z2read an array for the specified node (off of groupr   N
transposedF
value_typer  r  r  r  Tr  r  r  )r|   r  r   r  rN   VLArrayrT   rO   r  r;  r  T)r   r   r   r   r|   r   rE  rK  retr8  r  r  s               rS   
read_arrayzGenericFixed.read_array:  s    tzz3'UL%8
dFNN+q'%%C#GE<$FGEE7D1E hhuE25&$UD$/c2d3-'jjH555LJrU   c                    t        t        | j                  | d            }|dk(  r| j                  |||      S |dk(  r,t        | j                  |      }| j                  |||      }|S t        d|       )N_varietymultir   r   regularzunrecognized index variety: )rT   r  rE  read_multi_indexr   read_index_noder   )r   r   r   r   varietyr   r   s          rS   
read_indexzGenericFixed.read_index\  s     "'$**X6F"GHg((E(EE	!4::s+D((U(FEL:7)DEErU   c                4   t        |t              r-t        | j                  | dd       | j	                  ||       y t        | j                  | dd       t        d|| j                  | j                        }| j                  ||j                         t        | j                  |      }|j                  |j                  _        |j                  |j                  _        t        |t        t         f      r)| j#                  t%        |            |j                  _        t        |t        t         t(        f      r|j*                  |j                  _        t        |t              r2|j,                  %t/        |j,                        |j                  _        y y y )NrR  rS  rU  r   )rN   r5   rh  rE  write_multi_index_convert_indexrZ   r   write_arrayrx  r  r   r  r  r_   r3   r6   r0  r   r6  r8   r
  r  _get_tz)r   r   r   r  r   s        rS   write_indexzGenericFixed.write_indexj  s$   eZ(DJJ3%x 0':""3.DJJ3%x 0)<&wt}}dkkRIS)"2"234::s+D!*DMM!&DMM%-!=>,0,@,@e,M)%-n!MN%*ZZ"%/EHH4H#*588#4  5I/rU   c                p   t        | j                  | d|j                         t        t	        |j
                  |j                  |j                              D ]  \  }\  }}}t        |      rt        d      | d| }t        ||| j                  | j                        }| j                  ||j                         t        | j                   |      }	|j"                  |	j$                  _        ||	j$                  _        t        |	j$                  | d| |       | d| }
| j                  |
|        y )N_nlevelsz=Saving a MultiIndex with an extension dtype is not supported._level_name_label)rh  rE  r  	enumeraterK  levelsr  namesr,   r   r\  rZ   r   r]  rx  r  r   r  r  r_   )r   r   r   ilevlevel_codesr_   	level_key
conv_levelr   	label_keys              rS   r[  zGenericFixed.write_multi_index  s   

se8,emm<+4ekk5;;7,
 	5'A'[$ (,)S  %vaS)I'	3t{{SJY
(9(9:4::y1D!+DMM!%DMM DMMcU%v#6= %vaS)IY4)	5rU   c                   t        | j                  | d      }g }g }g }t        |      D ]  }| d| }	t        | j                  |	      }
| j	                  |
||      }|j                  |       |j                  |j                         | d| }| j                  |||      }|j                  |        t        |||d      S )Nra  rb  rT  rd  T)rf  r  rg  rD  )	r  rE  rp  r   rW  r   r_   rP  r5   )r   r   r   r   r  rf  r  rg  rh  rk  r   ri  rm  rj  s                 rS   rV  zGenericFixed.read_multi_index  s     $**X&67 "w 		&A%vaS)I4::y1D&&t5t&DCMM#LL"%vaS)I//)5t/LKLL%		& ed
 	
rU   c                   ||| }d|j                   v rkt        j                  |j                   j                        dk(  r?t        j                  |j                   j                  |j                   j
                        }t        |j                   j                        }d }d|j                   v r*t        |j                   j                        }t        |      }|j                   }| j                  |      \  }}	|dk(  r1 |t        ||| j                  | j                        fdt        i|	}
n* |t        ||| j                  | j                        fi |	}
||
_	        |
S )Nr  r   r  r_   r   r  r8  )r  rO   prodr  r  rL  rT   r  r`   r_   rB  _unconvert_indexrZ   r   r  )r   r   r   r   r  r  r_   rE  r=  r   r   s              rS   rW  zGenericFixed.read_index_node  s7    E$ dmm#0C0C(D(I88DMM//t}}7O7OPDt}}112T]]"t}}112D"4(D11%86> $t{{ 	
 E  $t{{ 	E 
rU   c                @   t        j                  d|j                  z        }| j                  j	                  | j
                  ||       t        | j
                  |      }t        |j                        |j                  _
        |j                  |j                  _        y)zwrite a 0-len array)rb   N)rO   r  rq  r   create_arrayr   r  r]   r8  r  rL  r  )r   r   r   arrr   s        rS   write_array_emptyzGenericFixed.write_array_empty  sj     hhtejj()!!$**c37tzz3'#&u{{#3 #kkrU   c                   t        |d      }|| j                  v r&| j                  j                  | j                  |       |j                  dk(  }d}t        |j                        rt        d      |st        |d      r|j                  }d}d }| j                  Et        t              5  t               j                  j                  |j                        }d d d        |[|sE| j                  j!                  | j                  |||j"                  | j                        }||d d  n| j%                  ||       nx|j                  j&                  t(        j*                  k(  rt-        j.                  |d      }	|rn6|	d	k(  rn0t0        |	||fz  }
t3        j4                  |
t6        t9               
       | j                  j;                  | j                  |t               j=                               }|j?                  |       ntA        |j                        r]| j                  jC                  | j                  ||jE                  d             dtG        | j                  |      jH                  _%        n?tM        |j                        r}| j                  jC                  | j                  ||jN                         tG        | j                  |      }tQ        |jR                        |jH                  _)        d|jH                  _%        ntU        |j                        r\| j                  jC                  | j                  ||jE                  d             dtG        | j                  |      jH                  _%        n<|r| j%                  ||       n'| j                  jC                  | j                  ||       |tG        | j                  |      jH                  _+        y # 1 sw Y   xY w)NT)extract_numpyr   Fz]Cannot store a category dtype in a HDF5 dataset that uses format="fixed". Use format="table".rN  )r   skipnarR  r  r3  r  r  ),rA   r   r   r  r  r(   r8  r   r1  rN  r   r   r   r   Atom
from_dtypecreate_carrayr  ru  r   rO   object_r   infer_dtypero   r  r  r"   r%   create_vlarray
ObjectAtomr   r*   rs  viewr  r  rL  r+   asi8r^  r  r/   rK  )r   r   r  r  r   empty_arrayrK  r  cainferred_typerk  vlarrr   s                rS   r]  zGenericFixed.write_array  s    c6$**LL$$TZZ5 jjAo
,%/  uc"!
==$*% >y~~00=> 
 \\//JJT5;; 0  1 &&sE2[[+  OOE%@M(*$sE'BBb"4AQASTLL//

CAUAUAWXELL -LL%%djj#uzz$7GH;GGDJJ$--8"5;;/ LL%%

C 4::s+D  'uxx0DMM'3DMM$!%++.LL%%djj#uzz$7GH;HGDJJ$--8""3.LL%%djj#u=7A

C ))4w> >s   ,.OO'r  r  r  r  r  )r   r]   r   r  r   r  r  r4   )r   r]   r   r4   r  r  )r   r]   r   r5   r  r  )r   r]   r   r  r   r  r  r5   )r   rJ   r   r  r   r  r  r4   )r   r]   r   r   r  r  rW   )r   r]   r  r   r  zIndex | Noner  r  )r   r  r  r  r3   r6   r/  r  r2  r,  r  r0  r4  rB  rD  r  r  r  r  r  rP  rY  r_  r[  rV  rW  ru  r]  )rj  rP  r  s   000rS   r*  r*  
  sW   $$j+xHO+:+@+@+BCC41a!Q$CJ	19,\  (
L F FJFF)F8BF	F5.54 FJ

)
8B
	
0 HL$$!+$:D$	$L* BFXBXB)XB2>XB	XBI Ds   B$r*  c                  b     e Zd ZU dZdgZded<   ed        Z	 	 	 	 d	 	 	 	 	 ddZd	 fdZ	 xZ
S )
r  r  r_   r   c                n    	 t        | j                  j                        fS # t        t        f$ r Y y w xY wrW   )rh   r   rx  r   r}   r   s    rS   r  zSeriesFixed.shapeA  s6    	

))*,,>* 		s   " 44c                    | j                  ||       | j                  d||      }| j                  d||      }t        ||| j                        S )Nr   rT  rx  )r   r_   )rD  rY  rP  r7   r_   )r   ri   r   r   r   r   rx  s          rS   r)  zSeriesFixed.readH  sO     	7E*u4@TBfE		::rU   c                    t        |   |fi | | j                  d|j                         | j	                  d|       |j
                  | j                  _        y )Nr   rx  )r  r  r_  r   r]  r_   rE  )r   r  r   r  s      rS   r  zSeriesFixed.writeU  sG    c$V$#)),3'((

rU   r'  r   r  r   r  r  r7   r  )r   r  r  r  r,  r  r  r  r)  r  r  r  s   @rS   r  r  ;  sa    KJ
N   
; 	
;
 
; 

;# #rU   r  c                  b     e Zd ZU ddgZded<   edd       Z	 	 	 	 d	 	 	 	 	 d	dZd
 fdZ xZ	S )BlockManagerFixedrq  nblocksr   c                n   	 | j                   }d}t        | j                        D ]4  }t        | j                  d| d      }t        |dd       }|-||d   z  }6 | j                  j
                  }t        |dd       }|t        |d|dz
         }ng }|j                  |       |S # t        $ r Y y w xY w)Nr   block_itemsr  rb   )	rq  rp  r  r  r   block0_valuesre   r   r}   )r   rq  r  rh  r   r  s         rS   r  zBlockManagerFixed.shapea  s    	99D E4<<( &tzzU1#V+<=gt4$U1X%E	& ::++DD'40E U1q23LLL 		s   AB( AB( (	B43B4c                   | j                  ||       | j                         j                  d      }g }t        | j                        D ]8  }||k(  r||fnd\  }}	| j                  d| ||	      }
|j                  |
       : |d   }g }t        | j                        D ]o  }| j                  d| d      }| j                  d| d	      }||j                  |         }t        |j                  ||d   	      }|j                  |       q t        |      dkD  r"t        |d
      }|j                  |d      }|S t        |d   |d   	      S )Nr   r  rC  rT  r  r  r  rb   r   r   rm  F)r   r  )rD  r  _get_block_manager_axisrp  rq  rY  r   r  rP  rv  r2   rN  rh   r9   r}  )r   ri   r   r   r   select_axisrd  rh  r*  r+  axr  dfs	blk_itemsrx  dfouts                    rS   r)  zBlockManagerFixed.read|  sY    	7E*mmo==a@tyy! 	A-.+-=UDM<MFE4s6FBKKO		 Qt||$ 	A%s&(9:I__uQCw%7vE_RFE--i89G688WDGDBJJrN	 s8a<1%C++e%+8CJaQ88rU   c                   t        |   |fi | t        |j                  t              r|j                  d      }|j                  }|j                         s|j                         }|j                  | j                  _        t        |j                        D ]6  \  }}|dk(  r|j                  st        d      | j                  d| |       8 t        |j                         | j                  _        t        |j                         D ]b  \  }}|j$                  j'                  |j(                        }| j+                  d| d|j,                  |       | j                  d| d|       d y )Nr  r   z/Columns index has to be unique for fixed formatrC  r  )r  r  )r  r  rN   _mgrrC   _as_manageris_consolidatedconsolidaterq  rE  re  rd  	is_uniquer   r_  rh   blocksr  r  rw  mgr_locsr]  rx  )	r   r  r   r  rh  r  blkr  r  s	           rS   r  zBlockManagerFixed.write  s3   c$V$ chh-//'*Cxx##%##%D))

tyy) 	-EArAvr|| !RSStA3Z,	- !-

, 	;FAs

5IuQCw/9MuQCv.	:		;rU   )r  zShape | Noner'  )r   r  r   r  r  r2   r  )
r   r  r  r,  r  r  r  r)  r  r  r  s   @rS   r  r  \  s`    )$JL 8  #9 	#9
 #9 
#9L; ;rU   r  c                      e Zd ZdZeZy)r  r  N)r   r  r  r  r2   r  r   rU   rS   r  r    s    KHrU   r  c                      e Zd ZU dZdZdZded<   ded<   dZded	<   d
Zded<   ded<   ded<   ded<   ded<   ded<   	 	 	 	 	 	 	 	 d<	 	 	 	 	 	 	 d= fdZ	e
d>d       Zd>dZd?dZd@dZe
dAd       Z	 	 	 	 dBdZe
dCd       Ze
dAd       Ze
d        Ze
d         Ze
d!        Ze
d"        Ze
d#        Ze
dCd$       Ze
dAd%       Ze
dDd&       ZdEd'Zd( ZdFd)ZdGd*ZdHd+ZdId,Z d@d-Z!d@d.Z"dJd@d/Z#d@d0Z$e%d1        Z&	 dK	 	 	 dLd2Z'	 dM	 	 	 	 	 dNd3Z(e)dOd4       Z*d5 Z+	 	 	 	 dP	 	 	 dQd6Z,e-	 	 	 	 dRd7       Z.dJdSd8Z/	 	 	 	 	 	 	 	 dTd9Z0	 dK	 	 	 dUd:Z1	 	 	 dK	 	 	 	 	 dVd;Z2 xZ3S )Wr  aa  
    represent a table:
        facilitate read/write of various types of tables

    Attrs in Table Node
    -------------------
    These are attributes that are store in the main table node, they are
    necessary to recreate these tables when read back in.

    index_axes    : a list of tuples of the (original indexing axis and
        index column)
    non_index_axes: a list of tuples of the (original index axis and
        columns on a non-indexing axis)
    values_axes   : a list of the columns which comprise the data of this
        table
    data_columns  : a list of the columns that we are allowing indexing
        (these become single columns in values_axes)
    nan_rep       : the string to use for nan representations for string
        objects
    levels        : the names of levels
    metadata      : the names of the metadata columns
    
wide_tablerq   r]   r  r  rb   zint | list[Hashable]rf  Tzlist[IndexCol]
index_axeszlist[tuple[int, Any]]rN  zlist[DataCol]values_axesre   r   r  rn  r  c                    t         |   ||||       |xs g | _        |xs g | _        |xs g | _        |xs g | _        |	xs i | _        |
| _        y )Nr  )r  r   r  rN  r  r   r  r   )r   r   r   rZ   r   r  rN  r  r   r  r   r  s              rS   r   zTable.__init__  s`     	&I$*,2&,"(.BJB	rU   c                >    | j                   j                  d      d   S )N_r   )r  r  r   s    rS   table_type_shortzTable.table_type_short  s    $$S)!,,rU   c                   | j                          t        | j                        rdj                  | j                        nd}d| d}d}| j                  r8dj                  | j
                  D cg c]  }t        |       c}      }d| d}dj                  | j                  D cg c]  }|j                   c}      }| j                  d| d| j                   d	| j                   d
| j                   d| d| dS c c}w c c}w )r  r  r.  z,dc->[r@  r  r   r  z (typ->z,nrows->z,ncols->z,indexers->[r  )r1  rh   r   r  r  r  r]   r  r_   r  r  r/  ncols)r   jdcr  verrQ  jverr   jindex_axess           rS   r   zTable.__repr__  s    -01B1B-Cchht(()cU!_88T\\:SV:;DdV1+Chh@1@A&se ,**+8DJJ< @jj\k]!B4qB	
	 ;  As   0D(Dc                L    | j                   D ]  }||j                  k(  s|c S  y)zreturn the axis for cN)rd  r_   )r   ra  r   s      rS   r   zTable.__getitem__  s*     	AAFF{	 rU   c                b   |y|j                   | j                   k7  r&t        d|j                    d| j                    d      dD ]h  }t        | |d      }t        ||d      }||k7  s#t        |      D ]$  \  }}||   }||k7  st	        d| d| d| d       t        d| d| d| d       y)	z"validate against an existing tableNz'incompatible table_type with existing [rc  r@  )r  rN  r  zinvalid combination of [z] on appending data [z] vs current table [)r  r   r  re  r   r]  )r   r(  ra  svovrh  saxoaxs           rS   r  zTable.validate  s   =t.$$%S(9< 
 A 	Aq$'B4(BRx
 (m FAsQ%Ccz(6qc :  #u$8Q@ 	  .qc1Frd K&&(T, %	rU   c                6    t        | j                  t              S )z@the levels attribute is 1 or a list in the case of a multi-index)rN   rf  re   r   s    rS   is_multi_indexzTable.is_multi_index:  s     $++t,,rU   c                    t        j                  |j                  j                        }	 |j	                         }t        |t              sJ ||fS # t
        $ r}t        d      |d}~ww xY w)ze
        validate that we can store the multi-index; reset and return the
        new object
        zBduplicate names/columns in the multi-index when storing as a tableN)r_  fill_missing_namesr   rg  reset_indexr   rN   r2   )r   r  rf  	reset_objrb  s        rS   validate_multiindexzTable.validate_multiindex?  so     ''		8	)I
 )Y///&    	T	s   A 	A+A&&A+c                    t        j                  | j                  D cg c]  }|j                  j                  d    c}      S c c}w )z-based on our axes, compute the expected nrowsr   )rO   rp  r  rO  r  r   rh  s     rS   nrows_expectedzTable.nrows_expectedP  s2     wwDOODq		*DEEDs    Ac                    d| j                   v S )zhas this table been createdrq   r  r   s    rS   r  zTable.is_existsU  s     $**$$rU   c                0    t        | j                  dd       S Nrq   r  r   r   s    rS   r  zTable.storableZ  s    tzz7D11rU   c                    | j                   S )z,return the table group (this is my storable))r  r   s    rS   rq   zTable.table^  s     }}rU   c                .    | j                   j                  S rW   )rq   r8  r   s    rS   r8  zTable.dtypec  s    zzrU   c                .    | j                   j                  S rW   rH  r   s    rS   rI  zTable.descriptiong  rJ  rU   c                V    t        j                  | j                  | j                        S rW   )rI  rJ  r  r  r   s    rS   rd  z
Table.axesk  s    t0@0@AArU   c                :    t        d | j                  D              S )z.the number of total columns in the values axesc              3  F   K   | ]  }t        |j                          y wrW   )rh   rx  )rj  r   s     rS   rl  zTable.ncols.<locals>.<genexpr>r  s     ;Q3qxx=;s   !)sumr  r   s    rS   r  zTable.ncolso  s     ;$*:*:;;;rU   c                     yr~  r   r   s    rS   is_transposedzTable.is_transposedt  r  rU   c                    t        t        j                  | j                  D cg c]  }t	        |d          c}| j
                  D cg c]  }t	        |j                         c}            S c c}w c c}w )z@return a tuple of my permutated axes, non_indexable at the frontr   )rf   rI  rJ  rN  r   r  rC  r   r   s     rS   data_orientationzTable.data_orientationx  sY     OO$($7$78qQqT8&*oo6QVV6
 	
86s   A/A4c                l   ddd}| j                   D cg c]  }|j                  |f }}| j                  D cg c]  \  }}||   df }}}| j                  D cg c]2  }|j                  t        | j                        v s%|j                  |f4 }}t        ||z   |z         S c c}w c c}}w c c}w )z<return a dict of the kinds allowable columns for this objectr   r   r   rb   N)r  r  rN  r  r_   ro  r   rn  )	r   
axis_namesr   d1rC  rx  d2r  d3s	            rS   
queryableszTable.queryables  s     !Y/
 %)OO4qqwwl44;?;N;NO<4z$&OO"&"2"2
affDDUDU@V6VQWWaL
 
 BGbL!! 5O
s   B&B+&B1B1c                l    | j                   D cg c]  }|j                  |j                  f c}S c c}w )zreturn a list of my index cols)r  rC  r  r  s     rS   
index_colszTable.index_cols  s)     ,0??;a!;;;s   1c                T    | j                   D cg c]  }|j                   c}S c c}w )zreturn a list of my values cols)r  r  r  s     rS   values_colszTable.values_cols  s     !%!1!12A222s   %c                >    | j                   j                  }| d| dS )z)return the metadata pathname for this keyz/meta/z/metar
  r&  s      rS   _get_metadata_pathzTable._get_metadata_path  s$    

&&se5))rU   c                    | j                   j                  | j                  |      t        |      d| j                  | j
                  | j                         y)z
        Write out a metadata array to the key as a fixed-format Series.

        Parameters
        ----------
        key : str
        values : ndarray
        rq   )r   rZ   r   r   N)r   r   r  r7   rZ   r   r   )r   r   rx  s      rS   r\  zTable.write_metadata  sF     	##C(6N]];;LL 	 	
rU   c                    t        t        | j                  dd      |d      *| j                  j                  | j	                  |            S y)z'return the meta data array for this keyr   N)r  r   r   r   r  r   s     rS   rt  zTable.read_metadata  sA    74::vt4c4@L;;%%d&=&=c&BCCrU   c                B   t        | j                        | j                  _        | j                         | j                  _        | j	                         | j                  _        | j
                  | j                  _        | j                  | j                  _        | j                  | j                  _        | j                  | j                  _        | j                  | j                  _	        | j                  | j                  _
        | j                  | j                  _        y)zset our table type & indexablesN)r]   r  rE  r  r  rN  r   r   rZ   r   rf  r  r   s    rS   r  zTable.set_attrs  s     #DOO 4

 $ 1

!%!1!1!3

$($7$7

!"&"3"3

!\\

"mm

 KK

 KK

))

rU   c                   t        | j                  dd      xs g | _        t        | j                  dd      xs g | _        t        | j                  dd      xs i | _        t        | j                  dd      | _        t        t        | j                  dd            | _        t        t        | j                  dd            | _	        t        | j                  d	d      xs g | _
        | j                  D cg c]  }|j                  s| c}| _        | j                  D cg c]  }|j                  r| c}| _        yc c}w c c}w )
rH  rN  Nr   r  r   rZ   r   rz   rf  )r  rE  rN  r   r  r   r[   rZ   rT   r   rf  
indexablesr  r  r  r  s     rS   r  zTable.get_attrs  s    %djj2BDIOR#DJJEKDJJ5;	tzz9d;(Z)NO%gdjj(H&MN&-djj(D&I&OR&*ooK9J9J1K'+P!a>O>OAP LPs   5E E !E3Ec           	         |k| j                   r^t        dj                  | j                  D cg c]  }t	        |       c}      z  }t        j                  |t        t                      yyyc c}w )r  Nr  r  )	r  rm   r  r  r]   r  r  r!   r%   )r   ri   rQ  rk  s       rS   r  zTable.validate_version  s\    ""(388T\\4RSV4R+SS*/1 # 4Rs   A/
c                    |yt        |t              sy| j                         }|D ]  }|dk(  r	||vst        d| d       y)z
        validate the min_itemsize doesn't contain items that are not in the
        axes this needs data_columns to be defined
        Nrx  zmin_itemsize has the key [z%] which is not an axis or data_column)rN   rn  r  r   )r   r   qrP  s       rS   validate_min_itemsizezTable.validate_min_itemsize  sf    
 ,-OO 		A H}z 0 4" " 		rU   c                `    g } j                    j                  j                  t         j                  j                        D ]k  \  }\  }}t        |      } j                  |      }|dnd}| d}t        |d      }	t        ||||	| j                  ||      }
|j                  |
       m t         j                        t        |       fd}|j                  t         j                  j                        D cg c]  \  }} |||       c}}       |S c c}}w )z/create/cache the indexables if they don't existNrs  r  )r_   rC  r  r  r  rq   r   r  c                f   t        |t              sJ t        }|v rt        }t	        |      }t        |j                        }t	        | dd       }t	        | dd       }t        |      }j                  |      }t	        | dd       }	 |||||| z   |j                  |	||
      }
|
S )Nr  r  r  )
r_   r  rx  r  r  r  rq   r   r  r8  )
rN   r]   r  r  r  _maybe_adjust_namer  r  rt  rq   )rh  ra  klassr  adj_namerx  r8  r  mdr   r  base_posr  descr   table_attrss              rS   rr   zTable.indexables.<locals>.f  s    a%%%EBw(4#D)!T\\:H [XJe*<dCFKH:V)<dCE "%(D##A&B ;8*E(:DADqLjjC JrU   )rI  rq   rE  re  r  r  rt  r  r   ro  r   rh   rs  r  )r   _indexablesrh  rC  r_   r  r  r   r  r  	index_colrr   ra  r  r  r  r  s   `            @@@@rS   r  zTable.indexables  s)    jj&&
  ))>)>? 	*OA|d4&D##D)B!#:TD&I;	48D jj	I y)%	** ""#{#!	 !	J 		$**:P:P0QR1AaGRS Ss   D*
c           
        | j                         sy|du ry||du r0| j                  D cg c]  }|j                  s|j                   }}t	        |t
        t        f      s|g}i }|||d<   |||d<   | j                  }|D ]  }t        |j                  |d      }||j                  r^|j                  }	|	j                  }
|	j                  }|||k7  r|j                          n||d<   ||
|k7  r|j                          n|
|d<   |j                  r|j                  j!                  d      rt#        d       |j$                  di | || j&                  d   d	   v st)        d
| d| d| d       yc c}w )aZ  
        Create a pytables index on the specified columns.

        Parameters
        ----------
        columns : None, bool, or listlike[str]
            Indicate which columns to create an index on.

            * False : Do not create any indexes.
            * True : Create indexes on all columns.
            * None : Create indexes on all columns.
            * listlike : Create indexes on the given columns.

        optlevel : int or None, default None
            Optimization level, if None, pytables defaults to 6.
        kind : str or None, default None
            Kind of index, if None, pytables defaults to "medium".

        Raises
        ------
        TypeError if trying to create an index on a complex-type column.

        Notes
        -----
        Cannot index Time64Col or ComplexCol.
        Pytables must be >= 3.0.
        NFTr  r  complexzColumns containing complex values can be stored but cannot be indexed when using table format. Either use fixed format, set index=False, or do not include the columns containing complex values to data_columns when initializing the table.r   rb   zcolumn z/ is not a data_column.
In order to read column z: you must reload the dataframe 
into HDFStore and include z  with the data_columns argument.r   )r1  rd  r	  r  rN   rf   re   rq   r  rk  r  r   r  r  remove_indexr   r  r   r  rN  r}   )r   r   r  r  r   kwrq   ra  r  r   cur_optlevelcur_kinds               rS   r  zTable.create_index>  s   <  e ?go(,		I1Q5H5HqwwIGI'E4=1iG%BzNBvJ

 $	A

At,A}<<GGE#(>>L$zzH'H,<(%-6
+0H()5: ||vv((3'H  #ANN(R(d))!,Q//$aS !//0c 21123SU A$	 Js
   E<E<c                (   t        | |||      }|j                         }g }| j                  D ]a  }|j                  | j                         |j                  || j                  | j                  | j                        }|j                  |       c |S )a  
        Create the axes sniffed from the table.

        Parameters
        ----------
        where : ???
        start : int or None, default None
        stop : int or None, default None

        Returns
        -------
        List[Tuple[index_values, column_values]]
        r6  r  )
	Selectionr   rd  rp  r  r@  r   rZ   r   r   )	r   ri   r   r   	selectionrx  r  r   ress	            rS   
_read_axeszTable._read_axes  s    " d%u4H	!!# 	 AJJtyy!)){{	  C NN3	  rU   c                    |S )zreturn the data for this objr   r  r  rK  s      rS   
get_objectzTable.get_object  s	     
rU   c                   t        |      sg S |d   \  }}| j                  j                  |i       }|j                  d      dk(  r|rt        d| d|       |du rt	        |      }n|g }t        |t              rLt        |      }t	        |      }|j                  |j                         D cg c]  }|dk7  r||vr| c}       |D 	cg c]	  }	|	|v s|	 c}	S c c}w c c}	w )zd
        take the input data_columns and min_itemize and create a data
        columns spec
        r   r   r5   z"cannot use a multi-index on axis [z] with data_columns Trx  )
rh   r  r   r   re   rN   rn  ro  rs  r  )
r   r   r   rN  rC  axis_labelsr  existing_data_columnsrP  ra  s
             rS   validate_data_columnszTable.validate_data_columns  s   
 >"I*1-kyy}}T2&88F|+4TF ;  ,~/  4,L!L lD)$'$5!-L *..0H}2G)G  (<a1+;<< =s   0C	C#C#c                   t        |t              s1| j                  j                  }t	        d| dt        |       d      |dg}|D cg c]  }|j                  |       }}| j                         rGd}	| j                  D cg c]  }|j                   }}t        | j                        }| j                  }nd}	| j                  }
| j                  dk(  sJ t        |      | j                  d	z
  k7  rt!        d
      g }|d}dD cg c]	  }||vs| c}d   }|j"                  |   }t        |      }|	rt        |      }| j$                  |   d	   }t'        t)        j*                  |      t)        j*                  |            sFt'        t)        j*                  t-        |            t)        j*                  t-        |                  r|}|
j/                  |i       }t        |j0                        |d<   t        |      j2                  |d<   |j5                  ||f       |d   }|j"                  |   }|j7                  |      }t9        ||| j:                  | j<                        }||_	        |j?                  d       |jA                  |
       |jC                  |       |g}t        |      }|d	k(  sJ t        |      d	k(  sJ |D ]  }tE        ||d   |d	         } |j                  d	k(  }| jG                  |||      }| jI                  ||      jK                         }| jM                  ||	|| jN                  |      \  }}g }tQ        tS        ||            D ]  \  }\  }}tT        }d}|r=t        |      d	k(  r/|d   |v r(tV        }|d   }|t        |tX              st!        d      |	r|r	 | jN                  |   } nd} |xs d| }"t_        |"|j`                  | ||| j:                  | j<                  |      }#tc        |"| jd                        }$|jg                  |#      }%ti        |#jj                  jl                        }&d}'to        |#dd      tq        |#jr                        }'dx}(x})}*tu        |#jj                        r=|#jv                  }*d}(t)        j*                  |#jx                  d      j{                         })t}        |#      \  }+}, ||$|"t        |      |%||&|'|*|(|)|,|+      }-|-jA                  |
       |j5                  |-       |d	z  } |D -cg c]  }-|-j~                  s|-jl                   }.}- t        |       | j                  | j                  | j:                  | j<                  ||||.|
|
      }/t        | d      r| j                  |/_B        |/j                  |       |r|	r|/j                  |        |/S c c}w c c}w c c}w # tZ        t\        f$ r"}!t!        d| d| jN                   d      |!d}!~!ww xY wc c}-w )a0  
        Create and return the axes.

        Parameters
        ----------
        axes: list or None
            The names or numbers of the axes to create.
        obj : DataFrame
            The object to create axes on.
        validate: bool, default True
            Whether to validate the obj against an existing object already written.
        nan_rep :
            A value to use for string column nan_rep.
        data_columns : List[str], True, or None, default None
            Specify the columns that we want to create to allow indexing on.

            * True : Use all available columns.
            * None : Use no columns.
            * List[str] : Use the specified columns.

        min_itemsize: Dict[str, int] or None, default None
            The min itemsize for a column in bytes.
        z/cannot properly create the storer for: [group->r  r@  Nr   TFr  rb   z<currently only support ndim-1 indexers in an AppendableTablenanr  rg  r   r  zIncompatible appended table [z]with existing table [values_block_)existing_colr   r   rZ   r   r   r  rs  r  )r_   r  rx  r  r  r  r  r  r   r  r8  r  )
r   r   rZ   r   r  rN  r  r   r  r   rf  )ErN   r2   r   r   r   r   _get_axis_numberr1  r  rC  re   r   r   r  rq  rh   r   rd  rN  r1   rO   arrayru  rg  rg  r   r   _get_axis_namer\  rZ   r   r  rl  rT  _reindex_axisr  r  rE  _get_blocks_and_itemsr  re  rK  r  r  r]   
IndexErrorr   _maybe_convert_for_string_atomrx  r  r  r  r  r8  r_   r  r^  r  r(   r  r  r  r  r	  r   r1  rf  r  r  )0r   rd  r  r  r   r   r   r   r   table_existsnew_infonew_non_index_axesrQ  ri  append_axisindexer
exist_axisr  	axis_name	new_indexnew_index_axesjrK  r  r  r  vaxesrh  r  b_itemsr  r_   r
  rb  new_namedata_convertedr  r  r  r  r   r  r  r  r  rL  dcs	new_tables0                                                   rS   _create_axeszTable._create_axes  s!   @ #y)JJ&&EA% Is)A'  <3D 266A$$Q'66 ??L$(OO4qAFF4D4 1 12LllG !L99yyA~~t9		A%N 
 $& ?G !2QATMq215HHSM1g,-G,,W5a8J#BHH[$9288J;OP $HHVK01288F:<N3O #-K ""3+QWWWAw''V!!3"45 1gHHSM&&s+	"9aL		 	!h'  .#Avv %&!+++# 	1AQqT1Q40C	1 ^^q(
 11,(:
 Z0==? 66<!3T5E5E|
	
 !*3vy+A!B J	A~W ED G 1gajL6P(qz
4(=$%TUU #'#3#3A#6L  $2qc2H;

)){{	N *(DLLAH//.1C!."6"6";";<DB~tT2>^../(,,D,8g#N$8$89(00!88N$=$=EJPPR7GD*G}! C OOH%LLFAUJ	X $)BCC,A,AsxxBBDJ;;**]];;%-
	 4"#{{I''5t$y 7
 50 3b #H- $7x @0040@0@/AD n Cs<   WW	WW6WX
/X
X%XXc           
     F   t        | j                  t              r| j                  d      } d }| j                  }t	        t
        |      }t        |j                        } ||      }t        |      r|d   \  }	}
t        |
      j                  t        |            }| j                  ||	      j                  }t        |j                        } ||      }|D ]R  }| j                  |g|	      j                  }|j                  |j                         |j                   ||             T |rt        ||      D ci c]!  \  }}t        |j                               ||f# }}}g }g }|D ]N  }t        |j                         }	 |j#                  |      \  }}|j%                  |       |j%                  |       P |}|}||fS c c}}w # t&        t(        f$ rC}dj+                  |D cg c]  }t-        |       nc c}w c}      }t/        d| d      |d }~ww xY w)Nr  c                    | j                   D cg c]'  }| j                  j                  |j                        ) c}S c c}w rW   )r  r  rw  r  )mgrr  s     rS   get_blk_itemsz2Table._get_blocks_and_items.<locals>.get_blk_items  s+    <?JJGSCIINN3<<0GGGs   ,>r   rm  r  z+cannot match existing table structure for [z] on appending data)rN   r  rC   r  r   rD   re   r  rh   r4   rt  r}  rs  rK  rf   tolistrx  r|  r   r  r   r  rG   r   )r  r  r  r  r   r&  r%  r  r  rC  r  
new_labelsra  br  by_items
new_blocksnew_blk_itemsear  rb  itemjitemss                          rS   r  zTable._get_blocks_and_items  s     ejj,/%%g.E	H jj<%"3::.!.s!3	| 21 5D+{+66u\7JKJ--
-6;;C #**%F%c*I! 5mmQCdm388 cjj)  s!345  #&fi"8Aw gnn&'!W5H  ')JM! bii(	!)e!4JAw%%a(!((1  F%Iy  + #H-  XXe&Ld|D'9&L&LMF$EfX N, , s*    &G6GH H,G?>HH c                   
 |t        |      }|P j                  rDt         j                  t               sJ  j                  D ]  }||vs|j	                  d|         j
                  D ]  \  }}t        |||       |j                  3|j                  j                         D ]  \  }
}
 fd}	 |	||       S )zprocess axes filtersr   c                    j                   D ]  }j                  |      }j                  |      }|J | |k(  rP	j                  r$|j	                  t        	j                              } ||      }j                  |      |   c S | |v st        t        |       j                        }t        |      }t        t              rd|z
  } ||      }j                  |      |   c S  t        d|  d      )Nrm  rb   zcannot find the field [z] for filtering!)_AXIS_ORDERSr  	_get_axisr  unionr4   rf  r{  rB   r  rx  rN   r2   r   )
fieldfiltr  axis_numberaxis_valuestakersrx  r  opr   s
          rS   process_filterz*Table.process_axes.<locals>.process_filter  s   %(%5%5 E	&)&:&:9&E&)mmI&>*666 !I-  $22'+zz%2D'E%'T%:F#&777#<V#DD #k1 &2'#u2E2L2L%MF#/#5D  *#y9./+o%'%5F#&777#<V#DD7E: %'>ugEU%VWWrU   )	re   r  rN   rf  insertrN  r  filterr   )r   r  r  r   r  rC  labelsr5  r6  r;  r:  s   ``        @rS   process_axeszTable.process_axes
  s     7mG 4#6#6dkk4000[[ )G#NN1a()
 !// 	<LD&T67;C	< '#,#3#3#:#:#< #2r4XB %UD1G#2J 
rU   c                n   |t        | j                  d      }d|d}| j                  D ci c]  }|j                  |j                   c}|d<   |rC|| j
                  xs d}t               j                  |||xs | j                        }||d<   |S | j                  | j                  |d<   |S c c}w )z:create the description of the table from the axes & valuesi'  rq   )r_   re  rI  	   )r   r   r   r   )
maxr  rd  r  r  r   r   r  r   r   )r   r   r   r   re  r~  r   r   s           rS   create_descriptionzTable.create_descriptionD  s     t22E:Ll; 59II>qAGGQUUN>-  OO0q	i''#%9)9)9 ( G
 #AiL  ]]&==AiL ?s   B2c                   | j                  |       | j                         syt        | |||      }|j                         }|j                  |j                  j                         D ]m  \  }}}| j                  ||j                         |j                         dz         }	| ||	j                  ||j                         z
     |      j                     }o t        |      S )zf
        select coordinates (row numbers) from a table; return the
        coordinates object
        Fr6  rb   rT  )r  r1  r  select_coordsr=  r   r=  r  rB  ilocrx  r4   )
r   ri   r   r   r  coordsr5  r:  r6  r  s
             rS   r8  zTable.read_coordinatesc  s     	e$   d%u4H	((*'#,#3#3#:#:#< Sr4''FJJL14D (   499Vfjjl-B#CT J Q QR	S V}rU   c                    | j                          | j                         sy|t        d      | j                  D ]  }||j                  k(  s|j
                  st        d| d      t        | j                  j                  |      }|j                  | j                         |j                  ||| | j                  | j                  | j                        }t!        t#        |d   |j$                        |      c S  t'        d| d      )	zj
        return a single column from the table, generally only indexables
        are interesting
        Fz4read_column does not currently accept a where clausezcolumn [z=] can not be extracted individually; it is not data indexabler  rb   r^   z] not found in the table)r  r1  r   rd  r_   r	  r   r  rq   rk  rp  r  r@  r   rZ   r   r7   r;  r  r   )r   r<  ri   r   r   r   ra  
col_valuess           rS   r=  zTable.read_column}  s    	  RSS  	IA**$"6( +3 3  DJJOOV4

499%YYeDM LL!]];;	 ' 
 gjmQTT:HH#	I& &)ABCCrU   )Nrz   NNNNNN)r   r   r   rJ   r   r]   r  r  r  )ra  r]   r  r  )r  r  r  z tuple[DataFrame, list[Hashable]]r  )r  ztuple[int, ...])r  dict[str, Any])r  r  )r   r]   r  r]   )r   r]   rx  ry  r  r  r  rW   r  )r  r  r  r  r  )r   r  r   r  r  z!list[tuple[ArrayLike, ArrayLike]]rK  r   )TNNN)r  r2   r  r   )r  r2   r  r   )r  r  r  r2   )r   r  r   r   re  r  r  rJ  r(  )r<  r]   r   r  r   r  )4r   r  r  r  r  r  r  rf  rL  r   r  r  r   r   r  r  r  r  r  r  rq   r8  rI  rd  r  r  r  r  r  r  r  r\  rt  r  r  r  r  r$   r  r  r  r  r  r  r"  staticmethodr  r?  rC  r8  r=  r  r  s   @rS   r  r    s&   . KKO#$F $H))N
J  
  
* - -
$ D - -!%!	)!" F F % % 2 2       & & B B < <   
 
" <
3*

$$
Q	, I IX ?CT1;T	Tn CG & 5? 	* D  $=T h h 	hT <!<!<! <!|8t  	
 ! 
@ HL!+:D:  )D)D 	)D
 )DrU   r  c                  4    e Zd ZdZdZ	 	 	 	 d	 	 	 ddZddZy)	r  z
    a write-once read-many table: this format DOES NOT ALLOW appending to a
    table. writing is a one-time operation the data are stored in a format
    that allows for searching the data on disk
    r  Nc                    t        d      )z[
        read the indices and the indexing array, calculate offset rows and return
        z!WORMTable needs to implement readr"  r#  s        rS   r)  zWORMTable.read  s     ""EFFrU   c                    t        d      )z
        write in a format that we can search later on (but cannot append
        to): write out the indices and the values using _write_array
        (e.g. a CArray) create an indexing table so that we can search
        z"WORMTable needs to implement writer"  r%  s     rS   r  zWORMTable.write  s     ""FGGrU   r'  r(  r  )r   r  r  r  r  r)  r  r   rU   rS   r  r    s>     J  
G 	
G
 
GHrU   r  c                  p    e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 d	 	 	 	 	 d	dZd
ddZ	 	 	 	 	 	 	 	 	 	 ddZdddZy)rz  (support the new appendable table formats
appendableNc                8   |s2| j                   r&| j                  j                  | j                  d       | j	                  ||||||      }|j
                  D ]  }|j                           |j                   sQ|j                  ||||	      }|j                          ||d<    |j                  j                  |j                  fi | |j                  |j                  _
        |j
                  D ]  }|j                  ||        |j                  ||
       y )Nrq   )rd  r  r  r   r   r   )r   r   r   re  rV  )r   )r  r   r  r   r"  rd  rV  rC  r  create_tabler  rE  r_  
write_data)r   r  rd  r   r   r   r   r   r   re  r   r   r   rV  rq   r   optionss                    rS   r  zAppendableTable.write  s     $..LL$$TZZ9 !!%% " 
  	A	  ..#%)	 / G OO%0GM" 'EMM&&u{{>g> !::  	.Auf-	. 	62rU   c                B   | j                   j                  }| j                  }g }|rs| j                  D ]d  }t	        |j
                        j                  d      }t        |t        j                        sC|j                  |j                  dd             f t        |      r%|d   }|dd D ]  }||z  }	 |j                         }nd}| j                  D cg c]  }|j                   }	}t        |	      }
|
dk(  sJ |
       | j                  D cg c]  }|j!                          }}|D cg c]Q  }|j#                  t        j$                  t        j&                  |j(                        |j(                  dz
              S }}g }t+        |      D ]K  \  }}|f| j                   ||
|z         j,                  z   }|j                  ||   j/                  |             M |d}t        j0                  t3        ||      | j                   	      }||z  dz   }t5        |      D ]^  }||z  }t3        |dz   |z  |      }||k\  r y| j7                  ||	D cg c]  }||| 	 c}|||| nd|D cg c]  }||| 	 c}
       ` yc c}w c c}w c c}w c c}w c c}w )z`
        we form the data into a 2-d including indexes,values,mask write chunk-by-chunk
        r   rm  u1Fr  rb   Nr   r  )indexesr  rx  )r8  rg  r  r  r:   r  rh  rN   rO   r7  r   r  rh   r  r  rO  rC  	transposerollr  rq  re  r  reshaper  r  rp  write_data_chunk)r   r   r   rg  r/  masksr   r  mrY  nindexesrx  r  bvaluesrh  	new_shaperowschunksstart_iend_is                       rS   rU  zAppendableTable.write_data	  s    

  ## %% @ AFF|''Q'/dBJJ/LLT!>?@ u:8D12Y  ax ::<DD '+oo619966w<1}&h&} *.)9)9:A!++-::OUV!!++bggbii&7!DEVVf% 	9DAq4::eHqL.A#B#H#HHINN6!9,,Y78	9
 IxxIu-TZZ@)#a'v 	A)mGQ)+U3E%!!3:;a75);,0,<T'%($29:Q'%(:	 " 	' 7 ;V( <:s   JJ1AJJ1Jc                   |D ]#  }t        j                  |j                        r# y |d   j                  d   }|t        |      k7  r!t        j                  || j
                        }| j
                  j                  }t        |      }t        |      D ]  \  }	}
|
|||	   <    t        |      D ]  \  }	}||||	|z      <    |;|j                         j                  t        d       }|j                         s||   }t        |      r6| j                  j                  |       | j                  j                          yy)z
        Parameters
        ----------
        rows : an empty memory space where we are putting the chunk
        indexes : an array of the indexes
        mask : an array of the masks
        values : an array of the values
        Nr   r  Fr  )rO   rp  r  rh   r  r8  rg  re  r  r  r   rh  rq   r   r  )r   rc  rY  r  rx  r  r/  rg  r`  rh  ri  r_  s               rS   r]  z AppendableTable.write_data_chunkD  s.      	A77177#	 
  #CI88E4D

  w<  ( 	!FAs DqN	! f% 	*DAq()Dq8|$%	* $$T$66A557Awt9JJd#JJ rU   c                   |t        |      s|7|5| j                  }| j                  j                  | j                  d       |S || j                  }| j
                  j                  ||      }| j
                  j                          |S | j                         sy | j
                  }t        | |||      }|j                         }t        |      j                         }t        |      }	|	r|j                         }
t        |
|
dkD     j                        }t        |      sdg}|d   |	k7  r|j!                  |	       |d   dk7  r|j#                  dd       |j%                         }t'        |      D ]U  }|j)                  t+        ||            }|j                  ||j                  d      ||j                  d      dz          |}W | j
                  j                          |	S )NTrZ  rT  rb   r   r  )rh   r/  r   r  r   rq   remove_rowsr  r1  r  rE  r7   sort_valuesdiffre   r   r   r<  r|  reversedrw  rp  )r   ri   r   r   r/  rq   r  rx  sorted_serieslnrk  r   pgr  rc  s                  rS   ra  zAppendableTable.deletep  s    =E
}

((t(D L	 <::D

..U.F

  "L   

dETB	((* v224 !%%'D$tax.../F v; bzRb! ayA~a# Bf% $))%2,7!!tzz!}-DB4H14L "   JJ 	rU   )NFNNNNNNFNNT)r   r   r   r   r  r  r  )r   r  r   r   r  r  )
rc  ry  rY  list[np.ndarray]r  znpt.NDArray[np.bool_] | Nonerx  rp  r  r  r  r(  )	r   r  r  r  r  r  rU  r]  ra  r   rU   rS   rz  rz    s    2J :3 	:3 :3 
:3x9v** "* +	*
 !* 
*X:rU   rz  c                  h    e Zd ZU dZdZdZdZeZde	d<   e
dd       Zedd       Z	 	 	 	 d	 	 	 dd
Zy	)r  rQ  r  r  r  r  r  c                :    | j                   d   j                  dk(  S )Nr   rb   )r  rC  r   s    rS   r  z"AppendableFrameTable.is_transposed  s    q!&&!++rU   c                "    |r|j                   }|S )zthese are written transposed)rN  r  s      rS   r  zAppendableFrameTable.get_object  s     %%C
rU   Nc           	        | j                  |       | j                         sy | j                  |||      }t        | j                        r,| j
                  j                  | j                  d   d   i       ni }t        | j                        D cg c]  \  }}|| j                  d   u s| }	}}t        |	      dk(  sJ |	d   }
||
   d   }g }t        | j                        D ]  \  }}|| j                  vr||   \  }}|j                  d      dk7  rt        |      }nt        j                  |      }|j                  d      }||j                  |d       | j                  r|}|}t        |t!        |d	d       
      }n&|j"                  }t        |t!        |d	d       
      }|}|j$                  dk(  r:t'        |t(        j*                        r |j-                  d|j.                  d   f      }t'        |t(        j*                        rt1        |j"                  ||      }n8t'        |t              rt1        |||      }nt1        j2                  |g||      }|j4                  |j6                  k(  j9                         sJ |j4                  |j6                  f       |j;                  |        t        |      dk(  r|d   }nt=        |d      }t?        | |||      }| jA                  |||      }|S c c}}w )Nr6  r   rb   r   r5   rg  Tinplacer_   r^   r  rm  )r  r   )!r  r1  r  rh   rN  r  r   re  rd  r  r  r4   r5   from_tuples	set_namesr  r  rN  rq  rN   rO   r7  r\  r  r2   _from_arraysdtypesr8  rh  r   r9   r  r?  )r   ri   r   r   r   r>  r  rh  r  indsindr   framesr   
index_valsrO  rk  rg  rx  index_cols_r  r  s                          rS   r)  zAppendableFrameTable.read  s    	e$  uEE 4&&' IIMM$--a03R8 	  )3PearT__Q=O7OPP4yA~~1gsAdii( %	DAq((("()J xx</Z(!--j9HHW%E ud3!! e'%*FG u75&$+GH {{aJvrzz$BFLLO(<=&"**-vxxfEFE*vuFC ++VHe6RII-224Oryy&,,6OO4MM"K%	N v;!BQ'Bd%u4H	rYH	o Qs   L,Lr  rK  r'  r(  )r   r  r  r  r  r  rq  r2   r  r  r  r  r  r  r)  r   rU   rS   r  r    so    2K#JD)2H&2, ,    N 	N
 NrU   r  c                  x     e Zd ZdZdZdZdZeZe	d	d       Z
ed
d       Zd fd	Z	 	 	 	 d	 	 	 	 	 d fdZ xZS )r  rQ  r  r  r  c                     yr~  r   r   s    rS   r  z#AppendableSeriesTable.is_transposed  r  rU   c                    |S rW   r   r  s      rS   r  z AppendableSeriesTable.get_object  s    
rU   c                    t        |t              s!|j                  xs d}|j                  |      }t	        |   d||j                  j                         d|S )+we are going to write this as a frame tablerx  r  r   r   )rN   r2   r_   to_framer  r  r   r'  )r   r  r   r   r_   r  s        rS   r  zAppendableSeriesTable.write!  sO    #y)88'xD,,t$Cw}R3;;3E3E3GR6RRrU   c                f   | j                   }|F|rDt        | j                  t              sJ | j                  D ]  }||vs|j	                  d|        t
        |   ||||      }|r|j                  | j                  d       |j                  d d df   }|j                  dk(  rd |_	        |S )Nr   rB  Tru  rx  )
r  rN   rf  re   r<  r  r)  	set_indexrF  r_   )	r   ri   r   r   r   r  r  rR   r  s	           rS   r)  zAppendableSeriesTable.read(  s     ,,>dkk4000[[ )G#NN1a() GLugULNKKTK2FF1a4L 66XAFrU   r  rK  rW   r'  r  )r   r  r  r  r  r  rq  r7   r  r  r  r  r  r  r)  r  r  s   @rS   r  r    s|    2 K$JDH   S   	
  
 rU   r  c                  *     e Zd ZdZdZdZ fdZ xZS )r  rQ  r  r  c                   |j                   xs d}| j                  |      \  }| _        t        | j                  t              sJ t	        | j                        }|j                  |       t        |      |_        t        | $  dd|i|S )r  rx  r  r   )
r_   r  rf  rN   re   r   r4   r   r  r  )r   r  r   r_   newobjrk  r  s         rS   r  z AppendableMultiSeriesTable.writeH  sx    xx#8"66s;$++t,,,DKK Dtw}22622rU   )r   r  r  r  r  r  r  r  r  s   @rS   r  r  B  s    2 K)J3 3rU   r  c                  l    e Zd ZU dZdZdZdZeZde	d<   e
dd       Ze
d        Zdd	Zed
        Zd Zy)r  z:a table that read/writes the generic pytables table formatr  r  r  zlist[Hashable]rf  c                    | j                   S rW   )r  r   s    rS   r  zGenericTable.pandas_type\  s    rU   c                L    t        | j                  dd       xs | j                  S r  r  r   s    rS   r  zGenericTable.storable`  s    tzz7D1?TZZ?rU   c                N   g | _         d| _        g | _        | j                  D cg c]  }|j                  s| c}| _        | j                  D cg c]  }|j                  r| c}| _        | j                  D cg c]  }|j                   c}| _        yc c}w c c}w c c}w )rH  N)	rN  r   rf  r  r  r  r  r_   r   r  s     rS   r  zGenericTable.get_attrsd  s~     &*ooK9J9J1K'+P!a>O>OAP-1-=-=>QVV> LP>s   BBB"B<B"c           
        | j                   }| j                  d      }|dnd}t        dd| j                  ||      }|g}t	        |j
                        D ]h  \  }}t        |t              sJ t        ||      }| j                  |      }|dnd}t        |||g|| j                  ||      }	|j                  |	       j |S )z0create the indexables from the table descriptionr   Nrs  r   )r_   rC  rq   r   r  )r_   r  rx  r  rq   r   r  )rI  rt  r|  rq   re  _v_namesrN   r]   r  r  r   )
r   r~  r  r   r  r  rh  r  r  r  s
             rS   r  zGenericTable.indexablesn  s     
 (^z#q


	 IR{ajj) 	#DAqa%%%1a=D##A&B!#:TD(sjjB r"	#" rU   c                    t        d      )Nz cannot write on an generic tabler"  r%  s     rS   r  zGenericTable.write  s    !"DEErU   Nr  r  )r   r  r  r  r  r  rq  r2   r  r  r  r  r  r  r$   r  r  r   rU   rS   r  r  S  sg    DK JDH    @ @?    DFrU   r  c                       e Zd ZdZdZeZdZ ej                  d      Z
edd       Zd	 fd	Z	 	 	 	 d
	 	 	 d fdZ xZS )r  za frame with a multi-indexr  r  z^level_\d+$c                     y)Nappendable_multir   r   s    rS   r  z*AppendableMultiFrameTable.table_type_short  s    !rU   c                (   |g }n|du r|j                   j                         }| j                  |      \  }| _        t	        | j                  t
              sJ | j                  D ]  }||vs|j                  d|        t        |    d||d|S )NTr   r  r   )	r   r'  r  rf  rN   re   r<  r  r  )r   r  r   r   r  r  s        rS   r  zAppendableMultiFrameTable.write  s    LT!;;--/L33C8T[$++t,,, 	*A$##Aq)	* w}J<J6JJrU   c                ,   t         |   ||||      }|j                  | j                        }|j                  j                  |j                  j                  D cg c]!  }| j                  j                  |      rd n|# c}      |_        |S c c}w )NrB  )	r  r)  r  rf  r   rx  rg  
_re_levelssearch)r   ri   r   r   r   r  r_   r  s          rS   r)  zAppendableMultiFrameTable.read  s~     W\we$\O\\$++& 88%%HJWT__++D1Tt;W
 	 Xs   &Br  rW   r'  r(  )r   r  r  r  r  r2   r  rq  recompiler  r  r  r  r)  r  r  s   @rS   r  r    si    $(JHDN+J" "
K   	
  rU   r  c                   | j                  |      }t        |      }|t        |      }||j                  |      r|j                  |      r| S t        |j                               }|*t        |j                               j	                  |d      }|j                  |      s7t        d d       g| j                  z  }|||<   | j                  t        |         } | S )NF)sort)	r3  rB   equalsuniquerz  slicerq  r{  rf   )r  rC  r>  r(  r  slicers         rS   r  r    s    	t	B&!F U#u-6==3D
&--/*Felln-::6:N==',T4'8&9CHH&DtggeFm$JrU   c                0    t        j                  |       }|S )z+for a tz-aware type, return an encoded zone)r   get_timezone)r  zones     rS   r^  r^    s    !!"%DKrU   c                     y rW   r   rx  r  r  s      rS   r;  r;    s     rU   c                     y rW   r   r  s      rS   r;  r;    s    rU   c                   t        | t              r| j                  | j                  |k(  sJ |ut        | t              r| j                  }| j                  } nd}| j                         } t        |      }t        | |      } | j                  d      j                  |      } | S |rt        j                  | d      } | S )a  
    coerce the values to a DatetimeIndex if tz is set
    preserve the input shape if possible

    Parameters
    ----------
    values : ndarray or Index
    tz : str or tzinfo
    coerce : if we do not have a passed timezone, coerce to M8[ns] ndarray
    Nr^   r9  M8[ns]r  )rN   r3   r  r_   r  r  rT   r;  r<  rO   r  )rx  r  r  r_   s       rS   r;  r;    s     &-( yy FIIO33	~fm,;;D[[FD\\^FR vD1##E*55b9 M 
F(3 MrU   c                Z   t        | t              sJ |j                  }t        |      \  }}t	        |      }t
        j                  |      }t        |t              s*t        |j                        st        |j                        r(t        | |||t        |dd       t        |dd       |      S t        |t              rt        d      t        j                   |d      }	t#        j$                  |      }
|	dk(  rgt#        j$                  |
D cg c]  }|j'                          c}t"        j(                        }t        | |dt+               j-                         |	      S |	d
k(  rJt/        |
||      }|j                  j0                  }t        | |d
t+               j3                  |      |	      S |	dv rt        | ||||      S t        |t"        j4                        r|j                  t6        k(  sJ |dk(  sJ |       t+               j9                         }t        | ||||	      S c c}w )Nr
  r  )rx  r  r  r
  r  r  zMultiIndex not supported here!Frx  r   r  )r  rR  )integerfloating)rx  r  r  r  r  )rN   r]   r_   r  r  r  r  r;   r0   r8  r'   r  r  r5   r   r   r~  rO   r  	toordinalint32r   	Time32Col_convert_string_arrayr  rS  r7  r  r  )r_   r   rZ   r   r  r  r  r  r  r  rx  r  r  s                rS   r\  r\    s   dC   J 5U;Iz*%D%%i0D 	5*%u{{+%
 -udD)!
 	
 %$899OOE%8M ZZFJJv>!>bhhO	)VWY%8%8%:z
 	
 
(	")&(FC	??++I)!
 	
 
1	14J
 	
 )RZZ0Y__5NNNx%%y##%it
KK1  ?s   H(c           	     :   |dk(  rt        |       }|S |dk(  rt        |       }|S |dk(  r?	 t        j                  | D cg c]  }t	        j
                  |       c}t              }|S |dv rt        j                  |       }|S |dv rt        | d ||      }|S |dk(  rt        j                  | d	         }|S t        d
|       c c}w # t        $ rF t        j                  | D cg c]  }t	        j                  |       nc c}w c}t              }Y |S w xY w)Nr  r  r   r  )r  floatr   rR  r  r  r   zunrecognized index type )
r3   r8   rO   r  r   r  r  r   r  r  )r  r  rZ   r   r   r  s         rS   rq  rq  Q  s7    |d#$ L# 
	t$  L 
	TJJTB 0 0 3B&QE L 
-	-

4  L 
(	'$&
 L	 
	

47# L 3D6:;;  C 	TJJtD! 2 21 5DDFSE L	Ts.   C CC C D'D
DDc                   |j                   t        k7  r|S t        t        j                  |      }|j                   j
                  }t        j                  |d      }	|	dk(  rt        d      |	dk(  rt        d      |	dk(  s|dk(  s|S t        |      }
|j                         }|||
<   t        j                  |d      }	|	dk7  rht        |j                  d	         D ]M  }||   }t        j                  |d      }	|	dk7  s%t        |      |kD  r||   nd
| }t        d| d|	 d       t        |||      j                  |j                        }|j                   }t#        |t$              r1t'        |j)                  |       xs |j)                  d      xs d	      }t+        |xs d	|      }||j-                  |      }|||kD  r|}|j/                  d| d      }|S )NFrx  r   z+[date] is not implemented as a table columnr+  z>too many timezones in this block, create separate data columnsrR  r  r   zNo.zCannot serialize the column [z2]
because its data contents are not [string] but [z] object dtyperx  z|Sr  )r8  r  r   rO   r7  r_   r   r~  r   r:   r  rp  r  rh   r  r\  r  rN   rn  r   r   rB  rY  r  )r_   ra  r
  r   r   rZ   r   r   r  r  r  r  rh  rL  error_column_labelr  r  ecis                     rS   r  r  j  s    }}2::w'G##JOOGE:MEFF	*	$ L
 	
 x':+A=D<<>DDJ OOD7M  tzz!}% 		Aq'COOC>M(36w<!3CWQZ3qc"34F3G H%n6 		 +46BJJ4::VN&&H ,%<++D1T\5E5Eh5OTSTU<$1h/H ''1?sX~H#**Rz?*GNrU   c                l   t        |       rVt        | j                               j                  j	                  ||      j
                  j                  | j                        } t        | j                               }t        dt        j                  |            }t        j                  | d|       } | S )a  
    Take a string-like that is object dtype and coerce to a fixed size string type.

    Parameters
    ----------
    data : np.ndarray[object]
    encoding : str
    errors : str
        Handler for encoding errors.

    Returns
    -------
    np.ndarray[fixed-length-string]
    rb   Sr  )rh   r7   r  r]   encoder  r\  r  r&   rB  
libwritersmax_len_string_arrayrO   r  )r  rZ   r   ensuredr  s        rS   r  r    s      4y4::< S&)WWWTZZ( 	 DJJL)G1j55g>?H::dAhZ.1DKrU   c                   | j                   }t        j                  | j                         t              } t        |       rt        j                  t        |             }d| }t        | d   t              r1t        |       j                  j                  ||      j                  } n(| j                  |d      j                  t        d      } |d}t        j                   | |       | j#                  |      S )a*  
    Inverse of _convert_string_array.

    Parameters
    ----------
    data : np.ndarray[fixed-length-string]
    nan_rep : the storage repr of NaN
    encoding : str
    errors : str
        Handler for encoding errors.

    Returns
    -------
    np.ndarray[object]
        Decoded data.
    r  Ur   )r   Fr  r  )r  rO   r  r  r  rh   r  r  r&   rN   rA  r7   r]   rQ   r  r  !string_array_replace_from_nan_repr\  )r  r   rZ   r   r  r  r8  s          rS   r  r    s    & JJE::djjl&1D
4y22=3FGH:d1gu%$<##**8F*CKKD;;u5;188e8LD00w?<<rU   c                    t        |t              sJ t        |             t        |      rt	        |||      } ||       } | S rW   )rN   r]   r   _need_convert_get_converter)rx  r<  rZ   r   convs        rS   r:  r:    s?    h$4d8n4$Xh&9fMrU   c                H    | dk(  rd S | dk(  rfdS t        d|        )Nr  c                0    t        j                  | d      S )Nr  r  )rO   r  )rQ  s    rS   r   z _get_converter.<locals>.<lambda>  s    AX6 rU   rR  c                "    t        | d       S )Nr  )r  )rQ  rZ   r   s    rS   r   z _get_converter.<locals>.<lambda>  s    0thv
 rU   zinvalid kind )r   )r  rZ   r   s    ``rS   r  r    s7    |66		
 	
 =/00rU   c                    | dv ryy)N)r  rR  TFr   r  s    rS   r  r    s    ''rU   c                    t        |t              st        |      dk  rt        d      |d   dk(  r@|d   dk  r8|d   dk(  r0t	        j
                  d|       }|r|j                         d   }d| } | S )	z
    Prior to 0.10.1, we named values blocks like: values_block_0 an the
    name values_0, adjust the given name if necessary.

    Parameters
    ----------
    name : str
    version : Tuple[int, int, int]

    Returns
    -------
    str
       z6Version is incorrect, expected sequence of 3 integers.r   rb   r  r  zvalues_block_(\d+)values_)rN   r]   rh   r   r  r  r   )r_   r  r_  grps       rS   r  r    sx     '33w<!#3QRRqzQ71:+
aII+T2((*Q-CSE?DKrU   c                   t        |       } | j                  d      s| j                  d      rd}|S | j                  d      rd}|S | j                  d      rd}|S | j                  d      s| j                  d      rd}|S | j                  d      rd}|S | j                  d	      rd
}|S | j                  d      rd}|S | j                  d      rd}|S | j                  d      rd}|S | dk(  rd}|S t        d|  d      )zA
    Find the "kind" string describing the given dtype name.
    rR  rA  r  r  r   r  r  r  	timedeltar  r   rs  r  r  zcannot interpret dtype of [r@  )rT   r  r   )	dtype_strr  s     rS   r  r  -  sO     	*IH%)=)=g)F. K- 
		g	&* K) 
		i	(& K% 
		e	$	(<(<V(D" K! 
		l	+ K 
		k	* K 
		f	% K 
		j	) K 
		h	' K 
h	 K 6ykCDDrU   c                n   t        | t              r| j                  } | j                  j                  j                  d      d   }| j                  j                  dv r%t        j                  | j                  d            } nt        | t              r| j                  } t        j                  |       } | |fS )zJ
    Convert the passed data into a storable form and a dtype string.
    r   r   )r_  Mr3  )rN   r<   r  r8  r_   r  r  rO   r  r  r6   r  )r  r  s     rS   r  r  N  s     $$zz &&s+A.Jzz*$zz$))D/* 
D+	&yy::dDrU   c                  @    e Zd ZdZ	 	 	 d	 	 	 	 	 	 	 ddZd Zd Zd Zy)	r  z
    Carries out a selection operation on a tables.Table object.

    Parameters
    ----------
    table : a Table object
    where : list of Terms (or convertible to)
    start, stop: indices to start and/or stop selection

    Nc                   || _         || _        || _        || _        d | _        d | _        d | _        d | _        t        |      rQt        t              5  t        j                  |d      }|dk(  s|dk(  rt        j                  |      }|j                  t        j                   k(  rS| j                  | j                  }}|d}|| j                   j"                  }t        j$                  ||      |   | _        nt'        |j                  j(                  t        j*                        rd| j                  || j                  k  j-                         s)| j                  (|| j                  k\  j-                         rt        d      || _        d d d        | j                  K| j/                  |      | _        | j                  (| j                  j1                         \  | _        | _        y y y # 1 sw Y   axY w)NFrx  r  booleanr   z3where must have index locations >= start and < stop)rq   ri   r   r   	conditionr=  termsrH  r-   r   r   r   r~  rO   r  r8  bool_r/  r  
issubclassr   r  r  generateevaluate)r   rq   ri   r   r   inferreds         rS   r   zSelection.__init__p  s    


	
 *% 1??5?y(H	,AJJu-E{{bhh.&*jj$))t =$%E<#'::#3#3D+-99UD+A%+H(#EKK$4$4bjjA JJ2

8J7O7O7Q II1u		7I6N6N6P", U#  ,1(%1( #u-DJ zz%.2jj.A.A.C+ & $)1 1s   D:G..G7c                   |y| j                   j                         }	 t        ||| j                   j                        S # t        $ rB}dj                  |j                               }t        d| d| d      }t        |      |d}~ww xY w)z'where can be a : dict,list,tuple,stringN)r  rZ   r  z-                The passed where expression: a*  
                            contains an invalid variable reference
                            all of the variable references must be a reference to
                            an axis (e.g. 'index' or 'columns'), or a data_column
                            The currently defined references are: z
                )	rq   r  r?   rZ   	NameErrorr  r  r   r   )r   ri   r  rb  qkeysr  s         rS   r  zSelection.generate  s    =JJ!!#	+!djj>Q>QRR 	+ HHQVVX&E..3W 5C DI' JC S/s*	+s   !A 	B
=BBc                   | j                   T| j                  j                  j                  | j                   j                         | j                  | j
                        S | j                  /| j                  j                  j                  | j                        S | j                  j                  j                  | j                  | j
                        S )(
        generate the selection
        rT  )	r  rq   
read_wherer   r   r   rH  r8  r)  r   s    rS   r   zSelection.select  s     >>%::##..%%'tzz		 /   )::##44T5E5EFFzz$$4::DII$FFrU   c                   | j                   | j                  }}| j                  j                  }|d}n
|dk  r||z  }||}n
|dk  r||z  }| j                  A| j                  j                  j                  | j                  j                         ||d      S | j                  | j                  S t        j                  ||      S )r  r   T)r   r   r  )
r   r   rq   r/  r  get_where_listr   rH  rO   r  )r   r   r   r/  s       rS   rE  zSelection.select_coords  s     jj$))t

  =EQYUNE<DAXEMD>>%::##22%%'u4d 3   )###yy%%rU   r  )rq   r  r   r  r   r  r  r  )r   r  r  r  r   r  r   rE  r   rU   rS   r  r  d  sS    	  -D-D 	-D
 -D 
-D^+.
G&rU   r  )rd   r   )r   NNFNTNNNNrz   rL   )r   FilePath | HDFStorer   r]   r   r  r   r]   r   r  r   r  r   r   r   r  r   r   r   r  r   r  r   r  r   r]   rZ   r]   r  r  )	Nr   rz   NNNNFN)r   r  r   r]   r   r]   ri   zstr | list | Noner   r  r   r  r   zlist[str] | Noner   r   r   r  )r   rJ   r   rJ   r  r   rW   )r  r2   rC  r   r>  r4   r  r2   )r  r   r  str | tzinfor  )rx  np.ndarray | Indexr  r  r  r   r  r3   )rx  r  r  r  r  r   r  ry  )rx  r  r  zstr | tzinfo | Noner  r   r  znp.ndarray | DatetimeIndex)
r_   r]   r   r4   rZ   r]   r   r]   r  r  )r  r]   rZ   r]   r   r]   r  r  )r_   r]   ra  r   r   r  )r  ry  rZ   r]   r   r]   r  ry  )rx  ry  r<  r]   rZ   r]   r   r]   )r  r]   rZ   r]   r   r]   )r  r]   r  r   )r_   r]   r  zSequence[int]r  r]   )r  r]   r  r]   )r  r   )r  
__future__r   
contextlibr   r  r+  r   r   rI  r   r  textwrapr   typingr   r	   r
   r   r   r   r   r   r   r   r  numpyrO   pandas._configr   r   pandas._libsr   r   r  pandas._libs.tslibsr   pandas._typingr   r   r   r   r   r   pandas.compat._optionalr   pandas.compat.pickle_compatr   pandas.errorsr   r    r!   r"   r#   pandas.util._decoratorsr$   pandas.util._exceptionsr%   pandas.core.dtypes.commonr&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   pandas.core.dtypes.missingr1   r   r2   r3   r4   r5   r6   r7   r8   r9   r:   pandas.core.apir;   pandas.core.arraysr<   r=   r>   pandas.core.commoncorecommonr_   pandas.core.computation.pytablesr?   r@   pandas.core.constructionrA   pandas.core.indexes.apirB   pandas.core.internalsrC   rD   pandas.io.commonrE   pandas.io.formats.printingrF   rG   r|   rH   rI   rJ   rK   r  rX   rT   r[   r`   rg   rl   rm   r  rn   ro   r  rr  rt   ru   config_prefixregister_optionis_boolis_one_of_factoryr{   r   r   r   r   r   r   r2  r  r|  r  r  r  r  r*  r  r  r  r  r  rz  r  r  r  r  r  r  r^  r;  r\  rq  r  r  r  r:  r  r  r  r  r  r  r   rU   rS   <module>r     sY   #    	 	     
 *  ? 4  3 4    8
 
 
 ' 
 !   3 0
 ,
   ,   	 :* U !  
  gGgN 	
E 
E  V(# F>5*WF*&**+CD	 
$) !4  04595$5	5 5 	5
 5 5 5 5 5 .5 5 35 5 5  
!5t 	# $ X$X X 	X
 X X X X X XvR Rj*m m`d> d>N	h BZ9h Z9z$w $6	. 	o? o?d`B5 `BF#, #B]; ];@" 
eDE eDPH H<ce cLa? aH.0 .b3!6 3"?F' ?FD( 4 (V0 
AF$0:> 
 
 

 IN##$7#AE##L>LB2H
HH HV>$
$),$69$$N12B,t& t&]\ s   9AM55M?