aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/framework/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/grpcio/grpc/framework/interfaces')
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/__init__.py2
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/base/__init__.py2
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/base/base.py184
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/base/utilities.py42
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/face/__init__.py2
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/face/face.py610
-rw-r--r--src/python/grpcio/grpc/framework/interfaces/face/utilities.py87
7 files changed, 508 insertions, 421 deletions
diff --git a/src/python/grpcio/grpc/framework/interfaces/__init__.py b/src/python/grpcio/grpc/framework/interfaces/__init__.py
index 7086519106..b89398809f 100644
--- a/src/python/grpcio/grpc/framework/interfaces/__init__.py
+++ b/src/python/grpcio/grpc/framework/interfaces/__init__.py
@@ -26,5 +26,3 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
diff --git a/src/python/grpcio/grpc/framework/interfaces/base/__init__.py b/src/python/grpcio/grpc/framework/interfaces/base/__init__.py
index 7086519106..b89398809f 100644
--- a/src/python/grpcio/grpc/framework/interfaces/base/__init__.py
+++ b/src/python/grpcio/grpc/framework/interfaces/base/__init__.py
@@ -26,5 +26,3 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
diff --git a/src/python/grpcio/grpc/framework/interfaces/base/base.py b/src/python/grpcio/grpc/framework/interfaces/base/base.py
index a2ddd9c474..cb3328296c 100644
--- a/src/python/grpcio/grpc/framework/interfaces/base/base.py
+++ b/src/python/grpcio/grpc/framework/interfaces/base/base.py
@@ -26,7 +26,6 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"""The base interface of RPC Framework.
Implementations of this interface support the conduct of "operations":
@@ -49,7 +48,7 @@ from grpc.framework.foundation import abandonment # pylint: disable=unused-impo
class NoSuchMethodError(Exception):
- """Indicates that an unrecognized operation has been called.
+ """Indicates that an unrecognized operation has been called.
Attributes:
code: A code value to communicate to the other side of the operation along
@@ -58,8 +57,8 @@ class NoSuchMethodError(Exception):
along with indication of operation termination. May be None.
"""
- def __init__(self, code, details):
- """Constructor.
+ def __init__(self, code, details):
+ """Constructor.
Args:
code: A code value to communicate to the other side of the operation
@@ -67,12 +66,12 @@ class NoSuchMethodError(Exception):
details: A details value to communicate to the other side of the
operation along with indication of operation termination. May be None.
"""
- self.code = code
- self.details = details
+ self.code = code
+ self.details = details
class Outcome(object):
- """The outcome of an operation.
+ """The outcome of an operation.
Attributes:
kind: A Kind value coarsely identifying how the operation terminated.
@@ -82,23 +81,23 @@ class Outcome(object):
provided.
"""
- @enum.unique
- class Kind(enum.Enum):
- """Ways in which an operation can terminate."""
+ @enum.unique
+ class Kind(enum.Enum):
+ """Ways in which an operation can terminate."""
- COMPLETED = 'completed'
- CANCELLED = 'cancelled'
- EXPIRED = 'expired'
- LOCAL_SHUTDOWN = 'local shutdown'
- REMOTE_SHUTDOWN = 'remote shutdown'
- RECEPTION_FAILURE = 'reception failure'
- TRANSMISSION_FAILURE = 'transmission failure'
- LOCAL_FAILURE = 'local failure'
- REMOTE_FAILURE = 'remote failure'
+ COMPLETED = 'completed'
+ CANCELLED = 'cancelled'
+ EXPIRED = 'expired'
+ LOCAL_SHUTDOWN = 'local shutdown'
+ REMOTE_SHUTDOWN = 'remote shutdown'
+ RECEPTION_FAILURE = 'reception failure'
+ TRANSMISSION_FAILURE = 'transmission failure'
+ LOCAL_FAILURE = 'local failure'
+ REMOTE_FAILURE = 'remote failure'
class Completion(six.with_metaclass(abc.ABCMeta)):
- """An aggregate of the values exchanged upon operation completion.
+ """An aggregate of the values exchanged upon operation completion.
Attributes:
terminal_metadata: A terminal metadata value for the operaton.
@@ -108,21 +107,21 @@ class Completion(six.with_metaclass(abc.ABCMeta)):
class OperationContext(six.with_metaclass(abc.ABCMeta)):
- """Provides operation-related information and action."""
+ """Provides operation-related information and action."""
- @abc.abstractmethod
- def outcome(self):
- """Indicates the operation's outcome (or that the operation is ongoing).
+ @abc.abstractmethod
+ def outcome(self):
+ """Indicates the operation's outcome (or that the operation is ongoing).
Returns:
None if the operation is still active or the Outcome value for the
operation if it has terminated.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def add_termination_callback(self, callback):
- """Adds a function to be called upon operation termination.
+ @abc.abstractmethod
+ def add_termination_callback(self, callback):
+ """Adds a function to be called upon operation termination.
Args:
callback: A callable to be passed an Outcome value on operation
@@ -134,42 +133,44 @@ class OperationContext(six.with_metaclass(abc.ABCMeta)):
terminated an Outcome value describing the operation termination and the
passed callback will not be called as a result of this method call.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def time_remaining(self):
- """Describes the length of allowed time remaining for the operation.
+ @abc.abstractmethod
+ def time_remaining(self):
+ """Describes the length of allowed time remaining for the operation.
Returns:
A nonnegative float indicating the length of allowed time in seconds
remaining for the operation to complete before it is considered to have
timed out. Zero is returned if the operation has terminated.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def cancel(self):
- """Cancels the operation if the operation has not yet terminated."""
- raise NotImplementedError()
+ @abc.abstractmethod
+ def cancel(self):
+ """Cancels the operation if the operation has not yet terminated."""
+ raise NotImplementedError()
- @abc.abstractmethod
- def fail(self, exception):
- """Indicates that the operation has failed.
+ @abc.abstractmethod
+ def fail(self, exception):
+ """Indicates that the operation has failed.
Args:
exception: An exception germane to the operation failure. May be None.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class Operator(six.with_metaclass(abc.ABCMeta)):
- """An interface through which to participate in an operation."""
+ """An interface through which to participate in an operation."""
- @abc.abstractmethod
- def advance(
- self, initial_metadata=None, payload=None, completion=None,
- allowance=None):
- """Progresses the operation.
+ @abc.abstractmethod
+ def advance(self,
+ initial_metadata=None,
+ payload=None,
+ completion=None,
+ allowance=None):
+ """Progresses the operation.
Args:
initial_metadata: An initial metadata value. Only one may ever be
@@ -181,23 +182,24 @@ class Operator(six.with_metaclass(abc.ABCMeta)):
allowance: A positive integer communicating the number of additional
payloads allowed to be passed by the remote side of the operation.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
+
class ProtocolReceiver(six.with_metaclass(abc.ABCMeta)):
- """A means of receiving protocol values during an operation."""
+ """A means of receiving protocol values during an operation."""
- @abc.abstractmethod
- def context(self, protocol_context):
- """Accepts the protocol context object for the operation.
+ @abc.abstractmethod
+ def context(self, protocol_context):
+ """Accepts the protocol context object for the operation.
Args:
protocol_context: The protocol context object for the operation.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class Subscription(six.with_metaclass(abc.ABCMeta)):
- """Describes customer code's interest in values from the other side.
+ """Describes customer code's interest in values from the other side.
Attributes:
kind: A Kind value describing the overall kind of this value.
@@ -215,20 +217,20 @@ class Subscription(six.with_metaclass(abc.ABCMeta)):
Kind.FULL.
"""
- @enum.unique
- class Kind(enum.Enum):
+ @enum.unique
+ class Kind(enum.Enum):
- NONE = 'none'
- TERMINATION_ONLY = 'termination only'
- FULL = 'full'
+ NONE = 'none'
+ TERMINATION_ONLY = 'termination only'
+ FULL = 'full'
class Servicer(six.with_metaclass(abc.ABCMeta)):
- """Interface for service implementations."""
+ """Interface for service implementations."""
- @abc.abstractmethod
- def service(self, group, method, context, output_operator):
- """Services an operation.
+ @abc.abstractmethod
+ def service(self, group, method, context, output_operator):
+ """Services an operation.
Args:
group: The group identifier of the operation to be serviced.
@@ -248,20 +250,20 @@ class Servicer(six.with_metaclass(abc.ABCMeta)):
abandonment.Abandoned: If the operation has been aborted and there no
longer is any reason to service the operation.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class End(six.with_metaclass(abc.ABCMeta)):
- """Common type for entry-point objects on both sides of an operation."""
+ """Common type for entry-point objects on both sides of an operation."""
- @abc.abstractmethod
- def start(self):
- """Starts this object's service of operations."""
- raise NotImplementedError()
+ @abc.abstractmethod
+ def start(self):
+ """Starts this object's service of operations."""
+ raise NotImplementedError()
- @abc.abstractmethod
- def stop(self, grace):
- """Stops this object's service of operations.
+ @abc.abstractmethod
+ def stop(self, grace):
+ """Stops this object's service of operations.
This object will refuse service of new operations as soon as this method is
called but operations under way at the time of the call may be given a
@@ -281,13 +283,19 @@ class End(six.with_metaclass(abc.ABCMeta)):
much sooner (if for example this End had no operations in progress at
the time its stop method was called).
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def operate(
- self, group, method, subscription, timeout, initial_metadata=None,
- payload=None, completion=None, protocol_options=None):
- """Commences an operation.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def operate(self,
+ group,
+ method,
+ subscription,
+ timeout,
+ initial_metadata=None,
+ payload=None,
+ completion=None,
+ protocol_options=None):
+ """Commences an operation.
Args:
group: The group identifier of the invoked operation.
@@ -312,23 +320,23 @@ class End(six.with_metaclass(abc.ABCMeta)):
returned pair is an Operator to which operation values not passed in
this call should later be passed.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def operation_stats(self):
- """Reports the number of terminated operations broken down by outcome.
+ @abc.abstractmethod
+ def operation_stats(self):
+ """Reports the number of terminated operations broken down by outcome.
Returns:
A dictionary from Outcome.Kind value to an integer identifying the number
of operations that terminated with that outcome kind.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def add_idle_action(self, action):
- """Adds an action to be called when this End has no ongoing operations.
+ @abc.abstractmethod
+ def add_idle_action(self, action):
+ """Adds an action to be called when this End has no ongoing operations.
Args:
action: A callable that accepts no arguments.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
diff --git a/src/python/grpcio/grpc/framework/interfaces/base/utilities.py b/src/python/grpcio/grpc/framework/interfaces/base/utilities.py
index 87a85018f5..461706ff9f 100644
--- a/src/python/grpcio/grpc/framework/interfaces/base/utilities.py
+++ b/src/python/grpcio/grpc/framework/interfaces/base/utilities.py
@@ -26,7 +26,6 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"""Utilities for use with the base interface of RPC Framework."""
import collections
@@ -34,27 +33,30 @@ import collections
from grpc.framework.interfaces.base import base
-class _Completion(
- base.Completion,
- collections.namedtuple(
- '_Completion', ('terminal_metadata', 'code', 'message',))):
- """A trivial implementation of base.Completion."""
+class _Completion(base.Completion,
+ collections.namedtuple('_Completion', (
+ 'terminal_metadata',
+ 'code',
+ 'message',))):
+ """A trivial implementation of base.Completion."""
+
+class _Subscription(base.Subscription,
+ collections.namedtuple('_Subscription', (
+ 'kind',
+ 'termination_callback',
+ 'allowance',
+ 'operator',
+ 'protocol_receiver',))):
+ """A trivial implementation of base.Subscription."""
-class _Subscription(
- base.Subscription,
- collections.namedtuple(
- '_Subscription',
- ('kind', 'termination_callback', 'allowance', 'operator',
- 'protocol_receiver',))):
- """A trivial implementation of base.Subscription."""
-_NONE_SUBSCRIPTION = _Subscription(
- base.Subscription.Kind.NONE, None, None, None, None)
+_NONE_SUBSCRIPTION = _Subscription(base.Subscription.Kind.NONE, None, None,
+ None, None)
def completion(terminal_metadata, code, message):
- """Creates a base.Completion aggregating the given operation values.
+ """Creates a base.Completion aggregating the given operation values.
Args:
terminal_metadata: A terminal metadata value for an operaton.
@@ -64,11 +66,11 @@ def completion(terminal_metadata, code, message):
Returns:
A base.Completion aggregating the given operation values.
"""
- return _Completion(terminal_metadata, code, message)
+ return _Completion(terminal_metadata, code, message)
def full_subscription(operator, protocol_receiver):
- """Creates a "full" base.Subscription for the given base.Operator.
+ """Creates a "full" base.Subscription for the given base.Operator.
Args:
operator: A base.Operator to be used in an operation.
@@ -78,5 +80,5 @@ def full_subscription(operator, protocol_receiver):
A base.Subscription of kind base.Subscription.Kind.FULL wrapping the given
base.Operator and base.ProtocolReceiver.
"""
- return _Subscription(
- base.Subscription.Kind.FULL, None, None, operator, protocol_receiver)
+ return _Subscription(base.Subscription.Kind.FULL, None, None, operator,
+ protocol_receiver)
diff --git a/src/python/grpcio/grpc/framework/interfaces/face/__init__.py b/src/python/grpcio/grpc/framework/interfaces/face/__init__.py
index 7086519106..b89398809f 100644
--- a/src/python/grpcio/grpc/framework/interfaces/face/__init__.py
+++ b/src/python/grpcio/grpc/framework/interfaces/face/__init__.py
@@ -26,5 +26,3 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
diff --git a/src/python/grpcio/grpc/framework/interfaces/face/face.py b/src/python/grpcio/grpc/framework/interfaces/face/face.py
index 4826e7fff6..36ddca18c1 100644
--- a/src/python/grpcio/grpc/framework/interfaces/face/face.py
+++ b/src/python/grpcio/grpc/framework/interfaces/face/face.py
@@ -26,7 +26,6 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"""Interfaces defining the Face layer of RPC Framework."""
import abc
@@ -45,33 +44,38 @@ from grpc.framework.foundation import stream # pylint: disable=unused-import
class NoSuchMethodError(Exception):
- """Raised by customer code to indicate an unrecognized method.
+ """Raised by customer code to indicate an unrecognized method.
Attributes:
group: The group of the unrecognized method.
name: The name of the unrecognized method.
"""
- def __init__(self, group, method):
- """Constructor.
+ def __init__(self, group, method):
+ """Constructor.
Args:
group: The group identifier of the unrecognized RPC name.
method: The method identifier of the unrecognized RPC name.
"""
- super(NoSuchMethodError, self).__init__()
- self.group = group
- self.method = method
+ super(NoSuchMethodError, self).__init__()
+ self.group = group
+ self.method = method
- def __repr__(self):
- return 'face.NoSuchMethodError(%s, %s)' % (self.group, self.method,)
+ def __repr__(self):
+ return 'face.NoSuchMethodError(%s, %s)' % (
+ self.group,
+ self.method,)
class Abortion(
- collections.namedtuple(
- 'Abortion',
- ('kind', 'initial_metadata', 'terminal_metadata', 'code', 'details',))):
- """A value describing RPC abortion.
+ collections.namedtuple('Abortion', (
+ 'kind',
+ 'initial_metadata',
+ 'terminal_metadata',
+ 'code',
+ 'details',))):
+ """A value describing RPC abortion.
Attributes:
kind: A Kind value identifying how the RPC failed.
@@ -85,21 +89,21 @@ class Abortion(
details value was received.
"""
- @enum.unique
- class Kind(enum.Enum):
- """Types of RPC abortion."""
+ @enum.unique
+ class Kind(enum.Enum):
+ """Types of RPC abortion."""
- CANCELLED = 'cancelled'
- EXPIRED = 'expired'
- LOCAL_SHUTDOWN = 'local shutdown'
- REMOTE_SHUTDOWN = 'remote shutdown'
- NETWORK_FAILURE = 'network failure'
- LOCAL_FAILURE = 'local failure'
- REMOTE_FAILURE = 'remote failure'
+ CANCELLED = 'cancelled'
+ EXPIRED = 'expired'
+ LOCAL_SHUTDOWN = 'local shutdown'
+ REMOTE_SHUTDOWN = 'remote shutdown'
+ NETWORK_FAILURE = 'network failure'
+ LOCAL_FAILURE = 'local failure'
+ REMOTE_FAILURE = 'remote failure'
class AbortionError(six.with_metaclass(abc.ABCMeta, Exception)):
- """Common super type for exceptions indicating RPC abortion.
+ """Common super type for exceptions indicating RPC abortion.
initial_metadata: The initial metadata from the other side of the RPC or
None if no initial metadata value was received.
@@ -111,100 +115,100 @@ class AbortionError(six.with_metaclass(abc.ABCMeta, Exception)):
details value was received.
"""
- def __init__(self, initial_metadata, terminal_metadata, code, details):
- super(AbortionError, self).__init__()
- self.initial_metadata = initial_metadata
- self.terminal_metadata = terminal_metadata
- self.code = code
- self.details = details
+ def __init__(self, initial_metadata, terminal_metadata, code, details):
+ super(AbortionError, self).__init__()
+ self.initial_metadata = initial_metadata
+ self.terminal_metadata = terminal_metadata
+ self.code = code
+ self.details = details
- def __str__(self):
- return '%s(code=%s, details="%s")' % (
- self.__class__.__name__, self.code, self.details)
+ def __str__(self):
+ return '%s(code=%s, details="%s")' % (self.__class__.__name__,
+ self.code, self.details)
class CancellationError(AbortionError):
- """Indicates that an RPC has been cancelled."""
+ """Indicates that an RPC has been cancelled."""
class ExpirationError(AbortionError):
- """Indicates that an RPC has expired ("timed out")."""
+ """Indicates that an RPC has expired ("timed out")."""
class LocalShutdownError(AbortionError):
- """Indicates that an RPC has terminated due to local shutdown of RPCs."""
+ """Indicates that an RPC has terminated due to local shutdown of RPCs."""
class RemoteShutdownError(AbortionError):
- """Indicates that an RPC has terminated due to remote shutdown of RPCs."""
+ """Indicates that an RPC has terminated due to remote shutdown of RPCs."""
class NetworkError(AbortionError):
- """Indicates that some error occurred on the network."""
+ """Indicates that some error occurred on the network."""
class LocalError(AbortionError):
- """Indicates that an RPC has terminated due to a local defect."""
+ """Indicates that an RPC has terminated due to a local defect."""
class RemoteError(AbortionError):
- """Indicates that an RPC has terminated due to a remote defect."""
+ """Indicates that an RPC has terminated due to a remote defect."""
class RpcContext(six.with_metaclass(abc.ABCMeta)):
- """Provides RPC-related information and action."""
+ """Provides RPC-related information and action."""
- @abc.abstractmethod
- def is_active(self):
- """Describes whether the RPC is active or has terminated."""
- raise NotImplementedError()
+ @abc.abstractmethod
+ def is_active(self):
+ """Describes whether the RPC is active or has terminated."""
+ raise NotImplementedError()
- @abc.abstractmethod
- def time_remaining(self):
- """Describes the length of allowed time remaining for the RPC.
+ @abc.abstractmethod
+ def time_remaining(self):
+ """Describes the length of allowed time remaining for the RPC.
Returns:
A nonnegative float indicating the length of allowed time in seconds
remaining for the RPC to complete before it is considered to have timed
out.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def add_abortion_callback(self, abortion_callback):
- """Registers a callback to be called if the RPC is aborted.
+ @abc.abstractmethod
+ def add_abortion_callback(self, abortion_callback):
+ """Registers a callback to be called if the RPC is aborted.
Args:
abortion_callback: A callable to be called and passed an Abortion value
in the event of RPC abortion.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def cancel(self):
- """Cancels the RPC.
+ @abc.abstractmethod
+ def cancel(self):
+ """Cancels the RPC.
Idempotent and has no effect if the RPC has already terminated.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def protocol_context(self):
- """Accesses a custom object specified by an implementation provider.
+ @abc.abstractmethod
+ def protocol_context(self):
+ """Accesses a custom object specified by an implementation provider.
Returns:
A value specified by the provider of a Face interface implementation
affording custom state and behavior.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """Invocation-side utility object for an RPC."""
+ """Invocation-side utility object for an RPC."""
- @abc.abstractmethod
- def initial_metadata(self):
- """Accesses the initial metadata from the service-side of the RPC.
+ @abc.abstractmethod
+ def initial_metadata(self):
+ """Accesses the initial metadata from the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -213,11 +217,11 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The initial metadata object emitted by the service-side of the RPC, or
None if there was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def terminal_metadata(self):
- """Accesses the terminal metadata from the service-side of the RPC.
+ @abc.abstractmethod
+ def terminal_metadata(self):
+ """Accesses the terminal metadata from the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -226,11 +230,11 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The terminal metadata object emitted by the service-side of the RPC, or
None if there was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def code(self):
- """Accesses the code emitted by the service-side of the RPC.
+ @abc.abstractmethod
+ def code(self):
+ """Accesses the code emitted by the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -239,11 +243,11 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The code object emitted by the service-side of the RPC, or None if there
was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def details(self):
- """Accesses the details value emitted by the service-side of the RPC.
+ @abc.abstractmethod
+ def details(self):
+ """Accesses the details value emitted by the service-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the service-side of the RPC.
@@ -252,15 +256,15 @@ class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
The details value emitted by the service-side of the RPC, or None if there
was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
- """A context object passed to method implementations."""
+ """A context object passed to method implementations."""
- @abc.abstractmethod
- def invocation_metadata(self):
- """Accesses the metadata from the invocation-side of the RPC.
+ @abc.abstractmethod
+ def invocation_metadata(self):
+ """Accesses the metadata from the invocation-side of the RPC.
This method blocks until the value is available or is known not to have been
emitted from the invocation-side of the RPC.
@@ -269,11 +273,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
The metadata object emitted by the invocation-side of the RPC, or None if
there was no such value.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def initial_metadata(self, initial_metadata):
- """Accepts the service-side initial metadata value of the RPC.
+ @abc.abstractmethod
+ def initial_metadata(self, initial_metadata):
+ """Accepts the service-side initial metadata value of the RPC.
This method need not be called by method implementations if they have no
service-side initial metadata to transmit.
@@ -282,11 +286,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
initial_metadata: The service-side initial metadata value of the RPC to
be transmitted to the invocation side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def terminal_metadata(self, terminal_metadata):
- """Accepts the service-side terminal metadata value of the RPC.
+ @abc.abstractmethod
+ def terminal_metadata(self, terminal_metadata):
+ """Accepts the service-side terminal metadata value of the RPC.
This method need not be called by method implementations if they have no
service-side terminal metadata to transmit.
@@ -295,11 +299,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
terminal_metadata: The service-side terminal metadata value of the RPC to
be transmitted to the invocation side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def code(self, code):
- """Accepts the service-side code of the RPC.
+ @abc.abstractmethod
+ def code(self, code):
+ """Accepts the service-side code of the RPC.
This method need not be called by method implementations if they have no
code to transmit.
@@ -308,11 +312,11 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
code: The code of the RPC to be transmitted to the invocation side of the
RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def details(self, details):
- """Accepts the service-side details of the RPC.
+ @abc.abstractmethod
+ def details(self, details):
+ """Accepts the service-side details of the RPC.
This method need not be called by method implementations if they have no
service-side details to transmit.
@@ -321,34 +325,34 @@ class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
details: The service-side details value of the RPC to be transmitted to
the invocation side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class ResponseReceiver(six.with_metaclass(abc.ABCMeta)):
- """Invocation-side object used to accept the output of an RPC."""
+ """Invocation-side object used to accept the output of an RPC."""
- @abc.abstractmethod
- def initial_metadata(self, initial_metadata):
- """Receives the initial metadata from the service-side of the RPC.
+ @abc.abstractmethod
+ def initial_metadata(self, initial_metadata):
+ """Receives the initial metadata from the service-side of the RPC.
Args:
initial_metadata: The initial metadata object emitted from the
service-side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def response(self, response):
- """Receives a response from the service-side of the RPC.
+ @abc.abstractmethod
+ def response(self, response):
+ """Receives a response from the service-side of the RPC.
Args:
response: A response object emitted from the service-side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def complete(self, terminal_metadata, code, details):
- """Receives the completion values emitted from the service-side of the RPC.
+ @abc.abstractmethod
+ def complete(self, terminal_metadata, code, details):
+ """Receives the completion values emitted from the service-side of the RPC.
Args:
terminal_metadata: The terminal metadata object emitted from the
@@ -356,17 +360,20 @@ class ResponseReceiver(six.with_metaclass(abc.ABCMeta)):
code: The code object emitted from the service-side of the RPC.
details: The details object emitted from the service-side of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a unary-unary RPC in any call style."""
+ """Affords invoking a unary-unary RPC in any call style."""
- @abc.abstractmethod
- def __call__(
- self, request, timeout, metadata=None, with_call=False,
- protocol_options=None):
- """Synchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self,
+ request,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Synchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -385,11 +392,11 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def future(self, request, timeout, metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def future(self, request, timeout, metadata=None, protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -405,13 +412,17 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(
- self, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -427,15 +438,15 @@ class UnaryUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call for the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a unary-stream RPC in any call style."""
+ """Affords invoking a unary-stream RPC in any call style."""
- @abc.abstractmethod
- def __call__(self, request, timeout, metadata=None, protocol_options=None):
- """Invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self, request, timeout, metadata=None, protocol_options=None):
+ """Invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -450,13 +461,17 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event(
- self, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event(self,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request: The request value for the RPC.
@@ -472,17 +487,20 @@ class UnaryStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call object for the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a stream-unary RPC in any call style."""
+ """Affords invoking a stream-unary RPC in any call style."""
- @abc.abstractmethod
- def __call__(
- self, request_iterator, timeout, metadata=None,
- with_call=False, protocol_options=None):
- """Synchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Synchronously invokes the underlying RPC.
Args:
request_iterator: An iterator that yields request values for the RPC.
@@ -501,12 +519,15 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def future(
- self, request_iterator, timeout, metadata=None, protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def future(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
request_iterator: An iterator that yields request values for the RPC.
@@ -522,13 +543,16 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def event(
- self, receiver, abortion_callback, timeout, metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
receiver: A ResponseReceiver to be passed the response data of the RPC.
@@ -544,16 +568,19 @@ class StreamUnaryMultiCallable(six.with_metaclass(abc.ABCMeta)):
A single object that is both a Call object for the RPC and a
stream.Consumer to which the request values of the RPC should be passed.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
- """Affords invoking a stream-stream RPC in any call style."""
+ """Affords invoking a stream-stream RPC in any call style."""
- @abc.abstractmethod
- def __call__(
- self, request_iterator, timeout, metadata=None, protocol_options=None):
- """Invokes the underlying RPC.
+ @abc.abstractmethod
+ def __call__(self,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes the underlying RPC.
Args:
request_iterator: An iterator that yields request values for the RPC.
@@ -568,13 +595,16 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def event(
- self, receiver, abortion_callback, timeout, metadata=None,
- protocol_options=None):
- """Asynchronously invokes the underlying RPC.
+ @abc.abstractmethod
+ def event(self,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Asynchronously invokes the underlying RPC.
Args:
receiver: A ResponseReceiver to be passed the response data of the RPC.
@@ -590,11 +620,11 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
A single object that is both a Call object for the RPC and a
stream.Consumer to which the request values of the RPC should be passed.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
- """A sum type that describes a method implementation.
+ """A sum type that describes a method implementation.
Attributes:
cardinality: A cardinality.Cardinality value.
@@ -639,11 +669,11 @@ class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
- """A general type able to service many methods."""
+ """A general type able to service many methods."""
- @abc.abstractmethod
- def service(self, group, method, response_consumer, context):
- """Services an RPC.
+ @abc.abstractmethod
+ def service(self, group, method, response_consumer, context):
+ """Services an RPC.
Args:
group: The group identifier of the RPC.
@@ -666,17 +696,22 @@ class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
NoSuchMethodError: If this MultiMethod does not recognize the given group
and name for the RPC and is not able to service the RPC.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class GenericStub(six.with_metaclass(abc.ABCMeta)):
- """Affords RPC invocation via generic methods."""
-
- @abc.abstractmethod
- def blocking_unary_unary(
- self, group, method, request, timeout, metadata=None,
- with_call=False, protocol_options=None):
- """Invokes a unary-request-unary-response method.
+ """Affords RPC invocation via generic methods."""
+
+ @abc.abstractmethod
+ def blocking_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Invokes a unary-request-unary-response method.
This method blocks until either returning the response value of the RPC
(in the event of RPC completion) or raising an exception (in the event of
@@ -700,13 +735,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future_unary_unary(
- self, group, method, request, timeout, metadata=None,
- protocol_options=None):
- """Invokes a unary-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future_unary_unary(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a unary-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -723,13 +762,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def inline_unary_stream(
- self, group, method, request, timeout, metadata=None,
- protocol_options=None):
- """Invokes a unary-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def inline_unary_stream(self,
+ group,
+ method,
+ request,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a unary-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -745,13 +788,18 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def blocking_stream_unary(
- self, group, method, request_iterator, timeout, metadata=None,
- with_call=False, protocol_options=None):
- """Invokes a stream-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def blocking_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ with_call=False,
+ protocol_options=None):
+ """Invokes a stream-request-unary-response method.
This method blocks until either returning the response value of the RPC
(in the event of RPC completion) or raising an exception (in the event of
@@ -775,13 +823,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Raises:
AbortionError: Indicating that the RPC was aborted.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def future_stream_unary(
- self, group, method, request_iterator, timeout, metadata=None,
- protocol_options=None):
- """Invokes a stream-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def future_stream_unary(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a stream-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -798,13 +850,17 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
response value of the RPC. In the event of RPC abortion, the returned
Future's exception value will be an AbortionError.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def inline_stream_stream(
- self, group, method, request_iterator, timeout, metadata=None,
- protocol_options=None):
- """Invokes a stream-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def inline_stream_stream(self,
+ group,
+ method,
+ request_iterator,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Invokes a stream-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -820,13 +876,19 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
values. Drawing response values from the returned iterator may raise
AbortionError indicating abortion of the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_unary_unary(
- self, group, method, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_unary_unary(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -843,13 +905,19 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call for the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_unary_stream(
- self, group, method, request, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_unary_stream(self,
+ group,
+ method,
+ request,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -866,13 +934,18 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A Call for the RPC.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_stream_unary(
- self, group, method, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-unary-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_stream_unary(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-unary-response method.
Args:
group: The group identifier of the RPC.
@@ -889,13 +962,18 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
A pair of a Call object for the RPC and a stream.Consumer to which the
request values of the RPC should be passed.
"""
- raise NotImplementedError()
-
- @abc.abstractmethod
- def event_stream_stream(
- self, group, method, receiver, abortion_callback, timeout,
- metadata=None, protocol_options=None):
- """Event-driven invocation of a unary-request-stream-response method.
+ raise NotImplementedError()
+
+ @abc.abstractmethod
+ def event_stream_stream(self,
+ group,
+ method,
+ receiver,
+ abortion_callback,
+ timeout,
+ metadata=None,
+ protocol_options=None):
+ """Event-driven invocation of a unary-request-stream-response method.
Args:
group: The group identifier of the RPC.
@@ -912,11 +990,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
A pair of a Call object for the RPC and a stream.Consumer to which the
request values of the RPC should be passed.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def unary_unary(self, group, method):
- """Creates a UnaryUnaryMultiCallable for a unary-unary method.
+ @abc.abstractmethod
+ def unary_unary(self, group, method):
+ """Creates a UnaryUnaryMultiCallable for a unary-unary method.
Args:
group: The group identifier of the RPC.
@@ -925,11 +1003,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A UnaryUnaryMultiCallable value for the named unary-unary method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def unary_stream(self, group, method):
- """Creates a UnaryStreamMultiCallable for a unary-stream method.
+ @abc.abstractmethod
+ def unary_stream(self, group, method):
+ """Creates a UnaryStreamMultiCallable for a unary-stream method.
Args:
group: The group identifier of the RPC.
@@ -938,11 +1016,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A UnaryStreamMultiCallable value for the name unary-stream method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def stream_unary(self, group, method):
- """Creates a StreamUnaryMultiCallable for a stream-unary method.
+ @abc.abstractmethod
+ def stream_unary(self, group, method):
+ """Creates a StreamUnaryMultiCallable for a stream-unary method.
Args:
group: The group identifier of the RPC.
@@ -951,11 +1029,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A StreamUnaryMultiCallable value for the named stream-unary method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
- @abc.abstractmethod
- def stream_stream(self, group, method):
- """Creates a StreamStreamMultiCallable for a stream-stream method.
+ @abc.abstractmethod
+ def stream_stream(self, group, method):
+ """Creates a StreamStreamMultiCallable for a stream-stream method.
Args:
group: The group identifier of the RPC.
@@ -964,11 +1042,11 @@ class GenericStub(six.with_metaclass(abc.ABCMeta)):
Returns:
A StreamStreamMultiCallable value for the named stream-stream method.
"""
- raise NotImplementedError()
+ raise NotImplementedError()
class DynamicStub(six.with_metaclass(abc.ABCMeta)):
- """Affords RPC invocation via attributes corresponding to afforded methods.
+ """Affords RPC invocation via attributes corresponding to afforded methods.
Instances of this type may be scoped to a single group so that attribute
access is unambiguous.
diff --git a/src/python/grpcio/grpc/framework/interfaces/face/utilities.py b/src/python/grpcio/grpc/framework/interfaces/face/utilities.py
index db2ec6ed87..39a642f0ae 100644
--- a/src/python/grpcio/grpc/framework/interfaces/face/utilities.py
+++ b/src/python/grpcio/grpc/framework/interfaces/face/utilities.py
@@ -26,7 +26,6 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
"""Utilities for RPC Framework's Face interface."""
import collections
@@ -38,18 +37,24 @@ from grpc.framework.foundation import stream # pylint: disable=unused-import
from grpc.framework.interfaces.face import face
-class _MethodImplementation(
- face.MethodImplementation,
- collections.namedtuple(
- '_MethodImplementation',
- ['cardinality', 'style', 'unary_unary_inline', 'unary_stream_inline',
- 'stream_unary_inline', 'stream_stream_inline', 'unary_unary_event',
- 'unary_stream_event', 'stream_unary_event', 'stream_stream_event',])):
- pass
+class _MethodImplementation(face.MethodImplementation,
+ collections.namedtuple('_MethodImplementation', [
+ 'cardinality',
+ 'style',
+ 'unary_unary_inline',
+ 'unary_stream_inline',
+ 'stream_unary_inline',
+ 'stream_stream_inline',
+ 'unary_unary_event',
+ 'unary_stream_event',
+ 'stream_unary_event',
+ 'stream_stream_event',
+ ])):
+ pass
def unary_unary_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a unary-unary RPC method as a callable value
@@ -59,13 +64,13 @@ def unary_unary_inline(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.UNARY_UNARY, style.Service.INLINE, behavior,
- None, None, None, None, None, None, None)
+ return _MethodImplementation(cardinality.Cardinality.UNARY_UNARY,
+ style.Service.INLINE, behavior, None, None,
+ None, None, None, None, None)
def unary_stream_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a unary-stream RPC method as a callable
@@ -75,13 +80,13 @@ def unary_stream_inline(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.UNARY_STREAM, style.Service.INLINE, None,
- behavior, None, None, None, None, None, None)
+ return _MethodImplementation(cardinality.Cardinality.UNARY_STREAM,
+ style.Service.INLINE, None, behavior, None,
+ None, None, None, None, None)
def stream_unary_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a stream-unary RPC method as a callable
@@ -91,13 +96,13 @@ def stream_unary_inline(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.STREAM_UNARY, style.Service.INLINE, None, None,
- behavior, None, None, None, None, None)
+ return _MethodImplementation(cardinality.Cardinality.STREAM_UNARY,
+ style.Service.INLINE, None, None, behavior,
+ None, None, None, None, None)
def stream_stream_inline(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a stream-stream RPC method as a callable
@@ -107,13 +112,13 @@ def stream_stream_inline(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.STREAM_STREAM, style.Service.INLINE, None, None,
- None, behavior, None, None, None, None)
+ return _MethodImplementation(cardinality.Cardinality.STREAM_STREAM,
+ style.Service.INLINE, None, None, None,
+ behavior, None, None, None, None)
def unary_unary_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a unary-unary RPC method as a callable
@@ -123,13 +128,13 @@ def unary_unary_event(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.UNARY_UNARY, style.Service.EVENT, None, None,
- None, None, behavior, None, None, None)
+ return _MethodImplementation(cardinality.Cardinality.UNARY_UNARY,
+ style.Service.EVENT, None, None, None, None,
+ behavior, None, None, None)
def unary_stream_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a unary-stream RPC method as a callable
@@ -139,13 +144,13 @@ def unary_stream_event(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.UNARY_STREAM, style.Service.EVENT, None, None,
- None, None, None, behavior, None, None)
+ return _MethodImplementation(cardinality.Cardinality.UNARY_STREAM,
+ style.Service.EVENT, None, None, None, None,
+ None, behavior, None, None)
def stream_unary_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a stream-unary RPC method as a callable
@@ -156,13 +161,13 @@ def stream_unary_event(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.STREAM_UNARY, style.Service.EVENT, None, None,
- None, None, None, None, behavior, None)
+ return _MethodImplementation(cardinality.Cardinality.STREAM_UNARY,
+ style.Service.EVENT, None, None, None, None,
+ None, None, behavior, None)
def stream_stream_event(behavior):
- """Creates an face.MethodImplementation for the given behavior.
+ """Creates an face.MethodImplementation for the given behavior.
Args:
behavior: The implementation of a stream-stream RPC method as a callable
@@ -173,6 +178,6 @@ def stream_stream_event(behavior):
Returns:
An face.MethodImplementation derived from the given behavior.
"""
- return _MethodImplementation(
- cardinality.Cardinality.STREAM_STREAM, style.Service.EVENT, None, None,
- None, None, None, None, None, behavior)
+ return _MethodImplementation(cardinality.Cardinality.STREAM_STREAM,
+ style.Service.EVENT, None, None, None, None,
+ None, None, None, behavior)