Ë
    òmxiU  ã            	       ó¾   — d Z ddlmZ ddlZddlZddlZddlZ ej                  e«      Z	 G d„ de«      Z
 G d„ d ej                  dg d¢«      e
«      Zd	„ Zd
„ Zd„ Zy)z%Utilities for working with callables.é    )ÚABCNc                   óX   — e Zd ZdZej
                   G d„ dej                  «      «       Zy)ÚOutcomea•  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                   óT   — e Zd ZdZ ej
                  «       Z ej
                  «       Zy)úOutcome.Kindz8Identifies the general kind of the outcome of some call.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚenumÚautoÚRETURNEDÚRAISED© ó    ú^/home/htdocs/ttos/venv/lib/python3.12/site-packages/grpc/framework/foundation/callable_util.pyÚKindr   %   s   „ áFà�4—9‘9“;ˆØ�—‘“‰r   r   N)r   r	   r
   r   r   ÚuniqueÚEnumr   r   r   r   r   r      s*   „ ñ	ð 
‡[�[ôˆt�y‰yó ó ñr   r   c                   ó   — e Zd ZdZy)Ú_EasyOutcomez$A trivial implementation of Outcome.N)r   r	   r
   r   r   r   r   r   r   -   s   „ ò /r   r   )ÚkindÚreturn_valueÚ	exceptionc                 óú   — 	 t        t        j                  j                   | |i |¤Žd «      S # t        $ rD}t
        j                  |«       t        t        j                  j                  d |«      cY d }~S d }~ww xY w©N)r   r   r   r   Ú	ExceptionÚ_LOGGERr   r   )ÚbehaviorÚmessageÚargsÚkwargsÚes        r   Ú_call_logging_exceptionsr$   6   sh   € ð:ÜÜ�L‰L×!Ñ!¡8¨TÐ#<°VÑ#<¸dó
ð 	
øô ò :Ü×Ñ˜'Ô"ÜœGŸL™L×/Ñ/°°qÓ9Õ9ûð:ús   ‚*- ­	A:¶9A5Á/A:Á5A:c                 óF   ‡ ‡— t        j                  ‰ «      ˆ ˆfd„«       }|S )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        ‰‰g| ¢­i |¤ŽS r   ©r$   )r!   r"   r   r    s     €€r   Úwrapped_behaviorz0with_exceptions_logged.<locals>.wrapped_behaviorN   s   ø€ ä'¨°'ÐK¸DÒKÀFÑKÐKr   )Ú	functoolsÚwraps)r   r    r(   s   `` r   Úwith_exceptions_loggedr+   @   s*   ù€ ô ‡_�_�XÓôLó ðLð Ðr   c                 ó"   — t        | |g|¢­i |¤ŽS )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_exceptionsr-   U   s   € ô $ H¨gÐG¸ÒGÀÑGÐGr   )r   Úabcr   Úcollectionsr   r)   ÚloggingÚ	getLoggerr   r   r   Ú
namedtupler   r$   r+   r-   r   r   r   ú<module>r3      sl   ðñ ,å Û Û Û Û à
ˆ'×
Ñ
˜HÓ
%€ôˆcô ô(/Ø€K×ÑØÒ=óð ô	/ò:òó*Hr   