
    mBNj              	         U d Z ddlmZ ddlZddlZddlZ	ddl
ZddlZddlmZ ddlmZ ej(                  r	ddlZddlZnddlmZmZ 	 	 ddlmZ g d	Z! e"       Z# G d
 d      Z$ G d de%e      Z&e&ejN                  d   z  Z( G d de%e      Z)e)ejN                  d   z  Z*ejN                  e)jV                  e)jX                  e)jZ                  e)j\                  ddddf   Z/ejN                  e)j`                  e)jb                  ddf   Z2d8dZ3d8dZ4d8dZ5eeZ6nee4Z6ne5Z6d9dZ7i Z8de9d<    G d dejt                        Z; G d  d!e;ejt                        Z< G d" d#e<      Z= G d$ d%e<      Z> G d& d'e;ejt                        Z?d(Z@d)ZA G d* d+e?      ZBd,ZCd-ZD G d. d/e?      ZEd0ZFd1ZG G d2 d3e?      ZHd4ZId5ZJ G d6 d7e?      ZKy# e $ r dZY xw xY w):z*Vector type to be exchanged with the DBMS.    )annotationsN)Enum   )_typing)nppa)swap_endian)VectorVectorDTypeVectorEndianc                     e Zd ZU dZdZded<   ej                  	 	 	 	 	 	 d"d       Zej                  	 	 	 	 	 	 d#d       Zej                  dd	 	 	 	 	 	 	 d$d	       Zej                  d%d
       Zej                  d&d       Zd'dZe	e
j                  	 	 	 	 	 	 	 	 d(d              Zddd)dZdd	 	 	 	 	 d*dZed+d       Zd,dZd-dZd-dZedd	 	 	 	 	 	 	 d.d       Zdd	 	 	 	 	 	 	 d/dZeej                  	 	 	 	 	 	 d0d              Zeej                  	 	 	 	 	 	 d1d              Ze	 	 	 	 	 	 d2d       Z	 	 	 	 	 	 d3dZd4dZed5d       Zd6dZd%dZed7d       Zd8dZd&d Zy!)9r
   a  
    A class representing a Neo4j vector.

    The constructor accepts various types of data to create a vector.
    Depending on ``data``'s type, further arguments may be required/allowed.
    Examples of valid invocations are::

        Vector([1, 2, 3], "i8")
        Vector(b"\x00\x01\x00\x02", VectorDType.I16)
        Vector(b"\x01\x00\x02\x00", "i16", byteorder="little")
        Vector(numpy.array([1, 2, 3]))
        Vector(pyarrow.array([1, 2, 3]))

    Internally, a vector is stored as a contiguous block of memory
    (:class:`bytes`), containing homogeneous values encoded in big-endian
    order. Support for this feature requires a DBMS supporting Bolt version
    6.0 or later.

    :param data:
        The data from which the vector will be constructed.
        The constructor accepts the following types:

        * ``Iterable[float]``, ``Iterable[int]`` (but not ``bytes`` or
          ``bytearray``):
          Use an iterable of floats or an iterable of ints to construct the
          vector from native Python values.
          The ``dtype`` parameter is required.
          See also: :meth:`.from_native`.
        * ``bytes``, ``bytearray``: Use raw bytes to construct the vector.
          The ``dtype`` parameter is required and ``byteorder`` is optional.
        * ``numpy.ndarray``: Use a numpy array to construct the vector.
          No further parameters are accepted.
          See also: :meth:`.from_numpy`.
        * ``pyarrow.Array``: Use a pyarrow array to construct the vector.
          No further parameters are accepted.
          See also: :meth:`.from_pyarrow`.
    :param dtype: The type of the vector.
        See :class:`.VectorDType` for currently supported inner data types.
        See also :attr:`.dtype`.

        This parameter is required if ``data`` is of type :class:`bytes`,
        :class:`bytearray`, ``Iterable[float]``, or ``Iterable[int]``.
        Otherwise, it must be omitted.
    :param byteorder: The endianness of the input data (default: ``"big"``).
        If ``"little"`` is given, ``neo4j-rust-ext`` or ``numpy`` is used to
        speed up the internal byte flipping (if either package is installed).
        Use :data:`sys.byteorder` if you want to use the system's native
        endianness.

        This parameter is optional if ``data`` is of type ``bytes`` or
        ``bytearray``. Otherwise, it must be omitted.

    :raises ValueError:
        Depending on the type of ``data``:
            * ``Iterable[float]``, ``Iterable[int]`` (excluding byte types):
                * If the dtype is not supported.
            * ``bytes``, ``bytearray``:
                * If the dtype is not supported or data's size is not a
                  multiple of dtype's size.
                * If byteorder is not one of ``"big"`` or ``"little"``.
            * ``numpy.ndarray``:
                * If the dtype is not supported.
                * If the array is not one-dimensional.
            * ``pyarrow.Array``:
                * If the array's type is not supported.
                * If the array contains null values.
    :raises TypeError:
        Depending on the type of ``data``:
            * ``Iterable[float]``, ``Iterable[int]`` (excluding byte types):
                * If data's elements don't match the expected type depending on
                  dtype.
    :raises OverflowError:
        Depending on the type of ``data``:
            * ``Iterable[float]``, ``Iterable[int]`` (excluding byte types):
                * If the value is out of range for the given type.

    .. versionadded: 6.0
    )__weakref___inner_InnerVectorr   c                    y N selfdatadtypes      ]/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/neo4j/vector.py__init__zVector.__init__            c                    y r   r   r   s      r   r   zVector.__init__   r   r   big	byteorderc                   y r   r   r   r   r   r   s       r   r   zVector.__init__   s     r   c                    y r   r   r   r   s     r   r   zVector.__init__   s    69r   c                    y r   r   r#   s     r   r   zVector.__init__   s    47r   c                   t        |t        t        f      rG| j                  | j                  |||      5   | j                  t        |      g|i | d d d        y t
        Xt        |t
        j                        r>| j                  | j                  |||      5   | j                  |g|i | d d d        y t        Xt        |t        j                        r>| j                  | j                  |||      5   | j                  |g|i | d d d        y | j                  | j                  |||      5   | j                  |g|i | d d d        y # 1 sw Y   y xY w# 1 sw Y   y xY w# 1 sw Y   y xY w# 1 sw Y   y xY wr   )
isinstancebytes	bytearray_checked_init_overload
_set_bytes_npndarray
_set_numpy_paArray_set_pyarrow_set_native)r   r   argskwargss       r   r   zVector.__init__   so   dUI./,,tV  d=d=f=  _D#++!>,,tV  6t6v6  _D#))!<,,!!4v "!!$888 
 ,,  $f !  777  
 
 
 s/    EE$:E08E<E!$E-0E9<Fc              #  d  K   	 d  y # t         $ r t        j                  |       }	  |j                  |g|i |  # t         $ ra}t	        |      j
                  }|dk(  rt	        |      j                  }n| dt	        |      j                   }t        d| d|       d d }~ww xY ww xY ww)Nbuiltins.z>Invalid arguments for Vector initialization with data of type z: )	TypeError_inspect	signaturebindtype
__module____qualname__)setterr   r2   r3   r9   
bind_errortype_name_module	type_names           r   r)   zVector._checked_init_overload   s     	 	 **62I	t5d5f5   	#':#8#8 #z1 $T
 7 7I#3"4Ad4j6M6M5N OI$$-;b> 			s:   B0	 B0B-?B-	B)AB$$B))B--B0c                  |xdk(  r | j                   j                  S dk(  r| j                   j                  S 	 t        d|d      )a  
        Get the raw bytes of the vector.

        The data is a continuous block of memory, containing an array of the
        vector's data type. The data is stored in big-endian order. Pass
        another byte-order to this method to get the converted data.

        :param byteorder: The endianness the data should be returned in.
            If the data's byte-order needs flipping, this method tries to use
            ``neo4j-rust-ext`` or ``numpy``, if installed, to speed up the
            process. Use :data:`sys.byteorder` if you want to use the system's
            native endianness.

        :returns: The raw bytes of the vector.

        :raises ValueError:
            If byteorder is not one of ``"big"`` or ``"little"``.
        r   littleInvalid byteorder: . Must be 'big' or 'little'.r   r   data_le
ValueError)r   r   s     r   rawz
Vector.raw   sN    & {{'''{{*** )) 71 1 r   c                  |xdk(  r || j                   _        ydk(  r|| j                   _        y	 t        d|d      )a  
        Set the raw bytes of the vector.

        :param data: The new raw bytes of the vector.
        :param byteorder: The endianness of ``data``.
            The data will always be stored in big-endian order. If passed-in
            byte-order needs flipping, this method tries to use
            ``neo4j-rust-ext`` or ``numpy``, if installed, to speed up the
            process. Use :data:`sys.byteorder` if you want to use the system's
            native endianness.

        :raises ValueError:
          * If data's size is not a multiple of dtype's size.
          * If byteorder is not one of ``"big"`` or ``"little"``.
        :raises TypeError: If the data is not of type bytes.
        r   rC   rD   rE   NrF   )r   r   r   s      r   set_rawzVector.set_raw  sF    . #' &*# )) 71 1 r   c                .    | j                   j                  S )zX
        Get the type of the vector.

        :returns: The type of the vector.
        )r   r   r   s    r   r   zVector.dtype#  s     {{   r   c                ,    t        | j                        S )zt
        Get the number of elements in the vector.

        :returns: The number of elements in the vector.
        )lenr   rM   s    r   __len__zVector.__len__,  s     4;;r   c                ,    t        | j                        S r   )strr   rM   s    r   __str__zVector.__str__4  s    4;;r   c                    | j                   j                   d| j                         d| j                  j                  dS )N(, ))	__class____name__rI   r   valuerM   s    r   __repr__zVector.__repr__7  s9    ~~&&'qb9I9I8LAN	
r   c              P    | j                  |       }|j                  |||       |S )a  
        Create a Vector instance from raw bytes.

        :param data: The raw bytes to create the vector from.
        :param dtype: The type of the vector.
            See also :attr:`.dtype`.
        :param byteorder: The endianness of the data.
            If ``"little"``, the bytes in data will be flipped to big-endian.
            If installed, ``neo4j-rust-ext`` or ``numpy`` will be used to speed
            up the byte flipping. Use :data:`sys.byteorder` if you want to use
            the system's native endianness.

        :raises ValueError:
          * If data's size is not a multiple of dtype's size.
          * If byteorder is not one of ``"big"`` or ``"little"``.
        :raises TypeError: If the data is not of type bytes.
        r   )__new__r*   )clsr   r   r   objs        r   
from_byteszVector.from_bytes<  s)    4 kk#tUi8
r   c              4     t        |      ||      | _        y )Nr   )	_get_typer   r!   s       r   r*   zVector._set_bytesZ  s     'i&tyAr   c                    y r   r   r^   r   r   s      r   from_nativezVector.from_natived       r   c                    y r   r   rd   s      r   re   zVector.from_nativej  rf   r   c               L    | j                  |       }|j                  ||       |S )a`  
        Create a Vector instance from an iterable of values.

        :param data: The list, tuple, or other iterable of values to create the
            vector from.
        :param dtype: The type of the vector.
            See also :attr:`.dtype`.

        ``data`` must contain values that match the expected type given by
        ``dtype``:

        * ``dtype == "f32"``: :class:`float`
        * ``dtype == "f64"``: :class:`float`
        * ``dtype == "i8"``: :class:`int`
        * ``dtype == "i16"``: :class:`int`
        * ``dtype == "i32"``: :class:`int`
        * ``dtype == "i64"``: :class:`int`

        :raises ValueError: If the dtype is not supported.
        :raises TypeError: If data's elements don't match the expected type
            depending on dtype.
        :raises OverflowError: If the value is out of range for the given type.
        )r]   r1   )r^   r   r   r_   s       r   re   zVector.from_nativep  s%    < kk#e$
