;is0 dZddlZddlZddlmZddlmZddlmZddlmZddlmZddl m Z dd l m Z ej Z ejZejZdd Zd ZejZejZejZGd d eZdZdZGddeZeddddddZ ddZddZddZejZejZGddeZ e dddddddZ! ddZ"ddZ#dS)z.Entry points into the Beta API of gRPC Python.N)_auth)_client_adaptations) _metadata)_server_adaptations) interfaces) cardinality)facec:fd}tj||S)Nc,fd}||dS)NcDtj||dSN)runbeta) beta_metadataerrorcallbacks MC:\PYTHON\MyICR_Workspace\venv\Lib\site-packages\grpc/beta/implementations.pywrapped_callbackzCmetadata_call_credentials..plugin..wrapped_callback's& HY%m44e < < < < <)contextrrmetadata_plugins ` rpluginz)metadata_call_credentials..plugin&s8 = = = = = !122222r)name)grpcmetadata_call_credentials)rrrs` rrr%s433333  )&t < < <|j||dS)aFSubscribes to this Channel's connectivity. Args: callback: A callable to be invoked and passed an interfaces.ChannelConnectivity identifying this Channel's connectivity. The callable will be invoked immediately upon subscription and again for every change to this Channel's connectivity thereafter until it is unsubscribed. try_to_connect: A boolean indicating whether or not this Channel should attempt to connect if it is not already connected and ready to conduct RPCs. )try_to_connectN)r# subscribe)r$rr(s rr)zChannel.subscribeKs% HHHHHrc:|j|dS)zUnsubscribes a callback from this Channel's connectivity. Args: callback: A callable previously registered with this Channel from having been passed to its "subscribe" method. N)r# unsubscribe)r$rs rr+zChannel.unsubscribeZs  !!(+++++rr )__name__ __module__ __qualname____doc__r&r)r+rrrr!r!@sT    I I I I,,,,,rr!cZtj||nd||fz}t|S)a@Creates an insecure Channel to a remote host. Args: host: The name of the remote host to which to connect. port: The port of the remote host to which to connect. If None only the 'host' part will be used. Returns: A Channel to the remote host through which RPCs may be conducted. N%s:%d)rinsecure_channelr!)hostportr%s rr2r2ds:# 'T4L"8G 7  rc\tj||nd||fz|}t|S)auCreates a secure Channel to a remote host. Args: host: The name of the remote host to which to connect. port: The port of the remote host to which to connect. If None only the 'host' part will be used. channel_credentials: A ChannelCredentials. Returns: A secure Channel to the remote host through which RPCs may be conducted. Nr1)rsecure_channelr!)r3r4channel_credentialsr%s rr6r6us=! 'T4L"8:MG 7  rceZdZdZdZdS) StubOptionszA value encapsulating the various options for creation of a Stub. This class and its instances have no supported interface - it exists to define the type of its instances and its instances exist to be passed to other functions. cZ||_||_||_||_||_||_dSr r3request_serializersresponse_deserializersmetadata_transformer thread_poolthread_pool_size)r$r3r<r=r>r?r@s rr&zStubOptions.__init__s9 #6 &<#$8!& 0rNr,r-r.r/r&rrrr9r9s-11111rr9c*t||||||S)a[Creates a StubOptions value to be passed at stub creation. All parameters are optional and should always be passed by keyword. Args: host: A host string to set on RPC calls. request_serializers: A dictionary from service name-method name pair to request serialization behavior. response_deserializers: A dictionary from service name-method name pair to response deserialization behavior. metadata_transformer: A callable that given a metadata object produces another metadata object to be used in the underlying communication on the wire. thread_pool: A thread pool to use in stubs. thread_pool_size: The size of thread pool to create for use in stubs; ignored if thread_pool has been passed. Returns: A StubOptions value created from the passed parameters. )r9r;s r stub_optionsrCs(8     rcz|tn|}tj|j|j|j|j|jS)zCreates a face.GenericStub on which RPCs can be made. Args: channel: A Channel for use by the created stub. options: A StubOptions customizing the created stub. Returns: A face.GenericStub on which RPCs can be made. )_EMPTY_STUB_OPTIONSr generic_stubr#r3r>r<r=)r%optionseffective_optionss rrFrFsG07++G  +.-0   rc ~|tn|}tj|j|||j|j|j|jS)aCreates a face.DynamicStub with which RPCs can be invoked. Args: channel: A Channel for the returned face.DynamicStub to use. service: The package-qualified full name of the service. cardinalities: A dictionary from RPC method name to cardinality.Cardinality value identifying the cardinality of the RPC method. options: An optional StubOptions value further customizing the functionality of the returned face.DynamicStub. Returns: A face.DynamicStub with which RPCs can be invoked. )rEr dynamic_stubr#r3r>r<r=)r%service cardinalitiesrGrHs rrJrJsM07++G  +.-0  rceZdZdZdZdS) ServerOptionszA value encapsulating the various options for creation of a Server. This class and its instances have no supported interface - it exists to define the type of its instances and its instances exist to be passed to other functions. ch||_||_||_||_||_||_||_dSr multi_method_implementationrequest_deserializersresponse_serializersr?r@default_timeoutmaximum_timeout)r$rQrRrSr?r@rTrUs rr&zServerOptions.__init__sC,G(%:"$8!& 0..rNrArrrrNrNs-/////rrNc ,t|||||||S)aCreates a ServerOptions value to be passed at server creation. All parameters are optional and should always be passed by keyword. Args: multi_method_implementation: A face.MultiMethodImplementation to be called to service an RPC if the server has no specific method implementation for the name of the RPC for which service was requested. request_deserializers: A dictionary from service name-method name pair to request deserialization behavior. response_serializers: A dictionary from service name-method name pair to response serialization behavior. thread_pool: A thread pool to use in stubs. thread_pool_size: The size of thread pool to create for use in stubs; ignored if thread_pool has been passed. default_timeout: A duration in seconds to allow for RPC service when servicing RPCs that did not include a timeout value when invoked. maximum_timeout: A duration in seconds to allow for RPC service when servicing RPCs no matter what timeout value was passed when the RPC was invoked. Returns: A StubOptions value created from the passed parameters. )rNrPs rserver_optionsrWs,B #  rc||tn|}tj||j|j|j|j|jS)aCreates an interfaces.Server with which RPCs can be serviced. Args: service_implementations: A dictionary from service name-method name pair to face.MethodImplementation. options: An optional ServerOptions value further customizing the functionality of the returned Server. Returns: An interfaces.Server with which RPCs can be serviced. )_EMPTY_SERVER_OPTIONSrserverrQrRrSr?r@)service_implementationsrGrHs rrZrZEsJ29--g  %5/.%*   rr )NNNNNN)NNNNNNN)$r/ threadingrr grpc.betarrrrgrpc.framework.commonrgrpc.framework.interfaces.facer ChannelCredentialsssl_channel_credentialsCallCredentialsrraccess_token_call_credentialscomposite_call_credentialscomposite_channel_credentialsobjectr!r2r6r9rErCrFrJServerCredentialsssl_server_credentialsrNrYrWrZrrrris54 )))))))))))) ------//////,6&==== O O O!% B!< $ B!,!,!,!,!,f!,!,!,H"$11111&1112"k$dD$EE  ####L(4*4/////F///6& dD$dD$OO!%))))Xr