
    2i                       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       J/var/www/html/secretsanta/venv/lib/python3.12/site-packages/psycopg/abc.py__call__zWaitFunc.__call__<           N).)r1   z	PQGen[RV]r2   intr3   floatreturnr(   )__name__
__module____qualname____doc__r5   r/   r7   r4   r,   r,   7   s     Vr7   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     	r7   c                     y)zThe connection used by this object, if available.

        :rtype: `~psycopg.Connection` or `~psycopg.AsyncConnection` or `!None`
        Nr/   rD   s    r4   
connectionzAdaptContext.connectionV        	r7   Nr:   r   r:   zBaseConnection[Any] | None)r;   r<   r=   r>   propertyrE   rG   r/   r7   r4   rB   rB   E   s/    	    r7   rB   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formatr8   oidNc                     y r.   r/   )r0   clscontexts      r4   __init__zDumper.__init__o   r6   r7   c                     y)zlConvert the object `!obj` to PostgreSQL representation.

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

        :param obj: the object to convert.
        Nr/   rV   s     r4   quotezDumper.quotex   rY   r7   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   rW   rO   s      r4   get_keyzDumper.get_key   s    D 	r7   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     	r7   r.   )rR   r   rS   AdaptContext | None)rW   r   r:   zBuffer | None)rW   r   r:   r   )rW   r   rO   r   r:   r$   rW   r   rO   r   r:   rM   )
r;   r<   r=   r>   __annotations__rT   rX   r[   r^   r`   r/   r7   r4   rM   rM   _   s6      
HQK"Hr7   rM   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.
    rN   rO   Nc                     y r.   r/   )r0   rP   rS   s      r4   rT   zLoader.__init__   r6   r7   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   rH   r7   r.   )rP   r8   rS   ra   )rh   r   r:   r   )r;   r<   r=   r>   rc   rT   ri   r/   r7   r4   re   re      s      Kr7   re   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   rS   s     r4   rT   zTransformer.__init__   r6   r7   c                     y r.   r/   )rR   rS   s     r4   from_contextzTransformer.from_context   s    HKr7   c                     y r.   r/   rD   s    r4   rG   zTransformer.connection   s    8;r7   c                     y r.   r/   rD   s    r4   encodingzTransformer.encoding   s    "r7   c                     y r.   r/   rD   s    r4   rE   zTransformer.adapters   s    '*r7   c                     y r.   r/   rD   s    r4   pgresultzTransformer.pgresult   s    +.r7   T)set_loadersrO   c                    y r.   r/   )r0   resultrw   rO   s       r4   set_pgresultzTransformer.set_pgresult   s     r7   c                     y r.   r/   r0   rl   rO   s      r4   set_dumper_typeszTransformer.set_dumper_types   r6   r7   c                     y r.   r/   r|   s      r4   set_loader_typeszTransformer.set_loader_types   r6   r7   c                     y r.   r/   )r0   paramsrm   s      r4   dump_sequencezTransformer.dump_sequence   s    "%r7   c                     y r.   r/   rV   s     r4   
as_literalzTransformer.as_literal   r6   r7   c                     y r.   r/   r]   s      r4   
get_dumperzTransformer.get_dumper   r6   r7   c                     y r.   r/   )r0   row0row1make_rows       r4   	load_rowszTransformer.load_rows   r6   r7   c                     y r.   r/   )r0   rowr   s      r4   load_rowzTransformer.load_row   r6   r7   c                     y r.   r/   )r0   records     r4   load_sequencezTransformer.load_sequence   r6   r7   c                     y r.   r/   )r0   rP   rO   s      r4   
get_loaderzTransformer.get_loader   r6   r7   r.   )rS   ra   )rS   ra   r:   rk   rJ   )r:   strrI   )r:   PGresult | None)ry   r   rw   boolrO   zpq.Format | Noner:   None)rl   zSequence[int]rO   rN   r:   r   )r   zSequence[Any]rm   zSequence[PyFormat]r:   Sequence[Buffer | None])rW   r   r:   bytesrb   )r   r8   r   r8   r   RowMaker[Row]r:   z	list[Row])r   r8   r   r   r:   r   )r   r   r:   ztuple[Any, ...])rP   r8   rO   rN   r:   re   )r;   r<   r=   rc   rT   classmethodrp   rK   rG   rs   rE   rv   rz   r}   r   r   r   r   r   r   r   r   r/   r7   r4   rk   rk      s    !!##@K K; ;" "* *. . !#' 	
 ! 
 UT&#&.@&	 & 1CXETDr7   rk   )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   rc   r   	bytearray
memoryviewr   r   r   r   r    r!   r#   tupler$   r8   r%   dictr&   r'   r(   r)   r*   r,   r?   r@   rB   rM   re   rk   r/   r7   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r7   