
    nh2                       d Z ddlmZ ddlZddl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   
      ZddZ	 	 	 	 	 	 	 	 ddZej(                  dk\  rej*                  Zej,                  ZyddZddZy)z2Miscellaneous pieces that need to be synchronized.    )annotationsN)AnyCallableTypeVarcast)OperationFailure)_REAUTHENTICATION_REQUIRED_CODETF.)boundc                0     d fd}t        t        |      S )Nc                 N   |j                  dd      }ddlm} ddlm} 	  | i |S # t
        $ rr}|r |j                  t        k(  rVd }| D ],  }t        ||      r|} nt        ||      s |j                  } n |r|j                  d       n  | i |cY d }~S  d }~ww xY w)N	no_reauthFr   )_BulkWriteContext)
ConnectionT)reauthenticate)poppymongo.messager   pymongo.synchronous.poolr   r   coder	   
isinstanceconnauthenticate)	argskwargsr   r   r   excr   argfuncs	           /var/www/html/SchoolMeal/SchoolMeal/pds_admin_SchoolMeal/Backend/venv/lib/python3.12/site-packages/pymongo/synchronous/helpers.pyinnerz_handle_reauth.<locals>.inner)   s    JJ{E2	57	((( 	xx::  C!#z2"!#'89"xx %%T%:T,V,,)	s&   ) 	B$9B,,BB$BB$)r   r   r   r   returnr   )r   r
   )r   r   s   ` r   _handle_reauthr!   (   s    : 5>    c                    t         s(t        j                         } |j                  | |fi |S t	        j                  | |fi |S )N)_IS_SYNCasyncioget_running_loopgetaddrinfosocket)hostportr   loops       r   _getaddrinfor,   I   sG     '')td5f55!!$777r"   )   
   c                "    | j                         S zhCompatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#next.)__next__clss    r   nextr4   `       ||~r"   c                "    | j                         S r0   )__iter__r2   s    r   iterr8   d   r5   r"   )r   r
   r    r
   )r)   r   r*   r   r   r   r    zklist[tuple[socket.AddressFamily, socket.SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]])r3   r   r    r   )__doc__
__future__r   r%   builtinsr(   systypingr   r   r   r   pymongo.errorsr   pymongo.helpers_sharedr	   r$   r
   r!   r,   version_infor4   r8    r"   r   <module>rB      s    9 "    
  C CxS)*B8
88$'88$ w==D==Dr"   