o
    "4g(                     @  sV  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
 ddlmZmZ ddlmZ ddlmZ dd	lmZmZmZ e
rgd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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) d)eZ6eegd*f Z7de$d+< ee(gef Z8de$d,< G d-d. d.eZ9G d/d0 d0eZ:G d1d2 d2eZ;G d3d4 d4eZ<dS )5zN
Protocol objects representing different implementations of the same classes.
    )annotations)AnyCallable	GeneratorMapping)ProtocolSequenceTYPE_CHECKING)DictUnion   )pq)PyFormat)LiteralString	TypeAliasTypeVar)sql)RowRowMaker)PGresult)WaitReady)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                   @  s   e Zd ZdZ	d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                 C     d S N )selfr*   r,   r.   r3   r3   T/var/www/html/authentication-server/venv/lib/python3.10/site-packages/psycopg/abc.py__call__<      zWaitFunc.__call__r2   )r*   r+   r,   r-   r.   r/   r0   r&   )__name__
__module____qualname____doc__r6   r3   r3   r3   r5   r)   7   s    r)   Buffer | NoneDumpFuncLoadFuncc                   @  s,   e Zd ZdZed
ddZed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.

    r0   r   c                 C     dS )z1The adapters configuration that this object uses.Nr3   r4   r3   r3   r5   adaptersS   s   zAdaptContext.adaptersBaseConnection[Any] | Nonec                 C  r@   )zThe connection used by this object, if available.

        :rtype: `~psycopg.Connection` or `~psycopg.AsyncConnection` or `!None`
        Nr3   rA   r3   r3   r5   
connectionX      zAdaptContext.connectionNr0   r   r0   rC   )r8   r9   r:   r;   propertyrB   rD   r3   r3   r3   r5   r?   G   s    r?   c                   @  sZ   e Zd ZU dZded< 	 ded< 	 ddddZdddZdddZd ddZd!ddZ	dS )"DumperzM
    Convert Python objects of type `!cls` to PostgreSQL representation.
    	pq.Formatformatr-   oidNclsr   contextAdaptContext | Nonec                 C  r1   r2   r3   )r4   rM   rN   r3   r3   r5   __init__q       zDumper.__init__objr   r0   r<   c                 C  r@   )zlConvert the object `!obj` to PostgreSQL representation.

        :param obj: the object to convert.
        Nr3   r4   rR   r3   r3   r5   dumps      zDumper.dumpr   c                 C  r@   )ziConvert the object `!obj` to escaped representation.

        :param obj: the object to convert.
        Nr3   rS   r3   r3   r5   quotez   rU   zDumper.quoter   r"   c                 C  r@   )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()`.

        Nr3   r4   rR   rK   r3   r3   r5   get_key   s   "zDumper.get_keyc                 C  r@   )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.
        Nr3   rW   r3   r3   r5   upgrade   s   zDumper.upgrader2   )rM   r   rN   rO   )rR   r   r0   r<   )rR   r   r0   r   )rR   r   rK   r   r0   r"   rR   r   rK   r   r0   rI   )
r8   r9   r:   r;   __annotations__rP   rT   rV   rX   rY   r3   r3   r3   r5   rI   a   s   
 


$rI   c                   @  s2   e Zd ZU dZded< 	 ddd	d
ZdddZdS )LoaderzK
    Convert PostgreSQL values with type OID `!oid` to Python objects.
    rJ   rK   NrL   r-   rN   rO   c                 C  r1   r2   r3   )r4   rL   rN   r3   r3   r5   rP      rQ   zLoader.__init__datar   r0   r   c                 C  r@   )z|
        Convert the data returned by the database into a Python object.

        :param data: the data to convert.
        Nr3   )r4   r]   r3   r3   r5   load   rE   zLoader.loadr2   )rL   r-   rN   rO   )r]   r   r0   r   )r8   r9   r:   r;   r[   rP   r^   r3   r3   r3   r5   r\      s   
 r\   c                   @  s   e Zd ZU ded< ded< dLdMdd	ZedNddZedOddZedPddZ	edQddZ
edRddZddddSd!d"ZdTd%d&ZdTd'd(ZdUd-d.ZdVd2d3ZdWd6d7ZdXd>d?ZdYdBdCZdZdFdGZd[dJdKZdS )\Transformerztuple[int, ...] | Nonetypeszlist[pq.Format] | NoneformatsNrN   rO   c                 C  r1   r2   r3   )r4   rN   r3   r3   r5   rP      rQ   zTransformer.__init__r0   c                 C  r1   r2   r3   )rM   rN   r3   r3   r5   from_context      zTransformer.from_contextrC   c                 C  r1   r2   r3   rA   r3   r3   r5   rD      rc   zTransformer.connectionstrc                 C  r1   r2   r3   rA   r3   r3   r5   encoding   rc   zTransformer.encodingr   c                 C  r1   r2   r3   rA   r3   r3   r5   rB      rc   zTransformer.adaptersPGresult | Nonec                 C  r1   r2   r3   rA   r3   r3   r5   pgresult   rc   zTransformer.pgresultT)set_loadersrK   resultrh   boolrK   pq.Format | NoneNonec                C  r1   r2   r3   )r4   ri   rh   rK   r3   r3   r5   set_pgresult   rE   zTransformer.set_pgresultSequence[int]rJ   c                 C  r1   r2   r3   r4   r`   rK   r3   r3   r5   set_dumper_types   rQ   zTransformer.set_dumper_typesc                 C  r1   r2   r3   ro   r3   r3   r5   set_loader_types   rQ   zTransformer.set_loader_typesparamsSequence[Any]Sequence[PyFormat]Sequence[Buffer | None]c                 C  r1   r2   r3   )r4   rr   ra   r3   r3   r5   dump_sequence   r7   zTransformer.dump_sequencerR   r   bytesc                 C  r1   r2   r3   rS   r3   r3   r5   
as_literal   rQ   zTransformer.as_literalr   rI   c                 C  r1   r2   r3   rW   r3   r3   r5   
get_dumper   rQ   zTransformer.get_dumperrow0r-   row1make_rowRowMaker[Row]	list[Row]c                 C  r1   r2   r3   )r4   rz   r{   r|   r3   r3   r5   	load_rows   rQ   zTransformer.load_rowsrow
Row | Nonec                 C  r1   r2   r3   )r4   r   r|   r3   r3   r5   load_row   rQ   zTransformer.load_rowrecordtuple[Any, ...]c                 C  r1   r2   r3   )r4   r   r3   r3   r5   load_sequence   rQ   zTransformer.load_sequencerL   r\   c                 C  r1   r2   r3   )r4   rL   rK   r3   r3   r5   
get_loader   rQ   zTransformer.get_loaderr2   )rN   rO   )rN   rO   r0   r_   rG   )r0   rd   rF   )r0   rf   )ri   rf   rh   rj   rK   rk   r0   rl   )r`   rn   rK   rJ   r0   rl   )rr   rs   ra   rt   r0   ru   )rR   r   r0   rw   rZ   )rz   r-   r{   r-   r|   r}   r0   r~   )r   r-   r|   r}   r0   r   )r   ru   r0   r   )rL   r-   rK   rJ   r0   r\   )r8   r9   r:   r[   rP   classmethodrb   rH   rD   re   rB   rg   rm   rp   rq   rv   rx   ry   r   r   r   r   r3   r3   r3   r5   r_      s4   
 







r_   )=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   r[   rw   	bytearray
memoryviewr   r   rd   r   r   r!   r"   r-   r#   r$   r%   r&   r'   r(   r)   r=   r>   r?   rI   r\   r_   r3   r3   r3   r5   <module>   sJ     S