Skip to content

Commit

Permalink
Make options a constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
daspecster committed Dec 29, 2016
1 parent 11092e6 commit 78aa62a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bigtable/google/cloud/bigtable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@
READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/bigtable.data.readonly'
"""Scope for reading table data."""

# NOTE: 'grpc.max_message_length' will no longer be recognized in
# grpcio 1.1 and later.
_MAX_MSG_LENGTH_100MB = 100 * 1024 * 1024
_GRPC_MAX_LENGTH_OPTIONS = (('grpc.max_message_length', _MAX_MSG_LENGTH_100MB),
('grpc.max_receive_message_length',
_MAX_MSG_LENGTH_100MB))

This comment has been minimized.

Copy link
@dhermes

dhermes Dec 29, 2016

Contributor

Might be easier to read as:

_GRPC_MAX_LENGTH_OPTIONS = (
    ('grpc.max_message_length', _MAX_MSG_LENGTH_100MB),
    ('grpc.max_receive_message_length', _MAX_MSG_LENGTH_100MB),
)

Your call though.



def _make_data_stub(client):
Expand All @@ -78,14 +83,9 @@ def _make_data_stub(client):
:returns: A gRPC stub object.
"""
if client.emulator_host is None:
# NOTE: 'grpc.max_message_length' will no longer be recognized in
# grpcio 1.1 and later.
max_msg_length = (('grpc.max_message_length', _MAX_MSG_LENGTH_100MB),
('grpc.max_receive_message_length',
_MAX_MSG_LENGTH_100MB))
return make_secure_stub(client.credentials, client.user_agent,
bigtable_pb2.BigtableStub, DATA_API_HOST,
extra_options=max_msg_length)
extra_options=_GRPC_MAX_LENGTH_OPTIONS)
else:
return make_insecure_stub(bigtable_pb2.BigtableStub,
client.emulator_host)
Expand Down

0 comments on commit 78aa62a

Please sign in to comment.