+
    8i                      a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIHtHt ^ RIHtHtHtHtHtHtHtHt ]'       d   ^ RIHt ]! RRR	7      tR
]R&   ]! RRR	7      tR]R&   ]! R]! R4      R	7      tR]R&   R R ltR R ltR R lt R R lt!R R lt"R R lt#R R lt$ ! R R]
],          4      t%]! R ]R!]3,          R"7      t&R# R$ lt'R% R& lt(^
t)R']R(&   ^t*R']R)&    ! R* R+4      t+R# ),zInternal helpers for CSOT.)annotationsN)deque)AbstractContextManager)
ContextVarToken)TYPE_CHECKINGAnyCallableDequeMutableMappingOptionalTypeVarcast)WriteConcernTIMEOUT)defaultzContextVar[Optional[float]]RTT        zContextVar[float]DEADLINEinfc                   V ^8  d   QhRR/#    returnNone )formats   "K/var/www/html/photoedit/myenv/lib/python3.14/site-packages/pymongo/_csot.py__annotate__r   #   s      4     c                     \         P                  R 4       \        P                  R4       \        P                  \	        R4      4       R # )Nr   r   )r   setr   r   floatr   r   r   	reset_allr#   #   s)    KKGGCLLLur   c                   V ^8  d   QhRR/# r   r   Optional[float]r   )r   s   "r   r   r   )   s      _ r   c                 ,    \         P                  R 4      # N)r   getr   r   r   get_timeoutr*   )   s    ;;tr   c                   V ^8  d   QhRR/# r   r   r"   r   )r   s   "r   r   r   -   s       r   c                 *    \         P                  4       # r(   )r   r)   r   r   r   get_rttr.   -   s    779r   c                   V ^8  d   QhRR/# r,   r   )r   s   "r   r   r   1   s      e r   c                 *    \         P                  4       # r(   )r   r)   r   r   r   get_deadliner1   1   s    <<>r   c                    V ^8  d   QhRRRR/# )r   rttr"   r   r   r   )r   s   "r   r   r   5   s       4 r   c                0    \         P                  V 4       R # r(   )r   r!   )r3   s   &r   set_rttr5   5   s    GGCLr   c                   V ^8  d   QhRR/# r%   r   )r   s   "r   r   r   9   s     - -? -r   c                     \        4       '       g   R # \        P                  4       \        P                  ! 4       ,
          # r(   )r*   r   r)   time	monotonicr   r   r   	remainingr:   9   s$    ==<<>DNN,,,r   c                    V ^8  d   QhRRRR/# )r   max_timeoutr"   r   r   )r   s   "r   r   r   ?   s     % % %5 %r   c                8    \        4       pVf   V # \        W4      # )z4Return the remaining timeout clamped to a max value.)r:   min)r<   timeouts   & r   clamp_remainingr@   ?   s    kGw$$r   c                  >    ] tR t^GtRtR R ltR R ltR R ltRtR	# )
_TimeoutContextzInternal timeout context manager.

Use :func:`pymongo.timeout` instead::

  with pymongo.timeout(0.5):
      client.test.test.insert_one({})
c                   V ^8  d   QhRR/# )r   r?   r&   r   )r   s   "r   r   _TimeoutContext.__annotate__P   s     a a ar   c                	     Wn         R V n        R # r(   _timeout_tokens)selfr?   s   &&r   __init___TimeoutContext.__init__P   s    \`r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rD   T   s     B B4 Br   c                	j   \         P                  V P                  4      p\        P	                  4       pV P                  '       d'   \
        P                  ! 4       V P                  ,           M
\        R 4      p\        P                  \        W#4      4      p\        P                  R4      pWV3V n
        R# )r   r   N)r   r!   rG   r   r)   r8   r9   r"   r>   r   rH   )rI   timeout_tokenprev_deadlinenext_deadlinedeadline_token	rtt_tokens   &     r   	__enter___TimeoutContext.__enter__T   so    DMM2 <@MMM(4==8uUZ|!c-&GHGGCL	%yAr   c               (    V ^8  d   QhRRRRRRRR/# )r   exc_typer   exc_valexc_tbr   r   r   )r   s   "r   r   rD   \   s(     ! ! !s !C !D !r   c                	    V P                   '       dQ   V P                   w  rEp\        P                  V4       \        P                  V4       \        P                  V4       R # R # r(   )rH   r   resetr   r   )rI   rV   rW   rX   rN   rQ   rR   s   &&&&   r   __exit___TimeoutContext.__exit__\   sB    <<<7;||4M9MM-(NN>*IIi 	 r   rF   N)	__name__
