Use str instead of Text

pull/21951/head
Lidi Zheng 5 years ago
parent d77a231c2a
commit 8701b18efb
  1. 6
      src/python/grpcio/grpc/experimental/aio/__init__.py
  2. 4
      src/python/grpcio/grpc/experimental/aio/_base_call.py
  3. 12
      src/python/grpcio/grpc/experimental/aio/_channel.py
  4. 4
      src/python/grpcio/grpc/experimental/aio/_interceptor.py
  5. 6
      src/python/grpcio/grpc/experimental/aio/_server.py
  6. 6
      src/python/grpcio/grpc/experimental/aio/_typing.py

@ -17,7 +17,7 @@ gRPC Async API objects may only be used on the thread on which they were
created. AsyncIO doesn't provide thread safety for most of its APIs.
"""
from typing import Any, Optional, Sequence, Text, Tuple
from typing import Any, Optional, Sequence, Tuple
import grpc
from grpc._cython.cygrpc import (EOF, AbortError, BaseError, UsageError,
@ -33,7 +33,7 @@ from ._typing import ChannelArgumentType
def insecure_channel(
target: Text,
target: str,
options: Optional[ChannelArgumentType] = None,
compression: Optional[grpc.Compression] = None,
interceptors: Optional[Sequence[UnaryUnaryClientInterceptor]] = None):
@ -56,7 +56,7 @@ def insecure_channel(
def secure_channel(
target: Text,
target: str,
credentials: grpc.ChannelCredentials,
options: Optional[ChannelArgumentType] = None,
compression: Optional[grpc.Compression] = None,

@ -19,7 +19,7 @@ RPC, e.g. cancellation.
"""
from abc import ABCMeta, abstractmethod
from typing import AsyncIterable, Awaitable, Generic, Optional, Text, Union
from typing import AsyncIterable, Awaitable, Generic, Optional, Union
import grpc
@ -110,7 +110,7 @@ class Call(RpcContext, metaclass=ABCMeta):
"""
@abstractmethod
async def details(self) -> Text:
async def details(self) -> str:
"""Accesses the details sent by the server.
Returns:

@ -13,7 +13,7 @@
# limitations under the License.
"""Invocation-side implementation of gRPC Asyncio Python."""
import asyncio
from typing import Any, AsyncIterable, Optional, Sequence, AbstractSet, Text
from typing import Any, AsyncIterable, Optional, Sequence, AbstractSet
from weakref import WeakSet
import logging
@ -321,7 +321,7 @@ class Channel:
_unary_unary_interceptors: Optional[Sequence[UnaryUnaryClientInterceptor]]
_ongoing_calls: _OngoingCalls
def __init__(self, target: Text, options: ChannelArgumentType,
def __init__(self, target: str, options: ChannelArgumentType,
credentials: Optional[grpc.ChannelCredentials],
compression: Optional[grpc.Compression],
interceptors: Optional[Sequence[UnaryUnaryClientInterceptor]]):
@ -470,7 +470,7 @@ class Channel:
def unary_unary(
self,
method: Text,
method: str,
request_serializer: Optional[SerializingFunction] = None,
response_deserializer: Optional[DeserializingFunction] = None
) -> UnaryUnaryMultiCallable:
@ -496,7 +496,7 @@ class Channel:
def unary_stream(
self,
method: Text,
method: str,
request_serializer: Optional[SerializingFunction] = None,
response_deserializer: Optional[DeserializingFunction] = None
) -> UnaryStreamMultiCallable:
@ -507,7 +507,7 @@ class Channel:
def stream_unary(
self,
method: Text,
method: str,
request_serializer: Optional[SerializingFunction] = None,
response_deserializer: Optional[DeserializingFunction] = None
) -> StreamUnaryMultiCallable:
@ -518,7 +518,7 @@ class Channel:
def stream_stream(
self,
method: Text,
method: str,
request_serializer: Optional[SerializingFunction] = None,
response_deserializer: Optional[DeserializingFunction] = None
) -> StreamStreamMultiCallable:

@ -16,7 +16,7 @@ import asyncio
import collections
import functools
from abc import ABCMeta, abstractmethod
from typing import Callable, Optional, Iterator, Sequence, Text, Union
from typing import Callable, Optional, Iterator, Sequence, Union
import grpc
from grpc._cython import cygrpc
@ -36,7 +36,7 @@ class ClientCallDetails(
('method', 'timeout', 'metadata', 'credentials', 'wait_for_ready')),
grpc.ClientCallDetails):
method: Text
method: str
timeout: Optional[float]
metadata: Optional[MetadataType]
credentials: Optional[grpc.CallCredentials]

@ -15,7 +15,7 @@
import asyncio
from concurrent.futures import Executor
from typing import Any, Optional, Sequence, Text
from typing import Any, Optional, Sequence
import grpc
from grpc import _common, _compression
@ -58,7 +58,7 @@ class Server:
"""
self._server.add_generic_rpc_handlers(generic_rpc_handlers)
def add_insecure_port(self, address: Text) -> int:
def add_insecure_port(self, address: str) -> int:
"""Opens an insecure port for accepting RPCs.
This method may only be called before starting the server.
@ -72,7 +72,7 @@ class Server:
"""
return self._server.add_insecure_port(_common.encode(address))
def add_secure_port(self, address: Text,
def add_secure_port(self, address: str,
server_credentials: grpc.ServerCredentials) -> int:
"""Opens a secure port for accepting RPCs.

@ -13,15 +13,15 @@
# limitations under the License.
"""Common types for gRPC Async API"""
from typing import Any, AnyStr, Callable, Sequence, Text, Tuple, TypeVar
from typing import Any, AnyStr, Callable, Sequence, Tuple, TypeVar
from grpc._cython.cygrpc import EOF
RequestType = TypeVar('RequestType')
ResponseType = TypeVar('ResponseType')
SerializingFunction = Callable[[Any], bytes]
DeserializingFunction = Callable[[bytes], Any]
MetadatumType = Tuple[Text, AnyStr]
MetadatumType = Tuple[str, AnyStr]
MetadataType = Sequence[MetadatumType]
ChannelArgumentType = Sequence[Tuple[Text, Any]]
ChannelArgumentType = Sequence[Tuple[str, Any]]
EOFType = type(EOF)
DoneCallbackType = Callable[[Any], None]

Loading…
Cancel
Save