From 24a66903a9bdb8055d70eacd8e3459e8b0279bc7 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 6 Aug 2020 12:25:42 -0700 Subject: [PATCH] Yapf --- examples/python/cancellation/search.py | 14 ++++++-------- examples/python/cancellation/server.py | 4 ++-- examples/python/compression/server.py | 3 +-- examples/python/debug/debug_server.py | 4 ++-- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/examples/python/cancellation/search.py b/examples/python/cancellation/search.py index b5249f64515..7bfa0d819c4 100644 --- a/examples/python/cancellation/search.py +++ b/examples/python/cancellation/search.py @@ -134,16 +134,14 @@ def search(target, distance = _get_substring_hamming_distance(candidate_hash, target) if interesting_hamming_distance is not None and distance <= interesting_hamming_distance: # Surface interesting candidates, but don't stop. - yield protos.HashNameResponse( - secret=base64.b64encode(secret), - hashed_name=candidate_hash, - hamming_distance=distance) + yield protos.HashNameResponse(secret=base64.b64encode(secret), + hashed_name=candidate_hash, + hamming_distance=distance) elif distance <= ideal_distance: # Yield ideal candidate and end the stream. - yield protos.HashNameResponse( - secret=base64.b64encode(secret), - hashed_name=candidate_hash, - hamming_distance=distance) + yield protos.HashNameResponse(secret=base64.b64encode(secret), + hashed_name=candidate_hash, + hamming_distance=distance) raise StopIteration() # pylint: disable=stop-iteration-return hashes_computed += 1 if hashes_computed == maximum_hashes: diff --git a/examples/python/cancellation/server.py b/examples/python/cancellation/server.py index feec242e817..b3c178ef457 100644 --- a/examples/python/cancellation/server.py +++ b/examples/python/cancellation/server.py @@ -90,8 +90,8 @@ def _running_server(port, maximum_hashes): # threads. server = grpc.server(futures.ThreadPoolExecutor(max_workers=1), maximum_concurrent_rpcs=1) - services.add_HashFinderServicer_to_server( - HashFinder(maximum_hashes), server) + services.add_HashFinderServicer_to_server(HashFinder(maximum_hashes), + server) address = '{}:{}'.format(_SERVER_HOST, port) actual_port = server.add_insecure_port(address) server.start() diff --git a/examples/python/compression/server.py b/examples/python/compression/server.py index a448788bf7c..5db9f13ae1b 100644 --- a/examples/python/compression/server.py +++ b/examples/python/compression/server.py @@ -66,8 +66,7 @@ def run_server(server_compression, no_compress_every_n, port): server = grpc.server(futures.ThreadPoolExecutor(), compression=server_compression, options=(('grpc.so_reuseport', 1),)) - services.add_GreeterServicer_to_server( - Greeter(no_compress_every_n), server) + services.add_GreeterServicer_to_server(Greeter(no_compress_every_n), server) address = '{}:{}'.format(_SERVER_HOST, port) server.add_insecure_port(address) server.start() diff --git a/examples/python/debug/debug_server.py b/examples/python/debug/debug_server.py index cf8a88b67ba..e9d351ae339 100644 --- a/examples/python/debug/debug_server.py +++ b/examples/python/debug/debug_server.py @@ -51,8 +51,8 @@ class FaultInjectGreeter(services.GreeterServicer): def create_server(addr, failure_rate): server = grpc.server(futures.ThreadPoolExecutor()) - services.add_GreeterServicer_to_server( - FaultInjectGreeter(failure_rate), server) + services.add_GreeterServicer_to_server(FaultInjectGreeter(failure_rate), + server) # Add Channelz Servicer to the gRPC server channelz.add_channelz_servicer(server)