o
    {g\
                     @  s   d Z ddlmZ ddlZddlZddlmZmZmZm	Z	 ddl
mZ ddlmZ dZeded	ef d
ZdddZejdkrFejZejZdS dddZdddZdS )z2Miscellaneous pieces that need to be synchronized.    )annotationsN)AnyCallableTypeVarcast)OperationFailure)_REAUTHENTICATION_REQUIRED_CODETF.)boundfuncreturnc                   s   d fdd}t t|S )Nargsr   kwargsr   c               
     s   | dd}ddlm} ddlm} z | i |W S  ty` } z:|r% |jtkr[d }| D ]}t||r9|} nt||rC|j	} nq.|rM|j
dd n  | i |W  Y d }~S  d }~ww )N	no_reauthFr   )_BulkWriteContext)
ConnectionT)reauthenticate)poppymongo.messager   pymongo.synchronous.poolr   r   coder   
isinstanceconnauthenticate)r   r   r   r   r   excr   argr    x/var/www/bot.gig.net.ua/public_html/telegram/P1/HellBot/venv/lib/python3.10/site-packages/pymongo/synchronous/helpers.pyinner'   s2   


z_handle_reauth.<locals>.inner)r   r   r   r   r   r   )r   r	   )r   r   r   r   r   _handle_reauth&   s   
r    )   
   clsr   c                 C     |   S zhCompatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#next.)__next__r#   r   r   r   nextL      r(   c                 C  r$   r%   )__iter__r'   r   r   r   iterP   r)   r+   )r   r	   r   r	   )r#   r   r   r   )__doc__
__future__r   builtinssystypingr   r   r   r   pymongo.errorsr   pymongo.helpers_sharedr   _IS_SYNCr	   r    version_infor(   r+   r   r   r   r   <module>   s   

!