__module____qualname____firstlineno____doc__rJ   rS   r[   __static_attributes__r   r   r   rB   rB   G   s    aB! !r   rB   F.)boundc                    V ^8  d   QhRRRR/# )r   funcrc   r   r   )r   s   "r   r   r   h   s     ! ! !a !r   c                   a  \         P                  ! S 4      '       d$   \        P                  ! S 4      R V 3R ll4       pM"\        P                  ! S 4      R V 3R ll4       p\	        \
        V4      # )zbApply the client's timeoutMS to this operation. Can wrap both asynchronous and synchronous methodsc               (    V ^8  d   QhRRRRRRRR/# r   rI   r   argskwargsr   r   )r   s   "r   r   apply.<locals>.__annotate__m   s(     	5 	5S 	5 	5 	5 	5r   c                   <"   \        4       fC   V P                  pVe3   \        V4      ;_uu_ 4        S! V .VO5/ VB G R j  xL
 uuR R R 4       # S! V .VO5/ VB G R j  xL
 #  L"  + '       g   i     L&; i L5ir(   r*   rG   rB   rI   rj   rk   r?   rf   s   &*, r   csot_wrapperapply.<locals>.csot_wrapperl   so     }$--&(11%)$%@%@%@@ 21d4T4V444  A 214s:   0A=A(A&A(A=!A;"A=&A((A8	3	A=c               (    V ^8  d   QhRRRRRRRR/# ri   r   )r   s   "r   r   rl   w   s(     	/ 	/s 	/3 	/# 	/# 	/r   c                   < \        4       f;   V P                  pVe+   \        V4      ;_uu_ 4        S! V .VO5/ VB uuR R R 4       # S! V .VO5/ VB #   + '       g   i     L; ir(   rn   ro   s   &*, r   rp   rq   v   s]    }$--&(11#D:4:6: 21.t.v.. 21s   AA$	)inspectiscoroutinefunction	functoolswrapsr   rc   )rf   rp   s   f r   applyrx   h   s[    ""4((			5 
	5 
		/ 
	/ <  r   c               $    V ^8  d   QhRRRRRR/# )r   cmdzMutableMapping[str, Any]write_concernzOptional[WriteConcern]r   r   r   )r   s   "r   r   r      s$     
! 
!	!
!2H
!	
!r   c                    V'       d   VP                   '       d   R# VP                  p\        4       e   VP                  RR4       V'       d   W R&   R# R# )z+Apply the given write concern to a command.NwtimeoutwriteConcern)is_server_defaultdocumentr*   pop)rz   r{   wcs   && r   apply_write_concernr      sF     M;;;			B} 
z4 	 N 
r   int_MAX_RTT_SAMPLES_MIN_RTT_SAMPLESc                  V    ] tR t^t$ RtR]R&   R R ltR R ltR R	 ltR
 R lt	Rt
R# )MovingMinimumz4Tracks a minimum RTT within the last 10 RTT samples.zDeque[float]samplesc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   MovingMinimum.__annotate__   s     6 6$ 6r   c                	0    \        \        R 7      V n        R# ))maxlenN)r   r   r   rI   s   &r   rJ   MovingMinimum.__init__   s    $45r   c                    V ^8  d   QhRRRR/# )r   sampler"   r   r   r   )r   s   "r   r   r      s     $ $ $4 $r   c                	f    V^ 8  d   \        RV 24      hV P                  P                  V4       R# )    zduration cannot be negative N)
ValueErrorr   append)rI   r   s   &&r   
add_sampleMovingMinimum.add_sample   s.    A:;F8DEEF#r   c                   V ^8  d   QhRR/# r,   r   )r   s   "r   r   r      s      U r   c                l    \        V P                  4      \        8  d   \        V P                  4      # R# )z7Get the min, or 0.0 if there aren't enough samples yet.r   )lenr   r   r>   r   s   &r   r)   MovingMinimum.get   s&    t|| 00t||$$r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s      t r   c                	:    V P                   P                  4        R # r(   )r   clearr   s   &r   rZ   MovingMinimum.reset   s    r   )r   N)r]   r^   r_   r`   ra   __annotations__rJ   r   r)   rZ   rb   r   r   r   r   r      s$    >6$
 r   r   ),__conditional_annotations__ra   
__future__r   rv   rt   r8   collectionsr   
contextlibr   contextvarsr   r   typingr   r   r	   r
   r   r   r   r   pymongo.write_concernr   r   r   r   r"   r   r#   r*   r.   r1   r5   r:   r@   rB   rc   rx   r   r   r   r   )r   s   @r   <module>r      s    ! "     - ) _ _ _2'1)T'J	$ J#E37 7(U5\J
 J-%!,S1 !< CxS)*!4
!  #  #  r   