o
    Ù­j  ã                   @  s`  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„ deƒZG dd	„ d	eƒZe e ¡ ¡Zd
d„ ZG dd„ deƒZdd„ Zdd„ Zd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d „ƒZ#d!Z$ej%d"kr®dd#l&m'Z' dd$l&m(Z( dd%l&m)Z) dd&l&m*Z* e$d'7 Z$dS dS ))zbgRPC's experimental APIs.

These APIs are subject to be removed during any minor version release.
é    )ÚannotationsN)ÚCallableÚOptionalÚUnion)Úcygrpcc                   @  s   e Zd ZdZdZdS )ÚChannelOptionszÌIndicates 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   © r   r   úW/var/www/html/CropPilot/venv/lib/python3.10/site-packages/grpc/experimental/__init__.pyr       s    r   c                   @  ó   e Zd ZdZdS )Ú
UsageErrorzDRaised by the gRPC library to indicate usage not allowed by the API.N©r	   r
   r   r   r   r   r   r   r   ,   ó    r   c                   C  s   t S )zeCreates a ChannelCredentials for use with an insecure channel.

    THIS IS AN EXPERIMENTAL API.
    )Ú_insecure_channel_credentialsr   r   r   r   Úinsecure_channel_credentials7   s   r   c                   @  r   )ÚExperimentalApiWarningz&A warning that an API is experimental.Nr   r   r   r   r   r   ?   r   r   c                 C  s<   | t vrt  | ¡ d | ¡d }tj|td| d� d S d S )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Úmsgr   r   r   Ú_warn_experimentalC   s   
ÿýÿør    c                   s   t  ˆ ¡‡ fdd„ƒ}|S )Nc                    s   t ˆ jdƒ ˆ | i |¤ŽS )Né   )r    r	   )ÚargsÚkwargs©Úfr   r   Ú_wrapperP   s   z"experimental_api.<locals>._wrapper)Ú	functoolsÚwraps)r%   r&   r   r$   r   Úexperimental_apiO   s   r)   c                 C  sb   |sdS |j s|js|j| |jƒd�S |j| |jƒd�S |js(|j| |jƒd�S |j| |jƒd�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Ú_replacer+   r-   r/   r1   )ÚwrapperÚhandlerr   r   r   Úwrap_server_method_handlerX   s   r7   ÚPrivateKeySignOnCompleteÚPrivateKeySignCancel)Úroot_certificatesÚprivate_key_sign_fnú'CustomPrivateKeySign'r:   úOptional[bytes]Úcertificate_chainÚbytesÚreturnúgrpc.ChannelCredentialsc                 C  s   t  t |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)r;   r:   r>   r   r   r   Ú*ssl_channel_credentials_with_custom_signer‡   s
   ÿÿrF   )r   r   r   r   rF   r7   )é   é   r0   r.   r,   r*   )r1   r/   r-   r+   )r;   r<   r:   r=   r>   r?   r@   rA   )+r   Ú
__future__r   Úcopyr'   ÚsysÚtypingr   r   r   r   rB   Úgrpc._cythonr   rD   Úsetr   Úobjectr   Ú	Exceptionr   rC   Úchannel_credentials_insecurer   r   ÚWarningr   r    r)   r7   r9   ÚPrivateKeySignatureAlgorithmr?   r8   ÚCustomPrivateKeySignrF   Ú__all__Úversion_infoÚgrpc._simple_stubsr1   r/   r-   r+   r   r   r   r   Ú<module>   sT   ÿ	ý
ûÿ
ý$
	ú