r   c               B    t        |      j                  |      | _        y r   )rb   re   r   r   s      r   r1   zVector._set_native  s      &2248r   c                6    | j                   j                         S )a   
        Convert the vector to a native Python list.

        The type of the elements in the list depends on the dtype of the
        vector. See :meth:`Vector.from_native` for details.

        :returns: A list of values representing the vector.
        )r   	to_nativerM   s    r   rk   zVector.to_native  s     {{$$&&r   c               J    | j                  |       }|j                  |       |S )af  
        Create a Vector instance from a numpy array.

        :param data: The numpy array to create the vector from.
            The array must be one-dimensional and have a dtype that is
            supported by Neo4j vectors: ``float64``, ``float32``,
            ``int64``, ``int32``, ``int16``, or ``int8``.
            See also :class:`.VectorDType`.

        :raises ValueError:
          * If the dtype is not supported.
          * If the array is not one-dimensional.
        :raises ImportError: If numpy is not installed.

        :returns: A Vector instance constructed from the numpy array.
        )r]   r-   r^   r   r_   s      r   
from_numpyzVector.from_numpy  s#    $ kk#t
r   c                6    | j                   j                         S )a   
        Convert the vector to a numpy array.

        The array's dtype depends on the dtype of the vector. However, it will
        always be in big-endian order.

        :returns: A numpy array representing the vector.

        :raises ImportError: If numpy is not installed.
        )r   to_numpyrM   s    r   rp   zVector.to_numpy  s     {{##%%r   c               l   |j                   dk7  rt        d      |j                  j                  xdk(  r t        }nbxdk(  r t
        }nUxdk(  r t        }nHxdk(  r t        }n;xdk(  r t        }n.dk(  rt        }n#	 t        d	|j                  j                         |j                  |      | _        y )
Nr   zData must be one-dimensionalfloat64float32int64int32int16int8zUnsupported numpy dtype: )ndimrH   r   name_VecF64_VecF32_VecI64_VecI32_VecI16_VecI8rn   r   )r   r   type_s      r   r-   zVector._set_numpy  s    99>;<<jjoo #<TZZ__<M!NOO&&t,r   c               J    | j                  |       }|j                  |       |S )a  
        Create a Vector instance from a pyarrow array.

        PyArrow stores data in little endian. Therefore, the byte-order needs
        to be swapped. If ``neo4j-rust-ext`` or ``numpy`` is installed, it will
        be used to speed up the byte flipping.

        :param data: The pyarrow array to create the vector from.
            The array must have a type that is supported by Neo4j.
            See also :class:`.VectorDType`.
        :raises ValueError:
          * If the array's type is not supported.
          * If the array contains null values.
        :raises ImportError: If pyarrow is not installed.

        :returns: A Vector instance constructed from the pyarrow array.
        )r]   r0   rm   s      r   from_pyarrowzVector.from_pyarrow  s%    & kk#
