
    *Jf                        U d 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
mZ ddlmZ ddlmZ ddlmZ ddlmZ dd	l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$e#e%d<   ee&e'e(f         Z)ee%d<   eee&ddf         Z*ee%d<   eee         ee+ef         f         Z,ee%d<    e
dd          Z-eg df         Z.ee%d<   ee#e	d         f         Z/ee%d<    e
d          Z0ee	e1df         de0f         Z2ee%d <   	 edde0f         Z3ee%d!<   	  G d" d#e          Z4eege)f         Z5ee%d$<   ee)gef         Z6ee%d%<    G d& d'e          Z7 G d( d)e          Z8 G d* d+e          Z9 G d, d-e          Z:dS ).zN
Protocol objects representing different implementations of the same classes.
    )AnyCallable	GeneratorMapping)ListOptionalSequenceTupleTypeVarUnion)TYPE_CHECKING)	TypeAlias   )pq)PyFormat)ProtocolLiteralString)sql)RowRowMaker)PGresult)WaitReady)BaseConnection)AdaptersMapNNoneTypeBufferzsql.SQLzsql.ComposedQueryParamsConnectionTypeBaseConnection[Any])boundPipelineCommand)	DumperKey.r$   RVr   r   	PQGenConnPQGenc            	       F    e Zd ZdZ	 ddee         dedee         defdZ	dS )	WaitFunczU
    Wait on the connection which generated `PQgen` and return its final result.
    Ngenfilenotimeoutreturnc                     d S N )selfr*   r+   r,   s       N/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/psycopg/abc.py__call__zWaitFunc.__call__7   s    S    r/   )
__name__
__module____qualname____doc__r'   r%   intr   floatr3   r0   r4   r2   r)   r)   2   sf         
 GK 9&)4<UO	     r4   r)   DumpFuncLoadFuncc                   R    e Zd ZdZedd            Zeded         fd            ZdS )	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.

    r-   r   c                     dS )z1The adapters configuration that this object uses.Nr0   r1   s    r2   adapterszAdaptContext.adaptersN   s	     	r4   r!   c                     dS )zThe connection used by this object, if available.

        :rtype: `~psycopg.Connection` or `~psycopg.AsyncConnection` or `!None`
        Nr0   r@   s    r2   
connectionzAdaptContext.connectionS   	     	r4   Nr-   r   )r5   r6   r7   r8   propertyrA   r   rC   r0   r4   r2   r>   r>   B   sk        	 	    X H%:;    X  r4   r>   c                       e Zd ZU dZej        ed<   	 eed<   	 ddede	e
         fdZded	efd
