o
    6	f(                     @   s  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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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               
      s  t jdd d} g  dtdtddf fdd}r!d	krAzd
dlm}  W n ty@ } z|d	| W Y d}~nd}~ww | sirIdkrizd
dlm}  W n tyh } z|d| W Y d}~nd}~ww | srqdkrzddl	m
}  W n ty } z|d| W Y d}~nd}~ww | r| ja| ja| ja| ja| ja| ja| ja| jadS rtd 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                    sF   sd|  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impl L/home/ertert/spirit/venv/lib/python3.10/site-packages/psycopg/pq/__init__.pyhandle_error?   s   

z'import_from_libpq.<locals>.handle_errorcr   )pqbinarypythonr   )	pq_ctypesz"requested psycopg implementation 'z	' unknown
c                 s   s    | ]}d | V  qdS )z- Nr)   ).0attemptr)   r)   r*   	<genexpr>i   s    z$import_from_libpq.<locals>.<genexpr>z(no pq wrapper available.
Attempts made:
)osenvirongetlowerstr	Exception	psycopg_cr-   psycopg_binaryr   r0   r   r   r   r   r   r   r   r   r$   join)moduler+   r    	sattemptsr)   r&   r*   import_from_libpq0   sT   

r@   )r   r   r   r   r   r   r   r   r   r   r   r   r	   r
   r   r   )r   N)%__doc__r5   loggingtypingr   r   r   r   r   miscr   r   r	   r
   _enumsr   r   r   r   r   r   r   r   r   	getLogger__name__r!   r9   __annotations__intr   r   r   r   r   r@   __all__r)   r)   r)   r*   <module>   s.    
	
B