
    S?Nj                       U d Z ddlmZ ddlmZmZmZmZmZ ddl	m
Z
mZmZmZ ddlmZ ddlmZ ddlmZmZmZ er(dd	lmZ dd
lmZmZ ddlmZ ddlmZmZ ddlm Z  ddl!m"Z"  e#d      Z$de%d<   ee&e'e(f   Z)de%d<   eee&ddf   Z*de%d<   ee*ef   Z+de%d<   eee   ee,ef   f   Z-de%d<    edd      Z.e
g df   Z/de%d<   ee#e0d   f   Z1de%d<   ee,e2df   Z3de%d<   e4e,e3f   Z5de%d <   ee,e3f   Z6de%d!<    ed"      Z7ee0e2d#f   d$e7f   Z8de%d%<   	 ed#d$e7f   Z9de%d&<   	  G d' d(e      Z:e
ege)dz  f   Z;de%d)<   e
e)gef   Z<de%d*<    G d+ d,e      Z= G d- d.e      Z> G d/ d0e      Z? G d1 d2e      Z@y)3zN
Protocol objects representing different implementations of the same classes.
    )annotations)TYPE_CHECKINGAnyProtocol	TypeAliasUnion)Callable	GeneratorMappingSequence   )pq)PyFormat)LiteralStringTemplateTypeVar)sql)RowRowMaker)PGresult)ReadyWait)AdaptersMap)BaseConnectionNtypeNoneTyper   Bufferzsql.SQLzsql.ComposedQueryNoTemplateQueryParamsConnectionTypezBaseConnection[Any])boundPipelineCommand)	DumperKey.r$   	ConnParamConnDictConnMappingRVr   zReady | int	PQGenConnPQGenc                      e Zd ZdZdddZy)WaitFunczU
    Wait on the connection which generated `PQgen` and return its final result.
    c                     y N )selfgenfilenointervals       \/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/psycopg/abc.py__call__zWaitFunc.__call__<   s    RU    N).)r1   z	PQGen[RV]r2   intr3   floatreturnr(   )__name__
__module____qualname____doc__r5   r/   r6   r4   r,   r,   7   s     Vr6   r,   DumpFuncLoadFuncc                  4    e Zd ZdZedd       Zedd       Zy)AdaptContextaO  
    A context describing how types are adapted.

    Example of `!AdaptContext` are `~psycopg.Connection`, `~psycopg.Cursor`,
    `~psycopg.adapt.Transformer`, `~psycopg.adapt.AdaptersMap`.

    Note that this is a `~typing.Protocol`, so objects implementing
    `!AdaptContext` don't need to explicitly inherit from this class.

    c                     y)z1The adapters configuration that this object uses.Nr/   r0   s    r4   adapterszAdaptContext.adaptersQ   s     	r6   c                     y)zThe connection used by this object, if available.

        :rtype: `~psycopg.Connection` or `~psycopg.AsyncConnection` or `!None`
        Nr/   rC   s    r4   
connectionzAdaptContext.connectionV        	r6   Nr9   r   r9   zBaseConnection[Any] | None)r:   r;   r<   r=   propertyrD   rF   r/   r6   r4   rA   rA   E   s/    	    r6   rA   c                  T    e Zd ZU dZded<   	 ded<   	 dddZddZdd	Zdd
ZddZ	y)DumperzM
    Convert Python objects of type `!cls` to PostgreSQL representation.
    	pq.Formatformatr7   oidNc                     y r.   r/   )r0   clscontexts      r4   __init__zDumper.__init__o   s    r6   c                     y)zlConvert the object `!obj` to PostgreSQL representation.

        :param obj: the object to convert.
        Nr/   r0   objs     r4   dumpzDumper.dumpq       
 	r6   c                     y)ziConvert the object `!obj` to escaped representation.

        :param obj: the object to convert.
        Nr/   rU   s     r4   quotezDumper.quotex   rX   r6   c                     y)a  Return an alternative key to upgrade the dumper to represent `!obj`.

        :param obj: The object to convert
        :param format: The format to convert to

        Normally the type of the object is all it takes to define how to dump
        the object to the database. For instance, a Python `~datetime.date` can
        be simply converted into a PostgreSQL :sql:`date`.

        In a few cases, just the type is not enough. For example:

        - A Python `~datetime.datetime` could be represented as a
          :sql:`timestamptz` or a :sql:`timestamp`, according to whether it
          specifies a `!tzinfo` or not.

        - A Python int could be stored as several Postgres types: int2, int4,
          int8, numeric. If a type too small is used, it may result in an
          overflow. If a type too large is used, PostgreSQL may not want to
          cast it to a smaller type.

        - Python lists should be dumped according to the type they contain to
          convert them to e.g. array of strings, array of ints (and which
          size of int?...)

        In these cases, a dumper can implement `!get_key()` and return a new
        class, or sequence of classes, that can be used to identify the same
        dumper again. If the mechanism is not needed, the method should return
        the same `!cls` object passed in the constructor.

        If a dumper implements `get_key()` it should also implement
        `upgrade()`.

        Nr/   r0   rV   rN   s      r4   get_keyzDumper.get_key   s    D 	r6   c                     y)a  Return a new dumper to manage `!obj`.

        :param obj: The object to convert
        :param format: The format to convert to

        Once `Transformer.get_dumper()` has been notified by `get_key()` that
        this Dumper class cannot handle `!obj` itself, it will invoke
        `!upgrade()`, which should return a new `Dumper` instance, which will
        be reused for every objects for which `!get_key()` returns the same
        result.
        Nr/   r\   s      r4   upgradezDumper.upgrade   s     	r6   r.   )rQ   r   rR   AdaptContext | None)rV   r   r9   zBuffer | None)rV   r   r9   r   )rV   r   rN   r   r9   r$   rV   r   rN   r   r9   rL   )
