
    Ph                     2    d Z ddlZddlmZ ddlZd ZddZy)zA wait callback to allow psycopg2 cooperation with eventlet.

Use `make_psycopg_green()` to enable eventlet support in Psycopg.
    N)
extensionsc                      t        t        d      st        dt        j                  z        t        j
                  t               y)z?Configure Psycopg to be used with eventlet in non-blocking way.set_wait_callbackzAsupport for coroutines not available in this Psycopg version (%s)N)hasattrr   ImportErrorpsycopg2__version__r   eventlet_wait_callback     lC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\eventlet/support/psycopg2_patcher.pymake_psycopg_greenr   !   s<    :23O""#$ 	$   !78r   c                    	 | j                         }|t        j                  k(  ry|t        j                  k(  r0t        j
                  j                  | j                         d       n[|t        j                  k(  r0t        j
                  j                  | j                         d       nt        j                  d|z        )z>A wait callback useful to allow eventlet to work with Psycopg.T)read)writezBad result from poll: %rN)pollr   POLL_OK	POLL_READeventlethubs
trampolinefileno
POLL_WRITEr   OperationalError)conntimeoutstates      r   r
   r
   +   s    
		J&&&j***MM$$T[[]$>j+++MM$$T[[]$$?++*U24 4 r   ))__doc__r   r   eventlet.hubsr   r   r
   r   r   r   <module>r!      s   4   94r   