r   c                6    | j                   j                         S )z
        Convert the vector to a pyarrow array.

        :returns: A pyarrow array representing the vector.

        :raises ImportError: If pyarrow is not installed.
        )r   
to_pyarrowrM   s    r   r   zVector.to_pyarrow  s     {{%%''r   c                  dd l }|j                  |j                         k(  rt        }n|j                  |j	                         k(  rt
        }n|j                  |j                         k(  rt        }n|j                  |j                         k(  rt        }n`|j                  |j                         k(  rt        }n<|j                  |j                         k(  rt        }nt        d|j                         |j                  |      }|| _        y )Nr   zUnsupported pyarrow dtype: )pyarrowr;   rr   rz   rs   r{   rt   r|   ru   r}   rv   r~   rw   r   rH   r   r   )r   r   r   r   inners        r   r0   zVector._set_pyarrow  s     99))EYY'//++EYY'--/)EYY'--/)EYY'--/)EYY',,.(E:499+FGG""4(r   N)r   _t.Iterable[float]r   _T_VectorDTypeFloatreturnNone)r   _t.Iterable[int]r   _T_VectorDTypeIntr   r   )r   zbytes | bytearrayr   _T_VectorDTyper   _T_VectorEndianr   r   )r   _np.ndarrayr   r   )r   	_pa.Arrayr   r   r   r   )r>   z_t.Callable[..., None]r2   tupler3   zdict[str, _t.Any]r   z_t.Generator[None, None, None])r   r   r   r'   r   r'   r   r   r   r   )r   r   r   intr   rR   )r   r'   r   r   r   r   r   _t.Self)r   r'   r   r   r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   r   r   )r   %_t.Iterable[float] | _t.Iterable[int]r   r   r   r   )r   r   r   r   r   r   r   zlist[object]r   r   r   r   r   r   r   r   r   r   r   r   ) rY   r<   r=   __doc__	__slots____annotations___toverloadr   staticmethod_contextlibcontextmanagerr)   rI   rK   propertyr   rP   rS   r[   classmethodr`   r*   re   r1   rk   rn   rp   r-   r   r   r0   r   r   r   r
   r
   ?   s   M^ *I[[  #
 
  [[ !
 
  [[ &+  # 
  [[9 9[[7 78, &  "	
 
(   0 6; F &+  
 #  
 D ! !  

  &+  # 
 F &+BB B #B 
B [[%.A	   [[#,=	   3 
 
 B939 9
 
9	'  *&-*  ,(r   r
   c                      e Zd ZdZdZdZy)r   a  
    Data endianness (i.e., byte order) of the elements in a :class:`Vector`.

    Inherits from :class:`str` and :class:`enum.Enum`.
    Every driver API accepting a :class:`.VectorEndian` value will also accept
    a string::

        >>> VectorEndian.BIG == "big"
        True
        >>> VectorEndian.LITTLE == "little"
        True

    .. seealso:: :attr:`Vector.raw`

    .. versionadded:: 6.0
    r   rC   N)rY   r<   r=   r   BIGLITTLEr   r   r   r   r     s    " CFr   r   )r   rC   c                  (    e Zd ZdZdZdZdZdZdZdZ	y)	r   a  
    The data type of the elements in a :class:`Vector`.

    Currently supported types are:

        * ``f32``: 32-bit floating point number (single)
        * ``f64``: 64-bit floating point number (double)
        * ``i8``: 8-bit integer
        * ``i16``: 16-bit integer
        * ``i32``: 32-bit integer
        * ``i64``: 64-bit integer

    Inherits from :class:`str` and :class:`enum.Enum`.
    Every driver API accepting a :class:`.VectorDType` value will also accept
    a string::

        >>> VectorDType.F32 == "f32"
        True
        >>> VectorDType.I8 == "i8"
        True

    .. seealso:: :attr:`Vector.dtype`

    .. versionadded:: 6.0
    f32f64i8i16i32i64N)
rY   r<   r=   r   F32F64I8I16I32I64r   r   r   r   r   2  s'    4 C
C	B
C
C
Cr   r   )r   r   r   r   r   r   r   r   r   r   r   r   c                   | dk(  r|S | dvrt        d|        t        |      | z  dk7  rt        dt        |       d|        t        | |      S )z&Swap from big endian to little endian.r   >            Unsupported type size: r   Data length  is not a multiple of )rH   rO   _swap_endian_unchecked)	type_sizer   s     r   _swap_endianr   g  sk    A~	!29+>??
4y9!3t9+%;I;G
 	
 ")T22r   c               ,   | xdk(  r t        j                  d      }nExdk(  r t        j                  d      }n)dk(  rt        j                  d      }n	 t        d|        t        j                  ||      j	                         j                         S )	Nr   z<i2r   z<i4r   z<i8r   r   )r+   r   rH   
frombufferbyteswaptobytes)r   r   r   s      r   _swap_endian_unchecked_npr   t  sq    
IIe$EIIe$EIIe$E6ykBCC>>$e,557??AAr   c                   | xdk(  r d}nxdk(  r d}ndk(  rd}n	 t        d|        t        |      | z  }d| | }d	| | }t        j                  |gt        j                  ||       S )
Nr   hr   ir   qr   ><)rH   rO   _structpackunpack)r   r   fmtcountfmt_befmt_les         r   _swap_endian_unchecked_pyr     s    
CCC6ykBCCI"EuFuF<<>!=>>r   c               &   t        | t              r:| t        j                  j	                         vrt        d| d      t        |       } t        | t              st        dt        |        d      | t        vrt        d| d      t        |    S )NzUnsupported vector type: r6   z#Expected a VectorDType or str, got )	r&   rR   r   __members__valuesrH   r7   r;   _TYPESr   s    r   rb   rb     s    %//66888	CDDE"e[)=d5k]!LMMF4UIQ?@@%=r   z%dict[VectorDType, type[_InnerVector]]r   c                      e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   dd	 	 	 	 	 d fdZedd       Zej                  d d       Zedd       Z	e	j                  d d       Z	d! fdZ
d"dZd#dZej                  d#d       Zd#dZeej                  d$d              Zej                  d%d       Zed&d       Zej                  d'd       Zed(d       Zej                  d)d       Z xZS )*r   )_data_data_lez_t.ClassVar[VectorDType]r   z_t.ClassVar[int]sizez_t.ClassVar[str]cypher_inner_type_reprr'   r   zbytes | Noner   r   r   c                  t         |           | j                  t        k(  rt	        d      |xdk(  r || _        d | _        y dk(  r#t        | j                  |      | _        || _        y 	 t        d|d      )Nz-Cannot instantiate abstract class InnerVectorr   rC   rD   rE   )
superr   rX   r   r7   r   r   r   r   rH   )r   r   r   rX   s      r   r   z_InnerVector.__init__  sy     	>>\)KLL 	 $(D9	 $ )) 71 1 r   c                    | j                   S r   )r   rM   s    r   r   z_InnerVector.data  s    zzr   c                   t        |t              st        d      t        |      | j                  z  dk(  s$t        dt        |       d| j                         || _        y )NzData must be of type bytesr   r   r   )r&   r'   r7   rO   r   rH   r   r#   s     r   r   z_InnerVector.data  s\    $&8994y499$)s4yk)?		{K  
r   c                |    | j                   %t        | j                  | j                        | _         | j                   S r   )r   r   r   r   rM   s    r   rG   z_InnerVector.data_le  s,    == (DII>DM}}r   c               H    t        | j                  |      | _        || _        y r   )r   r   r   r   r#   s     r   rG   z_InnerVector.data_le  s     D1	r   c                   t         |           t        j                  | j                  v ry t        | dd       }t        |t              st        d| j                   d      t        t        | dd       t              st        d| j                   d      | j                  dvr%t        d| j                   d| j                         |t        v rt        d| j                   d| d	      | t        |<   y )
Nr   zClass z) must have a VectorDType attribute'dtype'r   z! must have a str attribute 'size'>   r   r   r   r   z has an unhandled size z has a duplicate type '')r   __init_subclass___abcABC	__bases__getattrr&   r   r7   rY   r   r   rH   r   )r^   r   rX   s     r   r   z_InnerVector.__init_subclass__  s    !#88s}}$Wd+%- '   '#vt4c:&GH  88<' &=chhZH  F?&=eWAF  ur   c                F    t        | j                        | j                  z  S r   )rO   r   r   rM   s    r   rP   z_InnerVector.__len__  s    499~**r   c                h    t        |       }| j                  }| j                         }d| d| d| dS )Nzvector(rV   rW   )rO   r   _cypher_values_repr)r   r   	type_reprvalues_reprs       r   rS   z_InnerVector.__str__  s?    4y//	..0RvR	{!<<r   c                     y r   r   rM   s    r   r   z _InnerVector._cypher_values_repr  s    *-r   c                R    | j                   j                  }| d| j                  dS )NrU   rW   )rX   rY   r   )r   cls_names     r   r[   z_InnerVector.__repr__  s(    >>**1TYYM++r   c                    y r   r   r^   r   s     r   re   z_InnerVector.from_native  s    CFr   c                     y r   r   rM   s    r   rk   z_InnerVector.to_native  s    ),r   c                   |j                   j                  dk(  s,|j                   j                  dk(  r#t        j                  dk(  r|j                         } | |j	                               S )Nr   =rC   )r   r   _sysr   r   r   s     r   rn   z_InnerVector.from_numpy  sM    ::3&JJ  C'DNNh,F==?D4<<>""r   c                     y r   r   rM   s    r   rp   z_InnerVector.to_numpy      '*r   c                  |j                   j                  }| j                  |k(  sJ t        j                  j                  |d      j                         rt        d      |j                         \  }}||j                  |z  |j                  t        |      z   |z   } | t        |      t        j                        S )N	only_null)modez/PyArrow array must not contain any null values.r   )r;   
byte_widthr   r.   computer   as_pyrH   buffersoffsetrO   r'   r   r   )r^   r   width_buffers        r   r   z_InnerVector.from_pyarrow  s    		$$xx5   ;;T4::<NOOLLN	6KK%4;;T#:e"C
 5=DNN;;r   c                     y r   r   rM   s    r   r   z_InnerVector.to_pyarrow&  r   r   r   )r   r'   )r   r'   r   r   r   r   r   r   z_t.Iterable[object]r   r   r   r   r   r   r   )rY   r<   r=   r   r   r   r   r   r>   rG   r   rP   rS   r   abstractmethodr   r[   r   re   rk   rn   rp   r   r   __classcell__)rX   s   @r   r   r     sL   %I##
