
    R
h                    @   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<dS )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dS )WaitFunczU
    Wait on the connection which generated `PQgen` and return its final result.
    Ngen	PQGen[RV]filenointintervalfloat | Nonereturnr'   c                    d S N )selfr,   r.   r0   s       V/var/www/html/01_SiteInternet/03_Maps/venv/lib/python3.11/site-packages/psycopg/abc.py__call__zWaitFunc.__call__;   s    S    r4   )r,   r-   r.   r/   r0   r1   r2   r'   )__name__
__module____qualname____doc__r8   r5   r9   r7   r+   r+   6   s>         
 EI      r9   r+   Buffer | None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.

    r2   r   c                    dS )z1The adapters configuration that this object uses.Nr5   r6   s    r7   adapterszAdaptContext.adaptersR   s	     	r9   BaseConnection[Any] | Nonec                    dS )zThe connection used by this object, if available.

        :rtype: `~psycopg.Connection` or `~psycopg.AsyncConnection` or `!None`
        Nr5   rD   s    r7   
connectionzAdaptContext.connectionW   	     	r9   Nr2   r   r2   rF   )r:   r;   r<   r=   propertyrE   rH   r5   r9   r7   rB   rB   F   s^        	 	    X    X  r9   rB   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formatr/   oidNclsr   contextAdaptContext | Nonec                    d S r4   r5   )r6   rR   rS   s      r7   __init__zDumper.__init__p         r9   objr   r2   r>   c                    dS )zlConvert the object `!obj` to PostgreSQL representation.

        :param obj: the object to convert.
        Nr5   r6   rX   s     r7   dumpzDumper.dumpr   	    
 	r9   r   c                    dS )ziConvert the object `!obj` to escaped representation.

        :param obj: the object to convert.
        Nr5   rZ   s     r7   quotezDumper.quotey   r\   r9   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()`.

        Nr5   r6   rX   rP   s      r7   get_keyzDumper.get_key   s
    D 	r9   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.
        Nr5   r`   s      r7   upgradezDumper.upgrade   s	     	r9   r4   )rR   r   rS   rT   )rX   r   r2   r>   )rX   r   r2   r   )rX   r   rP   r   r2   r#   rX   r   rP   r   r2   rN   )
r:   r;   r<   r=   __annotations__rV   r[   r^   ra   rc   r5   r9   r7   rN   rN   `   s            HHHQKKKKK      " " " "H     r9   rN   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.
    rO   rP   NrQ   r/   rS   rT   c                    d S r4   r5   )r6   rQ   rS   s      r7   rV   zLoader.__init__   rW   r9   datar   r2   r   c                    dS )z|
        Convert the data returned by the database into a Python object.

        :param data: the data to convert.
        Nr5   )r6   ri   s     r7   loadzLoader.load   rI   r9   r4   )rQ   r/   rS   rT   )ri   r   r2   r   )r:   r;   r<   r=   re   rV   rk   r5   r9   r7   rg   rg      sY            KJJJJ     r9   rg   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formatsNrS   rT   c                    d S r4   r5   )r6   rS   s     r7   rV   zTransformer.__init__   rW   r9   r2   c                    d S r4   r5   )rR   rS   s     r7   from_contextzTransformer.from_context   s    HKr9   rF   c                    d S r4   r5   rD   s    r7   rH   zTransformer.connection   s    8;r9   strc                    d S r4   r5   rD   s    r7   encodingzTransformer.encoding   s    "sr9   r   c                    d S r4   r5   rD   s    r7   rE   zTransformer.adapters   s    '*sr9   PGresult | Nonec                    d S r4   r5   rD   s    r7   pgresultzTransformer.pgresult   s    +.3r9   T)set_loadersrP   resultr{   boolrP   pq.Format | NoneNonec                   d S r4   r5   )r6   r|   r{   rP   s       r7   set_pgresultzTransformer.set_pgresult   s	     sr9   Sequence[int]rO   c                    d S r4   r5   r6   rn   rP   s      r7   set_dumper_typeszTransformer.set_dumper_types   rW   r9   c                    d S r4   r5   r   s      r7   set_loader_typeszTransformer.set_loader_types   rW   r9   paramsSequence[Any]Sequence[PyFormat]Sequence[Buffer | None]c                    d S r4   r5   )r6   r   ro   s      r7   dump_sequencezTransformer.dump_sequence   s    "%#r9   rX   r   bytesc                    d S r4   r5   rZ   s     r7   
as_literalzTransformer.as_literal   rW   r9   r   rN   c                    d S r4   r5   r`   s      r7   
get_dumperzTransformer.get_dumper   rW   r9   row0r/   row1make_rowRowMaker[Row]	list[Row]c                    d S r4   r5   )r6   r   r   r   s       r7   	load_rowszTransformer.load_rows   rW   r9   row
Row | Nonec                    d S r4   r5   )r6   r   r   s      r7   load_rowzTransformer.load_row   rW   r9   recordtuple[Any, ...]c                    d S r4   r5   )r6   r   s     r7   load_sequencezTransformer.load_sequence   rW   r9   rQ   rg   c                    d S r4   r5   )r6   rQ   rP   s      r7   
get_loaderzTransformer.get_loader   rW   r9   r4   )rS   rT   )rS   rT   r2   rm   rK   )r2   rt   rJ   )r2   rx   )r|   rx   r{   r}   rP   r~   r2   r   )rn   r   rP   rO   r2   r   )r   r   ro   r   r2   r   )rX   r   r2   r   rd   )r   r/   r   r/   r   r   r2   r   )r   r/   r   r   r2   r   )r   r   r2   r   )rQ   r/   rP   rO   r2   rg   )r:   r;   r<   re   rV   classmethodrr   rL   rH   rv   rE   rz   r   r   r   r   r   r   r   r   r   r   r5   r9   r7   rm   rm      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LLLLTTTTDDDDDDr9   rm   )=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   re   r   	bytearray
memoryviewr   r   rt   r   r    r"   r#   r/   r$   r%   r&   r'   r(   r)   r+   r?   r@   rB   rN   rg   rm   r5   r9   r7   <module>r      s     # " " " " " 5 5 5 5 5 5 5 5 5 5 5 5 @ @ @ @ @ @ @ @ @ @ @ @ @ @       ( ( ( ( ( ( 6 6 6 6 6 6 6 6 6 6 1########      $$$$$$$$******000000d     %J67 7 7 7 7y.HI I I I I(3-c)::; ; ; ; ;)1FGGG%b$h/ / / / /T#::;	 ; ; ; ;S#t^,	 , , , ,3	>* * * * * i0 0 0 0 0
 WT]] !3]B!FG	 G G G G
 V]B67 7 7 7 7    x    uo56 6 6 6 6x}- - - - -    8   4P P P P PX P P Pf    X   0/E /E /E /E /E( /E /E /E /E /Er9   