Fix the pylint complain

pull/22638/head^2
Lidi Zheng 5 years ago
parent f375c0b548
commit f6e6b9f640
  1. 11
      examples/python/data_transmission/alts_client.py
  2. 5
      examples/python/data_transmission/alts_server.py
  3. 4
      src/python/grpcio/grpc/__init__.py

@ -17,8 +17,9 @@ The example would only successfully run in GCP environment."""
import grpc
import client
import demo_pb2_grpc
from client import (bidirectional_streaming_method, client_streaming_method,
server_streaming_method, simple_method)
SERVER_ADDRESS = "localhost:23333"
@ -28,10 +29,10 @@ def main():
SERVER_ADDRESS,
credentials=grpc.alts_channel_credentials()) as channel:
stub = demo_pb2_grpc.GRPCDemoStub(channel)
client.simple_method(stub)
client.client_streaming_method(stub)
client.server_streaming_method(stub)
client.bidirectional_streaming_method(stub)
simple_method(stub)
client_streaming_method(stub)
server_streaming_method(stub)
bidirectional_streaming_method(stub)
if __name__ == '__main__':

@ -18,15 +18,16 @@ The example would only successfully run in GCP environment."""
from concurrent import futures
import grpc
import demo_pb2_grpc
import server
from server import DemoServer
SERVER_ADDRESS = 'localhost:23333'
def main():
svr = grpc.server(futures.ThreadPoolExecutor())
demo_pb2_grpc.add_GRPCDemoServicer_to_server(server.DemoServer(), svr)
demo_pb2_grpc.add_GRPCDemoServicer_to_server(DemoServer(), svr)
svr.add_secure_port(SERVER_ADDRESS,
server_credentials=grpc.alts_server_credentials())
print("------------------start Python GRPC server with ALTS encryption")

@ -1833,7 +1833,7 @@ def local_server_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP):
_cygrpc.server_credentials_local(local_connect_type.value))
def alts_channel_credentials(service_accounts=[]):
def alts_channel_credentials(service_accounts=None):
"""Creates a ChannelCredentials for use with an ALTS-enabled Channel.
This is an EXPERIMENTAL API.
@ -1851,7 +1851,7 @@ def alts_channel_credentials(service_accounts=[]):
A ChannelCredentials for use with an ALTS-enabled Channel
"""
return ChannelCredentials(
_cygrpc.channel_credentials_alts(service_accounts))
_cygrpc.channel_credentials_alts(service_accounts or []))
def alts_server_credentials():

Loading…
Cancel
Save