Merge pull request #5651 from leifurhauks/py3_metaclasses

specify metaclasses in a py3-compatible way
pull/5859/head
Jan Tattermusch 9 years ago
commit 20792927fe
  1. 16
      src/python/grpcio/grpc/_adapter/_types.py
  2. 7
      src/python/grpcio/grpc/_links/invocation.py
  3. 22
      src/python/grpcio/grpc/beta/interfaces.py
  4. 10
      src/python/grpcio/grpc/framework/alpha/_face_utilities.py
  5. 7
      src/python/grpcio/grpc/framework/alpha/exceptions.py
  6. 31
      src/python/grpcio/grpc/framework/alpha/interfaces.py
  7. 7
      src/python/grpcio/grpc/framework/base/_ingestion.py
  8. 25
      src/python/grpcio/grpc/framework/base/_interfaces.py
  9. 7
      src/python/grpcio/grpc/framework/base/_reception.py
  10. 10
      src/python/grpcio/grpc/framework/base/_transmission.py
  11. 40
      src/python/grpcio/grpc/framework/base/interfaces.py
  12. 7
      src/python/grpcio/grpc/framework/core/_end.py
  13. 7
      src/python/grpcio/grpc/framework/core/_ingestion.py
  14. 28
      src/python/grpcio/grpc/framework/core/_interfaces.py
  15. 5
      src/python/grpcio/grpc/framework/core/_termination.py
  16. 7
      src/python/grpcio/grpc/framework/face/exceptions.py
  17. 37
      src/python/grpcio/grpc/framework/face/interfaces.py
  18. 6
      src/python/grpcio/grpc/framework/foundation/activated.py
  19. 7
      src/python/grpcio/grpc/framework/foundation/callable_util.py
  20. 7
      src/python/grpcio/grpc/framework/foundation/future.py
  21. 3
      src/python/grpcio/grpc/framework/foundation/relay.py
  22. 6
      src/python/grpcio/grpc/framework/foundation/stream.py
  23. 25
      src/python/grpcio/grpc/framework/interfaces/base/base.py
  24. 41
      src/python/grpcio/grpc/framework/interfaces/face/face.py
  25. 7
      src/python/grpcio/grpc/framework/interfaces/links/links.py
  26. 7
      src/python/grpcio/tests/unit/_adapter/_proto_scenarios.py
  27. 7
      src/python/grpcio/tests/unit/_links/_proto_scenarios.py
  28. 8
      src/python/grpcio/tests/unit/framework/common/test_control.py
  29. 7
      src/python/grpcio/tests/unit/framework/common/test_coverage.py
  30. 8
      src/python/grpcio/tests/unit/framework/face/testing/base_util.py
  31. 8
      src/python/grpcio/tests/unit/framework/face/testing/blocking_invocation_inline_service_test_case.py
  32. 8
      src/python/grpcio/tests/unit/framework/face/testing/control.py
  33. 12
      src/python/grpcio/tests/unit/framework/face/testing/coverage.py
  34. 8
      src/python/grpcio/tests/unit/framework/face/testing/event_invocation_synchronous_event_service_test_case.py
  35. 8
      src/python/grpcio/tests/unit/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py
  36. 7
      src/python/grpcio/tests/unit/framework/face/testing/interfaces.py
  37. 40
      src/python/grpcio/tests/unit/framework/face/testing/service.py
  38. 7
      src/python/grpcio/tests/unit/framework/face/testing/test_case.py
  39. 10
      src/python/grpcio/tests/unit/framework/interfaces/base/_control.py
  40. 10
      src/python/grpcio/tests/unit/framework/interfaces/base/test_interfaces.py
  41. 5
      src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py
  42. 5
      src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py
  43. 10
      src/python/grpcio/tests/unit/framework/interfaces/face/_invocation.py
  44. 40
      src/python/grpcio/tests/unit/framework/interfaces/face/_service.py
  45. 10
      src/python/grpcio/tests/unit/framework/interfaces/face/test_interfaces.py
  46. 7
      src/python/grpcio/tests/unit/framework/interfaces/links/test_cases.py

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,6 +31,8 @@ import abc
import collections import collections
import enum import enum
import six
from grpc._cython import cygrpc from grpc._cython import cygrpc
@ -247,8 +249,7 @@ class Event(collections.namedtuple(
""" """
class CompletionQueue: class CompletionQueue(six.with_metaclass(abc.ABCMeta)):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __init__(self): def __init__(self):
@ -285,8 +286,7 @@ class CompletionQueue:
return None return None
class Call: class Call(six.with_metaclass(abc.ABCMeta)):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def start_batch(self, ops, tag): def start_batch(self, ops, tag):
@ -334,8 +334,7 @@ class Call:
return None return None
class Channel: class Channel(six.with_metaclass(abc.ABCMeta)):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __init__(self, target, args, credentials=None): def __init__(self, target, args, credentials=None):
@ -399,8 +398,7 @@ class Channel:
return None return None
class Server: class Server(six.with_metaclass(abc.ABCMeta)):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __init__(self, completion_queue, args): def __init__(self, completion_queue, args):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -35,6 +35,8 @@ import logging
import threading import threading
import time import time
import six
from grpc._adapter import _intermediary_low from grpc._adapter import _intermediary_low
from grpc._links import _constants from grpc._links import _constants
from grpc.beta import interfaces as beta_interfaces from grpc.beta import interfaces as beta_interfaces
@ -372,12 +374,11 @@ class _Kernel(object):
pool.shutdown(wait=True) pool.shutdown(wait=True)
class InvocationLink(links.Link, activated.Activated): class InvocationLink(six.with_metaclass(abc.ABCMeta, links.Link, activated.Activated)):
"""A links.Link for use on the invocation-side of a gRPC connection. """A links.Link for use on the invocation-side of a gRPC connection.
Implementations of this interface are only valid for use when activated. Implementations of this interface are only valid for use when activated.
""" """
__metaclass__ = abc.ABCMeta
class _InvocationLink(InvocationLink): class _InvocationLink(InvocationLink):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -32,6 +32,8 @@
import abc import abc
import enum import enum
import six
from grpc._adapter import _types from grpc._adapter import _types
@ -105,19 +107,17 @@ def grpc_call_options(disable_compression=False, credentials=None):
return GRPCCallOptions(disable_compression, None, credentials) return GRPCCallOptions(disable_compression, None, credentials)
class GRPCAuthMetadataContext(object): class GRPCAuthMetadataContext(six.with_metaclass(abc.ABCMeta)):
"""Provides information to call credentials metadata plugins. """Provides information to call credentials metadata plugins.
Attributes: Attributes:
service_url: A string URL of the service being called into. service_url: A string URL of the service being called into.
method_name: A string of the fully qualified method name being called. method_name: A string of the fully qualified method name being called.
""" """
__metaclass__ = abc.ABCMeta
class GRPCAuthMetadataPluginCallback(object): class GRPCAuthMetadataPluginCallback(six.with_metaclass(abc.ABCMeta)):
"""Callback object received by a metadata plugin.""" """Callback object received by a metadata plugin."""
__metaclass__ = abc.ABCMeta
def __call__(self, metadata, error): def __call__(self, metadata, error):
"""Inform the gRPC runtime of the metadata to construct a CallCredentials. """Inform the gRPC runtime of the metadata to construct a CallCredentials.
@ -130,10 +130,9 @@ class GRPCAuthMetadataPluginCallback(object):
raise NotImplementedError() raise NotImplementedError()
class GRPCAuthMetadataPlugin(object): class GRPCAuthMetadataPlugin(six.with_metaclass(abc.ABCMeta)):
""" """
""" """
__metaclass__ = abc.ABCMeta
def __call__(self, context, callback): def __call__(self, context, callback):
"""Invoke the plugin. """Invoke the plugin.
@ -149,9 +148,8 @@ class GRPCAuthMetadataPlugin(object):
raise NotImplementedError() raise NotImplementedError()
class GRPCServicerContext(object): class GRPCServicerContext(six.with_metaclass(abc.ABCMeta)):
"""Exposes gRPC-specific options and behaviors to code servicing RPCs.""" """Exposes gRPC-specific options and behaviors to code servicing RPCs."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def peer(self): def peer(self):
@ -168,9 +166,8 @@ class GRPCServicerContext(object):
raise NotImplementedError() raise NotImplementedError()
class GRPCInvocationContext(object): class GRPCInvocationContext(six.with_metaclass(abc.ABCMeta)):
"""Exposes gRPC-specific options and behaviors to code invoking RPCs.""" """Exposes gRPC-specific options and behaviors to code invoking RPCs."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def disable_next_request_compression(self): def disable_next_request_compression(self):
@ -178,9 +175,8 @@ class GRPCInvocationContext(object):
raise NotImplementedError() raise NotImplementedError()
class Server(object): class Server(six.with_metaclass(abc.ABCMeta)):
"""Services RPCs.""" """Services RPCs."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def add_insecure_port(self, address): def add_insecure_port(self, address):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -30,6 +30,8 @@
import abc import abc
import collections import collections
import six
# face_interfaces is referenced from specification in this module. # face_interfaces is referenced from specification in this module.
from grpc.framework.common import cardinality from grpc.framework.common import cardinality
from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import
@ -45,7 +47,7 @@ def _qualified_name(service_name, method_name):
# TODO(nathaniel): This structure is getting bloated; it could be shrunk if # TODO(nathaniel): This structure is getting bloated; it could be shrunk if
# implementations._Stub used a generic rather than a dynamic underlying # implementations._Stub used a generic rather than a dynamic underlying
# face-layer stub. # face-layer stub.
class InvocationBreakdown(object): class InvocationBreakdown(six.with_metaclass(abc.ABCMeta)):
"""An intermediate representation of invocation-side views of RPC methods. """An intermediate representation of invocation-side views of RPC methods.
Attributes: Attributes:
@ -61,7 +63,6 @@ class InvocationBreakdown(object):
to callable behavior to be used deserializing response values for the to callable behavior to be used deserializing response values for the
RPC. RPC.
""" """
__metaclass__ = abc.ABCMeta
class _EasyInvocationBreakdown( class _EasyInvocationBreakdown(
@ -73,7 +74,7 @@ class _EasyInvocationBreakdown(
pass pass
class ServiceBreakdown(object): class ServiceBreakdown(six.with_metaclass(abc.ABCMeta)):
"""An intermediate representation of service-side views of RPC methods. """An intermediate representation of service-side views of RPC methods.
Attributes: Attributes:
@ -84,7 +85,6 @@ class ServiceBreakdown(object):
response_serializers: A dictionary from service-qualified RPC method name response_serializers: A dictionary from service-qualified RPC method name
to callable behavior to be used serializing response values for the RPC. to callable behavior to be used serializing response values for the RPC.
""" """
__metaclass__ = abc.ABCMeta
class _EasyServiceBreakdown( class _EasyServiceBreakdown(

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,13 +31,12 @@
Only GRPC should instantiate and raise these exceptions. Only GRPC should instantiate and raise these exceptions.
""" """
import abc import abc
import six
class RpcError(Exception): class RpcError(six.with_metaclass(abc.ABCMeta, Exception)):
"""Common super type for all exceptions raised by GRPC.""" """Common super type for all exceptions raised by GRPC."""
__metaclass__ = abc.ABCMeta
class CancellationError(RpcError): class CancellationError(RpcError):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -32,6 +32,8 @@
import abc import abc
import enum import enum
import six
# exceptions is referenced from specification in this module. # exceptions is referenced from specification in this module.
from grpc.framework.alpha import exceptions # pylint: disable=unused-import from grpc.framework.alpha import exceptions # pylint: disable=unused-import
from grpc.framework.foundation import activated from grpc.framework.foundation import activated
@ -59,9 +61,8 @@ class Abortion(enum.Enum):
SERVICER_FAILURE = 'servicer failure' SERVICER_FAILURE = 'servicer failure'
class CancellableIterator(object): class CancellableIterator(six.with_metaclass(abc.ABCMeta)):
"""Implements the Iterator protocol and affords a cancel method.""" """Implements the Iterator protocol and affords a cancel method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __iter__(self): def __iter__(self):
@ -79,9 +80,8 @@ class CancellableIterator(object):
raise NotImplementedError() raise NotImplementedError()
class RpcContext(object): class RpcContext(six.with_metaclass(abc.ABCMeta)):
"""Provides RPC-related information and action.""" """Provides RPC-related information and action."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def is_active(self): def is_active(self):
@ -108,7 +108,7 @@ class RpcContext(object):
raise NotImplementedError() raise NotImplementedError()
class UnaryUnarySyncAsync(object): class UnaryUnarySyncAsync(six.with_metaclass(abc.ABCMeta)):
"""Affords invoking a unary-unary RPC synchronously or asynchronously. """Affords invoking a unary-unary RPC synchronously or asynchronously.
Values implementing this interface are directly callable and present an Values implementing this interface are directly callable and present an
"async" method. Both calls take a request value and a numeric timeout. "async" method. Both calls take a request value and a numeric timeout.
@ -117,7 +117,6 @@ class UnaryUnarySyncAsync(object):
of a value of this type invokes its associated RPC and immediately returns a of a value of this type invokes its associated RPC and immediately returns a
future.Future bound to the asynchronous execution of the RPC. future.Future bound to the asynchronous execution of the RPC.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__(self, request, timeout): def __call__(self, request, timeout):
@ -147,7 +146,7 @@ class UnaryUnarySyncAsync(object):
raise NotImplementedError() raise NotImplementedError()
class StreamUnarySyncAsync(object): class StreamUnarySyncAsync(six.with_metaclass(abc.ABCMeta)):
"""Affords invoking a stream-unary RPC synchronously or asynchronously. """Affords invoking a stream-unary RPC synchronously or asynchronously.
Values implementing this interface are directly callable and present an Values implementing this interface are directly callable and present an
"async" method. Both calls take an iterator of request values and a numeric "async" method. Both calls take an iterator of request values and a numeric
@ -156,7 +155,6 @@ class StreamUnarySyncAsync(object):
of a value of this type invokes its associated RPC and immediately returns a of a value of this type invokes its associated RPC and immediately returns a
future.Future bound to the asynchronous execution of the RPC. future.Future bound to the asynchronous execution of the RPC.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__(self, request_iterator, timeout): def __call__(self, request_iterator, timeout):
@ -191,9 +189,8 @@ class StreamUnarySyncAsync(object):
raise NotImplementedError() raise NotImplementedError()
class RpcMethodDescription(object): class RpcMethodDescription(six.with_metaclass(abc.ABCMeta)):
"""A type for the common aspects of RPC method descriptions.""" """A type for the common aspects of RPC method descriptions."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def cardinality(self): def cardinality(self):
@ -207,9 +204,8 @@ class RpcMethodDescription(object):
raise NotImplementedError() raise NotImplementedError()
class RpcMethodInvocationDescription(RpcMethodDescription): class RpcMethodInvocationDescription(six.with_metaclass(abc.ABCMeta, RpcMethodDescription)):
"""Invocation-side description of an RPC method.""" """Invocation-side description of an RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def serialize_request(self, request): def serialize_request(self, request):
@ -240,9 +236,8 @@ class RpcMethodInvocationDescription(RpcMethodDescription):
raise NotImplementedError() raise NotImplementedError()
class RpcMethodServiceDescription(RpcMethodDescription): class RpcMethodServiceDescription(six.with_metaclass(abc.ABCMeta, RpcMethodDescription)):
"""Service-side description of an RPC method.""" """Service-side description of an RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def deserialize_request(self, serialized_request): def deserialize_request(self, serialized_request):
@ -345,7 +340,7 @@ class RpcMethodServiceDescription(RpcMethodDescription):
raise NotImplementedError() raise NotImplementedError()
class Stub(object): class Stub(six.with_metaclass(abc.ABCMeta)):
"""A stub with callable RPC method names for attributes. """A stub with callable RPC method names for attributes.
Instances of this type are context managers and only afford RPC invocation Instances of this type are context managers and only afford RPC invocation
@ -369,12 +364,10 @@ class Stub(object):
exceptions.RpcError, exceptions.CancellationError, exceptions.RpcError, exceptions.CancellationError,
and exceptions.ExpirationError. and exceptions.ExpirationError.
""" """
__metaclass__ = abc.ABCMeta
class Server(activated.Activated): class Server(six.with_metaclass(abc.ABCMeta, activated.Activated)):
"""A GRPC Server.""" """A GRPC Server."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def port(self): def port(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -32,6 +32,8 @@
import abc import abc
import collections import collections
import six
from grpc.framework.base import _constants from grpc.framework.base import _constants
from grpc.framework.base import _interfaces from grpc.framework.base import _interfaces
from grpc.framework.base import exceptions from grpc.framework.base import exceptions
@ -72,9 +74,8 @@ class _EmptyConsumer(stream.Consumer):
"""See stream.Consumer.consume_and_terminate for specification.""" """See stream.Consumer.consume_and_terminate for specification."""
class _ConsumerCreator(object): class _ConsumerCreator(six.with_metaclass(abc.ABCMeta)):
"""Common specification of different consumer-creating behavior.""" """Common specification of different consumer-creating behavior."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def create_consumer(self, requirement): def create_consumer(self, requirement):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,14 +31,15 @@
import abc import abc
import six
# interfaces is referenced from specification in this module. # interfaces is referenced from specification in this module.
from grpc.framework.base import interfaces # pylint: disable=unused-import from grpc.framework.base import interfaces # pylint: disable=unused-import
from grpc.framework.foundation import stream from grpc.framework.foundation import stream
class TerminationManager(object): class TerminationManager(six.with_metaclass(abc.ABCMeta)):
"""An object responsible for handling the termination of an operation.""" """An object responsible for handling the termination of an operation."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_expiration_manager(self, expiration_manager): def set_expiration_manager(self, expiration_manager):
@ -91,9 +92,8 @@ class TerminationManager(object):
raise NotImplementedError() raise NotImplementedError()
class TransmissionManager(object): class TransmissionManager(six.with_metaclass(abc.ABCMeta)):
"""A manager responsible for transmitting to the other end of an operation.""" """A manager responsible for transmitting to the other end of an operation."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def inmit(self, emission, complete): def inmit(self, emission, complete):
@ -117,9 +117,8 @@ class TransmissionManager(object):
raise NotImplementedError() raise NotImplementedError()
class EmissionManager(stream.Consumer): class EmissionManager(six.with_metaclass(abc.ABCMeta, stream.Consumer)):
"""A manager of values emitted by customer code.""" """A manager of values emitted by customer code."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_ingestion_manager_and_expiration_manager( def set_ingestion_manager_and_expiration_manager(
@ -166,9 +165,8 @@ class EmissionManager(stream.Consumer):
raise NotImplementedError() raise NotImplementedError()
class IngestionManager(stream.Consumer): class IngestionManager(six.with_metaclass(abc.ABCMeta, stream.Consumer)):
"""A manager responsible for executing customer code.""" """A manager responsible for executing customer code."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_expiration_manager(self, expiration_manager): def set_expiration_manager(self, expiration_manager):
@ -214,9 +212,8 @@ class IngestionManager(stream.Consumer):
raise NotImplementedError() raise NotImplementedError()
class ExpirationManager(object): class ExpirationManager(six.with_metaclass(abc.ABCMeta)):
"""A manager responsible for aborting the operation if it runs out of time.""" """A manager responsible for aborting the operation if it runs out of time."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def change_timeout(self, timeout): def change_timeout(self, timeout):
@ -246,9 +243,8 @@ class ExpirationManager(object):
raise NotImplementedError() raise NotImplementedError()
class ReceptionManager(object): class ReceptionManager(six.with_metaclass(abc.ABCMeta)):
"""A manager responsible for receiving tickets from the other end.""" """A manager responsible for receiving tickets from the other end."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def receive_ticket(self, ticket): def receive_ticket(self, ticket):
@ -261,9 +257,8 @@ class ReceptionManager(object):
raise NotImplementedError() raise NotImplementedError()
class CancellationManager(object): class CancellationManager(six.with_metaclass(abc.ABCMeta)):
"""A manager of operation cancellation.""" """A manager of operation cancellation."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def cancel(self): def cancel(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,6 +31,8 @@
import abc import abc
import six
from grpc.framework.base import interfaces from grpc.framework.base import interfaces
from grpc.framework.base import _interfaces from grpc.framework.base import _interfaces
@ -40,9 +42,8 @@ _INITIAL_FRONT_TO_BACK_TICKET_KINDS = (
) )
class _Receiver(object): class _Receiver(six.with_metaclass(abc.ABCMeta)):
"""Common specification of different ticket-handling behavior.""" """Common specification of different ticket-handling behavior."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def abort_if_abortive(self, ticket): def abort_if_abortive(self, ticket):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,6 +31,8 @@
import abc import abc
import six
from grpc.framework.base import _constants from grpc.framework.base import _constants
from grpc.framework.base import _interfaces from grpc.framework.base import _interfaces
from grpc.framework.base import interfaces from grpc.framework.base import interfaces
@ -77,9 +79,8 @@ _ABORTION_OUTCOME_TO_BACK_TO_FRONT_TICKET_KIND = {
} }
class _Ticketizer(object): class _Ticketizer(six.with_metaclass(abc.ABCMeta)):
"""Common specification of different ticket-creating behavior.""" """Common specification of different ticket-creating behavior."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def ticketize(self, operation_id, sequence_number, payload, complete): def ticketize(self, operation_id, sequence_number, payload, complete):
@ -187,9 +188,8 @@ class _BackTicketizer(_Ticketizer):
operation_id, sequence_number, kind, None) operation_id, sequence_number, kind, None)
class TransmissionManager(_interfaces.TransmissionManager): class TransmissionManager(six.with_metaclass(abc.ABCMeta, _interfaces.TransmissionManager)):
"""A _interfaces.TransmissionManager on which other managers may be set.""" """A _interfaces.TransmissionManager on which other managers may be set."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_ingestion_and_expiration_managers( def set_ingestion_and_expiration_managers(

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,6 +33,8 @@ import abc
import collections import collections
import enum import enum
import six
# stream is referenced from specification in this module. # stream is referenced from specification in this module.
from grpc.framework.foundation import stream # pylint: disable=unused-import from grpc.framework.foundation import stream # pylint: disable=unused-import
@ -50,13 +52,12 @@ class Outcome(enum.Enum):
SERVICED_FAILURE = 'serviced failure' SERVICED_FAILURE = 'serviced failure'
class OperationContext(object): class OperationContext(six.with_metaclass(abc.ABCMeta)):
"""Provides operation-related information and action. """Provides operation-related information and action.
Attributes: Attributes:
trace_id: A uuid.UUID identifying a particular set of related operations. trace_id: A uuid.UUID identifying a particular set of related operations.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def is_active(self): def is_active(self):
@ -93,9 +94,8 @@ class OperationContext(object):
raise NotImplementedError() raise NotImplementedError()
class Servicer(object): class Servicer(six.with_metaclass(abc.ABCMeta)):
"""Interface for service implementations.""" """Interface for service implementations."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, name, context, output_consumer): def service(self, name, context, output_consumer):
@ -120,7 +120,7 @@ class Servicer(object):
raise NotImplementedError() raise NotImplementedError()
class Operation(object): class Operation(six.with_metaclass(abc.ABCMeta)):
"""Representation of an in-progress operation. """Representation of an in-progress operation.
Attributes: Attributes:
@ -129,7 +129,6 @@ class Operation(object):
context: An OperationContext affording information and action about the context: An OperationContext affording information and action about the
operation. operation.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def cancel(self): def cancel(self):
@ -137,9 +136,8 @@ class Operation(object):
raise NotImplementedError() raise NotImplementedError()
class ServicedIngestor(object): class ServicedIngestor(six.with_metaclass(abc.ABCMeta)):
"""Responsible for accepting the result of an operation.""" """Responsible for accepting the result of an operation."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def consumer(self, operation_context): def consumer(self, operation_context):
@ -159,7 +157,7 @@ class ServicedIngestor(object):
raise NotImplementedError() raise NotImplementedError()
class ServicedSubscription(object): class ServicedSubscription(six.with_metaclass(abc.ABCMeta)):
"""A sum type representing a serviced's interest in an operation. """A sum type representing a serviced's interest in an operation.
Attributes: Attributes:
@ -167,7 +165,6 @@ class ServicedSubscription(object):
ingestor: A ServicedIngestor. Must be present if kind is Kind.FULL. Must ingestor: A ServicedIngestor. Must be present if kind is Kind.FULL. Must
be None if kind is Kind.TERMINATION_ONLY or Kind.NONE. be None if kind is Kind.TERMINATION_ONLY or Kind.NONE.
""" """
__metaclass__ = abc.ABCMeta
@enum.unique @enum.unique
class Kind(enum.Enum): class Kind(enum.Enum):
@ -178,9 +175,8 @@ class ServicedSubscription(object):
NONE = 'none' NONE = 'none'
class End(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def operation_stats(self): def operation_stats(self):
@ -202,9 +198,8 @@ class End(object):
raise NotImplementedError() raise NotImplementedError()
class Front(End): class Front(six.with_metaclass(abc.ABCMeta, End)):
"""Clientish objects that afford the invocation of operations.""" """Clientish objects that afford the invocation of operations."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def operate( def operate(
@ -228,9 +223,8 @@ class Front(End):
raise NotImplementedError() raise NotImplementedError()
class Back(End): class Back(six.with_metaclass(abc.ABCMeta, End)):
"""Serverish objects that perform the work of operations.""" """Serverish objects that perform the work of operations."""
__metaclass__ = abc.ABCMeta
class FrontToBackTicket( class FrontToBackTicket(
@ -315,9 +309,8 @@ class BackToFrontTicket(
TRANSMISSION_FAILURE = 'transmission failure' TRANSMISSION_FAILURE = 'transmission failure'
class ForeLink(object): class ForeLink(six.with_metaclass(abc.ABCMeta)):
"""Accepts back-to-front tickets and emits front-to-back tickets.""" """Accepts back-to-front tickets and emits front-to-back tickets."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def accept_back_to_front_ticket(self, ticket): def accept_back_to_front_ticket(self, ticket):
@ -334,9 +327,8 @@ class ForeLink(object):
raise NotImplementedError() raise NotImplementedError()
class RearLink(object): class RearLink(six.with_metaclass(abc.ABCMeta)):
"""Accepts front-to-back tickets and emits back-to-front tickets.""" """Accepts front-to-back tickets and emits back-to-front tickets."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def accept_front_to_back_ticket(self, ticket): def accept_front_to_back_ticket(self, ticket):
@ -353,11 +345,9 @@ class RearLink(object):
raise NotImplementedError() raise NotImplementedError()
class FrontLink(Front, ForeLink): class FrontLink(six.with_metaclass(abc.ABCMeta, Front, ForeLink)):
"""Clientish objects that operate by sending and receiving tickets.""" """Clientish objects that operate by sending and receiving tickets."""
__metaclass__ = abc.ABCMeta
class BackLink(Back, RearLink): class BackLink(six.with_metaclass(abc.ABCMeta, Back, RearLink)):
"""Serverish objects that operate by sending and receiving tickets.""" """Serverish objects that operate by sending and receiving tickets."""
__metaclass__ = abc.ABCMeta

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,6 +33,8 @@ import abc
import threading import threading
import uuid import uuid
import six
from grpc.framework.core import _operation from grpc.framework.core import _operation
from grpc.framework.core import _utilities from grpc.framework.core import _utilities
from grpc.framework.foundation import callable_util from grpc.framework.foundation import callable_util
@ -45,7 +47,7 @@ from grpc.framework.interfaces.links import utilities
_IDLE_ACTION_EXCEPTION_LOG_MESSAGE = 'Exception calling idle action!' _IDLE_ACTION_EXCEPTION_LOG_MESSAGE = 'Exception calling idle action!'
class End(base.End, links.Link): class End(six.with_metaclass(abc.ABCMeta, base.End, links.Link)):
"""A bridge between base.End and links.Link. """A bridge between base.End and links.Link.
Implementations of this interface translate arriving tickets into Implementations of this interface translate arriving tickets into
@ -53,7 +55,6 @@ class End(base.End, links.Link):
translate calls from application objects implementing base interfaces translate calls from application objects implementing base interfaces
into tickets sent to a joined link. into tickets sent to a joined link.
""" """
__metaclass__ = abc.ABCMeta
class _Cycle(object): class _Cycle(object):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,6 +33,8 @@ import abc
import collections import collections
import enum import enum
import six
from grpc.framework.core import _constants from grpc.framework.core import _constants
from grpc.framework.core import _interfaces from grpc.framework.core import _interfaces
from grpc.framework.core import _utilities from grpc.framework.core import _utilities
@ -70,9 +72,8 @@ class _SubscriptionCreation(
ABANDONED = 'abandoned' ABANDONED = 'abandoned'
class _SubscriptionCreator(object): class _SubscriptionCreator(six.with_metaclass(abc.ABCMeta)):
"""Common specification of subscription-creating behavior.""" """Common specification of subscription-creating behavior."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def create(self, group, method): def create(self, group, method):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,17 +31,18 @@
import abc import abc
import six
from grpc.framework.interfaces.base import base from grpc.framework.interfaces.base import base
class TerminationManager(object): class TerminationManager(six.with_metaclass(abc.ABCMeta)):
"""An object responsible for handling the termination of an operation. """An object responsible for handling the termination of an operation.
Attributes: Attributes:
outcome: None if the operation is active or a base.Outcome value if it has outcome: None if the operation is active or a base.Outcome value if it has
terminated. terminated.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def add_callback(self, callback): def add_callback(self, callback):
@ -105,9 +106,8 @@ class TerminationManager(object):
raise NotImplementedError() raise NotImplementedError()
class TransmissionManager(object): class TransmissionManager(six.with_metaclass(abc.ABCMeta)):
"""A manager responsible for transmitting to the other end of an operation.""" """A manager responsible for transmitting to the other end of an operation."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def kick_off( def kick_off(
@ -171,9 +171,8 @@ class TransmissionManager(object):
raise NotImplementedError() raise NotImplementedError()
class ExpirationManager(object): class ExpirationManager(six.with_metaclass(abc.ABCMeta)):
"""A manager responsible for aborting the operation if it runs out of time.""" """A manager responsible for aborting the operation if it runs out of time."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def change_timeout(self, timeout): def change_timeout(self, timeout):
@ -203,9 +202,8 @@ class ExpirationManager(object):
raise NotImplementedError() raise NotImplementedError()
class ProtocolManager(object): class ProtocolManager(six.with_metaclass(abc.ABCMeta)):
"""A manager of protocol-specific values passing through an operation.""" """A manager of protocol-specific values passing through an operation."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_protocol_receiver(self, protocol_receiver): def set_protocol_receiver(self, protocol_receiver):
@ -228,9 +226,8 @@ class ProtocolManager(object):
raise NotImplementedError() raise NotImplementedError()
class EmissionManager(base.Operator): class EmissionManager(six.with_metaclass(abc.ABCMeta, base.Operator)):
"""A manager of values emitted by customer code.""" """A manager of values emitted by customer code."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def advance( def advance(
@ -254,14 +251,13 @@ class EmissionManager(base.Operator):
raise NotImplementedError() raise NotImplementedError()
class IngestionManager(object): class IngestionManager(six.with_metaclass(abc.ABCMeta)):
"""A manager responsible for executing customer code. """A manager responsible for executing customer code.
This name of this manager comes from its responsibility to pass successive This name of this manager comes from its responsibility to pass successive
values from the other side of the operation into the code of the local values from the other side of the operation into the code of the local
customer. customer.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_group_and_method(self, group, method): def set_group_and_method(self, group, method):
@ -294,9 +290,8 @@ class IngestionManager(object):
raise NotImplementedError() raise NotImplementedError()
class ReceptionManager(object): class ReceptionManager(six.with_metaclass(abc.ABCMeta)):
"""A manager responsible for receiving tickets from the other end.""" """A manager responsible for receiving tickets from the other end."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def receive_ticket(self, ticket): def receive_ticket(self, ticket):
@ -308,7 +303,7 @@ class ReceptionManager(object):
raise NotImplementedError() raise NotImplementedError()
class Operation(object): class Operation(six.with_metaclass(abc.ABCMeta)):
"""An ongoing operation. """An ongoing operation.
Attributes: Attributes:
@ -316,7 +311,6 @@ class Operation(object):
operator: A base.Operator object for the operation for use by the customer operator: A base.Operator object for the operation for use by the customer
of the operation. of the operation.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def handle_ticket(self, ticket): def handle_ticket(self, ticket):

@ -31,6 +31,8 @@
import abc import abc
import six
from grpc.framework.core import _constants from grpc.framework.core import _constants
from grpc.framework.core import _interfaces from grpc.framework.core import _interfaces
from grpc.framework.core import _utilities from grpc.framework.core import _utilities
@ -50,9 +52,8 @@ def _service_completion_predicate(
return transmission_complete and ingestion_complete return transmission_complete and ingestion_complete
class TerminationManager(_interfaces.TerminationManager): class TerminationManager(six.with_metaclass(abc.ABCMeta, _interfaces.TerminationManager)):
"""A _interfaces.TransmissionManager on which another manager may be set.""" """A _interfaces.TransmissionManager on which another manager may be set."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_expiration_manager(self, expiration_manager): def set_expiration_manager(self, expiration_manager):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,6 +31,8 @@
import abc import abc
import six
class NoSuchMethodError(Exception): class NoSuchMethodError(Exception):
"""Raised by customer code to indicate an unrecognized RPC method name. """Raised by customer code to indicate an unrecognized RPC method name.
@ -49,12 +51,11 @@ class NoSuchMethodError(Exception):
self.name = name self.name = name
class RpcError(Exception): class RpcError(six.with_metaclass(abc.ABCMeta, Exception)):
"""Common super type for all exceptions raised by the Face layer. """Common super type for all exceptions raised by the Face layer.
Only RPC Framework should instantiate and raise these exceptions. Only RPC Framework should instantiate and raise these exceptions.
""" """
__metaclass__ = abc.ABCMeta
class CancellationError(RpcError): class CancellationError(RpcError):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -32,6 +32,8 @@
import abc import abc
import enum import enum
import six
# cardinality, style, exceptions, abandonment, future, and stream are # cardinality, style, exceptions, abandonment, future, and stream are
# referenced from specification in this module. # referenced from specification in this module.
from grpc.framework.common import cardinality # pylint: disable=unused-import from grpc.framework.common import cardinality # pylint: disable=unused-import
@ -52,9 +54,8 @@ class Abortion(enum.Enum):
SERVICER_FAILURE = 'servicer failure' SERVICER_FAILURE = 'servicer failure'
class CancellableIterator(object): class CancellableIterator(six.with_metaclass(abc.ABCMeta)):
"""Implements the Iterator protocol and affords a cancel method.""" """Implements the Iterator protocol and affords a cancel method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __iter__(self): def __iter__(self):
@ -72,9 +73,8 @@ class CancellableIterator(object):
raise NotImplementedError() raise NotImplementedError()
class RpcContext(object): class RpcContext(six.with_metaclass(abc.ABCMeta)):
"""Provides RPC-related information and action.""" """Provides RPC-related information and action."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def is_active(self): def is_active(self):
@ -103,13 +103,12 @@ class RpcContext(object):
raise NotImplementedError() raise NotImplementedError()
class Call(object): class Call(six.with_metaclass(abc.ABCMeta)):
"""Invocation-side representation of an RPC. """Invocation-side representation of an RPC.
Attributes: Attributes:
context: An RpcContext affording information about the RPC. context: An RpcContext affording information about the RPC.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def cancel(self): def cancel(self):
@ -117,9 +116,8 @@ class Call(object):
raise NotImplementedError() raise NotImplementedError()
class UnaryUnaryMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__(self, request, timeout): def __call__(self, request, timeout):
@ -171,9 +169,8 @@ class UnaryUnaryMultiCallable(object):
raise NotImplementedError() raise NotImplementedError()
class UnaryStreamMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__(self, request, timeout): def __call__(self, request, timeout):
@ -209,9 +206,8 @@ class UnaryStreamMultiCallable(object):
raise NotImplementedError() raise NotImplementedError()
class StreamUnaryMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__(self, request_iterator, timeout): def __call__(self, request_iterator, timeout):
@ -264,9 +260,8 @@ class StreamUnaryMultiCallable(object):
raise NotImplementedError() raise NotImplementedError()
class StreamStreamMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__(self, request_iterator, timeout): def __call__(self, request_iterator, timeout):
@ -302,7 +297,7 @@ l Args:
raise NotImplementedError() raise NotImplementedError()
class MethodImplementation(object): class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
"""A sum type that describes an RPC method implementation. """A sum type that describes an RPC method implementation.
Attributes: Attributes:
@ -347,12 +342,10 @@ class MethodImplementation(object):
is cardinality.Cardinality.STREAM_STREAM and style is is cardinality.Cardinality.STREAM_STREAM and style is
style.Service.EVENT. style.Service.EVENT.
""" """
__metaclass__ = abc.ABCMeta
class MultiMethodImplementation(object): class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
"""A general type able to service many RPC methods.""" """A general type able to service many RPC methods."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, name, response_consumer, context): def service(self, name, response_consumer, context):
@ -381,9 +374,8 @@ class MultiMethodImplementation(object):
raise NotImplementedError() raise NotImplementedError()
class GenericStub(object): class GenericStub(six.with_metaclass(abc.ABCMeta)):
"""Affords RPC methods to callers.""" """Affords RPC methods to callers."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def blocking_value_in_value_out(self, name, request, timeout): def blocking_value_in_value_out(self, name, request, timeout):
@ -622,7 +614,7 @@ class GenericStub(object):
raise NotImplementedError() raise NotImplementedError()
class DynamicStub(object): class DynamicStub(six.with_metaclass(abc.ABCMeta)):
"""A stub with RPC-method-bound multi-callable attributes. """A stub with RPC-method-bound multi-callable attributes.
Instances of this type responsd to attribute access as follows: if the Instances of this type responsd to attribute access as follows: if the
@ -637,4 +629,3 @@ class DynamicStub(object):
the attribute will be a StreamStreamMultiCallable with which to invoke the the attribute will be a StreamStreamMultiCallable with which to invoke the
RPC method. RPC method.
""" """
__metaclass__ = abc.ABCMeta

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,14 +31,14 @@
import abc import abc
import six
class Activated(object): class Activated(six.with_metaclass(abc.ABCMeta)):
"""Interface for objects that may be started and stopped. """Interface for objects that may be started and stopped.
Values implementing this type must also implement the context manager Values implementing this type must also implement the context manager
protocol. protocol.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __enter__(self): def __enter__(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -35,8 +35,10 @@ import enum
import functools import functools
import logging import logging
import six
class Outcome(object):
class Outcome(six.with_metaclass(abc.ABCMeta)):
"""A sum type describing the outcome of some call. """A sum type describing the outcome of some call.
Attributes: Attributes:
@ -47,7 +49,6 @@ class Outcome(object):
exception: The exception raised by the call. Must be present if kind is exception: The exception raised by the call. Must be present if kind is
Kind.RAISED. Kind.RAISED.
""" """
__metaclass__ = abc.ABCMeta
@enum.unique @enum.unique
class Kind(enum.Enum): class Kind(enum.Enum):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -49,6 +49,8 @@ built-in-but-only-in-3.3-and-later TimeoutError.
import abc import abc
import six
class TimeoutError(Exception): class TimeoutError(Exception):
"""Indicates that a particular call timed out.""" """Indicates that a particular call timed out."""
@ -58,13 +60,12 @@ class CancelledError(Exception):
"""Indicates that the computation underlying a Future was cancelled.""" """Indicates that the computation underlying a Future was cancelled."""
class Future(object): class Future(six.with_metaclass(abc.ABCMeta)):
"""A representation of a computation in another control flow. """A representation of a computation in another control flow.
Computations represented by a Future may be yet to be begun, may be ongoing, Computations represented by a Future may be yet to be begun, may be ongoing,
or may have already completed. or may have already completed.
""" """
__metaclass__ = abc.ABCMeta
# NOTE(nathaniel): This isn't the return type that I would want to have if it # NOTE(nathaniel): This isn't the return type that I would want to have if it
# were up to me. Were this interface being written from scratch, the return # were up to me. Were this interface being written from scratch, the return

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -46,7 +46,6 @@ class Relay(object):
would be no reason to use an implementation of this interface instead of a would be no reason to use an implementation of this interface instead of a
thread pool. thread pool.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def add_value(self, value): def add_value(self, value):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,10 +31,10 @@
import abc import abc
import six
class Consumer(object): class Consumer(six.with_metaclass(abc.ABCMeta)):
"""Interface for consumers of finite streams of values or objects.""" """Interface for consumers of finite streams of values or objects."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def consume(self, value): def consume(self, value):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -42,6 +42,8 @@ import abc
import enum import enum
import threading # pylint: disable=unused-import import threading # pylint: disable=unused-import
import six
# abandonment is referenced from specification in this module. # abandonment is referenced from specification in this module.
from grpc.framework.foundation import abandonment # pylint: disable=unused-import from grpc.framework.foundation import abandonment # pylint: disable=unused-import
@ -95,7 +97,7 @@ class Outcome(object):
REMOTE_FAILURE = 'remote failure' REMOTE_FAILURE = 'remote failure'
class Completion(object): 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: Attributes:
@ -103,12 +105,10 @@ class Completion(object):
code: A code value for the operation. code: A code value for the operation.
message: A message value for the operation. message: A message value for the operation.
""" """
__metaclass__ = abc.ABCMeta
class OperationContext(object): class OperationContext(six.with_metaclass(abc.ABCMeta)):
"""Provides operation-related information and action.""" """Provides operation-related information and action."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def outcome(self): def outcome(self):
@ -162,9 +162,8 @@ class OperationContext(object):
raise NotImplementedError() raise NotImplementedError()
class Operator(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def advance( def advance(
@ -184,9 +183,8 @@ class Operator(object):
""" """
raise NotImplementedError() raise NotImplementedError()
class ProtocolReceiver(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def context(self, protocol_context): def context(self, protocol_context):
@ -198,7 +196,7 @@ class ProtocolReceiver(object):
raise NotImplementedError() raise NotImplementedError()
class Subscription(object): 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: Attributes:
@ -216,7 +214,6 @@ class Subscription(object):
become available during the operation. Must be non-None if kind is become available during the operation. Must be non-None if kind is
Kind.FULL. Kind.FULL.
""" """
__metaclass__ = abc.ABCMeta
@enum.unique @enum.unique
class Kind(enum.Enum): class Kind(enum.Enum):
@ -226,9 +223,8 @@ class Subscription(object):
FULL = 'full' FULL = 'full'
class Servicer(object): class Servicer(six.with_metaclass(abc.ABCMeta)):
"""Interface for service implementations.""" """Interface for service implementations."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, group, method, context, output_operator): def service(self, group, method, context, output_operator):
@ -255,9 +251,8 @@ class Servicer(object):
raise NotImplementedError() raise NotImplementedError()
class End(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def start(self): def start(self):

@ -33,6 +33,8 @@ import abc
import collections import collections
import enum import enum
import six
# cardinality, style, abandonment, future, and stream are # cardinality, style, abandonment, future, and stream are
# referenced from specification in this module. # referenced from specification in this module.
from grpc.framework.common import cardinality # pylint: disable=unused-import from grpc.framework.common import cardinality # pylint: disable=unused-import
@ -96,7 +98,7 @@ class Abortion(
REMOTE_FAILURE = 'remote failure' REMOTE_FAILURE = 'remote failure'
class AbortionError(Exception): 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 initial_metadata: The initial metadata from the other side of the RPC or
@ -108,7 +110,6 @@ class AbortionError(Exception):
details: The details value from the other side of the RPC or None if no details: The details value from the other side of the RPC or None if no
details value was received. details value was received.
""" """
__metaclass__ = abc.ABCMeta
def __init__(self, initial_metadata, terminal_metadata, code, details): def __init__(self, initial_metadata, terminal_metadata, code, details):
super(AbortionError, self).__init__() super(AbortionError, self).__init__()
@ -150,9 +151,8 @@ 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(object): class RpcContext(six.with_metaclass(abc.ABCMeta)):
"""Provides RPC-related information and action.""" """Provides RPC-related information and action."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def is_active(self): def is_active(self):
@ -199,9 +199,8 @@ class RpcContext(object):
raise NotImplementedError() raise NotImplementedError()
class Call(RpcContext): class Call(six.with_metaclass(abc.ABCMeta, RpcContext)):
"""Invocation-side utility object for an RPC.""" """Invocation-side utility object for an RPC."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def initial_metadata(self): def initial_metadata(self):
@ -256,9 +255,8 @@ class Call(RpcContext):
raise NotImplementedError() raise NotImplementedError()
class ServicerContext(RpcContext): class ServicerContext(six.with_metaclass(abc.ABCMeta, RpcContext)):
"""A context object passed to method implementations.""" """A context object passed to method implementations."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def invocation_metadata(self): def invocation_metadata(self):
@ -326,9 +324,8 @@ class ServicerContext(RpcContext):
raise NotImplementedError() raise NotImplementedError()
class ResponseReceiver(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def initial_metadata(self, initial_metadata): def initial_metadata(self, initial_metadata):
@ -362,9 +359,8 @@ class ResponseReceiver(object):
raise NotImplementedError() raise NotImplementedError()
class UnaryUnaryMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__( def __call__(
@ -434,9 +430,8 @@ class UnaryUnaryMultiCallable(object):
raise NotImplementedError() raise NotImplementedError()
class UnaryStreamMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__(self, request, timeout, metadata=None, protocol_options=None): def __call__(self, request, timeout, metadata=None, protocol_options=None):
@ -480,9 +475,8 @@ class UnaryStreamMultiCallable(object):
raise NotImplementedError() raise NotImplementedError()
class StreamUnaryMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__( def __call__(
@ -553,9 +547,8 @@ class StreamUnaryMultiCallable(object):
raise NotImplementedError() raise NotImplementedError()
class StreamStreamMultiCallable(object): 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."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def __call__( def __call__(
@ -600,7 +593,7 @@ class StreamStreamMultiCallable(object):
raise NotImplementedError() raise NotImplementedError()
class MethodImplementation(object): class MethodImplementation(six.with_metaclass(abc.ABCMeta)):
"""A sum type that describes a method implementation. """A sum type that describes a method implementation.
Attributes: Attributes:
@ -643,12 +636,10 @@ class MethodImplementation(object):
is cardinality.Cardinality.STREAM_STREAM and style is is cardinality.Cardinality.STREAM_STREAM and style is
style.Service.EVENT. style.Service.EVENT.
""" """
__metaclass__ = abc.ABCMeta
class MultiMethodImplementation(object): class MultiMethodImplementation(six.with_metaclass(abc.ABCMeta)):
"""A general type able to service many methods.""" """A general type able to service many methods."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, group, method, response_consumer, context): def service(self, group, method, response_consumer, context):
@ -678,9 +669,8 @@ class MultiMethodImplementation(object):
raise NotImplementedError() raise NotImplementedError()
class GenericStub(object): class GenericStub(six.with_metaclass(abc.ABCMeta)):
"""Affords RPC invocation via generic methods.""" """Affords RPC invocation via generic methods."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def blocking_unary_unary( def blocking_unary_unary(
@ -977,7 +967,7 @@ class GenericStub(object):
raise NotImplementedError() raise NotImplementedError()
class DynamicStub(object): 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 Instances of this type may be scoped to a single group so that attribute
@ -993,4 +983,3 @@ class DynamicStub(object):
if the requested attribute is the name of a stream-stream method, the value of if the requested attribute is the name of a stream-stream method, the value of
the attribute will be a StreamStreamMultiCallable with which to invoke an RPC. the attribute will be a StreamStreamMultiCallable with which to invoke an RPC.
""" """
__metaclass__ = abc.ABCMeta

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,6 +33,8 @@ import abc
import collections import collections
import enum import enum
import six
class Protocol(collections.namedtuple('Protocol', ('kind', 'value',))): class Protocol(collections.namedtuple('Protocol', ('kind', 'value',))):
"""A sum type for handles to a system that transmits tickets. """A sum type for handles to a system that transmits tickets.
@ -123,9 +125,8 @@ class Ticket(
REMOTE_FAILURE = 'remote failure' REMOTE_FAILURE = 'remote failure'
class Link(object): class Link(six.with_metaclass(abc.ABCMeta)):
"""Accepts and emits tickets.""" """Accepts and emits tickets."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def accept_ticket(self, ticket): def accept_ticket(self, ticket):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -32,12 +32,13 @@
import abc import abc
import threading import threading
import six
from tests.unit._junkdrawer import math_pb2 from tests.unit._junkdrawer import math_pb2
class ProtoScenario(object): class ProtoScenario(six.with_metaclass(abc.ABCMeta)):
"""An RPC test scenario using protocol buffers.""" """An RPC test scenario using protocol buffers."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def method(self): def method(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -32,13 +32,14 @@
import abc import abc
import threading import threading
import six
from tests.unit._junkdrawer import math_pb2 from tests.unit._junkdrawer import math_pb2
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
class ProtoScenario(object): class ProtoScenario(six.with_metaclass(abc.ABCMeta)):
"""An RPC test scenario using protocol buffers.""" """An RPC test scenario using protocol buffers."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def group_and_method(self): def group_and_method(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,6 +33,8 @@ import abc
import contextlib import contextlib
import threading import threading
import six
class Defect(Exception): class Defect(Exception):
"""Simulates a programming defect raised into in a system under test. """Simulates a programming defect raised into in a system under test.
@ -42,7 +44,7 @@ class Defect(Exception):
""" """
class Control(object): class Control(six.with_metaclass(abc.ABCMeta)):
"""An object that accepts program control from a system under test. """An object that accepts program control from a system under test.
Systems under test passed a Control should call its control() method Systems under test passed a Control should call its control() method
@ -51,8 +53,6 @@ class Control(object):
the system under test to simulate hanging, failing, or functioning. the system under test to simulate hanging, failing, or functioning.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def control(self): def control(self):
"""Potentially does anything.""" """Potentially does anything."""

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,13 +31,14 @@
import abc import abc
import six
# This code is designed for use with the unittest module. # This code is designed for use with the unittest module.
# pylint: disable=invalid-name # pylint: disable=invalid-name
class Coverage(object): class Coverage(six.with_metaclass(abc.ABCMeta)):
"""Specification of test coverage.""" """Specification of test coverage."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def testSuccessfulUnaryRequestUnaryResponse(self): def testSuccessfulUnaryRequestUnaryResponse(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,6 +31,8 @@
import abc import abc
import six
# interfaces is referenced from specification in this module. # interfaces is referenced from specification in this module.
from grpc.framework.base import util as _base_util from grpc.framework.base import util as _base_util
from grpc.framework.base import implementations from grpc.framework.base import implementations
@ -43,7 +45,7 @@ _POOL_SIZE_LIMIT = 5
_MAXIMUM_TIMEOUT = 90 _MAXIMUM_TIMEOUT = 90
class LinkedPair(object): class LinkedPair(six.with_metaclass(abc.ABCMeta)):
"""A Front and Back that are linked to one another. """A Front and Back that are linked to one another.
Attributes: Attributes:
@ -51,8 +53,6 @@ class LinkedPair(object):
back: An interfaces.Back. back: An interfaces.Back.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def shut_down(self): def shut_down(self):
"""Shuts down this object and releases its resources.""" """Shuts down this object and releases its resources."""

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,6 +33,8 @@
import abc import abc
import unittest # pylint: disable=unused-import import unittest # pylint: disable=unused-import
import six
from grpc.framework.face import exceptions from grpc.framework.face import exceptions
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
from tests.unit.framework.face.testing import control from tests.unit.framework.face.testing import control
@ -43,12 +45,12 @@ from tests.unit.framework.face.testing import test_case
class BlockingInvocationInlineServiceTestCase( class BlockingInvocationInlineServiceTestCase(
test_case.FaceTestCase, coverage.BlockingCoverage): six.with_metaclass(abc.ABCMeta,
test_case.FaceTestCase, coverage.BlockingCoverage)):
"""A test of the Face layer of RPC Framework. """A test of the Face layer of RPC Framework.
Concrete subclasses must also extend unittest.TestCase. Concrete subclasses must also extend unittest.TestCase.
""" """
__metaclass__ = abc.ABCMeta
def setUp(self): def setUp(self):
"""See unittest.TestCase.setUp for full specification. """See unittest.TestCase.setUp for full specification.

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,8 +33,10 @@ import abc
import contextlib import contextlib
import threading import threading
import six
class Control(object):
class Control(six.with_metaclass(abc.ABCMeta)):
"""An object that accepts program control from a system under test. """An object that accepts program control from a system under test.
Systems under test passed a Control should call its control() method Systems under test passed a Control should call its control() method
@ -43,8 +45,6 @@ class Control(object):
the system under test to simulate hanging, failing, or functioning. the system under test to simulate hanging, failing, or functioning.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def control(self): def control(self):
"""Potentially does anything.""" """Potentially does anything."""

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,15 +31,15 @@
import abc import abc
import six
# These classes are only valid when inherited by unittest.TestCases. # These classes are only valid when inherited by unittest.TestCases.
# pylint: disable=invalid-name # pylint: disable=invalid-name
class BlockingCoverage(object): class BlockingCoverage(six.with_metaclass(abc.ABCMeta)):
"""Specification of test coverage for blocking behaviors.""" """Specification of test coverage for blocking behaviors."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def testSuccessfulUnaryRequestUnaryResponse(self): def testSuccessfulUnaryRequestUnaryResponse(self):
raise NotImplementedError() raise NotImplementedError()
@ -93,11 +93,9 @@ class BlockingCoverage(object):
raise NotImplementedError() raise NotImplementedError()
class FullCoverage(BlockingCoverage): class FullCoverage(six.with_metaclass(abc.ABCMeta, BlockingCoverage)):
"""Specification of test coverage for non-blocking behaviors.""" """Specification of test coverage for non-blocking behaviors."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def testParallelInvocations(self): def testParallelInvocations(self):
raise NotImplementedError() raise NotImplementedError()

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -32,6 +32,8 @@
import abc import abc
import unittest import unittest
import six
from grpc.framework.face import interfaces from grpc.framework.face import interfaces
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
from tests.unit.framework.face.testing import callback as testing_callback from tests.unit.framework.face.testing import callback as testing_callback
@ -43,12 +45,12 @@ from tests.unit.framework.face.testing import test_case
class EventInvocationSynchronousEventServiceTestCase( class EventInvocationSynchronousEventServiceTestCase(
test_case.FaceTestCase, coverage.FullCoverage): six.with_metaclass(abc.ABCMeta,
test_case.FaceTestCase, coverage.FullCoverage)):
"""A test of the Face layer of RPC Framework. """A test of the Face layer of RPC Framework.
Concrete subclasses must also extend unittest.TestCase. Concrete subclasses must also extend unittest.TestCase.
""" """
__metaclass__ = abc.ABCMeta
def setUp(self): def setUp(self):
"""See unittest.TestCase.setUp for full specification. """See unittest.TestCase.setUp for full specification.

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -34,6 +34,8 @@ import contextlib
import threading import threading
import unittest import unittest
import six
from grpc.framework.face import exceptions from grpc.framework.face import exceptions
from grpc.framework.foundation import future from grpc.framework.foundation import future
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
@ -74,12 +76,12 @@ class _PauseableIterator(object):
class FutureInvocationAsynchronousEventServiceTestCase( class FutureInvocationAsynchronousEventServiceTestCase(
test_case.FaceTestCase, coverage.FullCoverage): six.with_metaclass(abc.ABCMeta,
test_case.FaceTestCase, coverage.FullCoverage)):
"""A test of the Face layer of RPC Framework. """A test of the Face layer of RPC Framework.
Concrete subclasses must also extend unittest.TestCase. Concrete subclasses must also extend unittest.TestCase.
""" """
__metaclass__ = abc.ABCMeta
def setUp(self): def setUp(self):
"""See unittest.TestCase.setUp for full specification. """See unittest.TestCase.setUp for full specification.

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,13 +31,14 @@
import abc import abc
import six
# cardinality is referenced from specification in this module. # cardinality is referenced from specification in this module.
from grpc.framework.common import cardinality # pylint: disable=unused-import from grpc.framework.common import cardinality # pylint: disable=unused-import
class Method(object): class Method(six.with_metaclass(abc.ABCMeta)):
"""An RPC method to be used in tests of RPC implementations.""" """An RPC method to be used in tests of RPC implementations."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def name(self): def name(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,16 +31,16 @@
import abc import abc
import six
# interfaces is referenced from specification in this module. # interfaces is referenced from specification in this module.
from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import
from tests.unit.framework.face.testing import interfaces from tests.unit.framework.face.testing import interfaces
class UnaryUnaryTestMethodImplementation(interfaces.Method): class UnaryUnaryTestMethodImplementation(six.with_metaclass(abc.ABCMeta, interfaces.Method)):
"""A controllable implementation of a unary-unary RPC method.""" """A controllable implementation of a unary-unary RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, request, response_callback, context, control): def service(self, request, response_callback, context, control):
"""Services an RPC that accepts one message and produces one message. """Services an RPC that accepts one message and produces one message.
@ -59,11 +59,9 @@ class UnaryUnaryTestMethodImplementation(interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class UnaryUnaryTestMessages(object): class UnaryUnaryTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for unary-request-unary-response message pairings.""" """A type for unary-request-unary-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def request(self): def request(self):
"""Affords a request message. """Affords a request message.
@ -93,11 +91,9 @@ class UnaryUnaryTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class UnaryStreamTestMethodImplementation(interfaces.Method): class UnaryStreamTestMethodImplementation(six.with_metaclass(abc.ABCMeta, interfaces.Method)):
"""A controllable implementation of a unary-stream RPC method.""" """A controllable implementation of a unary-stream RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, request, response_consumer, context, control): def service(self, request, response_consumer, context, control):
"""Services an RPC that takes one message and produces a stream of messages. """Services an RPC that takes one message and produces a stream of messages.
@ -116,11 +112,9 @@ class UnaryStreamTestMethodImplementation(interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class UnaryStreamTestMessages(object): class UnaryStreamTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for unary-request-stream-response message pairings.""" """A type for unary-request-stream-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def request(self): def request(self):
"""Affords a request message. """Affords a request message.
@ -150,11 +144,9 @@ class UnaryStreamTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class StreamUnaryTestMethodImplementation(interfaces.Method): class StreamUnaryTestMethodImplementation(six.with_metaclass(abc.ABCMeta, interfaces.Method)):
"""A controllable implementation of a stream-unary RPC method.""" """A controllable implementation of a stream-unary RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, response_callback, context, control): def service(self, response_callback, context, control):
"""Services an RPC that takes a stream of messages and produces one message. """Services an RPC that takes a stream of messages and produces one message.
@ -180,11 +172,9 @@ class StreamUnaryTestMethodImplementation(interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class StreamUnaryTestMessages(object): class StreamUnaryTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for stream-request-unary-response message pairings.""" """A type for stream-request-unary-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def requests(self): def requests(self):
"""Affords a sequence of request messages. """Affords a sequence of request messages.
@ -214,11 +204,9 @@ class StreamUnaryTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class StreamStreamTestMethodImplementation(interfaces.Method): class StreamStreamTestMethodImplementation(six.with_metaclass(abc.ABCMeta, interfaces.Method)):
"""A controllable implementation of a stream-stream RPC method.""" """A controllable implementation of a stream-stream RPC method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, response_consumer, context, control): def service(self, response_consumer, context, control):
"""Services an RPC that accepts and produces streams of messages. """Services an RPC that accepts and produces streams of messages.
@ -244,11 +232,9 @@ class StreamStreamTestMethodImplementation(interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class StreamStreamTestMessages(object): class StreamStreamTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for stream-request-stream-response message pairings.""" """A type for stream-request-stream-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def requests(self): def requests(self):
"""Affords a sequence of request messages. """Affords a sequence of request messages.
@ -278,11 +264,9 @@ class StreamStreamTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class TestService(object): class TestService(six.with_metaclass(abc.ABCMeta)):
"""A specification of implemented RPC methods to use in tests.""" """A specification of implemented RPC methods to use in tests."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def name(self): def name(self):
"""Identifies the RPC service name used during the test. """Identifies the RPC service name used during the test.

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,18 +31,19 @@
import abc import abc
import six
# face_interfaces and interfaces are referenced in specification in this module. # face_interfaces and interfaces are referenced in specification in this module.
from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import
from tests.unit.framework.face.testing import interfaces # pylint: disable=unused-import from tests.unit.framework.face.testing import interfaces # pylint: disable=unused-import
class FaceTestCase(object): class FaceTestCase(six.with_metaclass(abc.ABCMeta)):
"""Describes a test of the Face Layer of RPC Framework. """Describes a test of the Face Layer of RPC Framework.
Concrete subclasses must also inherit from unittest.TestCase and from at least Concrete subclasses must also inherit from unittest.TestCase and from at least
one class that defines test methods. one class that defines test methods.
""" """
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def set_up_implementation( def set_up_implementation(

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -36,6 +36,8 @@ import random # pylint: disable=unused-import
import threading import threading
import time import time
import six
from grpc.framework.interfaces.base import base from grpc.framework.interfaces.base import base
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
from tests.unit.framework.interfaces.base import _sequence from tests.unit.framework.interfaces.base import _sequence
@ -247,8 +249,7 @@ class Instruction(
CONCLUDE = 'CONCLUDE' CONCLUDE = 'CONCLUDE'
class Controller(object): class Controller(six.with_metaclass(abc.ABCMeta)):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def failed(self, message): def failed(self, message):
@ -308,8 +309,7 @@ class Controller(object):
raise NotImplementedError() raise NotImplementedError()
class ControllerCreator(object): class ControllerCreator(six.with_metaclass(abc.ABCMeta)):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def name(self): def name(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,12 +31,13 @@
import abc import abc
import six
from grpc.framework.interfaces.base import base # pylint: disable=unused-import from grpc.framework.interfaces.base import base # pylint: disable=unused-import
class Serialization(object): class Serialization(six.with_metaclass(abc.ABCMeta)):
"""Specifies serialization and deserialization of test payloads.""" """Specifies serialization and deserialization of test payloads."""
__metaclass__ = abc.ABCMeta
def serialize_request(self, request): def serialize_request(self, request):
"""Serializes a request value used in a test. """Serializes a request value used in a test.
@ -85,9 +86,8 @@ class Serialization(object):
raise NotImplementedError() raise NotImplementedError()
class Implementation(object): class Implementation(six.with_metaclass(abc.ABCMeta)):
"""Specifies an implementation of the Base layer.""" """Specifies an implementation of the Base layer."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def instantiate(self, serializations, servicer): def instantiate(self, serializations, servicer):

@ -34,6 +34,8 @@ import itertools
import unittest import unittest
from concurrent import futures from concurrent import futures
import six
# test_interfaces is referenced from specification in this module. # test_interfaces is referenced from specification in this module.
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
from grpc.framework.interfaces.face import face from grpc.framework.interfaces.face import face
@ -46,14 +48,13 @@ from tests.unit.framework.interfaces.face import _stock_service
from tests.unit.framework.interfaces.face import test_interfaces # pylint: disable=unused-import from tests.unit.framework.interfaces.face import test_interfaces # pylint: disable=unused-import
class TestCase(test_coverage.Coverage, unittest.TestCase): class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.TestCase)):
"""A test of the Face layer of RPC Framework. """A test of the Face layer of RPC Framework.
Concrete subclasses must have an "implementation" attribute of type Concrete subclasses must have an "implementation" attribute of type
test_interfaces.Implementation and an "invoker_constructor" attribute of type test_interfaces.Implementation and an "invoker_constructor" attribute of type
_invocation.InvokerConstructor. _invocation.InvokerConstructor.
""" """
__metaclass__ = abc.ABCMeta
NAME = 'BlockingInvocationInlineServiceTest' NAME = 'BlockingInvocationInlineServiceTest'

@ -36,6 +36,8 @@ import threading
import unittest import unittest
from concurrent import futures from concurrent import futures
import six
# test_interfaces is referenced from specification in this module. # test_interfaces is referenced from specification in this module.
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
from grpc.framework.interfaces.face import face from grpc.framework.interfaces.face import face
@ -104,14 +106,13 @@ class _Callback(object):
self._condition.wait() self._condition.wait()
class TestCase(test_coverage.Coverage, unittest.TestCase): class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.TestCase)):
"""A test of the Face layer of RPC Framework. """A test of the Face layer of RPC Framework.
Concrete subclasses must have an "implementation" attribute of type Concrete subclasses must have an "implementation" attribute of type
test_interfaces.Implementation and an "invoker_constructor" attribute of type test_interfaces.Implementation and an "invoker_constructor" attribute of type
_invocation.InvokerConstructor. _invocation.InvokerConstructor.
""" """
__metaclass__ = abc.ABCMeta
NAME = 'FutureInvocationAsynchronousEventServiceTest' NAME = 'FutureInvocationAsynchronousEventServiceTest'

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,6 +31,8 @@
import abc import abc
import six
from grpc.framework.common import cardinality from grpc.framework.common import cardinality
_CARDINALITY_TO_GENERIC_BLOCKING_BEHAVIOR = { _CARDINALITY_TO_GENERIC_BLOCKING_BEHAVIOR = {
@ -62,9 +64,8 @@ _CARDINALITY_TO_MULTI_CALLABLE_ATTRIBUTE = {
} }
class Invoker(object): class Invoker(six.with_metaclass(abc.ABCMeta)):
"""A type used to invoke test RPCs.""" """A type used to invoke test RPCs."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def blocking(self, group, name): def blocking(self, group, name):
@ -82,9 +83,8 @@ class Invoker(object):
raise NotImplementedError() raise NotImplementedError()
class InvokerConstructor(object): class InvokerConstructor(six.with_metaclass(abc.ABCMeta)):
"""A type used to create Invokers.""" """A type used to create Invokers."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def name(self): def name(self):

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,16 +31,16 @@
import abc import abc
import six
# face is referenced from specification in this module. # face is referenced from specification in this module.
from grpc.framework.interfaces.face import face # pylint: disable=unused-import from grpc.framework.interfaces.face import face # pylint: disable=unused-import
from tests.unit.framework.interfaces.face import test_interfaces from tests.unit.framework.interfaces.face import test_interfaces
class UnaryUnaryTestMethodImplementation(test_interfaces.Method): class UnaryUnaryTestMethodImplementation(six.with_metaclass(abc.ABCMeta, test_interfaces.Method)):
"""A controllable implementation of a unary-unary method.""" """A controllable implementation of a unary-unary method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, request, response_callback, context, control): def service(self, request, response_callback, context, control):
"""Services an RPC that accepts one message and produces one message. """Services an RPC that accepts one message and produces one message.
@ -59,11 +59,9 @@ class UnaryUnaryTestMethodImplementation(test_interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class UnaryUnaryTestMessages(object): class UnaryUnaryTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for unary-request-unary-response message pairings.""" """A type for unary-request-unary-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def request(self): def request(self):
"""Affords a request message. """Affords a request message.
@ -93,11 +91,9 @@ class UnaryUnaryTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class UnaryStreamTestMethodImplementation(test_interfaces.Method): class UnaryStreamTestMethodImplementation(six.with_metaclass(abc.ABCMeta, test_interfaces.Method)):
"""A controllable implementation of a unary-stream method.""" """A controllable implementation of a unary-stream method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, request, response_consumer, context, control): def service(self, request, response_consumer, context, control):
"""Services an RPC that takes one message and produces a stream of messages. """Services an RPC that takes one message and produces a stream of messages.
@ -116,11 +112,9 @@ class UnaryStreamTestMethodImplementation(test_interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class UnaryStreamTestMessages(object): class UnaryStreamTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for unary-request-stream-response message pairings.""" """A type for unary-request-stream-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def request(self): def request(self):
"""Affords a request message. """Affords a request message.
@ -150,11 +144,9 @@ class UnaryStreamTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class StreamUnaryTestMethodImplementation(test_interfaces.Method): class StreamUnaryTestMethodImplementation(six.with_metaclass(abc.ABCMeta, test_interfaces.Method)):
"""A controllable implementation of a stream-unary method.""" """A controllable implementation of a stream-unary method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, response_callback, context, control): def service(self, response_callback, context, control):
"""Services an RPC that takes a stream of messages and produces one message. """Services an RPC that takes a stream of messages and produces one message.
@ -180,11 +172,9 @@ class StreamUnaryTestMethodImplementation(test_interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class StreamUnaryTestMessages(object): class StreamUnaryTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for stream-request-unary-response message pairings.""" """A type for stream-request-unary-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def requests(self): def requests(self):
"""Affords a sequence of request messages. """Affords a sequence of request messages.
@ -214,11 +204,9 @@ class StreamUnaryTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class StreamStreamTestMethodImplementation(test_interfaces.Method): class StreamStreamTestMethodImplementation(six.with_metaclass(abc.ABCMeta, test_interfaces.Method)):
"""A controllable implementation of a stream-stream method.""" """A controllable implementation of a stream-stream method."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def service(self, response_consumer, context, control): def service(self, response_consumer, context, control):
"""Services an RPC that accepts and produces streams of messages. """Services an RPC that accepts and produces streams of messages.
@ -244,11 +232,9 @@ class StreamStreamTestMethodImplementation(test_interfaces.Method):
raise NotImplementedError() raise NotImplementedError()
class StreamStreamTestMessages(object): class StreamStreamTestMessages(six.with_metaclass(abc.ABCMeta)):
"""A type for stream-request-stream-response message pairings.""" """A type for stream-request-stream-response message pairings."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def requests(self): def requests(self):
"""Affords a sequence of request messages. """Affords a sequence of request messages.
@ -278,11 +264,9 @@ class StreamStreamTestMessages(object):
raise NotImplementedError() raise NotImplementedError()
class TestService(object): class TestService(six.with_metaclass(abc.ABCMeta)):
"""A specification of implemented methods to use in tests.""" """A specification of implemented methods to use in tests."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def unary_unary_scenarios(self): def unary_unary_scenarios(self):
"""Affords unary-request-unary-response test methods and their messages. """Affords unary-request-unary-response test methods and their messages.

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -31,13 +31,14 @@
import abc import abc
import six
from grpc.framework.common import cardinality # pylint: disable=unused-import from grpc.framework.common import cardinality # pylint: disable=unused-import
from grpc.framework.interfaces.face import face # pylint: disable=unused-import from grpc.framework.interfaces.face import face # pylint: disable=unused-import
class Method(object): class Method(six.with_metaclass(abc.ABCMeta)):
"""Specifies a method to be used in tests.""" """Specifies a method to be used in tests."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def group(self): def group(self):
@ -126,9 +127,8 @@ class Method(object):
raise NotImplementedError() raise NotImplementedError()
class Implementation(object): class Implementation(six.with_metaclass(abc.ABCMeta)):
"""Specifies an implementation of the Face layer.""" """Specifies an implementation of the Face layer."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod @abc.abstractmethod
def instantiate( def instantiate(

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -33,6 +33,8 @@
import abc import abc
import unittest # pylint: disable=unused-import import unittest # pylint: disable=unused-import
import six
from grpc.framework.interfaces.links import links from grpc.framework.interfaces.links import links
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
from tests.unit.framework.interfaces.links import test_utilities from tests.unit.framework.interfaces.links import test_utilities
@ -58,13 +60,12 @@ _TRANSMISSION_GROUP = 'test.Group'
_TRANSMISSION_METHOD = 'TestMethod' _TRANSMISSION_METHOD = 'TestMethod'
class TransmissionTest(object): class TransmissionTest(six.with_metaclass(abc.ABCMeta)):
"""Tests ticket transmission between two connected links. """Tests ticket transmission between two connected links.
This class must be mixed into a unittest.TestCase that implements the abstract This class must be mixed into a unittest.TestCase that implements the abstract
methods it provides. methods it provides.
""" """
__metaclass__ = abc.ABCMeta
# This is a unittest.TestCase mix-in. # This is a unittest.TestCase mix-in.
# pylint: disable=invalid-name # pylint: disable=invalid-name

Loading…
Cancel
Save