
    j                       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@dS )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dS )WaitFunczU
    Wait on the connection which generated `PQgen` and return its final result.
    .gen	PQGen[RV]filenointintervalfloatreturnr(   c                    d S N )selfr-   r/   r1   s       V/DATA/AppData/hermes/projects/honcho/.venv/lib/python3.11/site-packages/psycopg/abc.py__call__zWaitFunc.__call__<             N).)r-   r.   r/   r0   r1   r2   r3   r(   )__name__
__module____qualname____doc__r9   r6   r;   r8   r,   r,   7   s,          VUUUUUUr;   r,   DumpFuncLoadFuncc                  B    e Zd ZdZedd            Zed	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.

    r3   r   c                    dS )z1The adapters configuration that this object uses.Nr6   r7   s    r8   adapterszAdaptContext.adaptersQ   s	     	r;   BaseConnection[Any] | Nonec                    dS )zThe connection used by this object, if available.

        :rtype: `~psycopg.Connection` or `~psycopg.AsyncConnection` or `!None`
        Nr6   rE   s    r8   
connectionzAdaptContext.connectionV   	     	r;   Nr3   r   r3   rG   )r<   r=   r>   r?   propertyrF   rI   r6   r;   r8   rC   rC   E   s^        	 	    X    X  r;   rC   c                  V    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	dS )DumperzM
    Convert Python objects of type `!cls` to PostgreSQL representation.
    	pq.Formatformatr0   oidNclsr   contextAdaptContext | Nonec                    d S r5   r6   )r7   rS   rT   s      r8   __init__zDumper.__init__o   r:   r;   objr   r3   Buffer | Nonec                    dS )zlConvert the object `!obj` to PostgreSQL representation.

        :param obj: the object to convert.
        Nr6   r7   rX   s     r8   dumpzDumper.dumpq   	    
 	r;   r   c                    dS )ziConvert the object `!obj` to escaped representation.

        :param obj: the object to convert.
        Nr6   r[   s     r8   quotezDumper.quotex   r]   r;   r   r$   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()`.

        Nr6   r7   rX   rQ   s      r8   get_keyzDumper.get_key   s
    D 	r;   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.
        Nr6   ra   s      r8   upgradezDumper.upgrade   s	     	r;   r5   )rS   r   rT   rU   )rX   r   r3   rY   )rX   r   r3   r   )rX   r   rQ   r   r3   r$   rX   r   rQ   r   r3   rO   )
r<   r=   r>   r?   __annotations__rW   r\   r_   rb   rd   r6   r;   r8   rO   rO   _   s            HHHQKKKKK      " " " "H     r;   rO   c                  2    e Zd ZU dZded<   	 ddd	ZddZdS )LoaderzK
    Convert PostgreSQL values with type OID `!oid` to Python objects.
    rP   rQ   NrR   r0   rT   rU   c                    d S r5   r6   )r7   rR   rT   s      r8   rW   zLoader.__init__   r:   r;   datar   r3   r   c                    dS )z|
        Convert the data returned by the database into a Python object.

        :param data: the data to convert.
        Nr6   )r7   rj   s     r8   loadzLoader.load   rJ   r;   r5   )rR   r0   rT   rU   )rj   r   r3   r   )r<   r=   r>   r?   rf   rW   rl   r6   r;   r8   rh   rh      sY            KJJJJ     r;   rh   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dAd            Z
edBd            ZddddCdZdDdZdDdZdEd$ZdFd(ZdGd+ZdHd2ZdId5ZdJd8ZdKd;ZdS )LTransformerztuple[int, ...] | Nonetypeszlist[pq.Format] | NoneformatsNrT   rU   c                    d S r5   r6   )r7   rT   s     r8   rW   zTransformer.__init__   r:   r;   r3   c                    d S r5   r6   )rS   rT   s     r8   from_contextzTransformer.from_context   s    HKr;   rG   c                    d S r5   r6   rE   s    r8   rI   zTransformer.connection   s    8;r;   strc                    d S r5   r6   rE   s    r8   encodingzTransformer.encoding   s    "sr;   r   c                    d S r5   r6   rE   s    r8   rF   zTransformer.adapters   s    '*sr;   PGresult | Nonec                    d S r5   r6   rE   s    r8   pgresultzTransformer.pgresult   s    +.3r;   T)set_loadersrQ   resultr|   boolrQ   pq.Format | NoneNonec                   d S r5   r6   )r7   r}   r|   rQ   s       r8   set_pgresultzTransformer.set_pgresult   s	     sr;   Sequence[int]rP   c                    d S r5   r6   r7   ro   rQ   s      r8   set_dumper_typeszTransformer.set_dumper_types   r:   r;   c                    d S r5   r6   r   s      r8   set_loader_typeszTransformer.set_loader_types   r:   r;   paramsSequence[Any]Sequence[PyFormat]Sequence[Buffer | None]c                    d S r5   r6   )r7   r   rp   s      r8   dump_sequencezTransformer.dump_sequence   s    "%#r;   rX   r   bytesc                    d S r5   r6   r[   s     r8   
as_literalzTransformer.as_literal   r:   r;   r   rO   c                    d S r5   r6   ra   s      r8   
get_dumperzTransformer.get_dumper   r:   r;   row0r0   row1make_rowRowMaker[Row]	list[Row]c                    d S r5   r6   )r7   r   r   r   s       r8   	load_rowszTransformer.load_rows   r:   r;   rowr   c                    d S r5   r6   )r7   r   r   s      r8   load_rowzTransformer.load_row   r:   r;   recordtuple[Any, ...]c                    d S r5   r6   )r7   r   s     r8   load_sequencezTransformer.load_sequence   r:   r;   rR   rh   c                    d S r5   r6   )r7   rR   rQ   s      r8   
get_loaderzTransformer.get_loader   r:   r;   r5   )rT   rU   )rT   rU   r3   rn   rL   )r3   ru   rK   )r3   ry   )r}   ry   r|   r~   rQ   r   r3   r   )ro   r   rQ   rP   r3   r   )r   r   rp   r   r3   r   )rX   r   r3   r   re   )r   r0   r   r0   r   r   r3   r   )r   r0   r   r   r3   r   )r   r   r3   r   )rR   r0   rQ   rP   r3   rh   )r<   r=   r>   rf   rW   classmethodrs   rM   rI   rw   rF   r{   r   r   r   r   r   r   r   r   r   r   r6   r;   r8   rn   rn      sF        !!!!####@@@@@KKK [K;;; X;""" X"*** X*... X. !#'      UTTTTTTT& & & & 1000CCCCXXXXEEEETTTTDDDDDDr;   rn   )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   rf   r   	bytearray
memoryviewr   r   r   ru   r    r!   r#   tupler$   r0   r%   dictr&   r'   r(   r)   r*   r,   r@   rA   rC   rO   rh   rn   r6   r;   r8   <module>r      s     # " " " " " A A A A A A A A A A A A A A B B B B B B B B B B B B       ( ( ( ( ( ( 5 5 5 5 5 5 5 5 5 5 1########      $$$$$$$$******000000d     %J67 7 7 7 7"=%N#RS S S S S(23 3 3 3 3(3-c)::; ; ; ; ;)1FGGG%b$h/ / / / /T5)9#::;	 ; ; ; ;S#t^,	 , , , ,3	>* * * * * i0 0 0 0 0
 WT]] sF{!3]B!FG	 G G G G
 V]B67 7 7 7 7V V V V Vx V V V uftm34 4 4 4 4x}- - - - -    8   4P P P P PX P P Pf    X   0/E /E /E /E /E( /E /E /E /E /Er;   