,,L ?D,;	&   
[[   
 ^^ 4+= 
- -, 	F  F	, ,# # 
* *	< 	< 
* *r   r   c                      e Zd ZdZddZy)_InnerVectorFloatr   c                x    t        | j                               }|j                  dd      j                  dd      S )NnanNaNinfInfinity)rR   rk   replace)r   ress     r   r   z%_InnerVectorFloat._cypher_values_repr-  s1    $.."#{{5%(00
CCr   Nr   rY   r<   r=   r   r   r   r   r   r  r  *  s    IDr   r  c                  Z    e Zd ZdZej
                  ZdZdZe	d	d       Z
d
dZddZddZy)rz   r   r   zFLOAT NOT NULLc               4   t        |t        j                        st        |      }t	        d |D              s9|D ]4  }t        |t
              rt        dt        |      j                   d        | t        j                  dt        |       dg|       S )Nc              3  <   K   | ]  }t        |t                y wr   r&   float.0items     r   	<genexpr>z&_VecF64.from_native.<locals>.<genexpr>=       <tt:dE*t   zCannot build f64 vector from , expected float.r   d)r&   r   Sizedr   allr  r7   r;   rY   r   r   rO   )r^   r   r  s      r   re   z_VecF64.from_native9  s    $);D<t<<!$.#7T
