o
    PDi                     @   sL   d dl Z d dlmZ ddlmZ ddlmZmZ e ZG dd dedZ	dS )	    N)Union   )BaseMetaClass)get_array_type_code_uint32SparseVectorImplc                   @   s   e Zd ZdZdedeeejf deeejf fddZdd Z	d	d
 Z
edd ZedejfddZedefddZedejfddZdS )SparseVectorz4
    Provides information about sparse vectors.
    num_dimensionsindicesvaluesc                 C   sf   t |tjr|jtkrtt|}t |tjstd|}t|t|kr)tdt|||| _dS )au  
        Creates and returns a :ref:`SparseVector object <sparsevectorsobj>`.

        The ``num_dimensions`` parameter is the number of dimensions contained
        in the vector.

        The ``indices`` parameter is the indices (zero-based) of non-zero
        values in the vector.

        The ``values`` parameter is the non-zero values stored in the vector.
        dz.indices and values must be of the same length!N)	
isinstancearraytypecodeARRAY_TYPE_CODE_UINT32len	TypeErrorr   from_values_impl)selfr   r	   r
    r   O/var/www/Datamplify/venv/lib/python3.10/site-packages/oracledb/sparse_vector.py__init__.   s   


zSparseVector.__init__c                 C   s*   | j j}| d| j d| j d| j dS )N(, ))	__class___public_namer   r	   r
   )r   cls_namer   r   r   __repr__L   s   zSparseVector.__repr__c                 C   s&   d| j  dt| j dt| j dS )N[r   ])r   listr	   r
   r   r   r   r   __str__S   s   zSparseVector.__str__c                 C   s   |  | }||_|S )N)__new__r   )clsimplvectorr   r   r   
_from_implY   s   
zSparseVector._from_implreturnc                 C      | j jS )zT
        Returns the indices (zero-based) of non-zero values in the vector.
        )r   r	   r"   r   r   r   r	   _      zSparseVector.indicesc                 C   r*   )zK
        Returns the number of dimensions contained in the vector.
        )r   r   r"   r   r   r   r   f   r+   zSparseVector.num_dimensionsc                 C   r*   )zC
        Returns the non-zero values stored in the vector.
        )r   r
   r"   r   r   r   r
   m   r+   zSparseVector.valuesN)__name__
__module____qualname____doc__intr   r!   r   r   r   r#   classmethodr(   propertyr	   r   r
   r   r   r   r   r   )   s&    

r   )	metaclass)
r   typingr   baser   	base_implr   r   r   r   r   r   r   r   <module>   s   