
    | f                    2   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j2                  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y) 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]PGcancelConnc                    t         j                  j                  dd      j                         d} g dfd}rdk(  r	 ddlm}  | srdk(  r	 ddlm}  | srd	k(  r	 d
dlm	}  | rm| j                  a
| j                  a| j                  a| j                  a| j                  a| j                  a| j                   a| j"                  a| j$                  ayrt'        d d      dj)                  d D              }t'        d|       # t        $ r} |d|       Y d}~d}~ww xY w# t        $ r} |d|       Y d}~d}~ww xY w# t        $ r} |d	|       Y d}~d}~ww xY w)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 Nc                d    sd|  d| }j                  |       y d|  d| }t        |      |)Nzcouldn't import psycopg 'z' implementation: z#couldn't import requested psycopg ')appendImportError)namee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   sF    -dV3EaSICOOC 7v=OPQsSCc")    cr   )pqbinarypythonr   )	pq_ctypesz"requested psycopg implementation 'z	' unknown
c              3  &   K   | ]	  }d |   yw)z- N ).0attempts     r+   	<genexpr>z$import_from_libpq.<locals>.<genexpr>l   s     E7)nEs   z(no pq wrapper available.
Attempts made:
)r&   r   r'   	ExceptionreturnNone)osenvirongetlower	psycopg_cr/   r9   psycopg_binaryr"   r2   r   r   r   r   r   r   r   r   r   r%   join)moduler,   r'   	sattemptsr)   r*   s       @@r+   import_from_libpqrE   3   sp    ::>>."-335DFH* 43;	!.
 448#3	&3
 448#3	&- ??..????????**"44	>tfINOOIIEHEE	 
 	
?  	!a  	!  	&1%%	&  	&1%%	&sH   D D/ $E 	D,	D''D,/	E8	EE	E*	E%%E*)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__r5   r-   r+   <module>rQ      s    # 	    8 8 / J J J J			8	$

   
  
 
 
 
 $ $?
D  r-   