
    LKi                     |   S SK JrJrJrJrJr  S SKJr  S SKJ	r	J
r
Jr  S SKJrJr  S SKJr  S SKJrJr  S SKrS SKrS SKJrJr  S S	KJr  S S
KJrJr   " S S\	5      r " S S\\5      r " S S\5      r \" 5       r! " S S\RD                  5      r# SS\RH                  RJ                  S\&S\\&\\S4   4   4S jjr'g)    )AnyOptionalSequenceTupleType)TracebackType)ProtocolSelfLiteral)ABCabstractmethod)local)overrideEnforceOverridesN)System	Component)UUID)islicecountc            	           \ rS rSrSrSS\S\\\S4      S\	4S jjr
S	\S\	4S
 jr SS\S\\\\S4         S\	4S jjrS\\S4   4S jrS\\\S4      4S jrSrg)Cursor   zFReifies methods we use from a DBAPI2 Cursor since DBAPI2 is not typed.Nsqlparams.returnc                     g N selfr   r   s      R/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/chromadb/db/base.pyexecuteCursor.execute           scriptc                     g r   r   )r    r&   s     r!   executescriptCursor.executescript   r$   r%   c                     g r   r   r   s      r!   executemanyCursor.executemany   s     	r%   c                     g r   r   r    s    r!   fetchoneCursor.fetchone   r$   r%   c                     g r   r   r.   s    r!   fetchallCursor.fetchall   r$   r%   r   r   )__name__
__module____qualname____firstlineno____doc__strr   r   r   r
   r"   r(   r   r+   r/   r2   __static_attributes__r   r%   r!   r   r      s    P3 sCx(A T C D  GK (%S/)B C	
%S/ (5c?3 r%   r   c            
       r    \ rS rSrSr\S\4S j5       r\S\\	\
      S\\
   S\\   S\S   4S	 j5       rS
rg)	TxWrapper#   a6  Wrapper class for DBAPI 2.0 Connection objects, with which clients can implement transactions.
Makes two guarantees that basic DBAPI 2.0 connections do not:

- __enter__ returns a Cursor object consistently (instead of a Connection like some do)
- Always re-raises an exception if one was thrown from the body
r   c                     g r   r   r.   s    r!   	__enter__TxWrapper.__enter__+   s    r%   exc_type	exc_value	tracebackFc                     g r   r   )r    rA   rB   rC   s       r!   __exit__TxWrapper.__exit__/        	r%   r   N)r4   r5   r6   r7   r8   r   r   r?   r   r   BaseExceptionr   r   rE   r:   r   r%   r!   r<   r<   #   st     6   4./ M* M*	
 
 r%   r<   c                   \  ^  \ rS rSrSrS\4U 4S jjr\S\4S j5       r	\
\S\\R                     4S j5       5       r\
\S\4S j5       5       r\
\S	\\   S\\   4S
 j5       5       r\
