Skip to content

Commit

Permalink
feat(bigtable): add py2 deprecation warnings; standardize use of 'req…
Browse files Browse the repository at this point in the history
…uired' in docstrings (via synth) (#10064)
  • Loading branch information
yoshi-automation committed Jan 29, 2020
1 parent 7e5d963 commit 5460de0
Show file tree
Hide file tree
Showing 11 changed files with 321 additions and 152 deletions.
11 changes: 11 additions & 0 deletions google/cloud/bigtable_admin_v2/__init__.py
Expand Up @@ -16,13 +16,24 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.bigtable_admin_v2 import types
from google.cloud.bigtable_admin_v2.gapic import bigtable_instance_admin_client
from google.cloud.bigtable_admin_v2.gapic import bigtable_table_admin_client
from google.cloud.bigtable_admin_v2.gapic import enums


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class BigtableInstanceAdminClient(
bigtable_instance_admin_client.BigtableInstanceAdminClient
):
Expand Down
Expand Up @@ -1051,7 +1051,7 @@ def get_iam_policy(
metadata=None,
):
"""
Gets the access control policy for an instance resource. Returns an empty
Gets the access control policy for a table resource. Returns an empty
policy if an table exists but does not have a policy set.
Example:
Expand Down
Expand Up @@ -267,7 +267,7 @@ def check_consistency(self):
def get_iam_policy(self):
"""Return the gRPC stub for :meth:`BigtableTableAdminClient.get_iam_policy`.
Gets the access control policy for an instance resource. Returns an empty
Gets the access control policy for a table resource. Returns an empty
policy if an table exists but does not have a policy set.
Returns:
Expand Down
Expand Up @@ -185,7 +185,7 @@ service BigtableTableAdmin {
};
}

// Gets the access control policy for an instance resource. Returns an empty
// Gets the access control policy for a table resource. Returns an empty
// policy if an table exists but does not have a policy set.
rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
option (google.api.http) = {
Expand Down
Expand Up @@ -255,7 +255,7 @@ def DeleteSnapshot(self, request, context):
raise NotImplementedError("Method not implemented!")

def GetIamPolicy(self, request, context):
"""Gets the access control policy for an instance resource. Returns an empty
"""Gets the access control policy for a table resource. Returns an empty
policy if an table exists but does not have a policy set.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down
11 changes: 11 additions & 0 deletions google/cloud/bigtable_v2/__init__.py
Expand Up @@ -16,11 +16,22 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.bigtable_v2 import types
from google.cloud.bigtable_v2.gapic import bigtable_client


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class BigtableClient(bigtable_client.BigtableClient):
__doc__ = bigtable_client.BigtableClient.__doc__

Expand Down
46 changes: 29 additions & 17 deletions google/cloud/bigtable_v2/gapic/bigtable_client.py
Expand Up @@ -224,8 +224,8 @@ def read_rows(
... pass
Args:
table_name (str): The unique name of the table from which to read. Values are of the form
``projects/<project>/instances/<instance>/tables/<table>``.
table_name (str): Required. The unique name of the table from which to read. Values are of
the form ``projects/<project>/instances/<instance>/tables/<table>``.
app_profile_id (str): This value specifies routing for replication. If not specified, the
"default" application profile will be used.
rows (Union[dict, ~google.cloud.bigtable_v2.types.RowSet]): The row keys and/or ranges to read. If not specified, reads from all rows.
Expand Down Expand Up @@ -319,8 +319,9 @@ def sample_row_keys(
... pass
Args:
table_name (str): The unique name of the table from which to sample row keys. Values are
of the form ``projects/<project>/instances/<instance>/tables/<table>``.
table_name (str): Required. The unique name of the table from which to sample row keys.
Values are of the form
``projects/<project>/instances/<instance>/tables/<table>``.
app_profile_id (str): This value specifies routing for replication. If not specified, the
"default" application profile will be used.
retry (Optional[google.api_core.retry.Retry]): A retry object used
Expand Down Expand Up @@ -403,11 +404,14 @@ def mutate_row(
>>> response = client.mutate_row(table_name, row_key, mutations)
Args:
table_name (str): The unique name of the table to which the mutation should be applied.
Values are of the form
table_name (str): Required. The unique name of the table to which the mutation should be
applied. Values are of the form
``projects/<project>/instances/<instance>/tables/<table>``.
row_key (bytes): The key of the row to which the mutation should be applied.
mutations (list[Union[dict, ~google.cloud.bigtable_v2.types.Mutation]]): Changes to be atomically applied to the specified row. Entries are applied
row_key (bytes): Required. The key of the row to which the mutation should be applied.
Classified as IDENTIFYING\_ID to provide context around data accesses
for auditing systems.
mutations (list[Union[dict, ~google.cloud.bigtable_v2.types.Mutation]]): Required. Changes to be atomically applied to the specified row. Entries are applied
in order, meaning that earlier mutations can be masked by later ones.
Must contain at least one entry and at most 100000.
Expand Down Expand Up @@ -497,8 +501,8 @@ def mutate_rows(
... pass
Args:
table_name (str): The unique name of the table to which the mutations should be applied.
entries (list[Union[dict, ~google.cloud.bigtable_v2.types.Entry]]): The row keys and corresponding mutations to be applied in bulk.
table_name (str): Required. The unique name of the table to which the mutations should be applied.
entries (list[Union[dict, ~google.cloud.bigtable_v2.types.Entry]]): Required. The row keys and corresponding mutations to be applied in bulk.
Each entry is applied as an atomic mutation, but the entries may be
applied in arbitrary order (even between entries for the same row).
At least one entry must be specified, and in total the entries can
Expand Down Expand Up @@ -586,10 +590,14 @@ def check_and_mutate_row(
>>> response = client.check_and_mutate_row(table_name, row_key)
Args:
table_name (str): The unique name of the table to which the conditional mutation should be
applied. Values are of the form
table_name (str): Required. The unique name of the table to which the conditional mutation
should be applied. Values are of the form
``projects/<project>/instances/<instance>/tables/<table>``.
row_key (bytes): The key of the row to which the conditional mutation should be applied.
row_key (bytes): Required. The key of the row to which the conditional mutation should be
applied.
Classified as IDENTIFYING\_ID to provide context around data accesses
for auditing systems.
app_profile_id (str): This value specifies routing for replication. If not specified, the
"default" application profile will be used.
predicate_filter (Union[dict, ~google.cloud.bigtable_v2.types.RowFilter]): The filter to be applied to the contents of the specified row. Depending
Expand Down Expand Up @@ -703,11 +711,15 @@ def read_modify_write_row(
>>> response = client.read_modify_write_row(table_name, row_key, rules)
Args:
table_name (str): The unique name of the table to which the read/modify/write rules should
be applied. Values are of the form
table_name (str): Required. The unique name of the table to which the read/modify/write
rules should be applied. Values are of the form
``projects/<project>/instances/<instance>/tables/<table>``.
row_key (bytes): The key of the row to which the read/modify/write rules should be applied.
rules (list[Union[dict, ~google.cloud.bigtable_v2.types.ReadModifyWriteRule]]): Rules specifying how the specified row's contents are to be transformed
row_key (bytes): Required. The key of the row to which the read/modify/write rules should
be applied.
Classified as IDENTIFYING\_ID to provide context around data accesses
for auditing systems.
rules (list[Union[dict, ~google.cloud.bigtable_v2.types.ReadModifyWriteRule]]): Required. Rules specifying how the specified row's contents are to be transformed
into writes. Entries are applied in order, meaning that earlier rules will
affect the results of later ones.
Expand Down

0 comments on commit 5460de0

Please sign in to comment.