§
    YŠtj¾  ã                  óf  — U d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	m
Z
mZ ddlmZ ej        Zded	<   ej        d         Zded
<   ej        Zej        Z ed¦  «        Z G d„ dej        e         ¦  «        Z G d„ dej        e         ¦  «        Z	 	 d%d&d„Z	 	 d%d'd„Zddœd(d#„Zddœd)d$„ZdS )*zø
Utilities to ease the differences between async and sync code.

These object offer a similar interface between sync and async versions; the
script async_to_sync.py will replace the async names with the sync names
when generating the sync version.
é    )ÚannotationsN)ÚAnyÚ	TypeAlias)ÚCallableÚ	Coroutineé   )ÚTypeVarr   ÚWorkerÚAWorkerÚTc                  ó&   ‡ — e Zd ZdZddˆ fd
„Zˆ xZS )ÚQueuez>
    A Queue subclass with an interruptible get() method.
    TNÚblockÚboolÚtimeoutúfloat | NoneÚreturnr   c                óR   •— |€d}t          ¦   «                              ||¬¦  «        S )Ng     õ@)r   r   )ÚsuperÚget)Úselfr   r   Ú	__class__s      €úN/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/psycopg/_acompat.pyr   z	Queue.get"   s'   ø€ àˆ?Ø(ˆGÝ‰wŒw�{Š{ °ˆ{Ñ8Ô8Ð8ó    )TN)r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__classcell__)r   s   @r   r   r      sL   ø€ € € € € ðð ð9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9r   r   c                  ó   — e Zd ZdS )ÚAQueueN)r   r   r   © r   r   r!   r!   )   s   € € € € € Ø€Dr   r!   r"   Úfú(Callable[..., Coroutine[Any, Any, None]]Úargsútuple[Any, ...]Únameú
str | Noner   úasyncio.Task[None]c                ó4   — t          j         | |Ž |¬¦  «        S )z,
    Equivalent to asyncio.create_task.
    )r'   )ÚasyncioÚcreate_task)r#   r%   r'   s      r   Úaspawnr-   -   s    € õ Ô˜q˜q $˜x¨dÐ3Ñ3Ô3Ð3r   úCallable[..., Any]úthreading.Threadc                ó^   — t          j        | ||d¬¦  «        }|                     ¦   «          |S )z=
    Equivalent to creating and running a daemon thread.
    T)Útargetr%   r'   Údaemon)Ú	threadingÚThreadÚstart)r#   r%   r'   Úts       r   Úspawnr7   8   s/   € õ 	Ô ¨°4ÀÐEÑEÔE€AØ‡G‚G�I„I€IØ€Hr   ©r   Útasksúasyncio.Task[Any]r   r   ÚNonec              ‡  óÆ   K  — t          j        |Ž }	 | �/t          j        t          j        |¦  «        | ¬¦  «        ƒ d{V —† n|ƒ d{V —† dS # t           j        $ r Y dS w xY w)ú7
    Equivalent to asyncio.gather or Thread.join()
    Nr8   )r+   ÚgatherÚwait_forÚshieldÚTimeoutError)r   r9   Úwaits      r   ÚagatherrC   E   s“   è è € õ Œ>˜5Ð!€DðØÐÝÔ"¥7¤>°$Ñ#7Ô#7ÀÐIÑIÔIÐIÐIÐIÐIÐIÐIÐIÐIàˆJˆJˆJˆJˆJˆJˆJð 	ˆøõ Ôð ð ð Øˆˆðøøøs   ’9A ÁA ÁA c                ód   — |D ],}|                      ¦   «         sŒ|                     | ¦  «         Œ-dS )r=   N)Úis_aliveÚjoin)r   r9   r6   s      r   r>   r>   U   sA   € ð ð ð ˆØ�zŠz‰|Œ|ð 	ØØ	�Šˆw‰Œˆˆðð r   )r"   N)r#   r$   r%   r&   r'   r(   r   r)   )r#   r.   r%   r&   r'   r(   r   r/   )r9   r:   r   r   r   r;   )r9   r/   r   r   r   r;   )r   Ú
__future__r   Úqueuer+   r3   Útypingr   r   Úcollections.abcr   r   Ú_compatr	   r4   r
   Ú__annotations__ÚTaskr   ÚLockÚALockr   r   r!   r-   r7   rC   r>   r"   r   r   ú<module>rP      sÅ  ððð ð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ð !Ð !Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /à Ð Ð Ð Ð Ð àÔ$€Ð $Ð $Ð $Ñ $Ø”\ $Ô'€Ð 'Ð 'Ð 'Ñ 'Ø„~€ØŒ€à€GˆC�L„L€ð	9ð 	9ð 	9ð 	9ð 	9ˆEŒK˜ŒNñ 	9ô 	9ð 	9ð	ð 	ð 	ð 	ð 	ˆWŒ]˜1Ôñ 	ô 	ð 	ð Øð4ð 4ð 4ð 4ð 4ð Øð
ð 
ð 
ð 
ð 
ð FJð ð ð ð ð ð ð  >Bð ð ð ð ð ð ð ð r   