
    d                         d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  G d d	ej        ee	          Z G d
 dej        ee          Z G d dej        ee	          ZdS )z%Here is defined the IndexArray class.    )bisect_leftbisect_right   )NotLoggedMixin)CArray)EArray)indexesextensionc                       e Zd ZdZdZdS )
CacheArrayz8Container for keeping index caches of 1st and 2nd level.
CACHEARRAYN__name__
__module____qualname____doc__
_c_classid     .lib/python3.11/site-packages/tables/indexes.pyr   r      s        BB JJJr   r   c                       e Zd ZdZdZdS )LastRowArrayzLContainer for keeping sorted and indices values of last row of an
    index.LASTROWARRAYNr   r   r   r   r   r      s           JJJr   r   c                   j     e Zd ZdZdZed             Zed             Z	 	 d fd	Zd Z	d	 Z
d
 Z xZS )
IndexArrayaD  Represent the index (sorted or reverse index) dataset in HDF5 file.

    All NumPy typecodes are supported except for complex datatypes.

    Parameters
    ----------
    parentnode
        The Index class from which this object will hang off.

        .. versionchanged:: 3.0
           Renamed from *parentNode* to *parentnode*.

    name : str
        The name of this node in its parent group.
    atom
        An Atom object representing the shape and type of the atomic objects to
        be saved. Only scalar atoms are supported.
    title
        Sets a TITLE attribute on the array entity.
    filters : Filters
        An instance of the Filters class that provides information about the
        desired I/O filters to be applied during the life of this object.
    byteorder
        The byteroder of the data on-disk.

    
INDEXARRAYc                     | j         d         S )zThe chunksize for this object.r   )
chunkshapeselfs    r   	chunksizezIndexArray.chunksize<   s     q!!r   c                     | j         d         S )zThe slicesize for this object.r   )shaper   s    r   	slicesizezIndexArray.slicesizeA   s     z!}r   N c           
         |                     |          | _        |9|dk    r |j        }d|j        |z  f}d|j        |z  f}	nd|j        f}d|j        f}	nd}d}	t                                          |||||||	|           dS )zCreate an IndexArray instance.Nsortedr   r   )r   	byteorder)_g_join_v_pathname	reductionr#   r    super__init__)r   
parentnodenameatomtitlefiltersr'   r*   r"   r   	__class__s             r   r,   zIndexArray.__init__F   s    
 &--d33x&0	J0I=>!5!BC

J01!56

 EJdE5'!Y 	 	8 	8 	8 	8 	8r   c                 \   |\  }}d}d}| j         d         }| j        j        }| j        }	||df         }
||
k    rd}||
k     rd}|dk    r
|dk    r||fS ||df         }|dk     r||k    r|}|dk     r||k    r|}|dk    r
|dk    r||fS | j        }d}|	                    |          }|dk    r|	                    |          }n8| j        j        |         }|j        |j	        z  }|	
                    |||           |dk     rNt          ||          }|                     |||z  ||dz   z            }t          j        |||          }|||z  z  }|dk     rTt          ||          }||k    r |                     |||z  ||dz   z            }t          j        |||          }|||z  z  }||fS )Nr   r   )r"   	_v_parentrvcacheboundscacher    getslotgetitemboundssizeitemsizesetitemr   _read_sorted_slicer	   _bisect_leftr   _bisect_right)r   nrowitemitem1item2result1result2hirangesr7   beginendr    nchunknslotr:   r;   chunknchunk2s                      r   _search_binzIndexArray._search_binb   s(   uZ]'&tQwE>>G5==Ga<<GqLLW%%T1WoQ;;s{{Q;;||a<<GqLLW%% N	##D))A:: ((//FF ^*40F;0Dfd333Q;; //F++D)f2D,5!,DF FE&3E5)LLGy6))GQ;;"6511G&  //i'6I09Wq[0IK K&4UE9MMGy7**G!!r   c                     d| j          dS )z&A compact representation of this classzIndexArray(path=))r)   r   s    r   __str__zIndexArray.__str__   s    5$"25555r   c                 j    |  d| j         d| j         d| j         d| j         d| j         d| j        S )z'A verbose representation of this class.z

  atom = z
  shape = z
  nrows = z
  chunksize = z
  slicesize = z
  byteorder = )r/   r"   nrowsr    r#   r'   r   s    r   __repr__zIndexArray.__repr__   sx      $ $
)$ $:$ $ :$ $ ~	$ $
 ~$ $ ~$ $ 	$r   )Nr$   NN)r   r   r   r   r   propertyr    r#   r,   rO   rR   rU   __classcell__)r2   s   @r   r   r      s         8 J" " X"   X
 #%)-8 8 8 8 8 888" 8" 8"t6 6 6	$ 	$ 	$ 	$ 	$ 	$ 	$r   r   N)r   bisectr   r   noder   carrayr   earrayr   r$   r	   r   r   r   r   r   r   <module>r\      s   + + , , , , , , , ,                                  !,nf            #0.&      L$ L$ L$ L$ L$!,nf L$ L$ L$ L$ L$r   