
    i                       U d Z ddlmZ ddlmZmZmZmZ ddlmZ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   e	e*ef   f   Z+de$d<    edd      Z,eg df   Z-de$d<   ee"df   Z.de$d<   ee*e/df   Z0de$d<   ee*e0f   Z1de$d<   e	e*e0f   Z2de$d <    ed!      Z3ed"d#e3f   Z4de$d$<   	 ed%d#e3f   Z5de$d&<   	  G d' d(e
      Z6eegd)f   Z7de$d*<   ee(gef   Z8de$d+<    G d, d-e
      Z9 G d. d/e
      Z: G d0 d1e
      Z; G d2 d3e
      Z<y)4zN
Protocol objects representing different implementations of the same classes.
    )annotations)TYPE_CHECKINGAnyCallableDict)	GeneratorMappingProtocolSequenceUnion   )pq)PyFormat)LiteralString	TypeAliasTypeVar)sql)RowRowMaker)PGresult)ReadyWait)AdaptersMap)BaseConnectionNtypeNoneTyper   Bufferzsql.SQLzsql.ComposedQueryParamsConnectionTypezBaseConnection[Any])boundPipelineCommandztuple[DumperKey, ...]	DumperKey	ConnParamConnDictConnMappingRVztuple[int, Wait]zReady | int	PQGenConnr   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.
    Nc                     y N )selfgenfilenointervals       k/var/www/html/hwPaymentPortal-be-dev/hw-payment-portal-api/venv/lib/python3.12/site-packages/psycopg/abc.py__call__zWaitFunc.__call__;   s        r-   )r0   z	PQGen[RV]r1   intr2   zfloat | Nonereturnr'   )__name__
__module____qualname____doc__r4   r.   r5   r3   r+   r+   6   s3    
 EI&)5A	r5   r+   Buffer | None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.   r/   s    r3   adapterszAdaptContext.adaptersR   s     	r5   c                     y)zThe connection used by this object, if available.

        :rtype: `~psycopg.Connection` or `~psycopg.AsyncConnection` or `!None`
        Nr.   rB   s    r3   
connectionzAdaptContext.connectionW        	r5   Nr7   r   r7   zBaseConnection[Any] | None)r8   r9   r:   r;   propertyrC   rE   r.   r5   r3   r@   r@   F   s/    	    r5   r@   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formatr6   oidNc                     y r-   r.   )r/   clscontexts      r3   __init__zDumper.__init__p       r5   c                     y)zlConvert the object `!obj` to PostgreSQL representation.

        :param obj: the object to convert.
        Nr.   r/   objs     r3   dumpzDumper.dumpr       
 	r5   c                     y)ziConvert the object `!obj` to escaped representation.

        :param obj: the object to convert.
        Nr.   rU   s     r3   quotezDumper.quotey   rX   r5   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.   r/   rV   rM   s      r3   get_keyzDumper.get_key   s    D 	r5   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      r3   upgradezDumper.upgrade   s     	r5   r-   )rP   r   rQ   AdaptContext | None)rV   r   r7   r<   )rV   r   r7   r   )rV   r   rM   r   r7   r#   rV   r   rM   r   r7   rK   )
r8   r9   r:   r;   __annotations__rR   rW   rZ   r]   r_   r.   r5   r3   rK   rK   `   s6      
HQK"Hr5   rK   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.
    rL   rM   Nc                     y r-   r.   )r/   rN   rQ   s      r3   rR   zLoader.__init__   rS   r5   c                     y)z|
        Convert the data returned by the database into a Python object.

        :param data: the data to convert.
        Nr.   )r/   datas     r3   loadzLoader.load   rF   r5   r-   )rN   r6   rQ   r`   )rg   r   r7   r   )r8   r9   r:   r;   rb   rR   rh   r.   r5   r3   rd   rd      s      Kr5   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.   )r/   rQ   s     r3   rR   zTransformer.__init__   rS   r5   c                     y r-   r.   )rP   rQ   s     r3   from_contextzTransformer.from_context   s    HKr5   c                     y r-   r.   rB   s    r3   rE   zTransformer.connection   s    8;r5   c                     y r-   r.   rB   s    r3   encodingzTransformer.encoding   s    "r5   c                     y r-   r.   rB   s    r3   rC   zTransformer.adapters   s    '*r5   c                     y r-   r.   rB   s    r3   pgresultzTransformer.pgresult   s    +.r5   T)set_loadersrM   c                    y r-   r.   )r/   resultrv   rM   s       r3   set_pgresultzTransformer.set_pgresult   s     r5   c                     y r-   r.   r/   rk   rM   s      r3   set_dumper_typeszTransformer.set_dumper_types   rS   r5   c                     y r-   r.   r{   s      r3   set_loader_typeszTransformer.set_loader_types   rS   r5   c                     y r-   r.   )r/   paramsrl   s      r3   dump_sequencezTransformer.dump_sequence   s    "%r5   c                     y r-   r.   rU   s     r3   
as_literalzTransformer.as_literal   rS   r5   c                     y r-   r.   r\   s      r3   
get_dumperzTransformer.get_dumper   rS   r5   c                     y r-   r.   )r/   row0row1make_rows       r3   	load_rowszTransformer.load_rows   rS   r5   c                     y r-   r.   )r/   rowr   s      r3   load_rowzTransformer.load_row   rS   r5   c                     y r-   r.   )r/   records     r3   load_sequencezTransformer.load_sequence   rS   r5   c                     y r-   r.   )r/   rN   rM   s      r3   
get_loaderzTransformer.get_loader   rS   r5   r-   )rQ   r`   )rQ   r`   r7   rj   rH   )r7   strrG   )r7   PGresult | None)rx   r   rv   boolrM   zpq.Format | Noner7   None)rk   zSequence[int]rM   rL   r7   r   )r   zSequence[Any]rl   zSequence[PyFormat]r7   Sequence[Buffer | None])rV   r   r7   bytesra   )r   r6   r   r6   r   RowMaker[Row]r7   z	list[Row])r   r6   r   r   r7   r   )r   r   r7   ztuple[Any, ...])rN   r6   rM   rL   r7   rd   )r8   r9   r:   rb   rR   classmethodro   rI   rE   rr   rC   ru   ry   r|   r~   r   r   r   r   r   r   r   r.   r5   r3   rj   rj      s    !!##@K K; ;" "* *. . !#' 	
 ! 
 UT&#&.@&	 & 1CXETDr5   rj   )=r;   
__future__r   typingr   r   r   r   r   r	   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#   r6   r$   r%   r&   r'   r(   r)   r+   r=   r>   r@   rK   rd   rj   r.   r5   r3   <module>r      s   # 5 5 @ @  ( 6 6# $*0d$  %J67	 7y.HIy I(3-c)::;	 ;)1FG%b$h/ /T#::;	9 ;S#t^,	9 ,3	>*) * i0Y 0
 T] !3]B!FG	9 G
 V]B67y 7x  uo56) 6x}-) -8 4PX PfX 0/E( /Er5   