r:   r;   r<   r=   __annotations__rS   rW   rZ   r]   r_   r/   r6   r4   rL   rL   _   s6      
HQK"Hr6   rL   c                  0    e Zd ZU dZded<   	 dddZd	dZy)
LoaderzK
    Convert PostgreSQL values with type OID `!oid` to Python objects.
    rM   rN   Nc                     y r.   r/   )r0   rO   rR   s      r4   rS   zLoader.__init__   s    sr6   c                     y)z|
        Convert the data returned by the database into a Python object.

        :param data: the data to convert.
        Nr/   )r0   datas     r4   loadzLoader.load   rG   r6   r.   )rO   r7   rR   r`   )rg   r   r9   r   )r:   r;   r<   r=   rb   rS   rh   r/   r6   r4   rd   rd      s      Kr6   rd   c                      e Zd ZU ded<   ded<   dddZedd       Zedd       Zedd	       Z	edd
       Z
edd       Zddd	 	 	 	 	 	 	 ddZd dZd dZ	 	 	 	 	 	 d!dZd"dZd#dZd$dZd%dZd&dZd'dZy)(Transformerztuple[int, ...] | Nonetypeszlist[pq.Format] | NoneformatsNc                     y r.   r/   )r0   rR   s     r4   rS   zTransformer.__init__   s    Sr6   c                     y r.   r/   )rQ   rR   s     r4   from_contextzTransformer.from_context   s    HKr6   c                     y r.   r/   rC   s    r4   rF   zTransformer.connection   s    8;r6   c                     y r.   r/   rC   s    r4   encodingzTransformer.encoding   s    "r6   c                     y r.   r/   rC   s    r4   rD   zTransformer.adapters   s    '*r6   c                     y r.   r/   rC   s    r4   pgresultzTransformer.pgresult   s    +.r6   T)set_loadersrN   c                    y r.   r/   )r0   resultrv   rN   s       r4   set_pgresultzTransformer.set_pgresult   s     r6   c                     y r.   r/   r0   rk   rN   s      r4   set_dumper_typeszTransformer.set_dumper_types       QTr6   c                     y r.   r/   r{   s      r4   set_loader_typeszTransformer.set_loader_types   r}   r6   c                     y r.   r/   )r0   paramsrl   s      r4   dump_sequencezTransformer.dump_sequence   s    "%r6   c                     y r.   r/   rU   s     r4   
as_literalzTransformer.as_literal   s    Sr6   c                     y r.   r/   r\   s      r4   
get_dumperzTransformer.get_dumper   s    r6   c                     y r.   r/   )r0   row0row1make_rows       r4   	load_rowszTransformer.load_rows   s    UXr6   c                     y r.   r/   )r0   rowr   s      r4   load_rowzTransformer.load_row   s    #r6   c                     y r.   r/   )r0   records     r4   load_sequencezTransformer.load_sequence   r}   r6   c                     y r.   r/   )r0   rO   rN   s      r4   
get_loaderzTransformer.get_loader   s    r6   r.   )rR   r`   )rR   r`   r9   rj   rI   )r9   strrH   )r9   PGresult | None)rx   r   rv   boolrN   zpq.Format | Noner9   None)rk   zSequence[int]rN   rM   r9   r   )r   zSequence[Any]rl   zSequence[PyFormat]r9   Sequence[Buffer | None])rV   r   r9   bytesra   )r   r7   r   r7   r   RowMaker[Row]r9   z	list[Row])r   r7   r   r   r9   r   )r   r   r9   ztuple[Any, ...])rO   r7   rN   rM   r9   rd   )r:   r;   r<   rb   rS   classmethodro   rJ   rF   rr   rD   ru   ry   r|   r   r   r   r   r   r   r   r   r/   r6   r4   rj   rj      s    !!##@K K; ;" "* *. . !#' 	
 ! 
 UT&#&.@&	 & 1CXETDr6   rj   )Ar=   
__future__r   typingr   r   r   r   r   collections.abcr	   r
   r   r    r   _enumsr   _compatr   r   r   r   rowsr   r   pq.abcr   waitingr   r   _adapters_mapr   _connection_baser   r   r   rb   r   	bytearray
memoryviewr   r   r   r   r    r!   r#   tupler$   r7   r%   dictr&   r'   r(   r)   r*   r,   r>   r?   rA   rL   rd   rj   r/   r6   r4   <module>r      s   # A A B B  ( 5 5# $*0d$  %J67	 7"=%N#RS S(23y 3(3-c)::;	 ;)1FG%b$h/ /T5)9#::;	9 ;S#t^,	9 ,3	>*) * i0Y 0
 T] sF{!3]B!FG	9 G
 V]B67y 7Vx V uftm34) 4x}-) -8 4PX PfX 0/E( /Er6   