
    R
hV                    &   d Z ddlmZ ddlmZmZ ddlmZmZ ddl	mZm
Z
 ddlmZ ddlmZ dd	lmZ erdd
lmZ ej        Z ed          Z G d dej        e          Z G d dej        e          Z G d de          Z G d de          ZdS )z)
Entry point into the adaptation system.
    )annotations)ABCabstractmethod)TYPE_CHECKINGAny   )abcpq)PyFormat)Transformer)AdaptersMap)BaseConnection\c                      e Zd ZU dZdZded<   	 ej        j        Z	ded<   	 dddZ
ddZedd            ZddZddZd dZdS )!DumperzP
    Convert Python object of the type `!cls` to PostgreSQL representation.
    r   intoid	pq.FormatformatNclstypecontextabc.AdaptContext | Nonec                8    || _         |  |r|j        nd | _        d S N)r   
connection)selfr   r   s      X/var/www/html/01_SiteInternet/03_Maps/venv/lib/python3.11/site-packages/psycopg/adapt.py__init__zDumper.__init__&   '    307A',,T    returnstrc           
         dt          |           j         dt          |           j         d| j         dt	          |           dd	S )N<.z (oid=z) at 0xx>)r   
__module____qualname__r   id)r   s    r   __repr__zDumper.__repr__+   s`    4T

% 4 4T

(? 4 4X4 4&(hh34 4 4	
r!   objr   Buffer | Nonec                    d S r    )r   r-   s     r   dumpzDumper.dump1   s    /2sr!   Bufferc                   |                      |          }|dS | j        r3t          j        | j        j                  }|                    |          S t          j                    }|                    |          }t          |vrd|z   dz   S d|z   dz   }|                    d          dk    r|                    dd          }|S )z
        By default return the `dump()` value quoted and sanitised, so
        that the result can be used to build a SQL string. This works well
        for most types and you won't likely have to implement this method in a
        subclass.
        Ns   NULL   's    E'   \s   \\)	r1   r   r
   Escapingpgconnescape_literalescape_stringORD_BSreplace)r   r-   valueescoutrvs         r   quotezDumper.quote4   s     		#=7? 	-+do455C%%e,,, kmm&&  #:$$ SL4'U##u,,E7++B	r!   r   abc.DumperKeyc                    | j         S )a  
        Implementation of the `~psycopg.abc.Dumper.get_key()` member of the
        `~psycopg.abc.Dumper` protocol. Look at its definition for details.

        This implementation returns the `!cls` passed in the constructor.
        Subclasses needing to specialise the PostgreSQL type according to the
        *value* of the object dumped (not only according to to its type)
        should override this class.

        )r   r   r-   r   s      r   get_keyzDumper.get_keya   s     xr!   c                    | S )a/  
        Implementation of the `~psycopg.abc.Dumper.upgrade()` member of the
        `~psycopg.abc.Dumper` protocol. Look at its definition for details.

        This implementation just returns `!self`. If a subclass implements
        `get_key()` it should probably override `!upgrade()` too.
        r0   rC   s      r   upgradezDumper.upgraden   s	     r!   r   r   r   r   r   )r"   r#   )r-   r   r"   r.   )r-   r   r"   r2   )r-   r   r   r   r"   rA   )r-   r   r   r   r"   r   )__name__r)   r*   __doc__r   __annotations__r
   FormatTEXTr   r   r,   r   r1   r@   rD   rF   r0   r!   r   r   r      s           CLLLL2	F&&&&(B B B B B

 
 
 
 222 ^2+ + + +Z        r!   r   c                  Z    e Zd ZU dZej        j        Zded<   	 ddd	Z	e
dd            ZdS )LoaderzK
    Convert PostgreSQL values with type OID `!oid` to Python objects.
    r   r   Nr   r   r   r   c                8    || _         |  |r|j        nd | _        d S r   )r   r   )r   r   r   s      r   r   zLoader.__init__   r    r!   datar2   r"   r   c                    dS )z.Convert a PostgreSQL value to a Python object.Nr0   )r   rP   s     r   loadzLoader.load   s	     	r!   r   r   r   r   r   )rP   r2   r"   r   )rH   r)   r*   rI   r
   rK   rL   r   rJ   r   r   rR   r0   r!   r   rN   rN   y   sx           	F&&&&(B B B B B
    ^  r!   rN   c                  &     e Zd ZdZdd	 fdZ xZS )
RecursiveDumperz:Dumper with a transformer to help dumping recursive types.Nr   r   r   r   c                ~    t                                          ||           t          j        |          | _        d S r   superr   r   from_context_tx)r   r   r   	__class__s      r   r   zRecursiveDumper.__init__   3    g&&&+G44r!   r   rG   rH   r)   r*   rI   r   __classcell__r[   s   @r   rU   rU      H        DD5 5 5 5 5 5 5 5 5 5 5r!   rU   c                  &     e Zd ZdZdd	 fdZ xZS )
RecursiveLoaderz:Loader with a transformer to help loading recursive types.Nr   r   r   r   c                ~    t                                          ||           t          j        |          | _        d S r   rW   )r   r   r   r[   s      r   r   zRecursiveLoader.__init__   r\   r!   r   rS   r]   r_   s   @r   rb   rb      r`   r!   rb   N)rI   
__future__r   r	   r   r   typingr   r    r
   _enumsr   _transformerr   _adapters_mapr   _connection_baser   r2   ordr:   r   rN   rU   rb   r0   r!   r   <module>rl      s    # " " " " " # # # # # # # # % % % % % % % %         ) ( ( ( ( ( 4 4 4 4 4 4 5 5 5 5 5 5 1000000		T[ [ [ [ [SZ [ [ [|    SZ   &5 5 5 5 5f 5 5 55 5 5 5 5f 5 5 5 5 5r!   