o
    DDiu                     @  s   d Z ddlmZ ddlZddlmZ ddlmZmZ ddl	m
Z ddlmZ dd	lmZ er4dd
lmZ edZG dd dZG dd deZdS )z)
Psycopg Pipeline object implementation.
    )annotationsN)TracebackType)TYPE_CHECKINGAny   )errors)Self)BasePipeline)
Connectionpsycopgc                   @  s    e Zd ZdddZdddZdS )
_DummyLockreturnNonec                 C     d S N selfr   r   J/var/www/Datamplify/venv/lib/python3.10/site-packages/psycopg/_pipeline.py	__enter__   s   z_DummyLock.__enter__exc_typetype[BaseException] | Noneexc_valBaseException | Noneexc_tbTracebackType | Nonec                 C  r   r   r   )r   r   r   r   r   r   r   __exit__   s   z_DummyLock.__exit__Nr   r   r   r   r   r   r   r   r   r   )__name__
__module____qualname__r   r   r   r   r   r   r      s    
r   c                      sP   e Zd ZU dZdZded< dd fddZdddZdddZdddZ  Z	S )Pipelinez/Handler for (sync) connection in pipeline mode.r   Connection[Any]_connFconn_no_lockboolr   r   c                   s(   t  | |rt | _d S |j| _d S r   )super__init__r   lock_lock)r   r%   r&   	__class__r   r   r)   .   s   zPipeline.__init__c              
   C  sf   z | j  | j|   W d   W dS 1 sw   Y  W dS  tjy2 } z|dd}~ww )zkSync the pipeline, send any pending command and receive and process
        all available results.
        N)r+   r$   wait	_sync_gene_NO_TRACEBACKwith_traceback)r   exr   r   r   sync2   s   &
zPipeline.syncr   c                 C  s<   | j  | j|   W d    | S 1 sw   Y  | S r   )r+   r$   r.   
_enter_genr   r   r   r   r   <   s   
zPipeline.__enter__r   r   r   r   r   r   c              
   C  s   zOz| j  | j|   W d    n1 sw   Y  W n! ty? } z|r0td| | n|d W Y d }~nd }~ww W | | d S W | | d S | | w )Nz error ignored terminating %r: %s)	r+   r$   r.   	_exit_gen	Exceptionloggerwarningr2   _exit)r   r   r   r   exc2r   r   r   r   A   s    
zPipeline.__exit__)F)r%   r#   r&   r'   r   r   r   )r   r   r   )
r   r    r!   __doc____annotations__r)   r4   r   r   __classcell__r   r   r,   r   r"   (   s   
 


r"   )r<   
__future__r   loggingtypesr   typingr   r    r   r0   _compatr   _pipeline_baser	   
connectionr
   	getLoggerr8   r   r"   r   r   r   r   <module>   s   
