Factor out interface-specific early_adopter code

Refactors early_adopter such that interface-specific code is located in
the framework module as a submodule `alpha`.
pull/1076/head
Masood Malekghassemi 10 years ago
parent acfcd03f06
commit 89905ac55d
  1. 2
      src/compiler/python_generator.cc
  2. 2
      src/python/interop/interop/methods.py
  3. 6
      src/python/src/grpc/early_adopter/implementations.py
  4. 2
      src/python/src/grpc/early_adopter/implementations_test.py
  5. 28
      src/python/src/grpc/framework/alpha/__init__.py
  6. 4
      src/python/src/grpc/framework/alpha/_face_utilities.py
  7. 4
      src/python/src/grpc/framework/alpha/_reexport.py
  8. 0
      src/python/src/grpc/framework/alpha/exceptions.py
  9. 2
      src/python/src/grpc/framework/alpha/interfaces.py
  10. 2
      src/python/src/grpc/framework/alpha/utilities.py
  11. 1
      src/python/src/setup.py
  12. 2
      test/compiler/python_plugin_test.py

@ -381,7 +381,7 @@ bool PrintStubFactory(const std::string& package_qualified_service_name,
bool PrintPreamble(const FileDescriptor* file, Printer* out) {
out->Print("import abc\n");
out->Print("from grpc.early_adopter import implementations\n");
out->Print("from grpc.early_adopter import utilities\n");
out->Print("from grpc.framework.alpha import utilities\n");
return true;
}

@ -32,7 +32,7 @@
import enum
import threading
from grpc.early_adopter import utilities
from grpc.framework.alpha import utilities
from interop import empty_pb2
from interop import messages_pb2

@ -33,9 +33,9 @@ import threading
from grpc._adapter import fore as _fore
from grpc._adapter import rear as _rear
from grpc.early_adopter import _face_utilities
from grpc.early_adopter import _reexport
from grpc.early_adopter import interfaces
from grpc.framework.alpha import _face_utilities
from grpc.framework.alpha import _reexport
from grpc.framework.alpha import interfaces
from grpc.framework.base import implementations as _base_implementations
from grpc.framework.base import util as _base_utilities
from grpc.framework.face import implementations as _face_implementations

@ -34,7 +34,7 @@
import unittest
from grpc.early_adopter import implementations
from grpc.early_adopter import utilities
from grpc.framework.alpha import utilities
from grpc._junkdrawer import math_pb2
SERVICE_NAME = 'math.Math'

@ -0,0 +1,28 @@
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -34,8 +34,8 @@ import collections
from grpc.framework.common import cardinality
from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import
from grpc.framework.face import utilities as face_utilities
from grpc.early_adopter import _reexport
from grpc.early_adopter import interfaces
from grpc.framework.alpha import _reexport
from grpc.framework.alpha import interfaces
def _qualified_name(service_name, method_name):

@ -31,8 +31,8 @@ from grpc.framework.common import cardinality
from grpc.framework.face import exceptions as face_exceptions
from grpc.framework.face import interfaces as face_interfaces
from grpc.framework.foundation import future
from grpc.early_adopter import exceptions
from grpc.early_adopter import interfaces
from grpc.framework.alpha import exceptions
from grpc.framework.alpha import interfaces
_EARLY_ADOPTER_CARDINALITY_TO_COMMON_CARDINALITY = {
interfaces.Cardinality.UNARY_UNARY: cardinality.Cardinality.UNARY_UNARY,

@ -33,7 +33,7 @@ import abc
import enum
# exceptions is referenced from specification in this module.
from grpc.early_adopter 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 future

@ -29,7 +29,7 @@
"""Utilities for use with GRPC."""
from grpc.early_adopter import interfaces
from grpc.framework.alpha import interfaces
class _RpcMethodDescription(

@ -64,6 +64,7 @@ _PACKAGES = (
'grpc._junkdrawer',
'grpc.early_adopter',
'grpc.framework',
'grpc.framework.alpha',
'grpc.framework.base',
'grpc.framework.common',
'grpc.framework.face',

@ -39,7 +39,7 @@ import tempfile
import time
import unittest
from grpc.early_adopter import exceptions
from grpc.framework.alpha import exceptions
from grpc.framework.foundation import future
# Identifiers of entities we expect to find in the generated module.

Loading…
Cancel
Save