
    Ng2                     :    d dl mZ d dl mZ  G d de          ZdS )   )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dS )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                 `    t          j        |t           j                   || _        || _        d S )N)Nenforce_numberUOffsetTFlagsr   r   )selfbufposs      M/var/www/html/ai-engine/env/lib/python3.11/site-packages/flatbuffers/table.py__init__zTable.__init__   s)    	ao...
    c                     | j         |                     t          j        | j                   z
  }|                     t          j        |          }||k     r#|                     t          j        ||z             S dS )zwOffset 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    sb    
 DHHQ_dh???HHQ_f55	)##88AOVl-BCCCqr   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+   s7    	ao...VZ ;TZMMMMr   c                 T   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.String0   s}    	ao...vz!/5tz3GGGao//AO7SIITZeFl 23444r   c                    t          j        |t           j                   || j        z  }|t	          j        t           j        j        | j        |          z  }t	          j        t           j        j        | j        |          }|S )zgVectorLen 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.VectorLen8   sb     	
ao...txvz!/5tz3GGGj4dj#FF
r   c                     t          j        |t           j                   || j        z  }||                     t           j        |          z   }|t           j        j        z  }|S )zkVector 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.VectorB   sR     	
ao...tx$((1?C000	Q_&&r   c                     t          |          t          u sJ t          j        |t          j                   || j        z  }||                     t          j        |          z   |_        | j        |_        dS )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.UnionM   sd     Bxx5    	ao...txtxx555:r   c                     t          j        |t           j                   |                    t	          j        |j        | j        |                    S )zf
        Get 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.GetW   s>    
 	
ao...}}VZ(94:sKKLLLr   c                     t          j        |t           j                   |t          j        ||           |                     |          }|dk    r|S |                     || j        |z             S )Nr   )r
   r   r   r   r   r   )r   slotdvalidator_flagsr   s        r   GetSlotzTable.GetSlot_   si    	q///&Q000kk$!88HxxC888r   c                     |                      |          }|                     |          }t          j        |          }t	          j        || j        ||          S )z
        GetVectorAsNumpy 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.GetVectorAsNumpyh   sN     S!!$$oe,,&{DJOOOr   c                 b    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.GetArrayAsNumpyt   s,     oe,,&{DJLLLr   c                     t          j        |t           j                   t          j        |t           j                   |                     |          }|dk    r|S |S )z
        GetVOffsetTSlot 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}   sR     	
q///	AO,,,kk$!88H
r   N)__name__
__module____qualname____doc__	__slots__r   r   r   r%   r(   r+   r/   r   r7   r:   r>   r@    r   r   r   r      s        P P !I  	 	 	N N N
5 5 5  	 	 	  M M M9 9 9
P 
P 
PM M M    r   r   N) r   r   r
   objectr   rF   r   r   <module>rI      si               w w w w wF w w w w wr   