8K8K7L M* *   7<<!CI;a 084899r   c                    dt        | j                        | j                  z   d}t        t	        j
                  || j                              S )Nr   r"  rO   r   r   listr   r   r   struct_formats     r   rk   z_VecF64.to_nativeF  <    C		Ndii78:GNN=$))<==r   c                b    dd l }|j                  | j                  |j                  d            S )Nr   z>f8r   numpyr   r   r   r   r-  s     r   rp   z_VecF64.to_numpyJ  (    		U1CDDr   c                    dd l }|j                  | j                        }|j                  j	                  |j                         t        |       d |gd      S Nr   )r   	py_bufferrG   r/   from_buffersrr   rO   r   r   r  s      r   r   z_VecF64.to_pyarrowO  H    ""4<<0}}))OOs4y4.!
 	
r   Nr	  r   r   r   )rY   r<   r=   r   r   r   r   r   r   r   re   rk   rp   r   r   r   r   rz   rz   2  s=    IOOED-
: 
:>E

r   rz   c                  Z    e Zd ZdZej
                  ZdZdZe	d	d       Z
d
dZddZddZy)r{   r   r   zFLOAT32 NOT NULLc                  t        |t        j                        st        |      }t	        d |D              s9|D ]4  }t        |t
              rt        dt        |      j                   d       	 t        j                  dt        |       dg| } | |      S # t        $ r= |D ]6  }	 t        j                  d|       # t        $ r t        d| d      d w xY w  w xY w)	Nc              3  <   K   | ]  }t        |t                y wr   r  r  s     r   r  z&_VecF32.from_native.<locals>.<genexpr>c  r  r   zCannot build f32 vector from r!  r   fz>fValue z9 is out of range for f32: [-3.4028234e+38, 3.4028234e+38])r&   r   r#  r   r$  r  r7   r;   rY   r   r   rO   OverflowError)r^   r   r  bytes_s       r   re   z_VecF32.from_native_  s    $);D<t<<!$.#7T
