
    (phO              	           S r SSKJr  SSKrSSKrSSKrSSKr\R                  " \5      r	 " S S\5      r
 " S S\R                  " S/ SQ5      \
5      rS	 rS
 rS rg)z%Utilities for working with callables.    )ABCNc                   `    \ rS rSrSr\R                   " S S\R                  5      5       rSr	g)Outcome   au  A sum type describing the outcome of some call.

Attributes:
  kind: One of Kind.RETURNED or Kind.RAISED respectively indicating that the
    call returned a value or raised an exception.
  return_value: The value returned by the call. Must be present if kind is
    Kind.RETURNED.
  exception: The exception raised by the call. Must be present if kind is
    Kind.RAISED.
c                   4    \ rS rSrSr\" 5       r\" 5       rSrg)Outcome.Kind%   z8Identifies the general kind of the outcome of some call. N)	__name__
__module____qualname____firstlineno____doc__objectRETURNEDRAISED__static_attributes__r
       Z/var/www/html/venv/lib/python3.13/site-packages/grpc/framework/foundation/callable_util.pyKindr   %   s    F8r   r   r
   N)
r   r   r   r   r   enumuniqueEnumr   r   r
   r   r   r   r      s*    	 
[[tyy  r   r   c                       \ rS rSrSrSrg)_EasyOutcome-   z$A trivial implementation of Outcome.r
   N)r   r   r   r   r   r   r
   r   r   r   r   -   s     /r   r   )kindreturn_value	exceptionc                      [        [        R                  R                  U " U0 UD6S 5      $ ! [         aD  n[
        R                  U5        [        [        R                  R                  S U5      s S nA$ S nAff = fN)r   r   r   r   	Exception_LOGGERr   r   )behaviormessageargskwargses        r   _call_logging_exceptionsr)   6   sh    :LL!!8T#<V#<d
 	
  :'"GLL//q99:s   *- 
A;9A60A;6A;c                 J   ^ ^ [         R                  " T 5      U U4S j5       nU$ )a  Wraps a callable in a try-except that logs any exceptions it raises.

Args:
  behavior: Any callable.
  message: A string to log if the behavior raises an exception.

Returns:
  A callable that when executed invokes the given behavior. The returned
    callable takes the same arguments as the given behavior but returns a
    future.Outcome describing whether the given behavior returned a value or
    raised an exception.
c                  $   > [        TT/U Q70 UD6$ r!   r)   )r&   r'   r$   r%   s     r   wrapped_behavior0with_exceptions_logged.<locals>.wrapped_behaviorN   s    ''KDKFKKr   )	functoolswraps)r$   r%   r-   s   `` r   with_exceptions_loggedr1   @   s*     __XL L r   c                      [        X/UQ70 UD6$ )a  Calls a behavior in a try-except that logs any exceptions it raises.

Args:
  behavior: Any callable.
  message: A string to log if the behavior raises an exception.
  *args: Positional arguments to pass to the given behavior.
  **kwargs: Keyword arguments to pass to the given behavior.

Returns:
  An Outcome describing whether the given behavior returned a value or raised
    an exception.
r,   )r$   r%   r&   r'   s       r   call_logging_exceptionsr3   U   s     $HGGGGr   )r   abcr   collectionsr   r/   logging	getLoggerr   r#   r   
namedtupler   r)   r1   r3   r
   r   r   <module>r9      sh    ,     


H
%c (/= 	/:*Hr   