Zded	efdZdeded	efdZdeded	d fdZdS )DumperzM
    Convert Python objects of type `!cls` to PostgreSQL representation.
    formatoidNclscontextc                     d S r/   r0   )r1   rK   rL   s      r2   __init__zDumper.__init__l         r4   objr-   c                     dS )zlConvert the object `!obj` to PostgreSQL representation.

        :param obj: the object to convert.
        Nr0   r1   rP   s     r2   dumpzDumper.dumpn   	    
 	r4   c                     dS )ziConvert the object `!obj` to escaped representation.

        :param obj: the object to convert.
        Nr0   rR   s     r2   quotezDumper.quoteu   rT   r4   c                     dS )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()`.

        Nr0   r1   rP   rI   s      r2   get_keyzDumper.get_key|   s
    D 	r4   c                     dS )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.
        Nr0   rX   s      r2   upgradezDumper.upgrade   s	     	r4   r/   )r5   r6   r7   r8   r   Format__annotations__r9   typer   r>   rN   r   r   rS   rV   r   r$   rY   r[   r0   r4   r2   rH   rH   \   s           I 
HHHQNNDN8L+ANNNN          "3 " "Y " " " "H3  X      r4   rH   c                   X    e Zd ZU dZej        ed<   	 d
dedee	         fdZ
dedefd	ZdS )LoaderzK
    Convert PostgreSQL values with type OID `!oid` to Python objects.
    rI   NrJ   rL   c                     d S r/   r0   )r1   rJ   rL   s      r2   rN   zLoader.__init__   rO   r4   datar-   c                     dS )z|
        Convert the data returned by the database into a Python object.

        :param data: the data to convert.
        Nr0   )r1   rb   s     r2   loadzLoader.load   rD   r4   r/   )r5   r6   r7   r8   r   r\   r]   r9   r   r>   rN   r   r   rd   r0   r4   r2   r`   r`      sx           I NMCM(<*@MMMM C      r4   r`   c            	          e Zd ZU eeedf                  ed<   eeej	                          ed<   d)dee
         fdZedee
         dd fd            Zeded	         fd
            Zedefd            Zed*d            Zeded         fd            Zdddded         dedeej	                 ddfdZdee         dej	        ddfdZdee         dej	        ddfdZdee         dee         deee                  fdZdedefdZdededefdZ dededd ded!         fd"Z!d#edd ded!         fd$Z"d%eee                  deedf         fd&Z#d'edej	        de$fd(Z%dS )+Transformer.typesformatsNrL   c                     d S r/   r0   )r1   rL   s     r2   rN   zTransformer.__init__   rO   r4   r-   c                     d S r/   r0   )rK   rL   s     r2   from_contextzTransformer.from_context   s    MPSr4   r!   c                     d S r/   r0   r@   s    r2   rC   zTransformer.connection   s    =@Sr4   c                     d S r/   r0   r@   s    r2   encodingzTransformer.encoding   s    "sr4   r   c                     d S r/   r0   r@   s    r2   rA   zTransformer.adapters   s    ),r4   r   c                     d S r/   r0   r@   s    r2   pgresultzTransformer.pgresult   s    03r4   T)set_loadersrI   resultrr   rI   c                    d S r/   r0   )r1   rs   rr   rI   s       r2   set_pgresultzTransformer.set_pgresult   s	     sr4   c                     d S r/   r0   r1   rg   rI   s      r2   set_dumper_typeszTransformer.set_dumper_types   rO   r4   c                     d S r/   r0   rw   s      r2   set_loader_typeszTransformer.set_loader_types   rO   r4   paramsc                     d S r/   r0   )r1   r{   rh   s      r2   dump_sequencezTransformer.dump_sequence   s    %(Sr4   rP   c                     d S r/   r0   rR   s     r2   
as_literalzTransformer.as_literal   rO   r4   c                     d S r/   r0   rX   s      r2   
get_dumperzTransformer.get_dumper   rO   r4   row0row1make_rowzRowMaker[Row]r   c                     d S r/   r0   )r1   r   r   r   s       r2   	load_rowszTransformer.load_rows   s    cr4   rowc                     d S r/   r0   )r1   r   r   s      r2   load_rowzTransformer.load_row   rO   r4   recordc                     d S r/   r0   )r1   r   s     r2   load_sequencezTransformer.load_sequence   rO   r4   rJ   c                     d S r/   r0   )r1   rJ   rI   s      r2   
get_loaderzTransformer.get_loader   rO   r4   r/   rE   )&r5   r6   r7   r   r
   r9   r]   r   r   r\   r>   rN   classmethodrk   rF   rC   strrn   rA   rq   boolru   r	   rx   rz   r   r   r   r}   bytesr   rH   r   r   r   r   r`   r   r0   r4   r2   rf   rf      s        E#s(O$$$$d29o&&&&CC 6CCCCP8L#9PmPPP [P@H%:;@@@ X@"#""" X",,, X,3(:.333 X3 !&*  $ 	
 # 
    UhsmTRYT4TTTTThsmTRYT4TTTT)sm).6x.@)	(6"	#) ) ) ) 1c0e0000CcC8CCCCC".=	e    TCS?SxSSSSWHXf-=$>W5c?WWWWDcD29DDDDDDDr4   rf   );r8   typingr   r   r   r   r   r   r	   r
   r   r   r   typing_extensionsr    r   _enumsr   _compatr   r   r   rowsr   r   pq.abcr   waitingr   r   rC   r   _adapters_mapr   r^   r   r]   r   	bytearray
memoryviewr   r   r   r   r    r#   r$   r%   r9   r&   r'   r)   r;   r<   r>   rH   r`   rf   r0   r4   r2   <module>r      s     5 4 4 4 4 4 4 4 4 4 4 4 B B B B B B B B B B B B B B B B             ' ' ' ' ' '       ( ( ( ( ( ( , , , , , , , , +########      $$$$$$$$************d$    %J67	 7 7 7y.HIy I I I(3-c)::;	 ; ; ;)1FGGG%b$h/ / / /T5)9#::;	9 ; ; ; WT]] sF{!3Wb!@A	9 A A A
 VWb01y 1 1 1    x    uf}-) - - -x}-) - - -    8   4P P P P PX P P Pf    X   01E 1E 1E 1E 1E( 1E 1E 1E 1E 1Er4   