8K8K7L M* *  	\\Ac$i["2:T:F 6{  		 LLt,$  '  ': ;      		s$   2#B C#,CC#CC#c                    dt        | j                        | j                  z   d}t        t	        j
                  || j                              S )Nr   r9  r&  r(  s     r   rk   z_VecF32.to_nativex  r*  r   c                b    dd l }|j                  | j                  |j                  d            S )Nr   z>f4r   r,  r.  s     r   rp   z_VecF32.to_numpy|  r/  r   c                    dd l }|j                  | j                        }|j                  j	                  |j                         t        |       d |gd      S r1  )r   r2  rG   r/   r3  rs   rO   r4  s      r   r   z_VecF32.to_pyarrow  r5  r   Nr	  r   r   r   )rY   r<   r=   r   r   r   r   r   r   r   re   rk   rp   r   r   r   r   r{   r{   X  s=    IOOED/ 0>E

r   r{   c                      e Zd ZdZddZy)_InnerVectorIntr   c                4    t        | j                               S r   )rR   rk   rM   s    r   r   z#_InnerVectorInt._cypher_values_repr  s    4>>#$$r   Nr   r  r   r   r   rA  rA    s    I%r   rA  l         l    c                  Z    e Zd ZdZej
                  ZdZdZe	d	d       Z
d
dZddZddZy)r|   r   r   zINTEGER NOT NULLc                  t        |t        j                        st        |      }	 t	        j
                  dt        |       dg| } | |      S # t        j                  $ ro |D ]h  }t        |t              s#t        dt        |      j                   d      d t        |cxk  r
