
    \j                       d Z ddlmZ ddlZddlZddlZddlmZmZm	Z	 ddl
Z
ddlZddlmZ  e       Z G d de      Z G d d	e      Z ej*                   ej,                               Zd
 Z G d de      Zd Zd Zd Zeg df   Zej>                  Zee	e ef   gdf   Z!ee edge	e df   f   Z"edd	 	 	 	 	 	 	 dd       Z#dZ$ejJ                  dkD  rddl&m'Z' ddl&m(Z( ddl&m)Z) ddl&m*Z* e$dz  Z$yy)zbgRPC's experimental APIs.

These APIs are subject to be removed during any minor version release.
    )annotationsN)CallableOptionalUnion)cygrpcc                      e Zd ZdZdZy)ChannelOptionszIndicates a channel option unique to gRPC Python.

    This enumeration is part of an EXPERIMENTAL API.

    Attributes:
      SingleThreadedUnaryStream: Perform unary-stream RPCs on a single thread.
    SingleThreadedUnaryStreamN)__name__
__module____qualname____doc__r
        D/root/env/lib/python3.12/site-packages/grpc/experimental/__init__.pyr	   r	       s     !<r   r	   c                      e Zd ZdZy)
UsageErrorzDRaised by the gRPC library to indicate usage not allowed by the API.Nr   r   r   r   r   r   r   r   r   ,   s    Nr   r   c                     t         S )zeCreates a ChannelCredentials for use with an insecure channel.

    THIS IS AN EXPERIMENTAL API.
    )_insecure_channel_credentialsr   r   r   insecure_channel_credentialsr   7   s
    
 )(r   c                      e Zd ZdZy)ExperimentalApiWarningz&A warning that an API is experimental.Nr   r   r   r   r   r   ?   s    0r   r   c                    | t         vrIt         j                  |        dj                  |       dz   }t        j                  |t
        d|z          y y )Nz8'{}' is an experimental API. It is subject to change or z5removal between minor releases. Proceed with caution.   )
stacklevel)_EXPERIMENTAL_APIS_USEDaddformatwarningswarnr   )api_namestack_offsetmsgs      r   _warn_experimentalr%   C   sX    ..##H-FMM FF 	 	c1a,>NO /r   c                B     t        j                          fd       }|S )Nc                 @    t        j                  d        | i |S )N   )r%   r   )argskwargsfs     r   _wrapperz"experimental_api.<locals>._wrapperP   s!    1::q)$!&!!r   )	functoolswraps)r+   r,   s   ` r   experimental_apir/   O   s%    __Q" " Or   c                `   |sy|j                   sP|j                  s"|j                   | |j                              S |j                   | |j                              S |j                  s"|j                   | |j
                              S |j                   | |j                              S )a  Wraps the server method handler function.

    The server implementation requires all server handlers being wrapped as
    RpcMethodHandler objects. This helper function ease the pain of writing
    server handler wrappers.

    Args:
        wrapper: A wrapper function that takes in a method handler behavior
          (the actual function) and returns a wrapped function.
        handler: A RpcMethodHandler object to be wrapped.

    Returns:
        A newly created RpcMethodHandler.
    Nunary_unaryunary_streamstream_unarystream_stream)request_streamingresponse_streaming_replacer2   r4   r6   r8   )wrapperhandlers     r   wrap_server_method_handlerr>   X   s     $$)) ##8K8K0L#MMWW5I5I-JKK%%WW5I5I-JKK''2G2G*HIIr   PrivateKeySignOnCompletePrivateKeySignCancel)root_certificatesc                X    t        j                  t        j                  |d||             S )a  Creates a ChannelCredentials for use with an SSL-enabled Channel with a custom signer.

    THIS IS AN EXPERIMENTAL API.
    This API will be removed in a future version and combined with `grpc.ssl_channel_credentials`.

    Args:
      private_key_sign_fn: a function with the signature of
        `CustomPrivateKeySign`. This function can return synchronously or
        asynchronously.  To return synchronously, return the signed bytes.  To
        return asynchronously, return a callable matching the
        `PrivateKeySignCancel` signature.This can be a no-op if no cancellation is
        needed. In the async case, this function must return this callable
        quickly, then call the passed in `PrivateKeySignOnComplete` when the async
        signing operation is complete to trigger gRPC to continue the handshake.
      root_certificates: The PEM-encoded root certificates as a byte string,
        or None to retrieve them from a default location chosen by gRPC
        runtime.
      certificate_chain: The PEM-encoded certificate chain as a byte string
        to use

    Returns:
      A ChannelCredentials for use with an SSL-enabled Channel.
    N)grpcChannelCredentials_cygrpcSSLChannelCredentials)private_key_sign_fnrA   certificate_chains      r   *ssl_channel_credentials_with_custom_signerrI      s0    < ""%%t%68K	
 r   )r	   r   r   r   rI   r>   )      r7   r5   r3   r1   )r8   r6   r4   r2   )rG   z'CustomPrivateKeySign'rA   zOptional[bytes]rH   bytesreturnzgrpc.ChannelCredentials)+r   
__future__r   copyr-   systypingr   r   r   r    rC   grpc._cythonr   rE   setr   objectr	   	Exceptionr   rD   channel_credentials_insecurer   r   Warningr   r%   r/   r>   r@   PrivateKeySignatureAlgorithmrL   r?   CustomPrivateKeySignrI   __all__version_infogrpc._simple_stubsr8   r6   r4   r2   r   r   r   <module>r]      so   #   
 , ,   *% 	<V 	<O O !8 7 7(G((*! 
)1W 1	PJ>  D) &CC #U5)+;%<$=t$CD   $"
 
%'
'(*   *.!/! '! 	!
 ! !H f0//.  G r   