Skip to content

Commit

Permalink
Merge pull request grpc#1076 from soltanmm/internal-codegen-support
Browse files Browse the repository at this point in the history
Factor out interface-specific early_adopter code
  • Loading branch information
nathanielmanistaatgoogle committed Mar 18, 2015
2 parents acfcd03 + 89905ac commit 1e82c63
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/compiler/python_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/python/interop/interop/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/python/src/grpc/early_adopter/implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

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
Expand Down
2 changes: 1 addition & 1 deletion src/python/src/grpc/early_adopter/implementations_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
28 changes: 28 additions & 0 deletions src/python/src/grpc/framework/alpha/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

"""Utilities for use with GRPC."""

from grpc.early_adopter import interfaces
from grpc.framework.alpha import interfaces


class _RpcMethodDescription(
Expand Down
1 change: 1 addition & 0 deletions src/python/src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
'grpc._junkdrawer',
'grpc.early_adopter',
'grpc.framework',
'grpc.framework.alpha',
'grpc.framework.base',
'grpc.framework.common',
'grpc.framework.face',
Expand Down
2 changes: 1 addition & 1 deletion test/compiler/python_plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
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.
Expand Down

0 comments on commit 1e82c63

Please sign in to comment.