t        k  rJn t        d| dt         dt         d      d   w xY w)	Nr   r   zCannot build i64 vector from , expected int.r:  z is out of range for i64: [rV   ])r&   r   r#  r   r   r   rO   errorr   r7   r;   rY   _I64_MIN_I64_MAXr;  r^   r   r<  r  s       r   re   z_VecI64.from_native      $);D	\\Ac$i["2:T:F 6{ }} 	!$,#7T
8K8K7L M( (     4383'  '$:Rz4     	   #A AC1#Cc                    dt        | j                        | j                  z   d}t        t	        j
                  || j                              S )Nr   r   r&  r(  s     r   rk   z_VecI64.to_native  r*  r   c                b    dd l }|j                  | j                  |j                  d            S )Nr   z>i8r   r,  r.  s     r   rp   z_VecI64.to_numpy  r/  r   c                    dd l }|j                  | j                        }|j                  j	                  |j                         t        |       d |gd      S r1  )r   r2  rG   r/   r3  rt   rO   r4  s      r   r   z_VecI64.to_pyarrow  G    ""4<<0}}))MMOSYv
 	
r   Nr	  r   r   r   )rY   r<   r=   r   r   r   r   r   r   r   re   rk   rp   r   r   r   r   r|   r|     s=    IOOED/ (>E

r   r|   i   ic                  Z    e Zd ZdZej
                  ZdZdZe	d	d       Z
d
dZddZddZy)r}   r   r   zINTEGER32 NOT NULLc                  t        |t        j                        st        |      }	 t	        j
                  dt        |       dg| } | |      S # t        j                  $ ro |D ]h  }t        |t              s#t        dt        |      j                   d      d t        |cxk  r
