
    g                     z   d dl Zd dlZd dlZd dlT d Z ej        d          j        Zdddded	k    rdnd
d
dddZe	                                D ]-\  Z
Z ee
dz   edz              e
dv r ee
dz   edz              .ddddddddddd
d e	                                D             Zd Zd Zd Zd  Zd! Zd" ZdS )#    N)*c                      t                                fd}t           fd|i          }|t                       <   dS )a  
    Dynamically construct deprecated classes as wrappers around renamed ones

    The deprecation warning added in their __new__-method will trigger upon
    construction of an instance of the class, but only once per session.

    We do this here (in __init__.py) because the base classes are defined in
    the SWIG interface, making it cumbersome to add the deprecation there.

    Parameters
    ----------
    deprecated_name : string
        Name of the class to be deprecated; _not_ present in SWIG interface.
    base_name : string
        Name of the class that is replacing deprecated_name; must already be
        imported into the current namespace.

    Returns
    -------
    None
        However, the deprecated class gets added to the faiss namespace
    c                     d d d}t          j        |t          d            t          |           j        | g|R i |}|S )NzThe class faiss.z" is deprecated in favour of faiss.!   )
stacklevel)warningswarnDeprecationWarningsuper__new__)clsargskwargsmsginstance
base_class	base_namedeprecated_names        U/var/www/html/mpstechhub/venv/lib/python3.11/site-packages/faiss/array_conversions.pynew_methz-_make_deprecated_swig_class.<locals>.new_meth/   se    ```T]```c-!<<<<15S))1#GGGGGG    r   N)globalstype)r   r   r   klazzr   s   ``  @r   _make_deprecated_swig_classr      sh    . 9%J       :-)X1FGGE "'GIIor   lFloat32Float64Int8Int32   Int64UInt8UInt64)FloatDoubleCharIntLongLongLongByteUint64Vector)r&   r*   r,   VectorVectorfloat32float64int8int16int32int64uint8uint16uint32uint64)
r   r   r    Int16r!   r#   r$   UInt16UInt32r%   c                 >    i | ]\  }}||                                 S  )lower).0kvs      r   
<dictcomp>rC   d   s&    <<<1q!''))<<<r   c                    | j         j        }|                    d          rt          |           S |                    d          sJ t          j        t          |dd                            }t          j        | 	                                |          }| 	                                dk    r5t          t          |          |                                 |j                   |S )z' convert a C++ vector to a numpy array AlignedTabler.   Ndtyper   )	__class____name__
startswithAlignedTable_to_arrayendswithnprH   vector_name_mapemptysizememcpyswig_ptrdatanbytesrB   	classnamerH   as       r   vector_to_arrayrY   h   s    $IN++ ($Q'''h'''''H_Yss^455E
'''Avvxx!||x{{AFFHHah///Hr   c                      t          |           S )N)rY   )rB   s    r   vector_float_to_arrayr[   u   s    1r   c                    | j         \  }|j        j        }|                    d          sJ t	          j        t          |dd                            }|| j        k    sJ d| j        d|d|d            |                    |           |dk    r7t          |	                                t          |           | j                   dS dS )	z  copy a numpy array to a vector r.   NrF   zcannot copy a z array to a z (should be )r   )shaperI   rJ   rM   rN   rH   rO   resizerR   rT   rS   rU   )rX   rB   nrW   rH   s        r   copy_array_to_vectorra   y   s    	
BA$Ih'''''H_Yss^455EAGGGGYYY	'  HHQKKK1uuqvvxx!ah///// ur   c                     | j         \  }|                                | j        k    sJ |                    |           |dk    r7t          |                                t          |           | j                   d S d S )Nr   )r^   itemsizer_   rR   getrS   rU   )rX   rB   r`   s      r   copy_array_to_AlignedTablere      sm    	
BA::<<1:%%%%HHQKKK1uuquuwwQX..... ur   c                     | j         dk    rt          | j                  }n"| j         dk    rt          | j                  }nJ t	          | |           |S )Nr7   r6   )rH   AlignedTableUint16rQ   AlignedTableUint8re   )rX   rB   s     r   array_to_AlignedTableri      sX    w(qv&&	
G		af%%q!$$$Hr   c                 T   | j         j        }|                    d          sJ |dd                                         }t	          j        |                                 |          }|j        dk    r5t          t          |          | 	                                |j
                   |S )z* convert an AlignedTable to a numpy array rE      NrG   r   )rI   rJ   rK   r?   rN   rP   rQ   rR   rS   rT   rU   rV   s       r   rL   rL      s    $I/////bccN  ""E
'''Avzzx{{AFFHHah///Hr   )numpyrN   arrayr	   faiss.loaderr   rc   sizeof_longdeprecated_name_mapitemsdepr_prefixbase_prefixrO   rY   r[   ra   re   ri   rL   r>   r   r   <module>rt      s            $' $' $'V ek#' "a''GGW   !4 9 9 ; ; B BKh 6h8NOOO ///##K.$@$/.$@	B 	B 	B   =< 3 9 9 ; ;<<<
 
 
  0 0 0 / / /      r   