+
    Dfj              	       *  a  R t0 t R t^ RIHtHt ^ RIHtHtHtH	t	H
t
 ^ RIHtHt ]
! R4      t]
! R4      t]
! R4      tR R ltR	 R
 ltR R ltR R ltR R lt]! ]P,                  ]! ]! ]4      ]! R4      4      4      t] ^ k R R ltR R ltR# )z1
General functional-style helpers for disttrial.
)partialwraps)	AwaitableCallableIterableOptionalTypeVar)Deferredsucceed_A_B_Cc                R    V ^8  d   QhR\         R\        \         ,          R\         /# )   defaultoptionalreturn)r   r   )formats   "@/usr/lib/python3/dist-packages/twisted/trial/_dist/functional.py__annotate__r      s%     
 
" 
 
 
    c                    Vf   V # V# )z
Get a definite value from an optional value.

@param default: The value to return if the optional value is missing.

@param optional: The optional value to return if it exists.
 )r   r   s   &&r   fromOptionalr      s     Or   c                    V ^8  d   QhR\         \        .\        3,          R\        \        ,          R\        \        ,          /# )r   	conditionxsr   )r   r   boolr   )r   s   "r   r   r      s4     	 	2$*- 	8B< 	HRL 	r   c              #  J   "   V F  pV ! V4      '       d   Vx  K   R# 	  R# 5i)zz
@return: An iterable over C{xs} that stops when C{condition} returns
    ``False`` based on the value of iterated C{xs}.
Nr   )r   r   xs   && r   	takeWhiler       s"     
 Q<<G	 s   !#c                h    V ^8  d   QhR\         \        ,          R\         \        ,          R\        /# )r   abr   )r   r   r   )r   s   "r   r   r   +   s)      im 	" " r   c                :   "   V G Rj  xL
  VG Rj  xL
 #  L L5i)z
Wait for one action to complete and then another.

If either action fails, failure is propagated.  If the first action fails,
the second action is not waited on.
Nr   )r"   r#   s   &&r   sequencer%   +   s      GG7N s   	c                    V ^8  d   QhR\         \        \        .\        3,          R\         \        \        .\        3,          /# r   fr   )r   r   r   r   )r   s   "r   r   r   6   s4     
 
Hb"Xr\" 
xR"'= 
r   c                0   a  \        S 4      V 3R l4       pV# )zW
Create a function like another but with the order of the first two
arguments flipped.
c                    < S! W4      # Nr   )r#   r"   r(   s   &&r   gflip.<locals>.g<   s    wr   r   )r(   r,   s   f r   flipr/   6   s"     1X  Hr   c                    V ^8  d   QhR\         \        .\        3,          R\         \        .\        3,          R\         \        .\        3,          /# )r   fxfyr   )r   r   r   r   )r   s   "r   r   r   C   sB      "r" "r(: xb?Q r   c                P   a a \        S 4      \        S4      V V3R l4       4       pV# )z}
Create a function that calls one function with an argument and then
another function with the result of the first function.
c                     < S! S! V 4      4      # r+   r   )r"   r1   r2   s   &r   r,   compose.<locals>.gI   s     "Q%yr   r.   )r1   r2   r,   s   ff r   composer6   C   s.     2Y
2Y   Hr   Nc                    V ^8  d   QhR\         \        .\        3,          R\         . \        \        ,          3,          R\        /# )r   	predicateactionr   )r   r   r   r   )r   s   "r   r   r   X   s?      d
#R2&' r   c                R   "    V! 4       G Rj  xL
 pV ! V4      '       d   K   V#  L5i)z
Call a function repeatedly until its result fails to satisfy a predicate.

@param predicate: The check to apply.

@param action: The function to call.

@return: The result of C{action} which did not satisfy C{predicate}.
Nr   )r8   r9   results   && r   iterateWhiler<   X   s(      x  M  s   '%''c                n    V ^8  d   QhR\         \        .\        3,          R\         . \        3,          /# r'   )r   intr   )r   s   "r   r   r   k   s.      XseRi( Xb"f-= r   c                "   a a ^ oR VV 3R llpV# )z
Wrap a function with another that automatically passes an integer counter
of the number of calls that have gone through the wrapper.
c                $    V ^8  d   QhR\         /# )r   r   )r   )r   s   "r   r   #countingCalls.<locals>.__annotate__r   s      r r   c                  H   <  S! S4      p S^,          oV #   S^,          oi ; i)   r   )r;   counterr(   s    r   r,   countingCalls.<locals>.gr   s,    	wZFqLG qLGs    !r   )r(   r,   rD   s   f @r   countingCallsrF   k   s    
 G  Hr   c                    V ^8  d   Qh/ ^ \         9   d.   \        \        \        ,          .\        R,          3,          ;R&   # )r   NdiscardResult)__conditional_annotations__r   r   r   r	   )r   s   "r   r   r      s8      \ x2$78 ]r   )rI   __doc__	functoolsr   r   typingr   r   r   r   r   twisted.internet.deferr	   r
   r   r   r   r   r    r%   r/   r6   fromCoroutinerH   r<   rF   r   )rI   s   @r   <module>rO      s    % C C 4T]T]T]
	
 <CDNGDM*< &r   