t        k  rJn t        d| dt         dt         d      d   w xY w)	Nr   r   zCannot build i32 vector from rE  r:  z is out of range for i32: [rV   rF  )r&   r   r#  r   r   r   rO   rG  r   r7   r;   rY   _I32_MIN_I32_MAXr;  rJ  s       r   re   z_VecI32.from_native  rK  rL  c                    dt        | j                        | j                  z   d}t        t	        j
                  || j                              S )Nr   r   r&  r(  s     r   rk   z_VecI32.to_native  r*  r   c                b    dd l }|j                  | j                  |j                  d            S )Nr   z>i4r   r,  r.  s     r   rp   z_VecI32.to_numpy  r/  r   c                    dd l }|j                  | j                        }|j                  j	                  |j                         t        |       d |gd      S r1  )r   r2  rG   r/   r3  ru   rO   r4  s      r   r   z_VecI32.to_pyarrow  rP  r   Nr	  r   r   r   )rY   r<   r=   r   r   r   r   r   r   r   re   rk   rp   r   r   r   r   r}   r}     =    IOOED1 (>E

r   r}   i i  c                  Z    e Zd ZdZej
                  ZdZdZe	d	d       Z
d
dZddZddZy)r~   r   r   zINTEGER16 NOT NULLc                  t        |t        j                        st        |      }	 t	        j
                  dt        |       dg| } | |      S # t        j                  $ ro |D ]h  }t        |t              s#t        dt        |      j                   d      d t        |cxk  r
t        k  rJn t        d| dt         dt         d      d   w xY w)	Nr   r   zCannot build i16 vector from rE  r:  z is out of range for i16: [rV   rF  )r&   r   r#  r   r   r   rO   rG  r   r7   r;   rY   _I16_MIN_I16_MAXr;  rJ  s       r   re   z_VecI16.from_native   rK  rL  c                    dt        | j                        | j                  z   d}t        t	        j
                  || j                              S )Nr   r   r&  r(  s     r   rk   z_VecI16.to_native  r*  r   c                b    dd l }|j                  | j                  |j                  d            S )Nr   z>i2r   r,  r.  s     r   rp   z_VecI16.to_numpy  r/  r   c                    dd l }|j                  | j                        }|j                  j	                  |j                         t        |       d |gd      S r1  )r   r2  rG   r/   r3  rv   rO   r4  s      r   r   z_VecI16.to_pyarrow  rP  r   Nr	  r   r   r   )rY   r<   r=   r   r   r   r   r   r   r   re   rk   rp   r   r   r   r   r~   r~     rX  r   r~   i   c                  Z    e Zd ZdZej
                  ZdZdZe	d	d       Z
d
dZddZddZy)r   r   r   zINTEGER8 NOT NULLc                  t        |t        j                        st        |      }	 t	        j
                  dt        |       dg| } | |      S # t        j                  $ ro |D ]h  }t        |t              s#t        dt        |      j                   d      d t        |cxk  r
t        k  rJn t        d| dt         dt         d      d   w xY w)	Nr   bzCannot build i8 vector from rE  r:  z is out of range for i8: [rV   rF  )r&   r   r#  r   r   r   rO   rG  r   r7   r;   rY   _I8_MIN_I8_MAXr;  rJ  s       r   re   z_VecI8.from_native2  s    $);D	\\Ac$i["2:T:F 6{ }} 	!$,#6tDz7J7J6K L( (    $1'1'  '#9Bwiq2     	rL  c                    dt        | j                        | j                  z   d}t        t	        j
                  || j                              S )Nr   rc  r&  r(  s     r   rk   z_VecI8.to_nativeG  r*  r   c                b    dd l }|j                  | j                  |j                  d            S )Nr   z>i1r   r,  r.  s     r   rp   z_VecI8.to_numpyK  r/  r   c                    dd l }|j                  | j                        }|j                  j	                  |j                         t        |       d |gd      S r1  )r   r2  rG   r/   r3  rw   rO   r4  s      r   r   z_VecI8.to_pyarrowP  sG    ""4<<0}}))LLNCIf~q
 	
r   Nr	  r   r   r   )rY   r<   r=   r   r   r   r   r   r   r   re   rk   rp   r   r   r   r   r   r   +  s=    INNED0 (>E

r   r   )r   r   r   r'   r   r'   )r   r   r   ztype[_InnerVector])Lr   
__future__r   r  abcr   
contextlibr   inspectr8   structr   sysr   enumr   _Enum r   r   TYPE_CHECKINGr-  r+   r   r.   _optional_depsr   r   typing_rust.vectorr	   _swap_endian_unchecked_rustImportError__all__object_DEFAULTr
   rR   r   Literalr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rb   r   r   r   r   r  rz   r{   rA  rH  rI  r|   rS  rT  r}   r[  r\  r~   rd  re  r   r   r   r   <module>r|     s#    1 '           	
'H
 8R Rt3 , O!<< #u  H "**DEE  JJNNOOOOOO				  jjOO[__eU2 

3B?  *8_66	 13- 2~+488 ~+BDdhh D#
 #
L/
 /
d%lDHH % &$+
o +
\ +
o +
\ +
o +
\ 
+
_ +
u  '"&'s   	F= =GG