aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/beta/_client_adaptations.py
diff options
context:
space:
mode:
authorGravatar Ken Payson <kpayson@google.com>2016-06-08 13:06:44 -0700
committerGravatar Ken Payson <kpayson@google.com>2016-06-10 11:48:24 -0700
commit1efb6017ec1edb26706895dfe71f4d72ea387cf4 (patch)
treeeaede04a7db3e55c9c0954185192dc84231c2637 /src/python/grpcio/grpc/beta/_client_adaptations.py
parent698d3e91ff42db3fe640cc369e8edf85abc5343d (diff)
Initial Python3 support
Notable Changes: -Convert all str types to byte types at cython layer (ascii encoding) -Use six for packages that have different names in Python2/Python3 -By default, unit tests are compiled/run in Python2.7 and Python3.4 -Ensure MACOSX_BUILD_TARGET is at least 10.7
Diffstat (limited to 'src/python/grpcio/grpc/beta/_client_adaptations.py')
-rw-r--r--src/python/grpcio/grpc/beta/_client_adaptations.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/python/grpcio/grpc/beta/_client_adaptations.py b/src/python/grpcio/grpc/beta/_client_adaptations.py
index 621fcf2174..024808c540 100644
--- a/src/python/grpcio/grpc/beta/_client_adaptations.py
+++ b/src/python/grpcio/grpc/beta/_client_adaptations.py
@@ -30,6 +30,7 @@
"""Translates gRPC's client-side API into gRPC's client-side Beta API."""
import grpc
+from grpc import _common
from grpc._cython import cygrpc
from grpc.beta import interfaces
from grpc.framework.common import cardinality
@@ -48,10 +49,6 @@ _STATUS_CODE_TO_ABORTION_KIND_AND_ABORTION_ERROR_CLASS = {
}
-def _fully_qualified_method(group, method):
- return b'/{}/{}'.format(group, method)
-
-
def _effective_metadata(metadata, metadata_transformer):
non_none_metadata = () if metadata is None else metadata
if metadata_transformer is None:
@@ -184,7 +181,7 @@ def _blocking_unary_unary(
metadata_transformer, request, request_serializer, response_deserializer):
try:
multi_callable = channel.unary_unary(
- _fully_qualified_method(group, method),
+ _common.fully_qualified_method(group, method),
request_serializer=request_serializer,
response_deserializer=response_deserializer)
effective_metadata = _effective_metadata(metadata, metadata_transformer)
@@ -205,7 +202,7 @@ def _future_unary_unary(
channel, group, method, timeout, protocol_options, metadata,
metadata_transformer, request, request_serializer, response_deserializer):
multi_callable = channel.unary_unary(
- _fully_qualified_method(group, method),
+ _common.fully_qualified_method(group, method),
request_serializer=request_serializer,
response_deserializer=response_deserializer)
effective_metadata = _effective_metadata(metadata, metadata_transformer)
@@ -219,7 +216,7 @@ def _unary_stream(
channel, group, method, timeout, protocol_options, metadata,
metadata_transformer, request, request_serializer, response_deserializer):
multi_callable = channel.unary_stream(
- _fully_qualified_method(group, method),
+ _common.fully_qualified_method(group, method),
request_serializer=request_serializer,
response_deserializer=response_deserializer)
effective_metadata = _effective_metadata(metadata, metadata_transformer)
@@ -235,7 +232,7 @@ def _blocking_stream_unary(
response_deserializer):
try:
multi_callable = channel.stream_unary(
- _fully_qualified_method(group, method),
+ _common.fully_qualified_method(group, method),
request_serializer=request_serializer,
response_deserializer=response_deserializer)
effective_metadata = _effective_metadata(metadata, metadata_transformer)
@@ -257,7 +254,7 @@ def _future_stream_unary(
metadata_transformer, request_iterator, request_serializer,
response_deserializer):
multi_callable = channel.stream_unary(
- _fully_qualified_method(group, method),
+ _common.fully_qualified_method(group, method),
request_serializer=request_serializer,
response_deserializer=response_deserializer)
effective_metadata = _effective_metadata(metadata, metadata_transformer)
@@ -272,7 +269,7 @@ def _stream_stream(
metadata_transformer, request_iterator, request_serializer,
response_deserializer):
multi_callable = channel.stream_stream(
- _fully_qualified_method(group, method),
+ _common.fully_qualified_method(group, method),
request_serializer=request_serializer,
response_deserializer=response_deserializer)
effective_metadata = _effective_metadata(metadata, metadata_transformer)