
    vpi                     2    d dl mZ d dl mZ  G d de      Zy)   )encode)number_typesc                   \    e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zy)TablezTable wraps a byte slice and provides read access to its data.

  The variable `Pos` indicates the root of the FlatBuffers object therein.
  )BytesPosc                 h    t        j                  |t         j                         || _        || _        y )N)Nenforce_numberUOffsetTFlagsr   r   )selfbufposs      S/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/flatbuffers/table.py__init__zTable.__init__   s$    S!//*DJDH    c                    | j                   | j                  t        j                  | j                         z
  }| j                  t        j                  |      }||k  r#| j                  t        j                  ||z         S y)zxOffset provides access into the Table's vtable.

    Deprecated fields are ignored by checking the vtable's length.
        )r   Getr
   SOffsetTFlagsVOffsetTFlags)r   vtableOffsetvtable	vtableEnds       r   OffsetzTable.Offset!   s^     XX$((;;F&1IiXXaoov'<==r   c                     t        j                  |t         j                         |t        j                  t         j                  j
                  | j                  |      z   S )z:Indirect retrieves the relative offset stored at `offset`.)r
   r   r   r   r   packer_typer   )r   offs     r   IndirectzTable.Indirect-   s<    S!//*AOO77SIIIr   c                    t        j                  |t         j                         |t        j                  t         j                  j
                  | j                  |      z  }|t         j                  j                  z   }t        j                  t         j                  j
                  | j                  |      }t        | j                  |||z          S )z<String gets a string from data stored inside the flatbuffer.)	r
   r   r   r   r   r   r   	bytewidthbytes)r   r   startlengths       r   StringzTable.String2   s    S!//*6::aoo114::sCCC!//+++EZZ33TZZEFEEFN344r   c                 V   t        j                  |t         j                         || j                  z  }|t	        j
                  t         j                  j                  | j                  |      z  }t	        j
                  t         j                  j                  | j                  |      }|S )zfVectorLen retrieves the length of the vector whose offset is stored

    at "off" in this object.
    )r
   r   r   r   r   r   r   r   )r   r   rets      r   	VectorLenzTable.VectorLen:   so    
 S!//*488OC6::aoo114::sCCC
**Q__00$**c
BCJr   c                     t        j                  |t         j                         || j                  z  }|| j	                  t         j                  |      z   }|t         j                  j
                  z  }|S )zjVector retrieves the start of data of the vector whose offset is

    stored at "off" in this object.
    )r
   r   r   r   r   r!   )r   r   xs      r   VectorzTable.VectorF   sW    
 S!//*488OCdhhq,,A	"	""AHr   c                    t        |      t        u sJ t        j                  |t        j                         || j
                  z  }|| j                  t        j                  |      z   |_        | j                  |_        y)z]Union initializes any Table-derived type to point to the union at

    the given offset.
    N)typer   r
   r   r   r   r   r   )r   t2r   s      r   UnionzTable.UnionS   s]    
 8uS!//*488OC488AOOS11BFzzBHr   c                     t        j                  |t         j                         |j                  t	        j
                  |j                  | j                  |            S )zVGet retrieves a value of the type specified by `flags`  at the

    given offset.
    )r
   r   r   py_typer   r   r   r   )r   flagsr   s      r   r   z	Table.Get_   s>    
 S!//*==E$5$5tzz3GHHr   c                     t        j                  |t         j                         |t        j                  ||       | j                  |      }|dk(  r|S | j	                  || j
                  |z         S )Nr   )r
   r   r   r   r   r   )r   slotdvalidator_flagsr   s        r   GetSlotzTable.GetSlotg   s_    T1??+"q/*
++d
C
axh88OTXX^44r   c                     | j                  |      }| j                  |      }t        j                  |      }t	        j
                  || j                  ||      S )zGetVectorAsNumpy returns the vector that starts at `Vector(off)`

    as a numpy array with the type specified by `flags`. The array is
    a `view` into Bytes, so modifying the returned array will
    modify Bytes in place.
    )r+   r(   r
   to_numpy_typer   GetVectorAsNumpyr   )r   r2   r   offsetr$   numpy_dtypes         r   r:   zTable.GetVectorAsNumpyp   sI     [[F^^C F//%(K"";

FFKKr   c                 p    t        j                  |      }t        j                  || j                  ||      S )a	  GetArrayAsNumpy returns the array with fixed width that starts at `Vector(offset)`

    with length `length` as a numpy array with the type specified by `flags`.
    The
    array is a `view` into Bytes so modifying the returned will modify Bytes in
    place.
    )r
   r9   r   r:   r   )r   r2   r   r$   r<   s        r   GetArrayAsNumpyzTable.GetArrayAsNumpy|   s-     //%(K"";

FCHHr   c                     t        j                  |t         j                         t        j                  |t         j                         | j                  |      }|dk(  r|S |S )zGetVOffsetTSlot retrieves the VOffsetT that the given vtable location

    points to. If the vtable value is zero, the default value `d`
    will be returned.
    r   )r
   r   r   r   )r   r4   r5   r   s       r   GetVOffsetTSlotzTable.GetVOffsetTSlot   sK     T1??+Q(
++d
C
axhJr   N)__name__
__module____qualname____doc__	__slots__r   r   r   r%   r(   r+   r/   r   r7   r:   r>   r@    r   r   r   r      sN    
 )
J
5

I5
L	Ir   r   N) r   r   r
   objectr   rF   r   r   <module>rI      s     AF Ar   