
    LKi                         S SK r S SKrS SKJrJrJrJr  S SKJr  \" S5      r	\" S5      r
S\\	\\\\
4   4   S\\	\
4   4S jr\" S	5      rS
\S\4S jrg)    N)AnyCallable	CoroutineTypeVar)	ParamSpecPRfuncreturnc                    ^  U 4S jnU$ )zA function decorator that converts an async function to a sync function.

This should generally not be used in production code paths.
c                  L  >^ S n [         R                  " 5       nUR                  5       (       a  T" U 0 UD6$ UR                  T" U 0 UD65      nS[        S[        4U4S jjmT" U5      $ ! [         a.    [         R                  " 5       n[         R                  " U5         Nf = f)Nresultr   c                    > [        U [        5      (       a  U  Vs/ s H  nT" U5      PM     sn$ [        U [        5      (       a  [        U 5      $ [	        U 5      (       a  [        U 5      $ U $ s  snf )N)
isinstancelistobjectasync_class_to_synccallableasync_to_sync)r   rconvert_results     ^/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/chromadb/utils/async_to_sync.pyr   ;async_to_sync.<locals>.sync_wrapper.<locals>.convert_result   sb    &$''39:6aq)6::&&))*622$V,,M ;s   A-)asyncioget_event_loopRuntimeErrornew_event_loopset_event_loop
is_runningrun_until_completer   )argskwargsloopr   r   r
   s       @r   sync_wrapper#async_to_sync.<locals>.sync_wrapper   s    	)))+D
 ??(((((t)>v)>?
	3 
	3 
	 f%%+  	)))+D""4(	)s   A+ +5B#"B# )r
   r$   s   ` r   r   r      s    &6     Tclsc                     [         R                  " U 5       Ha  u  p[        U5      (       d  M  [         R                  " U5      (       d  M4  UR	                  S5      (       a  ML  [        X[        U5      5        Mc     U $ )zA decorator that converts a class with async methods to a class with sync methods.

This should generally not be used in production code paths.
__)inspect
getmembersr   iscoroutinefunction
startswithsetattrr   )r)   attrvalues      r   r   r   2   sZ    
 ))#.UOO++E22OOD))C}U34 / Jr'   )r,   r   typingr   r   r   r   typing_extensionsr   r   r	   r   r(   r   r&   r'   r   <module>r5      sw      4 4 ' cNCL!Ic3k$:!:; !A !H CLQ 1 r'   