\S\\   S\\   4S j5       5       r\
\S\\   4S j5       5       rS\S\R2                  4S jrSrU =r$ )SqlDB9   zQDBAPI 2.0 interface wrapper to ensure consistent behavior between implementationssystemc                 $   > [         TU ]  U5        g r   )super__init__)r    rL   	__class__s     r!   rO   SqlDB.__init__<   s     r%   r   c                     g)zReturn a transaction wrapperNr   r.   s    r!   txSqlDB.tx?   s     	r%   c                      g)zReturn a PyPika Query builder of an appropriate subtype for this database
implementation (see
https://pypika.readthedocs.io/en/latest/3_advanced.html#handling-different-database-platforms)
Nr   r   r%   r!   querybuilderSqlDB.querybuilderD   rG   r%   c                      g)zReturn the appropriate parameter format for this database implementation.
Will be called with str.format(i) where i is the numeric index of the parameter.
Nr   r   r%   r!   parameter_formatSqlDB.parameter_formatM   s     	r%   uuidc                     g)z=Convert a UUID to a value that can be passed to the DB driverNr   )r[   s    r!   
uuid_to_dbSqlDB.uuid_to_dbU        	r%   valuec                     g)z,Convert a value from the DB driver to a UUIDNr   r`   s    r!   uuid_from_dbSqlDB.uuid_from_db[   r_   r%   c                      g)zQReturn the exception type that the DB raises when a unique constraint is
violatedNr   r   r%   r!   unique_constraint_errorSqlDB.unique_constraint_errora   s    
 	r%   idxc                 h    [         R                  " U R                  5       R                  U5      5      $ )z4Return a PyPika Parameter object for the given index)pypika	ParameterrY   format)r    rh   s     r!   paramSqlDB.paramh   s'     5 5 7 > >s CDDr%   r   )r4   r5   r6   r7   r8   r   rO   r   r<   rS   staticmethodr   rj   QueryrV   r9   rY   r   r   r   r]   rc   rH   rf   intrk   rm   r:   __classcell__)rP   s   @r!   rJ   rJ   9   s*   [!v ! I   $v||,    c    $ HSM    HSM htn    T-%8   
E E!1!1 E Er%   rJ   c                   B    \ rS rSrSrS\4S jr\S\S\4S j5       r	Sr
g	)
ParameterValuep   z
Wrapper class for PyPika paramters that allows the values for Parameters
to be expressed inline while building a query. See get_sql() for
detailed usage information.
r`   c                     Xl         g r   rb   )r    r`   s     r!   rO   ParameterValue.__init__w   s    
r%   kwargsr   c                 
   [        U R                  [        [        45      (       au  [        R
                  R                  U R                  5        [        [        R                  [        U R                  5      5      nSR                  S U 5       5      nSU S3nO_[        R
                  R                  U R                  5        [        R                  R                  [        [        R                  5      5      n[        U5      $ )Nz, c              3   `   #    U  H$  n[         R                  R                  U5      v   M&     g 7fr   )_context	formatstrrl   ).0is     r!   	<genexpr>)ParameterValue.get_sql.<locals>.<genexpr>   s$     $S7aX%7%7%>%>q%A%A7s   ,.())
isinstancer`   listtupler{   valuesextendr   	generatorlenjoinappendr|   rl   nextr9   )r    rx   indexesplaceholdersvals        r!   get_sqlParameterValue.get_sqlz   s    djj4-00OO""4::.X//TZZAG99$S7$SSLl^1%COO""4::.$$++D1C1C,DEC3xr%   rb   N)r4   r5   r6   r7   r8   r   rO   r   r9   r   r:   r   r%   r!   rt   rt   p   s5    c  
 
 
 
r%   rt   queryr|   r   .c                     / [         l        [        S5      [         l        U[         l        U R                  5       n[        [         R                  5      nX#4$ )a  
Wrapper for pypika's get_sql method that allows the values for Parameters
to be expressed inline while building a query, and that returns a tuple of the
SQL string and parameters. This makes it easier to construct complex queries
programmatically and automatically matches up the generated SQL with the required
parameter vector.

Doing so requires using the ParameterValue class defined in this module instead
of the base pypika.Parameter class.

Usage Example:

    q = (
        pypika.Query().from_("table")
        .select("col1")
        .where("col2"==ParameterValue("foo"))
        .where("col3"==ParameterValue("bar"))
    )

    sql, params = get_sql(q)

    cursor.execute(sql, params)

Note how it is not necessary to construct the parameter vector manually... it
will always be generated with the parameter values in the same order as emitted
SQL string.

The format string should match the parameter format for the database being used.
It will be called with str.format(i) where i is the numeric index of the parameter.
For example, Postgres requires parameters like `:1`, `:2`, etc. so the format string
should be `":{}"`.

See https://pypika.readthedocs.io/en/latest/2_tutorial.html#parametrized-queries for more
information on parameterized queries in PyPika.
   )r{   r   r   r   r|   r   r   )r   r|   r   r   s       r!   r   r      sA    N HOqH"H
--/C8??#F;r%   )?)(typingr   r   r   r   r   typesr   typing_extensionsr	   r
   r   abcr   r   	threadingr   	overridesr   r   rj   pypika.querieschromadb.configr   r   r[   r   	itertoolsr   r   r   r<   rJ   r{   rk   rt   queriesQueryBuilderr9   r   r   r%   r!   <module>r      s    7 7  5 5 #  0   -  #X *% ,1EI 1Eh 7V%% 2 :=,>>&&,36,
3c3h ,r%   