
    *Jf(                        U d Z ddlZddlZddlmZmZmZ ddlmZ ddl	m
Z
mZm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  ej        e          Zeed
<   	 eed<   	 eg ef         ed<   eej                 ed<   eej                 ed<   eej                  ed<   eej!                 ed<   eej"                 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.
    N)CallableListType   )abc)ConninfoOptionPGnotifyPGresAttDesc)error_message)
ConnStatusDiagnosticField
ExecStatusFormatTrace)PingPipelineStatusPollingStatusTransactionStatus__impl____build_version__versionPGconnPGresultConninfoEscapingPGcancelreturnc                     t           j                            dd                                          d} g dt          dt
          ddf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| r:| 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nameer   c                     s9d|  d| }t                               |                               |           d S d|  d| }t          |          |)Nzcouldn't import psycopg 'z' implementation: z#couldn't import requested psycopg ')loggerdebugappendImportError)r!   r"   msgattemptsimpls      V/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/psycopg/pq/__init__.pyhandle_errorz'import_from_libpq.<locals>.handle_error?   sp     	*IdIIaIICLL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>i   s(      EEn7nnEEEEEEr-   z(no pq wrapper available.
Attempts made:
)osenvirongetlowerstr	Exception	psycopg_cr/   psycopg_binaryr    r2   r   r   r   r   r   r   r   r   r'   join)moduler,   r"   	sattemptsr)   r*   s       @@r+   import_from_libpqrD   0   sq    :>>."--3355DFH*3 *9 * * * * * * * *  !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   
B *A;;B B 
B5B00B5C
 

C*C%%C*)r   r   r   r   r   r   r   r   r   r   r	   r   r
   r   r   r   )r   N)%__doc__r9   loggingtypingr   r   r   r    r   miscr   r	   r
   r   _enumsr   r   r   r   r   r   r   r   r   	getLogger__name__r$   r=   __annotations__intr   r   r   r   r   rD   __all__r5   r-   r+   <module>rO      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	$	$

     
"c'	   SZ   
s|
   
s|
   
s|
   
s|
   ?
 ?
 ?
 ?
D     r-   