
    | f                    6   U d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
mZmZ ddl	mZ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  ej        e          Zded<   	 ded<   	 ded<   ded<   ded<   ded<   ded<   ded<   ded<   d!dZ e             d ZdS )"z
psycopg libpq wrapper

This package exposes the libpq functionalities as Python objects and functions.

The real implementation (the binding to the C library) is
implementation-dependant but all the implementations share the same interface.
    )annotationsN)Callable   )abc)ConninfoOptionPGnotifyPGresAttDesc)error_messageversion_pretty)
ConnStatusDiagnosticField
ExecStatusFormatTrace)PingPipelineStatusPollingStatusTransactionStatusstr__impl__int__build_version__zCallable[[], int]versionztype[abc.PGconn]PGconnztype[abc.PGresult]PGresultztype[abc.Conninfo]Conninfoztype[abc.Escaping]Escapingztype[abc.PGcancel]PGcancelztype[abc.PGcancelConn]PGcancelConnreturnNonec                    t           j                            dd                                          d} g dfd
}rdk    r+	 ddlm}  n## t          $ r} |d|           Y d}~nd}~ww xY w| s3rdk    r+	 ddlm}  n## t          $ r} |d|           Y d}~nd}~ww xY w| s3rdk    r+	 ddlm	}  n## t          $ r} |d|           Y d}~nd}~ww xY w| rA| j
        a
| j        a| j        a| j        a| j        a| j        a| j        a| j        a| j        adS rt'          d d          d                    d D                       }t'          d|           )z
    Import pq objects implementation from the best libpq wrapper available.

    If an implementation is requested try to import only it, otherwise
    try to import the best implementation available.
    PSYCOPG_IMPL Nnamer   e	Exceptionr    r!   c                v    sd|  d| }                     |           d S d|  d| }t          |          |)Nzcouldn't import psycopg 'z' implementation: z#couldn't import requested psycopg ')appendImportError)r%   r&   msgattemptsimpls      I/var/www/equiseq/venv/lib/python3.11/site-packages/psycopg/pq/__init__.pyhandle_errorz'import_from_libpq.<locals>.handle_errorB   s^     	*IdIIaIICOOC     SSSPQSSCc"")    cr   )pqbinarypythonr   )	pq_ctypesz"requested psycopg implementation 'z	' unknown
c              3      K   | ]	}d | V  
dS )z- N ).0attempts     r.   	<genexpr>z$import_from_libpq.<locals>.<genexpr>l   s(      EEn7nnEEEEEEr0   z(no pq wrapper available.
Attempts made:
)r%   r   r&   r'   r    r!   )osenvirongetlower	psycopg_cr2   r'   psycopg_binaryr$   r5   r   r   r   r   r   r   r   r   r   r*   join)moduler/   r&   	sattemptsr,   r-   s       @@r.   import_from_libpqrE   3   sd    :>>."--3355DFH* * * * * * *  !43;;	!....... 	! 	! 	!La        	!  &4 &48#3#3	&3333333 	& 	& 	&L1%%%%%%%%	&  &4 &48#3#3	&------- 	& 	& 	&L1%%%%%%%%	&  
?.????*"4	 	
NtNNNOOOIIEEHEEEEE	  
 
 	
sH   	A 
A0A++A0>B 
B%B  B%3B: :
CCC)r   r   r   r   r   r   r   r   r   r   r   r   r	   r
   r   r   r   )r    r!   )__doc__
__future__r   r<   loggingtypingr   r$   r   miscr   r   r	   r
   r   _enumsr   r   r   r   r   r   r   r   r   	getLogger__name__logger__annotations__rE   __all__r8   r0   r.   <module>rQ      s     # " " " " " 				              8 8 8 8 8 8 8 8 8 8 / / / / / / / / J J J J J J J J J J J J J J J J J J J J J J J J J J		8	$	$ 
                             $ $ $ $?
 ?
 ?
 ?
D     r0   