From efabba016698f682604d5dddd8cdf23013e92ee1 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 19 Mar 2022 11:40:11 +0100 Subject: [PATCH 01/11] chore(deps): update all dependencies (#540) --- samples/beam/requirements-test.txt | 2 +- samples/beam/requirements.txt | 2 +- samples/hello/requirements-test.txt | 2 +- samples/hello/requirements.txt | 2 +- samples/hello_happybase/requirements-test.txt | 2 +- samples/instanceadmin/requirements-test.txt | 2 +- samples/instanceadmin/requirements.txt | 2 +- samples/metricscaler/requirements-test.txt | 2 +- samples/metricscaler/requirements.txt | 2 +- samples/quickstart/requirements-test.txt | 2 +- samples/quickstart/requirements.txt | 2 +- samples/quickstart_happybase/requirements-test.txt | 2 +- samples/snippets/filters/requirements-test.txt | 2 +- samples/snippets/filters/requirements.txt | 2 +- samples/snippets/reads/requirements-test.txt | 2 +- samples/snippets/reads/requirements.txt | 2 +- samples/snippets/writes/requirements-test.txt | 2 +- samples/snippets/writes/requirements.txt | 2 +- samples/tableadmin/requirements-test.txt | 2 +- samples/tableadmin/requirements.txt | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/samples/beam/requirements-test.txt b/samples/beam/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/beam/requirements-test.txt +++ b/samples/beam/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/beam/requirements.txt b/samples/beam/requirements.txt index 3270f46be..860a1045d 100644 --- a/samples/beam/requirements.txt +++ b/samples/beam/requirements.txt @@ -1,3 +1,3 @@ apache-beam==2.37.0 -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 google-cloud-core==2.2.3 diff --git a/samples/hello/requirements-test.txt b/samples/hello/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/hello/requirements-test.txt +++ b/samples/hello/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/hello/requirements.txt b/samples/hello/requirements.txt index 26cac3f4d..f0836a540 100644 --- a/samples/hello/requirements.txt +++ b/samples/hello/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 google-cloud-core==2.2.3 diff --git a/samples/hello_happybase/requirements-test.txt b/samples/hello_happybase/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/hello_happybase/requirements-test.txt +++ b/samples/hello_happybase/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/instanceadmin/requirements-test.txt b/samples/instanceadmin/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/instanceadmin/requirements-test.txt +++ b/samples/instanceadmin/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/instanceadmin/requirements.txt b/samples/instanceadmin/requirements.txt index 40a8ffc5e..f5c202aa0 100644 --- a/samples/instanceadmin/requirements.txt +++ b/samples/instanceadmin/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 backoff==1.11.1 diff --git a/samples/metricscaler/requirements-test.txt b/samples/metricscaler/requirements-test.txt index fded0b1be..fe1569ff4 100644 --- a/samples/metricscaler/requirements-test.txt +++ b/samples/metricscaler/requirements-test.txt @@ -1,3 +1,3 @@ -pytest==7.1.0 +pytest==7.1.1 mock==4.0.3 google-cloud-testutils diff --git a/samples/metricscaler/requirements.txt b/samples/metricscaler/requirements.txt index d3da5f1e9..af3bb97b7 100644 --- a/samples/metricscaler/requirements.txt +++ b/samples/metricscaler/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 google-cloud-monitoring==2.9.1 diff --git a/samples/quickstart/requirements-test.txt b/samples/quickstart/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/quickstart/requirements-test.txt +++ b/samples/quickstart/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/quickstart/requirements.txt b/samples/quickstart/requirements.txt index 39c4d4ea3..01e026f93 100644 --- a/samples/quickstart/requirements.txt +++ b/samples/quickstart/requirements.txt @@ -1 +1 @@ -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 diff --git a/samples/quickstart_happybase/requirements-test.txt b/samples/quickstart_happybase/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/quickstart_happybase/requirements-test.txt +++ b/samples/quickstart_happybase/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/snippets/filters/requirements-test.txt b/samples/snippets/filters/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/snippets/filters/requirements-test.txt +++ b/samples/snippets/filters/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/snippets/filters/requirements.txt b/samples/snippets/filters/requirements.txt index d8043c655..7e0c6dad2 100644 --- a/samples/snippets/filters/requirements.txt +++ b/samples/snippets/filters/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 snapshottest==0.6.0 \ No newline at end of file diff --git a/samples/snippets/reads/requirements-test.txt b/samples/snippets/reads/requirements-test.txt index 824a8a7a0..4f6bf643f 100644 --- a/samples/snippets/reads/requirements-test.txt +++ b/samples/snippets/reads/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/snippets/reads/requirements.txt b/samples/snippets/reads/requirements.txt index d8043c655..7e0c6dad2 100644 --- a/samples/snippets/reads/requirements.txt +++ b/samples/snippets/reads/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 snapshottest==0.6.0 \ No newline at end of file diff --git a/samples/snippets/writes/requirements-test.txt b/samples/snippets/writes/requirements-test.txt index c265ab709..678dbc8ef 100644 --- a/samples/snippets/writes/requirements-test.txt +++ b/samples/snippets/writes/requirements-test.txt @@ -1,2 +1,2 @@ backoff==1.11.1 -pytest==7.1.0 +pytest==7.1.1 diff --git a/samples/snippets/writes/requirements.txt b/samples/snippets/writes/requirements.txt index 9b025a34e..094fd4638 100644 --- a/samples/snippets/writes/requirements.txt +++ b/samples/snippets/writes/requirements.txt @@ -1 +1 @@ -google-cloud-bigtable==2.7.0 \ No newline at end of file +google-cloud-bigtable==2.7.1 \ No newline at end of file diff --git a/samples/tableadmin/requirements-test.txt b/samples/tableadmin/requirements-test.txt index 4fbdd9106..e3434bfa8 100644 --- a/samples/tableadmin/requirements-test.txt +++ b/samples/tableadmin/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.1.0 +pytest==7.1.1 google-cloud-testutils==1.3.1 diff --git a/samples/tableadmin/requirements.txt b/samples/tableadmin/requirements.txt index 39c4d4ea3..01e026f93 100644 --- a/samples/tableadmin/requirements.txt +++ b/samples/tableadmin/requirements.txt @@ -1 +1 @@ -google-cloud-bigtable==2.7.0 +google-cloud-bigtable==2.7.1 From 84cfb0abdfabd8aa2f292fc0bb7e6deab50f87f1 Mon Sep 17 00:00:00 2001 From: John Fremlin Date: Wed, 23 Mar 2022 19:02:10 -0400 Subject: [PATCH 02/11] docs: explain mutate vs mutate_rows (#543) Thanks to Bora for spotting this! --- google/cloud/bigtable/batcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google/cloud/bigtable/batcher.py b/google/cloud/bigtable/batcher.py index 950a198ef..3c23f4436 100644 --- a/google/cloud/bigtable/batcher.py +++ b/google/cloud/bigtable/batcher.py @@ -33,7 +33,7 @@ class MutationsBatcher(object): request. This class is not suited for usage in systems where each mutation - needs to guaranteed to be sent, since calling mutate may only result in an + must be guaranteed to be sent, since calling mutate may only result in an in-memory change. In a case of a system crash, any DirectRows remaining in memory will not necessarily be sent to the service, even after the completion of the mutate() method. @@ -105,7 +105,7 @@ def mutate(self, row): self.flush() def mutate_rows(self, rows): - """Add a row to the batch. If the current batch meets one of the size + """Add multiple rows to the batch. If the current batch meets one of the size limits, the batch is sent synchronously. For example: From 483f139f5065d55378bd850c33e89db460119fc1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 24 Mar 2022 07:12:44 -0400 Subject: [PATCH 03/11] feat: Add ListHotTablets API method and protobufs (#542) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add ListHotTablets API method and protobufs PiperOrigin-RevId: 436758628 Source-Link: https://github.com/googleapis/googleapis/commit/92ab86a79f4a9e774dfd6ee533d9376af084b376 Source-Link: https://github.com/googleapis/googleapis-gen/commit/931ef114d5f845abf117bf8e0a29836ca300b694 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMxZWYxMTRkNWY4NDVhYmYxMTdiZjhlMGEyOTgzNmNhMzAwYjY5NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- google/cloud/bigtable_admin_v2/__init__.py | 6 + .../bigtable_admin_v2/gapic_metadata.json | 10 + .../bigtable_instance_admin/async_client.py | 98 ++++ .../bigtable_instance_admin/client.py | 116 +++++ .../bigtable_instance_admin/pagers.py | 132 +++++ .../transports/base.py | 27 ++ .../transports/grpc.py | 30 ++ .../transports/grpc_asyncio.py | 30 ++ .../cloud/bigtable_admin_v2/types/__init__.py | 6 + .../types/bigtable_instance_admin.py | 76 +++ .../cloud/bigtable_admin_v2/types/instance.py | 43 ++ scripts/fixup_bigtable_admin_v2_keywords.py | 1 + .../test_bigtable_instance_admin.py | 451 +++++++++++++++++- 13 files changed, 1011 insertions(+), 15 deletions(-) diff --git a/google/cloud/bigtable_admin_v2/__init__.py b/google/cloud/bigtable_admin_v2/__init__.py index 1b46d6215..3713dc1e8 100644 --- a/google/cloud/bigtable_admin_v2/__init__.py +++ b/google/cloud/bigtable_admin_v2/__init__.py @@ -34,6 +34,8 @@ from .types.bigtable_instance_admin import ListAppProfilesResponse from .types.bigtable_instance_admin import ListClustersRequest from .types.bigtable_instance_admin import ListClustersResponse +from .types.bigtable_instance_admin import ListHotTabletsRequest +from .types.bigtable_instance_admin import ListHotTabletsResponse from .types.bigtable_instance_admin import ListInstancesRequest from .types.bigtable_instance_admin import ListInstancesResponse from .types.bigtable_instance_admin import PartialUpdateClusterMetadata @@ -78,6 +80,7 @@ from .types.instance import AutoscalingLimits from .types.instance import AutoscalingTargets from .types.instance import Cluster +from .types.instance import HotTablet from .types.instance import Instance from .types.table import Backup from .types.table import BackupInfo @@ -130,6 +133,7 @@ "GetInstanceRequest", "GetSnapshotRequest", "GetTableRequest", + "HotTablet", "Instance", "ListAppProfilesRequest", "ListAppProfilesResponse", @@ -137,6 +141,8 @@ "ListBackupsResponse", "ListClustersRequest", "ListClustersResponse", + "ListHotTabletsRequest", + "ListHotTabletsResponse", "ListInstancesRequest", "ListInstancesResponse", "ListSnapshotsRequest", diff --git a/google/cloud/bigtable_admin_v2/gapic_metadata.json b/google/cloud/bigtable_admin_v2/gapic_metadata.json index c360e7712..a843c42e0 100644 --- a/google/cloud/bigtable_admin_v2/gapic_metadata.json +++ b/google/cloud/bigtable_admin_v2/gapic_metadata.json @@ -70,6 +70,11 @@ "list_clusters" ] }, + "ListHotTablets": { + "methods": [ + "list_hot_tablets" + ] + }, "ListInstances": { "methods": [ "list_instances" @@ -175,6 +180,11 @@ "list_clusters" ] }, + "ListHotTablets": { + "methods": [ + "list_hot_tablets" + ] + }, "ListInstances": { "methods": [ "list_instances" diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py index 18b6541dc..af8e62857 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py @@ -69,8 +69,14 @@ class BigtableInstanceAdminAsyncClient: parse_crypto_key_path = staticmethod( BigtableInstanceAdminClient.parse_crypto_key_path ) + hot_tablet_path = staticmethod(BigtableInstanceAdminClient.hot_tablet_path) + parse_hot_tablet_path = staticmethod( + BigtableInstanceAdminClient.parse_hot_tablet_path + ) instance_path = staticmethod(BigtableInstanceAdminClient.instance_path) parse_instance_path = staticmethod(BigtableInstanceAdminClient.parse_instance_path) + table_path = staticmethod(BigtableInstanceAdminClient.table_path) + parse_table_path = staticmethod(BigtableInstanceAdminClient.parse_table_path) common_billing_account_path = staticmethod( BigtableInstanceAdminClient.common_billing_account_path ) @@ -2109,6 +2115,98 @@ async def test_iam_permissions( # Done; return the response. return response + async def list_hot_tablets( + self, + request: Union[bigtable_instance_admin.ListHotTabletsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListHotTabletsAsyncPager: + r"""Lists hot tablets in a cluster, within the time range + provided. Hot tablets are ordered based on CPU usage. + + Args: + request (Union[google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest, dict]): + The request object. Request message for + BigtableInstanceAdmin.ListHotTablets. + parent (:class:`str`): + Required. The cluster name to list hot tablets. Value is + in the following form: + ``projects/{project}/instances/{instance}/clusters/{cluster}``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListHotTabletsAsyncPager: + Response message for + BigtableInstanceAdmin.ListHotTablets. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = bigtable_instance_admin.ListHotTabletsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_hot_tablets, + default_retry=retries.Retry( + initial=1.0, + maximum=60.0, + multiplier=2, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListHotTabletsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + async def __aenter__(self): return self diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py index a13a4b794..f149ccf9d 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py @@ -227,6 +227,24 @@ def parse_crypto_key_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def hot_tablet_path( + project: str, instance: str, cluster: str, hot_tablet: str, + ) -> str: + """Returns a fully-qualified hot_tablet string.""" + return "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}".format( + project=project, instance=instance, cluster=cluster, hot_tablet=hot_tablet, + ) + + @staticmethod + def parse_hot_tablet_path(path: str) -> Dict[str, str]: + """Parses a hot_tablet path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/instances/(?P.+?)/clusters/(?P.+?)/hotTablets/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def instance_path(project: str, instance: str,) -> str: """Returns a fully-qualified instance string.""" @@ -240,6 +258,22 @@ def parse_instance_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/instances/(?P.+?)$", path) return m.groupdict() if m else {} + @staticmethod + def table_path(project: str, instance: str, table: str,) -> str: + """Returns a fully-qualified table string.""" + return "projects/{project}/instances/{instance}/tables/{table}".format( + project=project, instance=instance, table=table, + ) + + @staticmethod + def parse_table_path(path: str) -> Dict[str, str]: + """Parses a table path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/instances/(?P.+?)/tables/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def common_billing_account_path(billing_account: str,) -> str: """Returns a fully-qualified billing_account string.""" @@ -2215,6 +2249,88 @@ def test_iam_permissions( # Done; return the response. return response + def list_hot_tablets( + self, + request: Union[bigtable_instance_admin.ListHotTabletsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListHotTabletsPager: + r"""Lists hot tablets in a cluster, within the time range + provided. Hot tablets are ordered based on CPU usage. + + Args: + request (Union[google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest, dict]): + The request object. Request message for + BigtableInstanceAdmin.ListHotTablets. + parent (str): + Required. The cluster name to list hot tablets. Value is + in the following form: + ``projects/{project}/instances/{instance}/clusters/{cluster}``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListHotTabletsPager: + Response message for + BigtableInstanceAdmin.ListHotTablets. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a bigtable_instance_admin.ListHotTabletsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, bigtable_instance_admin.ListHotTabletsRequest): + request = bigtable_instance_admin.ListHotTabletsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_hot_tablets] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListHotTabletsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + def __enter__(self): return self diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py index 77bde77e4..bfcbbf23d 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py @@ -158,3 +158,135 @@ async def async_generator(): def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListHotTabletsPager: + """A pager for iterating through ``list_hot_tablets`` requests. + + This class thinly wraps an initial + :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``hot_tablets`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListHotTablets`` requests and continue to iterate + through the ``hot_tablets`` field on the + corresponding responses. + + All the usual :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., bigtable_instance_admin.ListHotTabletsResponse], + request: bigtable_instance_admin.ListHotTabletsRequest, + response: bigtable_instance_admin.ListHotTabletsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest): + The initial request object. + response (google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = bigtable_instance_admin.ListHotTabletsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[bigtable_instance_admin.ListHotTabletsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[instance.HotTablet]: + for page in self.pages: + yield from page.hot_tablets + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListHotTabletsAsyncPager: + """A pager for iterating through ``list_hot_tablets`` requests. + + This class thinly wraps an initial + :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``hot_tablets`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListHotTablets`` requests and continue to iterate + through the ``hot_tablets`` field on the + corresponding responses. + + All the usual :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., Awaitable[bigtable_instance_admin.ListHotTabletsResponse] + ], + request: bigtable_instance_admin.ListHotTabletsRequest, + response: bigtable_instance_admin.ListHotTabletsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest): + The initial request object. + response (google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = bigtable_instance_admin.ListHotTabletsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterator[bigtable_instance_admin.ListHotTabletsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterator[instance.HotTablet]: + async def async_generator(): + async for page in self.pages: + for response in page.hot_tablets: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py index b32cba715..2330879c7 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py @@ -350,6 +350,21 @@ def _prep_wrapped_messages(self, client_info): default_timeout=60.0, client_info=client_info, ), + self.list_hot_tablets: gapic_v1.method.wrap_method( + self.list_hot_tablets, + default_retry=retries.Retry( + initial=1.0, + maximum=60.0, + multiplier=2, + predicate=retries.if_exception_type( + core_exceptions.DeadlineExceeded, + core_exceptions.ServiceUnavailable, + ), + deadline=60.0, + ), + default_timeout=60.0, + client_info=client_info, + ), } def close(self): @@ -557,5 +572,17 @@ def test_iam_permissions( ]: raise NotImplementedError() + @property + def list_hot_tablets( + self, + ) -> Callable[ + [bigtable_instance_admin.ListHotTabletsRequest], + Union[ + bigtable_instance_admin.ListHotTabletsResponse, + Awaitable[bigtable_instance_admin.ListHotTabletsResponse], + ], + ]: + raise NotImplementedError() + __all__ = ("BigtableInstanceAdminTransport",) diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py index 8a0169ad0..e33cc473f 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py @@ -830,6 +830,36 @@ def test_iam_permissions( ) return self._stubs["test_iam_permissions"] + @property + def list_hot_tablets( + self, + ) -> Callable[ + [bigtable_instance_admin.ListHotTabletsRequest], + bigtable_instance_admin.ListHotTabletsResponse, + ]: + r"""Return a callable for the list hot tablets method over gRPC. + + Lists hot tablets in a cluster, within the time range + provided. Hot tablets are ordered based on CPU usage. + + Returns: + Callable[[~.ListHotTabletsRequest], + ~.ListHotTabletsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_hot_tablets" not in self._stubs: + self._stubs["list_hot_tablets"] = self.grpc_channel.unary_unary( + "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListHotTablets", + request_serializer=bigtable_instance_admin.ListHotTabletsRequest.serialize, + response_deserializer=bigtable_instance_admin.ListHotTabletsResponse.deserialize, + ) + return self._stubs["list_hot_tablets"] + def close(self): self.grpc_channel.close() diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py index c1be2101a..bf1b8a38e 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py @@ -856,6 +856,36 @@ def test_iam_permissions( ) return self._stubs["test_iam_permissions"] + @property + def list_hot_tablets( + self, + ) -> Callable[ + [bigtable_instance_admin.ListHotTabletsRequest], + Awaitable[bigtable_instance_admin.ListHotTabletsResponse], + ]: + r"""Return a callable for the list hot tablets method over gRPC. + + Lists hot tablets in a cluster, within the time range + provided. Hot tablets are ordered based on CPU usage. + + Returns: + Callable[[~.ListHotTabletsRequest], + Awaitable[~.ListHotTabletsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_hot_tablets" not in self._stubs: + self._stubs["list_hot_tablets"] = self.grpc_channel.unary_unary( + "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListHotTablets", + request_serializer=bigtable_instance_admin.ListHotTabletsRequest.serialize, + response_deserializer=bigtable_instance_admin.ListHotTabletsResponse.deserialize, + ) + return self._stubs["list_hot_tablets"] + def close(self): return self.grpc_channel.close() diff --git a/google/cloud/bigtable_admin_v2/types/__init__.py b/google/cloud/bigtable_admin_v2/types/__init__.py index a81a4b7ed..f35f0f4ab 100644 --- a/google/cloud/bigtable_admin_v2/types/__init__.py +++ b/google/cloud/bigtable_admin_v2/types/__init__.py @@ -29,6 +29,8 @@ ListAppProfilesResponse, ListClustersRequest, ListClustersResponse, + ListHotTabletsRequest, + ListHotTabletsResponse, ListInstancesRequest, ListInstancesResponse, PartialUpdateClusterMetadata, @@ -79,6 +81,7 @@ AutoscalingLimits, AutoscalingTargets, Cluster, + HotTablet, Instance, ) from .table import ( @@ -109,6 +112,8 @@ "ListAppProfilesResponse", "ListClustersRequest", "ListClustersResponse", + "ListHotTabletsRequest", + "ListHotTabletsResponse", "ListInstancesRequest", "ListInstancesResponse", "PartialUpdateClusterMetadata", @@ -153,6 +158,7 @@ "AutoscalingLimits", "AutoscalingTargets", "Cluster", + "HotTablet", "Instance", "Backup", "BackupInfo", diff --git a/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py b/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py index 131c28177..b4d7c55aa 100644 --- a/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py +++ b/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py @@ -47,6 +47,8 @@ "UpdateAppProfileRequest", "DeleteAppProfileRequest", "UpdateAppProfileMetadata", + "ListHotTabletsRequest", + "ListHotTabletsResponse", }, ) @@ -553,4 +555,78 @@ class UpdateAppProfileMetadata(proto.Message): """ +class ListHotTabletsRequest(proto.Message): + r"""Request message for BigtableInstanceAdmin.ListHotTablets. + + Attributes: + parent (str): + Required. The cluster name to list hot tablets. Value is in + the following form: + ``projects/{project}/instances/{instance}/clusters/{cluster}``. + start_time (google.protobuf.timestamp_pb2.Timestamp): + The start time to list hot tablets. The hot + tablets in the response will have start times + between the requested start time and end time. + Start time defaults to Now if it is unset, and + end time defaults to Now - 24 hours if it is + unset. The start time should be less than the + end time, and the maximum allowed time range + between start time and end time is 48 hours. + Start time and end time should have values + between Now and Now - 14 days. + end_time (google.protobuf.timestamp_pb2.Timestamp): + The end time to list hot tablets. + page_size (int): + Maximum number of results per page. + + A page_size that is empty or zero lets the server choose the + number of items to return. A page_size which is strictly + positive will return at most that many items. A negative + page_size will cause an error. + + Following the first request, subsequent paginated calls do + not need a page_size field. If a page_size is set in + subsequent calls, it must match the page_size given in the + first request. + page_token (str): + The value of ``next_page_token`` returned by a previous + call. + """ + + parent = proto.Field(proto.STRING, number=1,) + start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + page_size = proto.Field(proto.INT32, number=4,) + page_token = proto.Field(proto.STRING, number=5,) + + +class ListHotTabletsResponse(proto.Message): + r"""Response message for BigtableInstanceAdmin.ListHotTablets. + + Attributes: + hot_tablets (Sequence[google.cloud.bigtable_admin_v2.types.HotTablet]): + List of hot tablets in the tables of the + requested cluster that fall within the requested + time range. Hot tablets are ordered by node cpu + usage percent. If there are multiple hot tablets + that correspond to the same tablet within a + 15-minute interval, only the hot tablet with the + highest node cpu usage will be included in the + response. + next_page_token (str): + Set if not all hot tablets could be returned in a single + response. Pass this value to ``page_token`` in another + request to get the next page of results. + """ + + @property + def raw_page(self): + return self + + hot_tablets = proto.RepeatedField( + proto.MESSAGE, number=1, message=gba_instance.HotTablet, + ) + next_page_token = proto.Field(proto.STRING, number=2,) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/bigtable_admin_v2/types/instance.py b/google/cloud/bigtable_admin_v2/types/instance.py index 22c73dfdd..961cba434 100644 --- a/google/cloud/bigtable_admin_v2/types/instance.py +++ b/google/cloud/bigtable_admin_v2/types/instance.py @@ -27,6 +27,7 @@ "AutoscalingLimits", "Cluster", "AppProfile", + "HotTablet", }, ) @@ -323,4 +324,46 @@ class SingleClusterRouting(proto.Message): ) +class HotTablet(proto.Message): + r"""A tablet is a defined by a start and end key and is explained + in https://cloud.google.com/bigtable/docs/overview#architecture + and + https://cloud.google.com/bigtable/docs/performance#optimization. + A Hot tablet is a tablet that exhibits high average cpu usage + during the time interval from start time to end time. + + Attributes: + name (str): + The unique name of the hot tablet. Values are of the form + ``projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/[a-zA-Z0-9_-]*``. + table_name (str): + Name of the table that contains the tablet. Values are of + the form + ``projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*``. + start_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The start time of the hot + tablet. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The end time of the hot tablet. + start_key (str): + Tablet Start Key (inclusive). + end_key (str): + Tablet End Key (inclusive). + node_cpu_usage_percent (float): + Output only. The average CPU usage spent by a node on this + tablet over the start_time to end_time time range. The + percentage is the amount of CPU used by the node to serve + the tablet, from 0% (tablet was not interacted with) to 100% + (the node spent all cycles serving the hot tablet). + """ + + name = proto.Field(proto.STRING, number=1,) + table_name = proto.Field(proto.STRING, number=2,) + start_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + end_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + start_key = proto.Field(proto.STRING, number=5,) + end_key = proto.Field(proto.STRING, number=6,) + node_cpu_usage_percent = proto.Field(proto.FLOAT, number=7,) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/scripts/fixup_bigtable_admin_v2_keywords.py b/scripts/fixup_bigtable_admin_v2_keywords.py index 6d5bc00f4..2079dd99b 100644 --- a/scripts/fixup_bigtable_admin_v2_keywords.py +++ b/scripts/fixup_bigtable_admin_v2_keywords.py @@ -64,6 +64,7 @@ class bigtable_adminCallTransformer(cst.CSTTransformer): 'list_app_profiles': ('parent', 'page_size', 'page_token', ), 'list_backups': ('parent', 'filter', 'order_by', 'page_size', 'page_token', ), 'list_clusters': ('parent', 'page_token', ), + 'list_hot_tablets': ('parent', 'start_time', 'end_time', 'page_size', 'page_token', ), 'list_instances': ('parent', 'page_token', ), 'list_snapshots': ('parent', 'page_size', 'page_token', ), 'list_tables': ('parent', 'view', 'page_size', 'page_token', ), diff --git a/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py b/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py index 76df253aa..226f5acf7 100644 --- a/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py +++ b/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py @@ -5242,6 +5242,374 @@ async def test_test_iam_permissions_flattened_error_async(): ) +@pytest.mark.parametrize( + "request_type", [bigtable_instance_admin.ListHotTabletsRequest, dict,] +) +def test_list_hot_tablets(request_type, transport: str = "grpc"): + client = BigtableInstanceAdminClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = bigtable_instance_admin.ListHotTabletsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_hot_tablets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == bigtable_instance_admin.ListHotTabletsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListHotTabletsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_hot_tablets_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = BigtableInstanceAdminClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + client.list_hot_tablets() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == bigtable_instance_admin.ListHotTabletsRequest() + + +@pytest.mark.asyncio +async def test_list_hot_tablets_async( + transport: str = "grpc_asyncio", + request_type=bigtable_instance_admin.ListHotTabletsRequest, +): + client = BigtableInstanceAdminAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigtable_instance_admin.ListHotTabletsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_hot_tablets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == bigtable_instance_admin.ListHotTabletsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListHotTabletsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_hot_tablets_async_from_dict(): + await test_list_hot_tablets_async(request_type=dict) + + +def test_list_hot_tablets_field_headers(): + client = BigtableInstanceAdminClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = bigtable_instance_admin.ListHotTabletsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + call.return_value = bigtable_instance_admin.ListHotTabletsResponse() + client.list_hot_tablets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_hot_tablets_field_headers_async(): + client = BigtableInstanceAdminAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = bigtable_instance_admin.ListHotTabletsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigtable_instance_admin.ListHotTabletsResponse() + ) + await client.list_hot_tablets(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_hot_tablets_flattened(): + client = BigtableInstanceAdminClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = bigtable_instance_admin.ListHotTabletsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_hot_tablets(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_hot_tablets_flattened_error(): + client = BigtableInstanceAdminClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_hot_tablets( + bigtable_instance_admin.ListHotTabletsRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_hot_tablets_flattened_async(): + client = BigtableInstanceAdminAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = bigtable_instance_admin.ListHotTabletsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + bigtable_instance_admin.ListHotTabletsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_hot_tablets(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_hot_tablets_flattened_error_async(): + client = BigtableInstanceAdminAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_hot_tablets( + bigtable_instance_admin.ListHotTabletsRequest(), parent="parent_value", + ) + + +def test_list_hot_tablets_pager(transport_name: str = "grpc"): + client = BigtableInstanceAdminClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + instance.HotTablet(), + ], + next_page_token="abc", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[], next_page_token="def", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_hot_tablets(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, instance.HotTablet) for i in results) + + +def test_list_hot_tablets_pages(transport_name: str = "grpc"): + client = BigtableInstanceAdminClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_hot_tablets), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + instance.HotTablet(), + ], + next_page_token="abc", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[], next_page_token="def", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + ), + RuntimeError, + ) + pages = list(client.list_hot_tablets(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_hot_tablets_async_pager(): + client = BigtableInstanceAdminAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_hot_tablets), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + instance.HotTablet(), + ], + next_page_token="abc", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[], next_page_token="def", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + ), + RuntimeError, + ) + async_pager = await client.list_hot_tablets(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, instance.HotTablet) for i in responses) + + +@pytest.mark.asyncio +async def test_list_hot_tablets_async_pages(): + client = BigtableInstanceAdminAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_hot_tablets), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + instance.HotTablet(), + ], + next_page_token="abc", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[], next_page_token="def", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + ), + bigtable_instance_admin.ListHotTabletsResponse( + hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_hot_tablets(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.BigtableInstanceAdminGrpcTransport( @@ -5380,6 +5748,7 @@ def test_bigtable_instance_admin_base_transport(): "get_iam_policy", "set_iam_policy", "test_iam_permissions", + "list_hot_tablets", ) for method in methods: with pytest.raises(NotImplementedError): @@ -5821,9 +6190,37 @@ def test_parse_crypto_key_path(): assert expected == actual -def test_instance_path(): +def test_hot_tablet_path(): project = "winkle" instance = "nautilus" + cluster = "scallop" + hot_tablet = "abalone" + expected = "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}".format( + project=project, instance=instance, cluster=cluster, hot_tablet=hot_tablet, + ) + actual = BigtableInstanceAdminClient.hot_tablet_path( + project, instance, cluster, hot_tablet + ) + assert expected == actual + + +def test_parse_hot_tablet_path(): + expected = { + "project": "squid", + "instance": "clam", + "cluster": "whelk", + "hot_tablet": "octopus", + } + path = BigtableInstanceAdminClient.hot_tablet_path(**expected) + + # Check that the path construction is reversible. + actual = BigtableInstanceAdminClient.parse_hot_tablet_path(path) + assert expected == actual + + +def test_instance_path(): + project = "oyster" + instance = "nudibranch" expected = "projects/{project}/instances/{instance}".format( project=project, instance=instance, ) @@ -5833,8 +6230,8 @@ def test_instance_path(): def test_parse_instance_path(): expected = { - "project": "scallop", - "instance": "abalone", + "project": "cuttlefish", + "instance": "mussel", } path = BigtableInstanceAdminClient.instance_path(**expected) @@ -5843,8 +6240,32 @@ def test_parse_instance_path(): assert expected == actual +def test_table_path(): + project = "winkle" + instance = "nautilus" + table = "scallop" + expected = "projects/{project}/instances/{instance}/tables/{table}".format( + project=project, instance=instance, table=table, + ) + actual = BigtableInstanceAdminClient.table_path(project, instance, table) + assert expected == actual + + +def test_parse_table_path(): + expected = { + "project": "abalone", + "instance": "squid", + "table": "clam", + } + path = BigtableInstanceAdminClient.table_path(**expected) + + # Check that the path construction is reversible. + actual = BigtableInstanceAdminClient.parse_table_path(path) + assert expected == actual + + def test_common_billing_account_path(): - billing_account = "squid" + billing_account = "whelk" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -5854,7 +6275,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "clam", + "billing_account": "octopus", } path = BigtableInstanceAdminClient.common_billing_account_path(**expected) @@ -5864,7 +6285,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "whelk" + folder = "oyster" expected = "folders/{folder}".format(folder=folder,) actual = BigtableInstanceAdminClient.common_folder_path(folder) assert expected == actual @@ -5872,7 +6293,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "octopus", + "folder": "nudibranch", } path = BigtableInstanceAdminClient.common_folder_path(**expected) @@ -5882,7 +6303,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "oyster" + organization = "cuttlefish" expected = "organizations/{organization}".format(organization=organization,) actual = BigtableInstanceAdminClient.common_organization_path(organization) assert expected == actual @@ -5890,7 +6311,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "nudibranch", + "organization": "mussel", } path = BigtableInstanceAdminClient.common_organization_path(**expected) @@ -5900,7 +6321,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "cuttlefish" + project = "winkle" expected = "projects/{project}".format(project=project,) actual = BigtableInstanceAdminClient.common_project_path(project) assert expected == actual @@ -5908,7 +6329,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "mussel", + "project": "nautilus", } path = BigtableInstanceAdminClient.common_project_path(**expected) @@ -5918,8 +6339,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "winkle" - location = "nautilus" + project = "scallop" + location = "abalone" expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -5929,8 +6350,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "scallop", - "location": "abalone", + "project": "squid", + "location": "clam", } path = BigtableInstanceAdminClient.common_location_path(**expected) From 08d0857c4c33881adcff58d9d74fc6ec733de8eb Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:58:15 +0000 Subject: [PATCH 04/11] chore(python): use black==22.3.0 (#545) Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe --- .github/.OwlBot.lock.yaml | 2 +- docs/conf.py | 5 +- docs/snippets.py | 2 +- docs/snippets_table.py | 2 +- google/cloud/bigtable/backup.py | 6 +- google/cloud/bigtable/client.py | 10 +- google/cloud/bigtable/cluster.py | 2 +- google/cloud/bigtable/row_data.py | 10 +- .../bigtable_instance_admin/async_client.py | 162 ++- .../bigtable_instance_admin/client.py | 247 +++- .../transports/base.py | 34 +- .../transports/grpc.py | 3 +- .../bigtable_table_admin/async_client.py | 172 ++- .../services/bigtable_table_admin/client.py | 252 +++- .../bigtable_table_admin/transports/base.py | 46 +- .../bigtable_table_admin/transports/grpc.py | 3 +- .../types/bigtable_instance_admin.py | 314 ++++- .../types/bigtable_table_admin.py | 400 ++++-- .../cloud/bigtable_admin_v2/types/common.py | 23 +- .../cloud/bigtable_admin_v2/types/instance.py | 176 ++- google/cloud/bigtable_admin_v2/types/table.py | 210 ++- .../services/bigtable/async_client.py | 53 +- .../bigtable_v2/services/bigtable/client.py | 112 +- .../services/bigtable/transports/base.py | 26 +- .../services/bigtable/transports/grpc.py | 3 +- google/cloud/bigtable_v2/types/bigtable.py | 240 +++- google/cloud/bigtable_v2/types/data.py | 378 +++++- noxfile.py | 9 +- samples/beam/noxfile.py | 2 +- samples/hello/noxfile.py | 2 +- samples/hello_happybase/noxfile.py | 2 +- samples/instanceadmin/noxfile.py | 2 +- samples/metricscaler/noxfile.py | 2 +- samples/quickstart/noxfile.py | 2 +- samples/quickstart_happybase/noxfile.py | 2 +- samples/snippets/filters/noxfile.py | 2 +- samples/snippets/reads/noxfile.py | 2 +- samples/snippets/writes/noxfile.py | 2 +- samples/tableadmin/noxfile.py | 2 +- tests/system/_helpers.py | 4 +- tests/system/conftest.py | 8 +- tests/system/test_instance_admin.py | 17 +- tests/system/test_table_admin.py | 11 +- .../test_bigtable_instance_admin.py | 979 ++++++++++---- .../test_bigtable_table_admin.py | 1145 +++++++++++++---- tests/unit/gapic/bigtable_v2/test_bigtable.py | 375 ++++-- tests/unit/test_app_profile.py | 18 +- tests/unit/test_backup.py | 36 +- tests/unit/test_client.py | 38 +- tests/unit/test_cluster.py | 6 +- tests/unit/test_column_family.py | 4 +- tests/unit/test_instance.py | 27 +- tests/unit/test_policy.py | 10 +- tests/unit/test_row.py | 52 +- tests/unit/test_row_data.py | 42 +- tests/unit/test_row_filters.py | 20 +- tests/unit/test_table.py | 43 +- 57 files changed, 4447 insertions(+), 1312 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7cc..87dd00611 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe diff --git a/docs/conf.py b/docs/conf.py index 26814b0aa..34f3a4d08 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/docs/snippets.py b/docs/snippets.py index ee5490afe..1d93fdf12 100644 --- a/docs/snippets.py +++ b/docs/snippets.py @@ -55,7 +55,7 @@ PRODUCTION = enums.Instance.Type.PRODUCTION SERVER_NODES = 3 STORAGE_TYPE = enums.StorageType.SSD -LABEL_KEY = u"python-snippet" +LABEL_KEY = "python-snippet" LABEL_STAMP = ( datetime.datetime.utcnow() .replace(microsecond=0, tzinfo=UTC) diff --git a/docs/snippets_table.py b/docs/snippets_table.py index 4c3304fd0..f27260425 100644 --- a/docs/snippets_table.py +++ b/docs/snippets_table.py @@ -52,7 +52,7 @@ PRODUCTION = enums.Instance.Type.PRODUCTION SERVER_NODES = 3 STORAGE_TYPE = enums.StorageType.SSD -LABEL_KEY = u"python-snippet" +LABEL_KEY = "python-snippet" LABEL_STAMP = ( datetime.datetime.utcnow() .replace(microsecond=0, tzinfo=UTC) diff --git a/google/cloud/bigtable/backup.py b/google/cloud/bigtable/backup.py index c2b5ec9ee..6986d730a 100644 --- a/google/cloud/bigtable/backup.py +++ b/google/cloud/bigtable/backup.py @@ -382,7 +382,8 @@ def update_expire_time(self, new_expire_time): :param new_expire_time: the new expiration time timestamp """ backup_update = table.Backup( - name=self.name, expire_time=_datetime_to_pb_timestamp(new_expire_time), + name=self.name, + expire_time=_datetime_to_pb_timestamp(new_expire_time), ) update_mask = field_mask_pb2.FieldMask(paths=["expire_time"]) api = self._instance._client.table_admin_client @@ -426,7 +427,8 @@ def restore(self, table_id, instance_id=None): api = self._instance._client.table_admin_client if instance_id: parent = BigtableTableAdminClient.instance_path( - project=self._instance._client.project, instance=instance_id, + project=self._instance._client.project, + instance=instance_id, ) else: parent = self._instance.name diff --git a/google/cloud/bigtable/client.py b/google/cloud/bigtable/client.py index c50c20b0f..c82a268c6 100644 --- a/google/cloud/bigtable/client.py +++ b/google/cloud/bigtable/client.py @@ -193,7 +193,9 @@ def __init__( self._channel = channel self.SCOPE = self._get_scopes() super(Client, self).__init__( - project=project, credentials=credentials, client_options=client_options, + project=project, + credentials=credentials, + client_options=client_options, ) def _get_scopes(self): @@ -276,7 +278,8 @@ def _create_gapic_client_channel(self, client_class, grpc_transport): if self._emulator_host is not None: channel = self._emulator_channel( - transport=grpc_transport, options=_GRPC_CHANNEL_OPTIONS, + transport=grpc_transport, + options=_GRPC_CHANNEL_OPTIONS, ) else: channel = grpc_transport.create_channel( @@ -327,7 +330,8 @@ def table_data_client(self): """ if self._table_data_client is None: transport = self._create_gapic_client_channel( - bigtable_v2.BigtableClient, BigtableGrpcTransport, + bigtable_v2.BigtableClient, + BigtableGrpcTransport, ) klass = _create_gapic_client( bigtable_v2.BigtableClient, diff --git a/google/cloud/bigtable/cluster.py b/google/cloud/bigtable/cluster.py index 1d0af2c69..11fb5492d 100644 --- a/google/cloud/bigtable/cluster.py +++ b/google/cloud/bigtable/cluster.py @@ -509,7 +509,7 @@ def delete(self): client.instance_admin_client.delete_cluster(request={"name": self.name}) def _to_pb(self): - """ Create cluster proto buff message for API calls """ + """Create cluster proto buff message for API calls""" client = self._instance._client location = client.instance_admin_client.common_location_path( client.project, self.location_id diff --git a/google/cloud/bigtable/row_data.py b/google/cloud/bigtable/row_data.py index 3abb6c68c..0517f82e1 100644 --- a/google/cloud/bigtable/row_data.py +++ b/google/cloud/bigtable/row_data.py @@ -649,7 +649,7 @@ def build_updated_request(self): return resume_request def _filter_rows_keys(self): - """ Helper for :meth:`build_updated_request`""" + """Helper for :meth:`build_updated_request`""" return [ row_key for row_key in self.message.rows.row_keys @@ -657,7 +657,7 @@ def _filter_rows_keys(self): ] def _filter_row_ranges(self): - """ Helper for :meth:`build_updated_request`""" + """Helper for :meth:`build_updated_request`""" new_row_ranges = [] for row_range in self.message.rows.row_ranges: @@ -688,17 +688,17 @@ def _filter_row_ranges(self): return new_row_ranges def _key_already_read(self, key): - """ Helper for :meth:`_filter_row_ranges`""" + """Helper for :meth:`_filter_row_ranges`""" return key <= self.last_scanned_key @staticmethod def _start_key_set(row_range): - """ Helper for :meth:`_filter_row_ranges`""" + """Helper for :meth:`_filter_row_ranges`""" return row_range.start_key_open or row_range.start_key_closed @staticmethod def _end_key_set(row_range): - """ Helper for :meth:`_filter_row_ranges`""" + """Helper for :meth:`_filter_row_ranges`""" return row_range.end_key_open or row_range.end_key_closed diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py index af8e62857..ed5862d39 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py @@ -348,7 +348,12 @@ async def create_instance( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -441,7 +446,12 @@ async def get_instance( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -523,7 +533,12 @@ async def list_instances( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -592,7 +607,12 @@ async def update_instance( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -695,7 +715,12 @@ async def partial_update_instance( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -770,7 +795,10 @@ async def delete_instance( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_cluster( @@ -872,7 +900,12 @@ async def create_cluster( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -964,7 +997,12 @@ async def get_cluster( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1048,7 +1086,12 @@ async def list_clusters( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1117,7 +1160,12 @@ async def update_cluster( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1237,7 +1285,12 @@ async def partial_update_cluster( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1312,7 +1365,10 @@ async def delete_cluster( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_app_profile( @@ -1405,7 +1461,12 @@ async def create_app_profile( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1488,7 +1549,12 @@ async def get_app_profile( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1576,12 +1642,20 @@ async def list_app_profiles( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListAppProfilesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1678,7 +1752,12 @@ async def update_app_profile( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1753,7 +1832,10 @@ async def delete_app_profile( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def get_iam_policy( @@ -1862,7 +1944,9 @@ async def get_iam_policy( if isinstance(request, dict): request = iam_policy_pb2.GetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.GetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.GetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1889,7 +1973,12 @@ async def get_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1999,7 +2088,9 @@ async def set_iam_policy( if isinstance(request, dict): request = iam_policy_pb2.SetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.SetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2016,7 +2107,12 @@ async def set_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2082,7 +2178,8 @@ async def test_iam_permissions( request = iam_policy_pb2.TestIamPermissionsRequest(**request) elif not request: request = iam_policy_pb2.TestIamPermissionsRequest( - resource=resource, permissions=permissions, + resource=resource, + permissions=permissions, ) # Wrap the RPC method; this adds retry and timeout information, @@ -2110,7 +2207,12 @@ async def test_iam_permissions( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2196,12 +2298,20 @@ async def list_hot_tablets( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListHotTabletsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py index f149ccf9d..cc9317f6d 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py @@ -65,7 +65,8 @@ class BigtableInstanceAdminClientMeta(type): _transport_registry["grpc_asyncio"] = BigtableInstanceAdminGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[BigtableInstanceAdminTransport]: """Returns an appropriate transport class. @@ -175,10 +176,18 @@ def transport(self) -> BigtableInstanceAdminTransport: return self._transport @staticmethod - def app_profile_path(project: str, instance: str, app_profile: str,) -> str: + def app_profile_path( + project: str, + instance: str, + app_profile: str, + ) -> str: """Returns a fully-qualified app_profile string.""" - return "projects/{project}/instances/{instance}/appProfiles/{app_profile}".format( - project=project, instance=instance, app_profile=app_profile, + return ( + "projects/{project}/instances/{instance}/appProfiles/{app_profile}".format( + project=project, + instance=instance, + app_profile=app_profile, + ) ) @staticmethod @@ -191,10 +200,16 @@ def parse_app_profile_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def cluster_path(project: str, instance: str, cluster: str,) -> str: + def cluster_path( + project: str, + instance: str, + cluster: str, + ) -> str: """Returns a fully-qualified cluster string.""" return "projects/{project}/instances/{instance}/clusters/{cluster}".format( - project=project, instance=instance, cluster=cluster, + project=project, + instance=instance, + cluster=cluster, ) @staticmethod @@ -208,7 +223,10 @@ def parse_cluster_path(path: str) -> Dict[str, str]: @staticmethod def crypto_key_path( - project: str, location: str, key_ring: str, crypto_key: str, + project: str, + location: str, + key_ring: str, + crypto_key: str, ) -> str: """Returns a fully-qualified crypto_key string.""" return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format( @@ -229,11 +247,17 @@ def parse_crypto_key_path(path: str) -> Dict[str, str]: @staticmethod def hot_tablet_path( - project: str, instance: str, cluster: str, hot_tablet: str, + project: str, + instance: str, + cluster: str, + hot_tablet: str, ) -> str: """Returns a fully-qualified hot_tablet string.""" return "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}".format( - project=project, instance=instance, cluster=cluster, hot_tablet=hot_tablet, + project=project, + instance=instance, + cluster=cluster, + hot_tablet=hot_tablet, ) @staticmethod @@ -246,10 +270,14 @@ def parse_hot_tablet_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def instance_path(project: str, instance: str,) -> str: + def instance_path( + project: str, + instance: str, + ) -> str: """Returns a fully-qualified instance string.""" return "projects/{project}/instances/{instance}".format( - project=project, instance=instance, + project=project, + instance=instance, ) @staticmethod @@ -259,10 +287,16 @@ def parse_instance_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def table_path(project: str, instance: str, table: str,) -> str: + def table_path( + project: str, + instance: str, + table: str, + ) -> str: """Returns a fully-qualified table string.""" return "projects/{project}/instances/{instance}/tables/{table}".format( - project=project, instance=instance, table=table, + project=project, + instance=instance, + table=table, ) @staticmethod @@ -275,7 +309,9 @@ def parse_table_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -288,9 +324,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -299,9 +339,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -310,9 +354,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -321,10 +369,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -611,7 +663,12 @@ def create_instance( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -694,7 +751,12 @@ def get_instance( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -766,7 +828,12 @@ def list_instances( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -826,7 +893,12 @@ def update_instance( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -921,7 +993,12 @@ def partial_update_instance( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -996,7 +1073,10 @@ def delete_instance( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_cluster( @@ -1098,7 +1178,12 @@ def create_cluster( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1180,7 +1265,12 @@ def get_cluster( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1254,7 +1344,12 @@ def list_clusters( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1314,7 +1409,12 @@ def update_cluster( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1424,7 +1524,12 @@ def partial_update_cluster( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1499,7 +1604,10 @@ def delete_cluster( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_app_profile( @@ -1592,7 +1700,12 @@ def create_app_profile( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1665,7 +1778,12 @@ def get_app_profile( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1743,12 +1861,20 @@ def list_app_profiles( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListAppProfilesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1835,7 +1961,12 @@ def update_app_profile( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1910,7 +2041,10 @@ def delete_app_profile( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def get_iam_policy( @@ -2035,7 +2169,12 @@ def get_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2161,7 +2300,12 @@ def set_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2244,7 +2388,12 @@ def test_iam_permissions( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2320,12 +2469,20 @@ def list_hot_tablets( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListHotTabletsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py index 2330879c7..8084f4e21 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py @@ -135,7 +135,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_instance: gapic_v1.method.wrap_method( - self.create_instance, default_timeout=300.0, client_info=client_info, + self.create_instance, + default_timeout=300.0, + client_info=client_info, ), self.get_instance: gapic_v1.method.wrap_method( self.get_instance, @@ -198,10 +200,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.delete_instance: gapic_v1.method.wrap_method( - self.delete_instance, default_timeout=60.0, client_info=client_info, + self.delete_instance, + default_timeout=60.0, + client_info=client_info, ), self.create_cluster: gapic_v1.method.wrap_method( - self.create_cluster, default_timeout=60.0, client_info=client_info, + self.create_cluster, + default_timeout=60.0, + client_info=client_info, ), self.get_cluster: gapic_v1.method.wrap_method( self.get_cluster, @@ -264,10 +270,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.delete_cluster: gapic_v1.method.wrap_method( - self.delete_cluster, default_timeout=60.0, client_info=client_info, + self.delete_cluster, + default_timeout=60.0, + client_info=client_info, ), self.create_app_profile: gapic_v1.method.wrap_method( - self.create_app_profile, default_timeout=60.0, client_info=client_info, + self.create_app_profile, + default_timeout=60.0, + client_info=client_info, ), self.get_app_profile: gapic_v1.method.wrap_method( self.get_app_profile, @@ -315,7 +325,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.delete_app_profile: gapic_v1.method.wrap_method( - self.delete_app_profile, default_timeout=60.0, client_info=client_info, + self.delete_app_profile, + default_timeout=60.0, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( self.get_iam_policy, @@ -333,7 +345,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=60.0, client_info=client_info, + self.set_iam_policy, + default_timeout=60.0, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -370,9 +384,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py index e33cc473f..005fa38ba 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py @@ -234,8 +234,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py index bef292dc8..47f475443 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py @@ -321,7 +321,12 @@ async def create_table( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -435,7 +440,12 @@ async def create_table_from_snapshot( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -528,12 +538,20 @@ async def list_tables( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTablesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -618,7 +636,12 @@ async def get_table( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -686,7 +709,10 @@ async def delete_table( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def modify_column_families( @@ -779,7 +805,12 @@ async def modify_column_families( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -826,7 +857,10 @@ async def drop_row_range( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def generate_consistency_token( @@ -912,7 +946,12 @@ async def generate_consistency_token( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1007,7 +1046,12 @@ async def check_consistency( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1135,7 +1179,12 @@ async def snapshot_table( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1248,7 +1297,12 @@ async def get_snapshot( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1356,12 +1410,20 @@ async def list_snapshots( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListSnapshotsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1441,7 +1503,10 @@ async def delete_snapshot( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_backup( @@ -1546,7 +1611,12 @@ async def create_backup( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1634,7 +1704,12 @@ async def get_backup( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1724,7 +1799,12 @@ async def update_backup( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1791,7 +1871,10 @@ async def delete_backup( # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_backups( @@ -1878,12 +1961,20 @@ async def list_backups( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListBackupsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1944,7 +2035,12 @@ async def restore_table( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2063,7 +2159,9 @@ async def get_iam_policy( if isinstance(request, dict): request = iam_policy_pb2.GetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.GetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.GetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2090,7 +2188,12 @@ async def get_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2200,7 +2303,9 @@ async def set_iam_policy( if isinstance(request, dict): request = iam_policy_pb2.SetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.SetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -2217,7 +2322,12 @@ async def set_iam_policy( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2283,7 +2393,8 @@ async def test_iam_permissions( request = iam_policy_pb2.TestIamPermissionsRequest(**request) elif not request: request = iam_policy_pb2.TestIamPermissionsRequest( - resource=resource, permissions=permissions, + resource=resource, + permissions=permissions, ) # Wrap the RPC method; this adds retry and timeout information, @@ -2311,7 +2422,12 @@ async def test_iam_permissions( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py index 6ba7ca063..4d4d82f26 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py @@ -64,7 +64,8 @@ class BigtableTableAdminClientMeta(type): _transport_registry["grpc_asyncio"] = BigtableTableAdminGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[BigtableTableAdminTransport]: """Returns an appropriate transport class. @@ -175,10 +176,18 @@ def transport(self) -> BigtableTableAdminTransport: return self._transport @staticmethod - def backup_path(project: str, instance: str, cluster: str, backup: str,) -> str: + def backup_path( + project: str, + instance: str, + cluster: str, + backup: str, + ) -> str: """Returns a fully-qualified backup string.""" return "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}".format( - project=project, instance=instance, cluster=cluster, backup=backup, + project=project, + instance=instance, + cluster=cluster, + backup=backup, ) @staticmethod @@ -191,10 +200,16 @@ def parse_backup_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def cluster_path(project: str, instance: str, cluster: str,) -> str: + def cluster_path( + project: str, + instance: str, + cluster: str, + ) -> str: """Returns a fully-qualified cluster string.""" return "projects/{project}/instances/{instance}/clusters/{cluster}".format( - project=project, instance=instance, cluster=cluster, + project=project, + instance=instance, + cluster=cluster, ) @staticmethod @@ -233,10 +248,14 @@ def parse_crypto_key_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def instance_path(project: str, instance: str,) -> str: + def instance_path( + project: str, + instance: str, + ) -> str: """Returns a fully-qualified instance string.""" return "projects/{project}/instances/{instance}".format( - project=project, instance=instance, + project=project, + instance=instance, ) @staticmethod @@ -246,10 +265,18 @@ def parse_instance_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def snapshot_path(project: str, instance: str, cluster: str, snapshot: str,) -> str: + def snapshot_path( + project: str, + instance: str, + cluster: str, + snapshot: str, + ) -> str: """Returns a fully-qualified snapshot string.""" return "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}".format( - project=project, instance=instance, cluster=cluster, snapshot=snapshot, + project=project, + instance=instance, + cluster=cluster, + snapshot=snapshot, ) @staticmethod @@ -262,10 +289,16 @@ def parse_snapshot_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def table_path(project: str, instance: str, table: str,) -> str: + def table_path( + project: str, + instance: str, + table: str, + ) -> str: """Returns a fully-qualified table string.""" return "projects/{project}/instances/{instance}/tables/{table}".format( - project=project, instance=instance, table=table, + project=project, + instance=instance, + table=table, ) @staticmethod @@ -278,7 +311,9 @@ def parse_table_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -291,9 +326,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -302,9 +341,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -313,9 +356,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -324,10 +371,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -592,7 +643,12 @@ def create_table( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -708,7 +764,12 @@ def create_table_from_snapshot( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -791,12 +852,20 @@ def list_tables( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTablesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -871,7 +940,12 @@ def get_table( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -939,7 +1013,10 @@ def delete_table( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def modify_column_families( @@ -1032,7 +1109,12 @@ def modify_column_families( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1080,7 +1162,10 @@ def drop_row_range( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def generate_consistency_token( @@ -1160,7 +1245,12 @@ def generate_consistency_token( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1245,7 +1335,12 @@ def check_consistency( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1373,7 +1468,12 @@ def snapshot_table( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1476,7 +1576,12 @@ def get_snapshot( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1574,12 +1679,20 @@ def list_snapshots( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListSnapshotsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1659,7 +1772,10 @@ def delete_snapshot( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_backup( @@ -1764,7 +1880,12 @@ def create_backup( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1842,7 +1963,12 @@ def get_backup( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1932,7 +2058,12 @@ def update_backup( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1999,7 +2130,10 @@ def delete_backup( # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_backups( @@ -2076,12 +2210,20 @@ def list_backups( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListBackupsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2143,7 +2285,12 @@ def restore_table( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2278,7 +2425,12 @@ def get_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2404,7 +2556,12 @@ def set_iam_policy( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2487,7 +2644,12 @@ def test_iam_permissions( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py index ac5c17d0f..d53b3d8f3 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/base.py @@ -135,7 +135,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_table: gapic_v1.method.wrap_method( - self.create_table, default_timeout=300.0, client_info=client_info, + self.create_table, + default_timeout=300.0, + client_info=client_info, ), self.create_table_from_snapshot: gapic_v1.method.wrap_method( self.create_table_from_snapshot, @@ -173,7 +175,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.delete_table: gapic_v1.method.wrap_method( - self.delete_table, default_timeout=60.0, client_info=client_info, + self.delete_table, + default_timeout=60.0, + client_info=client_info, ), self.modify_column_families: gapic_v1.method.wrap_method( self.modify_column_families, @@ -181,7 +185,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.drop_row_range: gapic_v1.method.wrap_method( - self.drop_row_range, default_timeout=3600.0, client_info=client_info, + self.drop_row_range, + default_timeout=3600.0, + client_info=client_info, ), self.generate_consistency_token: gapic_v1.method.wrap_method( self.generate_consistency_token, @@ -214,7 +220,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.snapshot_table: gapic_v1.method.wrap_method( - self.snapshot_table, default_timeout=None, client_info=client_info, + self.snapshot_table, + default_timeout=None, + client_info=client_info, ), self.get_snapshot: gapic_v1.method.wrap_method( self.get_snapshot, @@ -247,10 +255,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.delete_snapshot: gapic_v1.method.wrap_method( - self.delete_snapshot, default_timeout=60.0, client_info=client_info, + self.delete_snapshot, + default_timeout=60.0, + client_info=client_info, ), self.create_backup: gapic_v1.method.wrap_method( - self.create_backup, default_timeout=60.0, client_info=client_info, + self.create_backup, + default_timeout=60.0, + client_info=client_info, ), self.get_backup: gapic_v1.method.wrap_method( self.get_backup, @@ -268,10 +280,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update_backup: gapic_v1.method.wrap_method( - self.update_backup, default_timeout=60.0, client_info=client_info, + self.update_backup, + default_timeout=60.0, + client_info=client_info, ), self.delete_backup: gapic_v1.method.wrap_method( - self.delete_backup, default_timeout=60.0, client_info=client_info, + self.delete_backup, + default_timeout=60.0, + client_info=client_info, ), self.list_backups: gapic_v1.method.wrap_method( self.list_backups, @@ -289,7 +305,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.restore_table: gapic_v1.method.wrap_method( - self.restore_table, default_timeout=60.0, client_info=client_info, + self.restore_table, + default_timeout=60.0, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( self.get_iam_policy, @@ -307,7 +325,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=60.0, client_info=client_info, + self.set_iam_policy, + default_timeout=60.0, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -329,9 +349,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py index 8cd13e806..04b0e37bf 100644 --- a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py +++ b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/transports/grpc.py @@ -236,8 +236,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py b/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py index b4d7c55aa..924deeb46 100644 --- a/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py +++ b/google/cloud/bigtable_admin_v2/types/bigtable_instance_admin.py @@ -77,11 +77,24 @@ class CreateInstanceRequest(proto.Message): at most four clusters can be specified. """ - parent = proto.Field(proto.STRING, number=1,) - instance_id = proto.Field(proto.STRING, number=2,) - instance = proto.Field(proto.MESSAGE, number=3, message=gba_instance.Instance,) + parent = proto.Field( + proto.STRING, + number=1, + ) + instance_id = proto.Field( + proto.STRING, + number=2, + ) + instance = proto.Field( + proto.MESSAGE, + number=3, + message=gba_instance.Instance, + ) clusters = proto.MapField( - proto.STRING, proto.MESSAGE, number=4, message=gba_instance.Cluster, + proto.STRING, + proto.MESSAGE, + number=4, + message=gba_instance.Cluster, ) @@ -94,7 +107,10 @@ class GetInstanceRequest(proto.Message): are of the form ``projects/{project}/instances/{instance}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListInstancesRequest(proto.Message): @@ -109,8 +125,14 @@ class ListInstancesRequest(proto.Message): DEPRECATED: This field is unused and ignored. """ - parent = proto.Field(proto.STRING, number=1,) - page_token = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_token = proto.Field( + proto.STRING, + number=2, + ) class ListInstancesResponse(proto.Message): @@ -136,10 +158,18 @@ def raw_page(self): return self instances = proto.RepeatedField( - proto.MESSAGE, number=1, message=gba_instance.Instance, + proto.MESSAGE, + number=1, + message=gba_instance.Instance, + ) + failed_locations = proto.RepeatedField( + proto.STRING, + number=2, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, ) - failed_locations = proto.RepeatedField(proto.STRING, number=2,) - next_page_token = proto.Field(proto.STRING, number=3,) class PartialUpdateInstanceRequest(proto.Message): @@ -155,9 +185,15 @@ class PartialUpdateInstanceRequest(proto.Message): should be replaced. Must be explicitly set. """ - instance = proto.Field(proto.MESSAGE, number=1, message=gba_instance.Instance,) + instance = proto.Field( + proto.MESSAGE, + number=1, + message=gba_instance.Instance, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -171,7 +207,10 @@ class DeleteInstanceRequest(proto.Message): ``projects/{project}/instances/{instance}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateClusterRequest(proto.Message): @@ -192,9 +231,19 @@ class CreateClusterRequest(proto.Message): ``OutputOnly`` must be left blank. """ - parent = proto.Field(proto.STRING, number=1,) - cluster_id = proto.Field(proto.STRING, number=2,) - cluster = proto.Field(proto.MESSAGE, number=3, message=gba_instance.Cluster,) + parent = proto.Field( + proto.STRING, + number=1, + ) + cluster_id = proto.Field( + proto.STRING, + number=2, + ) + cluster = proto.Field( + proto.MESSAGE, + number=3, + message=gba_instance.Cluster, + ) class GetClusterRequest(proto.Message): @@ -207,7 +256,10 @@ class GetClusterRequest(proto.Message): ``projects/{project}/instances/{instance}/clusters/{cluster}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListClustersRequest(proto.Message): @@ -224,8 +276,14 @@ class ListClustersRequest(proto.Message): DEPRECATED: This field is unused and ignored. """ - parent = proto.Field(proto.STRING, number=1,) - page_token = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_token = proto.Field( + proto.STRING, + number=2, + ) class ListClustersResponse(proto.Message): @@ -250,10 +308,18 @@ def raw_page(self): return self clusters = proto.RepeatedField( - proto.MESSAGE, number=1, message=gba_instance.Cluster, + proto.MESSAGE, + number=1, + message=gba_instance.Cluster, + ) + failed_locations = proto.RepeatedField( + proto.STRING, + number=2, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, ) - failed_locations = proto.RepeatedField(proto.STRING, number=2,) - next_page_token = proto.Field(proto.STRING, number=3,) class DeleteClusterRequest(proto.Message): @@ -266,7 +332,10 @@ class DeleteClusterRequest(proto.Message): ``projects/{project}/instances/{instance}/clusters/{cluster}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateInstanceMetadata(proto.Message): @@ -285,12 +354,20 @@ class CreateInstanceMetadata(proto.Message): """ original_request = proto.Field( - proto.MESSAGE, number=1, message="CreateInstanceRequest", + proto.MESSAGE, + number=1, + message="CreateInstanceRequest", ) request_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + finish_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - finish_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class UpdateInstanceMetadata(proto.Message): @@ -309,12 +386,20 @@ class UpdateInstanceMetadata(proto.Message): """ original_request = proto.Field( - proto.MESSAGE, number=1, message="PartialUpdateInstanceRequest", + proto.MESSAGE, + number=1, + message="PartialUpdateInstanceRequest", ) request_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + finish_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - finish_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class CreateClusterMetadata(proto.Message): @@ -333,12 +418,20 @@ class CreateClusterMetadata(proto.Message): """ original_request = proto.Field( - proto.MESSAGE, number=1, message="CreateClusterRequest", + proto.MESSAGE, + number=1, + message="CreateClusterRequest", ) request_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + finish_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - finish_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class UpdateClusterMetadata(proto.Message): @@ -357,12 +450,20 @@ class UpdateClusterMetadata(proto.Message): """ original_request = proto.Field( - proto.MESSAGE, number=1, message=gba_instance.Cluster, + proto.MESSAGE, + number=1, + message=gba_instance.Cluster, ) request_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + finish_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - finish_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class PartialUpdateClusterMetadata(proto.Message): @@ -382,11 +483,19 @@ class PartialUpdateClusterMetadata(proto.Message): """ request_time = proto.Field( - proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + finish_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) - finish_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) original_request = proto.Field( - proto.MESSAGE, number=3, message="PartialUpdateClusterRequest", + proto.MESSAGE, + number=3, + message="PartialUpdateClusterRequest", ) @@ -403,9 +512,15 @@ class PartialUpdateClusterRequest(proto.Message): should be replaced. """ - cluster = proto.Field(proto.MESSAGE, number=1, message=gba_instance.Cluster,) + cluster = proto.Field( + proto.MESSAGE, + number=1, + message=gba_instance.Cluster, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -430,10 +545,23 @@ class CreateAppProfileRequest(proto.Message): the app profile. """ - parent = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=2,) - app_profile = proto.Field(proto.MESSAGE, number=3, message=gba_instance.AppProfile,) - ignore_warnings = proto.Field(proto.BOOL, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=2, + ) + app_profile = proto.Field( + proto.MESSAGE, + number=3, + message=gba_instance.AppProfile, + ) + ignore_warnings = proto.Field( + proto.BOOL, + number=4, + ) class GetAppProfileRequest(proto.Message): @@ -446,7 +574,10 @@ class GetAppProfileRequest(proto.Message): ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListAppProfilesRequest(proto.Message): @@ -476,9 +607,18 @@ class ListAppProfilesRequest(proto.Message): call. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=2, + ) class ListAppProfilesResponse(proto.Message): @@ -504,10 +644,18 @@ def raw_page(self): return self app_profiles = proto.RepeatedField( - proto.MESSAGE, number=1, message=gba_instance.AppProfile, + proto.MESSAGE, + number=1, + message=gba_instance.AppProfile, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + failed_locations = proto.RepeatedField( + proto.STRING, + number=3, ) - next_page_token = proto.Field(proto.STRING, number=2,) - failed_locations = proto.RepeatedField(proto.STRING, number=3,) class UpdateAppProfileRequest(proto.Message): @@ -526,11 +674,20 @@ class UpdateAppProfileRequest(proto.Message): the app profile. """ - app_profile = proto.Field(proto.MESSAGE, number=1, message=gba_instance.AppProfile,) + app_profile = proto.Field( + proto.MESSAGE, + number=1, + message=gba_instance.AppProfile, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + ignore_warnings = proto.Field( + proto.BOOL, + number=3, ) - ignore_warnings = proto.Field(proto.BOOL, number=3,) class DeleteAppProfileRequest(proto.Message): @@ -546,13 +703,18 @@ class DeleteAppProfileRequest(proto.Message): deleting the app profile. """ - name = proto.Field(proto.STRING, number=1,) - ignore_warnings = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + ignore_warnings = proto.Field( + proto.BOOL, + number=2, + ) class UpdateAppProfileMetadata(proto.Message): - r"""The metadata for the Operation returned by UpdateAppProfile. - """ + r"""The metadata for the Operation returned by UpdateAppProfile.""" class ListHotTabletsRequest(proto.Message): @@ -593,11 +755,28 @@ class ListHotTabletsRequest(proto.Message): call. """ - parent = proto.Field(proto.STRING, number=1,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - page_size = proto.Field(proto.INT32, number=4,) - page_token = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=5, + ) class ListHotTabletsResponse(proto.Message): @@ -624,9 +803,14 @@ def raw_page(self): return self hot_tablets = proto.RepeatedField( - proto.MESSAGE, number=1, message=gba_instance.HotTablet, + proto.MESSAGE, + number=1, + message=gba_instance.HotTablet, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py b/google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py index ae1c6c916..6a366a5e4 100644 --- a/google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py +++ b/google/cloud/bigtable_admin_v2/types/bigtable_table_admin.py @@ -84,9 +84,19 @@ class RestoreTableRequest(proto.Message): This field is a member of `oneof`_ ``source``. """ - parent = proto.Field(proto.STRING, number=1,) - table_id = proto.Field(proto.STRING, number=2,) - backup = proto.Field(proto.STRING, number=3, oneof="source",) + parent = proto.Field( + proto.STRING, + number=1, + ) + table_id = proto.Field( + proto.STRING, + number=2, + ) + backup = proto.Field( + proto.STRING, + number=3, + oneof="source", + ) class RestoreTableMetadata(proto.Message): @@ -122,13 +132,30 @@ class RestoreTableMetadata(proto.Message): operation. """ - name = proto.Field(proto.STRING, number=1,) - source_type = proto.Field(proto.ENUM, number=2, enum=gba_table.RestoreSourceType,) + name = proto.Field( + proto.STRING, + number=1, + ) + source_type = proto.Field( + proto.ENUM, + number=2, + enum=gba_table.RestoreSourceType, + ) backup_info = proto.Field( - proto.MESSAGE, number=3, oneof="source_info", message=gba_table.BackupInfo, + proto.MESSAGE, + number=3, + oneof="source_info", + message=gba_table.BackupInfo, + ) + optimize_table_operation_name = proto.Field( + proto.STRING, + number=4, + ) + progress = proto.Field( + proto.MESSAGE, + number=5, + message=common.OperationProgress, ) - optimize_table_operation_name = proto.Field(proto.STRING, number=4,) - progress = proto.Field(proto.MESSAGE, number=5, message=common.OperationProgress,) class OptimizeRestoredTableMetadata(proto.Message): @@ -146,8 +173,15 @@ class OptimizeRestoredTableMetadata(proto.Message): optimizations. """ - name = proto.Field(proto.STRING, number=1,) - progress = proto.Field(proto.MESSAGE, number=2, message=common.OperationProgress,) + name = proto.Field( + proto.STRING, + number=1, + ) + progress = proto.Field( + proto.MESSAGE, + number=2, + message=common.OperationProgress, + ) class CreateTableRequest(proto.Message): @@ -198,12 +232,29 @@ class Split(proto.Message): Row key to use as an initial tablet boundary. """ - key = proto.Field(proto.BYTES, number=1,) + key = proto.Field( + proto.BYTES, + number=1, + ) - parent = proto.Field(proto.STRING, number=1,) - table_id = proto.Field(proto.STRING, number=2,) - table = proto.Field(proto.MESSAGE, number=3, message=gba_table.Table,) - initial_splits = proto.RepeatedField(proto.MESSAGE, number=4, message=Split,) + parent = proto.Field( + proto.STRING, + number=1, + ) + table_id = proto.Field( + proto.STRING, + number=2, + ) + table = proto.Field( + proto.MESSAGE, + number=3, + message=gba_table.Table, + ) + initial_splits = proto.RepeatedField( + proto.MESSAGE, + number=4, + message=Split, + ) class CreateTableFromSnapshotRequest(proto.Message): @@ -232,9 +283,18 @@ class CreateTableFromSnapshotRequest(proto.Message): ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``. """ - parent = proto.Field(proto.STRING, number=1,) - table_id = proto.Field(proto.STRING, number=2,) - source_snapshot = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + table_id = proto.Field( + proto.STRING, + number=2, + ) + source_snapshot = proto.Field( + proto.STRING, + number=3, + ) class DropRowRangeRequest(proto.Message): @@ -265,9 +325,20 @@ class DropRowRangeRequest(proto.Message): This field is a member of `oneof`_ ``target``. """ - name = proto.Field(proto.STRING, number=1,) - row_key_prefix = proto.Field(proto.BYTES, number=2, oneof="target",) - delete_all_data_from_table = proto.Field(proto.BOOL, number=3, oneof="target",) + name = proto.Field( + proto.STRING, + number=1, + ) + row_key_prefix = proto.Field( + proto.BYTES, + number=2, + oneof="target", + ) + delete_all_data_from_table = proto.Field( + proto.BOOL, + number=3, + oneof="target", + ) class ListTablesRequest(proto.Message): @@ -299,10 +370,23 @@ class ListTablesRequest(proto.Message): call. """ - parent = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum=gba_table.Table.View,) - page_size = proto.Field(proto.INT32, number=4,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum=gba_table.Table.View, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListTablesResponse(proto.Message): @@ -322,8 +406,15 @@ class ListTablesResponse(proto.Message): def raw_page(self): return self - tables = proto.RepeatedField(proto.MESSAGE, number=1, message=gba_table.Table,) - next_page_token = proto.Field(proto.STRING, number=2,) + tables = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gba_table.Table, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetTableRequest(proto.Message): @@ -340,8 +431,15 @@ class GetTableRequest(proto.Message): Defaults to ``SCHEMA_VIEW`` if unspecified. """ - name = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum=gba_table.Table.View,) + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum=gba_table.Table.View, + ) class DeleteTableRequest(proto.Message): @@ -355,7 +453,10 @@ class DeleteTableRequest(proto.Message): ``projects/{project}/instances/{instance}/tables/{table}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ModifyColumnFamiliesRequest(proto.Message): @@ -408,17 +509,37 @@ class Modification(proto.Message): This field is a member of `oneof`_ ``mod``. """ - id = proto.Field(proto.STRING, number=1,) + id = proto.Field( + proto.STRING, + number=1, + ) create = proto.Field( - proto.MESSAGE, number=2, oneof="mod", message=gba_table.ColumnFamily, + proto.MESSAGE, + number=2, + oneof="mod", + message=gba_table.ColumnFamily, ) update = proto.Field( - proto.MESSAGE, number=3, oneof="mod", message=gba_table.ColumnFamily, + proto.MESSAGE, + number=3, + oneof="mod", + message=gba_table.ColumnFamily, + ) + drop = proto.Field( + proto.BOOL, + number=4, + oneof="mod", ) - drop = proto.Field(proto.BOOL, number=4, oneof="mod",) - name = proto.Field(proto.STRING, number=1,) - modifications = proto.RepeatedField(proto.MESSAGE, number=2, message=Modification,) + name = proto.Field( + proto.STRING, + number=1, + ) + modifications = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=Modification, + ) class GenerateConsistencyTokenRequest(proto.Message): @@ -432,7 +553,10 @@ class GenerateConsistencyTokenRequest(proto.Message): ``projects/{project}/instances/{instance}/tables/{table}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class GenerateConsistencyTokenResponse(proto.Message): @@ -444,7 +568,10 @@ class GenerateConsistencyTokenResponse(proto.Message): The generated consistency token. """ - consistency_token = proto.Field(proto.STRING, number=1,) + consistency_token = proto.Field( + proto.STRING, + number=1, + ) class CheckConsistencyRequest(proto.Message): @@ -461,8 +588,14 @@ class CheckConsistencyRequest(proto.Message): GenerateConsistencyToken for the Table. """ - name = proto.Field(proto.STRING, number=1,) - consistency_token = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + consistency_token = proto.Field( + proto.STRING, + number=2, + ) class CheckConsistencyResponse(proto.Message): @@ -476,7 +609,10 @@ class CheckConsistencyResponse(proto.Message): the restrictions specified in the request. """ - consistent = proto.Field(proto.BOOL, number=1,) + consistent = proto.Field( + proto.BOOL, + number=1, + ) class SnapshotTableRequest(proto.Message): @@ -514,11 +650,27 @@ class SnapshotTableRequest(proto.Message): Description of the snapshot. """ - name = proto.Field(proto.STRING, number=1,) - cluster = proto.Field(proto.STRING, number=2,) - snapshot_id = proto.Field(proto.STRING, number=3,) - ttl = proto.Field(proto.MESSAGE, number=4, message=duration_pb2.Duration,) - description = proto.Field(proto.STRING, number=5,) + name = proto.Field( + proto.STRING, + number=1, + ) + cluster = proto.Field( + proto.STRING, + number=2, + ) + snapshot_id = proto.Field( + proto.STRING, + number=3, + ) + ttl = proto.Field( + proto.MESSAGE, + number=4, + message=duration_pb2.Duration, + ) + description = proto.Field( + proto.STRING, + number=5, + ) class GetSnapshotRequest(proto.Message): @@ -538,7 +690,10 @@ class GetSnapshotRequest(proto.Message): ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListSnapshotsRequest(proto.Message): @@ -567,9 +722,18 @@ class ListSnapshotsRequest(proto.Message): call. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListSnapshotsResponse(proto.Message): @@ -597,9 +761,14 @@ def raw_page(self): return self snapshots = proto.RepeatedField( - proto.MESSAGE, number=1, message=gba_table.Snapshot, + proto.MESSAGE, + number=1, + message=gba_table.Snapshot, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeleteSnapshotRequest(proto.Message): @@ -619,7 +788,10 @@ class DeleteSnapshotRequest(proto.Message): ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class SnapshotTableMetadata(proto.Message): @@ -643,12 +815,20 @@ class SnapshotTableMetadata(proto.Message): """ original_request = proto.Field( - proto.MESSAGE, number=1, message="SnapshotTableRequest", + proto.MESSAGE, + number=1, + message="SnapshotTableRequest", ) request_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + finish_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - finish_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class CreateTableFromSnapshotMetadata(proto.Message): @@ -673,12 +853,20 @@ class CreateTableFromSnapshotMetadata(proto.Message): """ original_request = proto.Field( - proto.MESSAGE, number=1, message="CreateTableFromSnapshotRequest", + proto.MESSAGE, + number=1, + message="CreateTableFromSnapshotRequest", ) request_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + finish_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - finish_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class CreateBackupRequest(proto.Message): @@ -703,9 +891,19 @@ class CreateBackupRequest(proto.Message): Required. The backup to create. """ - parent = proto.Field(proto.STRING, number=1,) - backup_id = proto.Field(proto.STRING, number=2,) - backup = proto.Field(proto.MESSAGE, number=3, message=gba_table.Backup,) + parent = proto.Field( + proto.STRING, + number=1, + ) + backup_id = proto.Field( + proto.STRING, + number=2, + ) + backup = proto.Field( + proto.MESSAGE, + number=3, + message=gba_table.Backup, + ) class CreateBackupMetadata(proto.Message): @@ -725,10 +923,24 @@ class CreateBackupMetadata(proto.Message): finished or was cancelled. """ - name = proto.Field(proto.STRING, number=1,) - source_table = proto.Field(proto.STRING, number=2,) - start_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + source_table = proto.Field( + proto.STRING, + number=2, + ) + start_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) class UpdateBackupRequest(proto.Message): @@ -752,9 +964,15 @@ class UpdateBackupRequest(proto.Message): accidentally by clients that do not know about them. """ - backup = proto.Field(proto.MESSAGE, number=1, message=gba_table.Backup,) + backup = proto.Field( + proto.MESSAGE, + number=1, + message=gba_table.Backup, + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -768,7 +986,10 @@ class GetBackupRequest(proto.Message): ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeleteBackupRequest(proto.Message): @@ -782,7 +1003,10 @@ class DeleteBackupRequest(proto.Message): ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListBackupsRequest(proto.Message): @@ -871,11 +1095,26 @@ class ListBackupsRequest(proto.Message): to the same ``parent`` and with the same ``filter``. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - order_by = proto.Field(proto.STRING, number=3,) - page_size = proto.Field(proto.INT32, number=4,) - page_token = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + order_by = proto.Field( + proto.STRING, + number=3, + ) + page_size = proto.Field( + proto.INT32, + number=4, + ) + page_token = proto.Field( + proto.STRING, + number=5, + ) class ListBackupsResponse(proto.Message): @@ -895,8 +1134,15 @@ class ListBackupsResponse(proto.Message): def raw_page(self): return self - backups = proto.RepeatedField(proto.MESSAGE, number=1, message=gba_table.Backup,) - next_page_token = proto.Field(proto.STRING, number=2,) + backups = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gba_table.Backup, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/bigtable_admin_v2/types/common.py b/google/cloud/bigtable_admin_v2/types/common.py index 5615167e6..704a07732 100644 --- a/google/cloud/bigtable_admin_v2/types/common.py +++ b/google/cloud/bigtable_admin_v2/types/common.py @@ -19,7 +19,11 @@ __protobuf__ = proto.module( - package="google.bigtable.admin.v2", manifest={"StorageType", "OperationProgress",}, + package="google.bigtable.admin.v2", + manifest={ + "StorageType", + "OperationProgress", + }, ) @@ -45,9 +49,20 @@ class OperationProgress(proto.Message): failed or was completed successfully. """ - progress_percent = proto.Field(proto.INT32, number=1,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + progress_percent = proto.Field( + proto.INT32, + number=1, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/bigtable_admin_v2/types/instance.py b/google/cloud/bigtable_admin_v2/types/instance.py index 961cba434..76733b615 100644 --- a/google/cloud/bigtable_admin_v2/types/instance.py +++ b/google/cloud/bigtable_admin_v2/types/instance.py @@ -85,12 +85,34 @@ class Type(proto.Enum): PRODUCTION = 1 DEVELOPMENT = 2 - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - state = proto.Field(proto.ENUM, number=3, enum=State,) - type_ = proto.Field(proto.ENUM, number=4, enum=Type,) - labels = proto.MapField(proto.STRING, proto.STRING, number=5,) - create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=State, + ) + type_ = proto.Field( + proto.ENUM, + number=4, + enum=Type, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + create_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) class AutoscalingTargets(proto.Message): @@ -105,7 +127,10 @@ class AutoscalingTargets(proto.Message): utilization). """ - cpu_utilization_percent = proto.Field(proto.INT32, number=2,) + cpu_utilization_percent = proto.Field( + proto.INT32, + number=2, + ) class AutoscalingLimits(proto.Message): @@ -121,8 +146,14 @@ class AutoscalingLimits(proto.Message): to. """ - min_serve_nodes = proto.Field(proto.INT32, number=1,) - max_serve_nodes = proto.Field(proto.INT32, number=2,) + min_serve_nodes = proto.Field( + proto.INT32, + number=1, + ) + max_serve_nodes = proto.Field( + proto.INT32, + number=2, + ) class Cluster(proto.Message): @@ -183,10 +214,14 @@ class ClusterAutoscalingConfig(proto.Message): """ autoscaling_limits = proto.Field( - proto.MESSAGE, number=1, message="AutoscalingLimits", + proto.MESSAGE, + number=1, + message="AutoscalingLimits", ) autoscaling_targets = proto.Field( - proto.MESSAGE, number=2, message="AutoscalingTargets", + proto.MESSAGE, + number=2, + message="AutoscalingTargets", ) class ClusterConfig(proto.Message): @@ -198,7 +233,9 @@ class ClusterConfig(proto.Message): """ cluster_autoscaling_config = proto.Field( - proto.MESSAGE, number=1, message="Cluster.ClusterAutoscalingConfig", + proto.MESSAGE, + number=1, + message="Cluster.ClusterAutoscalingConfig", ) class EncryptionConfig(proto.Message): @@ -221,17 +258,44 @@ class EncryptionConfig(proto.Message): key. """ - kms_key_name = proto.Field(proto.STRING, number=1,) + kms_key_name = proto.Field( + proto.STRING, + number=1, + ) - name = proto.Field(proto.STRING, number=1,) - location = proto.Field(proto.STRING, number=2,) - state = proto.Field(proto.ENUM, number=3, enum=State,) - serve_nodes = proto.Field(proto.INT32, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + location = proto.Field( + proto.STRING, + number=2, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=State, + ) + serve_nodes = proto.Field( + proto.INT32, + number=4, + ) cluster_config = proto.Field( - proto.MESSAGE, number=7, oneof="config", message=ClusterConfig, + proto.MESSAGE, + number=7, + oneof="config", + message=ClusterConfig, + ) + default_storage_type = proto.Field( + proto.ENUM, + number=5, + enum=common.StorageType, + ) + encryption_config = proto.Field( + proto.MESSAGE, + number=6, + message=EncryptionConfig, ) - default_storage_type = proto.Field(proto.ENUM, number=5, enum=common.StorageType,) - encryption_config = proto.Field(proto.MESSAGE, number=6, message=EncryptionConfig,) class AppProfile(proto.Message): @@ -289,7 +353,10 @@ class MultiClusterRoutingUseAny(proto.Message): eligible. """ - cluster_ids = proto.RepeatedField(proto.STRING, number=1,) + cluster_ids = proto.RepeatedField( + proto.STRING, + number=1, + ) class SingleClusterRouting(proto.Message): r"""Unconditionally routes all read/write requests to a specific @@ -307,12 +374,27 @@ class SingleClusterRouting(proto.Message): table/row/column in multiple clusters. """ - cluster_id = proto.Field(proto.STRING, number=1,) - allow_transactional_writes = proto.Field(proto.BOOL, number=2,) + cluster_id = proto.Field( + proto.STRING, + number=1, + ) + allow_transactional_writes = proto.Field( + proto.BOOL, + number=2, + ) - name = proto.Field(proto.STRING, number=1,) - etag = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + etag = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) multi_cluster_routing_use_any = proto.Field( proto.MESSAGE, number=5, @@ -320,7 +402,10 @@ class SingleClusterRouting(proto.Message): message=MultiClusterRoutingUseAny, ) single_cluster_routing = proto.Field( - proto.MESSAGE, number=6, oneof="routing_policy", message=SingleClusterRouting, + proto.MESSAGE, + number=6, + oneof="routing_policy", + message=SingleClusterRouting, ) @@ -357,13 +442,36 @@ class HotTablet(proto.Message): (the node spent all cycles serving the hot tablet). """ - name = proto.Field(proto.STRING, number=1,) - table_name = proto.Field(proto.STRING, number=2,) - start_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - start_key = proto.Field(proto.STRING, number=5,) - end_key = proto.Field(proto.STRING, number=6,) - node_cpu_usage_percent = proto.Field(proto.FLOAT, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + table_name = proto.Field( + proto.STRING, + number=2, + ) + start_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + start_key = proto.Field( + proto.STRING, + number=5, + ) + end_key = proto.Field( + proto.STRING, + number=6, + ) + node_cpu_usage_percent = proto.Field( + proto.FLOAT, + number=7, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/bigtable_admin_v2/types/table.py b/google/cloud/bigtable_admin_v2/types/table.py index b99c3a646..29b4ce75d 100644 --- a/google/cloud/bigtable_admin_v2/types/table.py +++ b/google/cloud/bigtable_admin_v2/types/table.py @@ -57,9 +57,16 @@ class RestoreInfo(proto.Message): This field is a member of `oneof`_ ``source_info``. """ - source_type = proto.Field(proto.ENUM, number=1, enum="RestoreSourceType",) + source_type = proto.Field( + proto.ENUM, + number=1, + enum="RestoreSourceType", + ) backup_info = proto.Field( - proto.MESSAGE, number=2, oneof="source_info", message="BackupInfo", + proto.MESSAGE, + number=2, + oneof="source_info", + message="BackupInfo", ) @@ -142,21 +149,42 @@ class ReplicationState(proto.Enum): READY_OPTIMIZING = 5 replication_state = proto.Field( - proto.ENUM, number=1, enum="Table.ClusterState.ReplicationState", + proto.ENUM, + number=1, + enum="Table.ClusterState.ReplicationState", ) encryption_info = proto.RepeatedField( - proto.MESSAGE, number=2, message="EncryptionInfo", + proto.MESSAGE, + number=2, + message="EncryptionInfo", ) - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) cluster_states = proto.MapField( - proto.STRING, proto.MESSAGE, number=2, message=ClusterState, + proto.STRING, + proto.MESSAGE, + number=2, + message=ClusterState, ) column_families = proto.MapField( - proto.STRING, proto.MESSAGE, number=3, message="ColumnFamily", + proto.STRING, + proto.MESSAGE, + number=3, + message="ColumnFamily", + ) + granularity = proto.Field( + proto.ENUM, + number=4, + enum=TimestampGranularity, + ) + restore_info = proto.Field( + proto.MESSAGE, + number=6, + message="RestoreInfo", ) - granularity = proto.Field(proto.ENUM, number=4, enum=TimestampGranularity,) - restore_info = proto.Field(proto.MESSAGE, number=6, message="RestoreInfo",) class ColumnFamily(proto.Message): @@ -173,7 +201,11 @@ class ColumnFamily(proto.Message): matches the active GC expression for its family. """ - gc_rule = proto.Field(proto.MESSAGE, number=1, message="GcRule",) + gc_rule = proto.Field( + proto.MESSAGE, + number=1, + message="GcRule", + ) class GcRule(proto.Message): @@ -221,7 +253,11 @@ class Intersection(proto.Message): ``rules``. """ - rules = proto.RepeatedField(proto.MESSAGE, number=1, message="GcRule",) + rules = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="GcRule", + ) class Union(proto.Message): r"""A GcRule which deletes cells matching any of the given rules. @@ -232,16 +268,35 @@ class Union(proto.Message): ``rules``. """ - rules = proto.RepeatedField(proto.MESSAGE, number=1, message="GcRule",) + rules = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="GcRule", + ) - max_num_versions = proto.Field(proto.INT32, number=1, oneof="rule",) + max_num_versions = proto.Field( + proto.INT32, + number=1, + oneof="rule", + ) max_age = proto.Field( - proto.MESSAGE, number=2, oneof="rule", message=duration_pb2.Duration, + proto.MESSAGE, + number=2, + oneof="rule", + message=duration_pb2.Duration, ) intersection = proto.Field( - proto.MESSAGE, number=3, oneof="rule", message=Intersection, + proto.MESSAGE, + number=3, + oneof="rule", + message=Intersection, + ) + union = proto.Field( + proto.MESSAGE, + number=4, + oneof="rule", + message=Union, ) - union = proto.Field(proto.MESSAGE, number=4, oneof="rule", message=Union,) class EncryptionInfo(proto.Message): @@ -271,9 +326,20 @@ class EncryptionType(proto.Enum): GOOGLE_DEFAULT_ENCRYPTION = 1 CUSTOMER_MANAGED_ENCRYPTION = 2 - encryption_type = proto.Field(proto.ENUM, number=3, enum=EncryptionType,) - encryption_status = proto.Field(proto.MESSAGE, number=4, message=status_pb2.Status,) - kms_key_version = proto.Field(proto.STRING, number=2,) + encryption_type = proto.Field( + proto.ENUM, + number=3, + enum=EncryptionType, + ) + encryption_status = proto.Field( + proto.MESSAGE, + number=4, + message=status_pb2.Status, + ) + kms_key_version = proto.Field( + proto.STRING, + number=2, + ) class Snapshot(proto.Message): @@ -322,13 +388,38 @@ class State(proto.Enum): READY = 1 CREATING = 2 - name = proto.Field(proto.STRING, number=1,) - source_table = proto.Field(proto.MESSAGE, number=2, message="Table",) - data_size_bytes = proto.Field(proto.INT64, number=3,) - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - delete_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - state = proto.Field(proto.ENUM, number=6, enum=State,) - description = proto.Field(proto.STRING, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + source_table = proto.Field( + proto.MESSAGE, + number=2, + message="Table", + ) + data_size_bytes = proto.Field( + proto.INT64, + number=3, + ) + create_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + delete_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) + description = proto.Field( + proto.STRING, + number=7, + ) class Backup(proto.Message): @@ -381,14 +472,43 @@ class State(proto.Enum): CREATING = 1 READY = 2 - name = proto.Field(proto.STRING, number=1,) - source_table = proto.Field(proto.STRING, number=2,) - expire_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - start_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - size_bytes = proto.Field(proto.INT64, number=6,) - state = proto.Field(proto.ENUM, number=7, enum=State,) - encryption_info = proto.Field(proto.MESSAGE, number=9, message="EncryptionInfo",) + name = proto.Field( + proto.STRING, + number=1, + ) + source_table = proto.Field( + proto.STRING, + number=2, + ) + expire_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + start_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + size_bytes = proto.Field( + proto.INT64, + number=6, + ) + state = proto.Field( + proto.ENUM, + number=7, + enum=State, + ) + encryption_info = proto.Field( + proto.MESSAGE, + number=9, + message="EncryptionInfo", + ) class BackupInfo(proto.Message): @@ -410,10 +530,24 @@ class BackupInfo(proto.Message): created from. """ - backup = proto.Field(proto.STRING, number=1,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - source_table = proto.Field(proto.STRING, number=4,) + backup = proto.Field( + proto.STRING, + number=1, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + source_table = proto.Field( + proto.STRING, + number=4, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/bigtable_v2/services/bigtable/async_client.py b/google/cloud/bigtable_v2/services/bigtable/async_client.py index cf40edc6c..6c9986f78 100644 --- a/google/cloud/bigtable_v2/services/bigtable/async_client.py +++ b/google/cloud/bigtable_v2/services/bigtable/async_client.py @@ -293,7 +293,12 @@ def read_rows( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -383,7 +388,12 @@ def sample_row_keys( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -504,7 +514,12 @@ async def mutate_row( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -609,7 +624,12 @@ def mutate_rows( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -758,7 +778,12 @@ async def check_and_mutate_row( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -845,7 +870,12 @@ async def ping_and_warm( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -963,7 +993,12 @@ async def read_modify_write_row( ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -977,7 +1012,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-bigtable",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-bigtable", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/bigtable_v2/services/bigtable/client.py b/google/cloud/bigtable_v2/services/bigtable/client.py index e221fefb5..c62875f3a 100644 --- a/google/cloud/bigtable_v2/services/bigtable/client.py +++ b/google/cloud/bigtable_v2/services/bigtable/client.py @@ -53,7 +53,10 @@ class BigtableClientMeta(type): _transport_registry["grpc"] = BigtableGrpcTransport _transport_registry["grpc_asyncio"] = BigtableGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[BigtableTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[BigtableTransport]: """Returns an appropriate transport class. Args: @@ -160,10 +163,14 @@ def transport(self) -> BigtableTransport: return self._transport @staticmethod - def instance_path(project: str, instance: str,) -> str: + def instance_path( + project: str, + instance: str, + ) -> str: """Returns a fully-qualified instance string.""" return "projects/{project}/instances/{instance}".format( - project=project, instance=instance, + project=project, + instance=instance, ) @staticmethod @@ -173,10 +180,16 @@ def parse_instance_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def table_path(project: str, instance: str, table: str,) -> str: + def table_path( + project: str, + instance: str, + table: str, + ) -> str: """Returns a fully-qualified table string.""" return "projects/{project}/instances/{instance}/tables/{table}".format( - project=project, instance=instance, table=table, + project=project, + instance=instance, + table=table, ) @staticmethod @@ -189,7 +202,9 @@ def parse_table_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -202,9 +217,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -213,9 +232,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -224,9 +247,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -235,10 +262,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -507,7 +538,12 @@ def read_rows( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -606,7 +642,12 @@ def sample_row_keys( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -726,7 +767,12 @@ def mutate_row( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -840,7 +886,12 @@ def mutate_rows( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -998,7 +1049,12 @@ def check_and_mutate_row( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1094,7 +1150,12 @@ def ping_and_warm( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1221,7 +1282,12 @@ def read_modify_write_row( ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1242,7 +1308,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-bigtable",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-bigtable", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/bigtable_v2/services/bigtable/transports/base.py b/google/cloud/bigtable_v2/services/bigtable/transports/base.py index 1ced17ddc..6a5e0eca7 100644 --- a/google/cloud/bigtable_v2/services/bigtable/transports/base.py +++ b/google/cloud/bigtable_v2/services/bigtable/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-bigtable",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-bigtable", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -126,10 +128,14 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.read_rows: gapic_v1.method.wrap_method( - self.read_rows, default_timeout=43200.0, client_info=client_info, + self.read_rows, + default_timeout=43200.0, + client_info=client_info, ), self.sample_row_keys: gapic_v1.method.wrap_method( - self.sample_row_keys, default_timeout=60.0, client_info=client_info, + self.sample_row_keys, + default_timeout=60.0, + client_info=client_info, ), self.mutate_row: gapic_v1.method.wrap_method( self.mutate_row, @@ -147,7 +153,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.mutate_rows: gapic_v1.method.wrap_method( - self.mutate_rows, default_timeout=600.0, client_info=client_info, + self.mutate_rows, + default_timeout=600.0, + client_info=client_info, ), self.check_and_mutate_row: gapic_v1.method.wrap_method( self.check_and_mutate_row, @@ -155,7 +163,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.ping_and_warm: gapic_v1.method.wrap_method( - self.ping_and_warm, default_timeout=None, client_info=client_info, + self.ping_and_warm, + default_timeout=None, + client_info=client_info, ), self.read_modify_write_row: gapic_v1.method.wrap_method( self.read_modify_write_row, @@ -167,9 +177,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() diff --git a/google/cloud/bigtable_v2/services/bigtable/transports/grpc.py b/google/cloud/bigtable_v2/services/bigtable/transports/grpc.py index 089cab726..3c836cad2 100644 --- a/google/cloud/bigtable_v2/services/bigtable/transports/grpc.py +++ b/google/cloud/bigtable_v2/services/bigtable/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property diff --git a/google/cloud/bigtable_v2/types/bigtable.py b/google/cloud/bigtable_v2/types/bigtable.py index 58fc45703..72785c264 100644 --- a/google/cloud/bigtable_v2/types/bigtable.py +++ b/google/cloud/bigtable_v2/types/bigtable.py @@ -67,11 +67,28 @@ class ReadRowsRequest(proto.Message): return all results. """ - table_name = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=5,) - rows = proto.Field(proto.MESSAGE, number=2, message=data.RowSet,) - filter = proto.Field(proto.MESSAGE, number=3, message=data.RowFilter,) - rows_limit = proto.Field(proto.INT64, number=4,) + table_name = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=5, + ) + rows = proto.Field( + proto.MESSAGE, + number=2, + message=data.RowSet, + ) + filter = proto.Field( + proto.MESSAGE, + number=3, + message=data.RowFilter, + ) + rows_limit = proto.Field( + proto.INT64, + number=4, + ) class ReadRowsResponse(proto.Message): @@ -165,22 +182,56 @@ class CellChunk(proto.Message): This field is a member of `oneof`_ ``row_status``. """ - row_key = proto.Field(proto.BYTES, number=1,) + row_key = proto.Field( + proto.BYTES, + number=1, + ) family_name = proto.Field( - proto.MESSAGE, number=2, message=wrappers_pb2.StringValue, + proto.MESSAGE, + number=2, + message=wrappers_pb2.StringValue, ) qualifier = proto.Field( - proto.MESSAGE, number=3, message=wrappers_pb2.BytesValue, + proto.MESSAGE, + number=3, + message=wrappers_pb2.BytesValue, + ) + timestamp_micros = proto.Field( + proto.INT64, + number=4, + ) + labels = proto.RepeatedField( + proto.STRING, + number=5, + ) + value = proto.Field( + proto.BYTES, + number=6, + ) + value_size = proto.Field( + proto.INT32, + number=7, + ) + reset_row = proto.Field( + proto.BOOL, + number=8, + oneof="row_status", + ) + commit_row = proto.Field( + proto.BOOL, + number=9, + oneof="row_status", ) - timestamp_micros = proto.Field(proto.INT64, number=4,) - labels = proto.RepeatedField(proto.STRING, number=5,) - value = proto.Field(proto.BYTES, number=6,) - value_size = proto.Field(proto.INT32, number=7,) - reset_row = proto.Field(proto.BOOL, number=8, oneof="row_status",) - commit_row = proto.Field(proto.BOOL, number=9, oneof="row_status",) - chunks = proto.RepeatedField(proto.MESSAGE, number=1, message=CellChunk,) - last_scanned_row_key = proto.Field(proto.BYTES, number=2,) + chunks = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=CellChunk, + ) + last_scanned_row_key = proto.Field( + proto.BYTES, + number=2, + ) class SampleRowKeysRequest(proto.Message): @@ -197,8 +248,14 @@ class SampleRowKeysRequest(proto.Message): profile will be used. """ - table_name = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=2,) + table_name = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=2, + ) class SampleRowKeysResponse(proto.Message): @@ -225,8 +282,14 @@ class SampleRowKeysResponse(proto.Message): fields. """ - row_key = proto.Field(proto.BYTES, number=1,) - offset_bytes = proto.Field(proto.INT64, number=2,) + row_key = proto.Field( + proto.BYTES, + number=1, + ) + offset_bytes = proto.Field( + proto.INT64, + number=2, + ) class MutateRowRequest(proto.Message): @@ -252,15 +315,27 @@ class MutateRowRequest(proto.Message): at most 100000. """ - table_name = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=4,) - row_key = proto.Field(proto.BYTES, number=2,) - mutations = proto.RepeatedField(proto.MESSAGE, number=3, message=data.Mutation,) + table_name = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=4, + ) + row_key = proto.Field( + proto.BYTES, + number=2, + ) + mutations = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=data.Mutation, + ) class MutateRowResponse(proto.Message): - r"""Response message for Bigtable.MutateRow. - """ + r"""Response message for Bigtable.MutateRow.""" class MutateRowsRequest(proto.Message): @@ -299,12 +374,29 @@ class Entry(proto.Message): You must specify at least one mutation. """ - row_key = proto.Field(proto.BYTES, number=1,) - mutations = proto.RepeatedField(proto.MESSAGE, number=2, message=data.Mutation,) + row_key = proto.Field( + proto.BYTES, + number=1, + ) + mutations = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=data.Mutation, + ) - table_name = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=3,) - entries = proto.RepeatedField(proto.MESSAGE, number=2, message=Entry,) + table_name = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=3, + ) + entries = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=Entry, + ) class MutateRowsResponse(proto.Message): @@ -332,10 +424,21 @@ class Entry(proto.Message): will be reported for both entries. """ - index = proto.Field(proto.INT64, number=1,) - status = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) + index = proto.Field( + proto.INT64, + number=1, + ) + status = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) - entries = proto.RepeatedField(proto.MESSAGE, number=1, message=Entry,) + entries = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Entry, + ) class CheckAndMutateRowRequest(proto.Message): @@ -376,15 +479,32 @@ class CheckAndMutateRowRequest(proto.Message): most 100000. """ - table_name = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=7,) - row_key = proto.Field(proto.BYTES, number=2,) - predicate_filter = proto.Field(proto.MESSAGE, number=6, message=data.RowFilter,) + table_name = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=7, + ) + row_key = proto.Field( + proto.BYTES, + number=2, + ) + predicate_filter = proto.Field( + proto.MESSAGE, + number=6, + message=data.RowFilter, + ) true_mutations = proto.RepeatedField( - proto.MESSAGE, number=4, message=data.Mutation, + proto.MESSAGE, + number=4, + message=data.Mutation, ) false_mutations = proto.RepeatedField( - proto.MESSAGE, number=5, message=data.Mutation, + proto.MESSAGE, + number=5, + message=data.Mutation, ) @@ -397,7 +517,10 @@ class CheckAndMutateRowResponse(proto.Message): any results for the specified row. """ - predicate_matched = proto.Field(proto.BOOL, number=1,) + predicate_matched = proto.Field( + proto.BOOL, + number=1, + ) class PingAndWarmRequest(proto.Message): @@ -414,8 +537,14 @@ class PingAndWarmRequest(proto.Message): profile will be used. """ - name = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=2, + ) class PingAndWarmResponse(proto.Message): @@ -449,11 +578,22 @@ class ReadModifyWriteRowRequest(proto.Message): later ones. """ - table_name = proto.Field(proto.STRING, number=1,) - app_profile_id = proto.Field(proto.STRING, number=4,) - row_key = proto.Field(proto.BYTES, number=2,) + table_name = proto.Field( + proto.STRING, + number=1, + ) + app_profile_id = proto.Field( + proto.STRING, + number=4, + ) + row_key = proto.Field( + proto.BYTES, + number=2, + ) rules = proto.RepeatedField( - proto.MESSAGE, number=3, message=data.ReadModifyWriteRule, + proto.MESSAGE, + number=3, + message=data.ReadModifyWriteRule, ) @@ -466,7 +606,11 @@ class ReadModifyWriteRowResponse(proto.Message): cells modified by the request. """ - row = proto.Field(proto.MESSAGE, number=1, message=data.Row,) + row = proto.Field( + proto.MESSAGE, + number=1, + message=data.Row, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/bigtable_v2/types/data.py b/google/cloud/bigtable_v2/types/data.py index c81358f07..bd45a62d3 100644 --- a/google/cloud/bigtable_v2/types/data.py +++ b/google/cloud/bigtable_v2/types/data.py @@ -53,8 +53,15 @@ class Row(proto.Message): not specified. """ - key = proto.Field(proto.BYTES, number=1,) - families = proto.RepeatedField(proto.MESSAGE, number=2, message="Family",) + key = proto.Field( + proto.BYTES, + number=1, + ) + families = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Family", + ) class Family(proto.Message): @@ -75,8 +82,15 @@ class Family(proto.Message): increasing "qualifier". """ - name = proto.Field(proto.STRING, number=1,) - columns = proto.RepeatedField(proto.MESSAGE, number=2, message="Column",) + name = proto.Field( + proto.STRING, + number=1, + ) + columns = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Column", + ) class Column(proto.Message): @@ -96,8 +110,15 @@ class Column(proto.Message): "timestamp_micros". """ - qualifier = proto.Field(proto.BYTES, number=1,) - cells = proto.RepeatedField(proto.MESSAGE, number=2, message="Cell",) + qualifier = proto.Field( + proto.BYTES, + number=1, + ) + cells = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Cell", + ) class Cell(proto.Message): @@ -122,9 +143,18 @@ class Cell(proto.Message): [RowFilter][google.bigtable.v2.RowFilter]. """ - timestamp_micros = proto.Field(proto.INT64, number=1,) - value = proto.Field(proto.BYTES, number=2,) - labels = proto.RepeatedField(proto.STRING, number=3,) + timestamp_micros = proto.Field( + proto.INT64, + number=1, + ) + value = proto.Field( + proto.BYTES, + number=2, + ) + labels = proto.RepeatedField( + proto.STRING, + number=3, + ) class RowRange(proto.Message): @@ -160,10 +190,26 @@ class RowRange(proto.Message): This field is a member of `oneof`_ ``end_key``. """ - start_key_closed = proto.Field(proto.BYTES, number=1, oneof="start_key",) - start_key_open = proto.Field(proto.BYTES, number=2, oneof="start_key",) - end_key_open = proto.Field(proto.BYTES, number=3, oneof="end_key",) - end_key_closed = proto.Field(proto.BYTES, number=4, oneof="end_key",) + start_key_closed = proto.Field( + proto.BYTES, + number=1, + oneof="start_key", + ) + start_key_open = proto.Field( + proto.BYTES, + number=2, + oneof="start_key", + ) + end_key_open = proto.Field( + proto.BYTES, + number=3, + oneof="end_key", + ) + end_key_closed = proto.Field( + proto.BYTES, + number=4, + oneof="end_key", + ) class RowSet(proto.Message): @@ -176,8 +222,15 @@ class RowSet(proto.Message): Contiguous row ranges included in the set. """ - row_keys = proto.RepeatedField(proto.BYTES, number=1,) - row_ranges = proto.RepeatedField(proto.MESSAGE, number=2, message="RowRange",) + row_keys = proto.RepeatedField( + proto.BYTES, + number=1, + ) + row_ranges = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="RowRange", + ) class ColumnRange(proto.Message): @@ -219,13 +272,30 @@ class ColumnRange(proto.Message): This field is a member of `oneof`_ ``end_qualifier``. """ - family_name = proto.Field(proto.STRING, number=1,) + family_name = proto.Field( + proto.STRING, + number=1, + ) start_qualifier_closed = proto.Field( - proto.BYTES, number=2, oneof="start_qualifier", + proto.BYTES, + number=2, + oneof="start_qualifier", + ) + start_qualifier_open = proto.Field( + proto.BYTES, + number=3, + oneof="start_qualifier", + ) + end_qualifier_closed = proto.Field( + proto.BYTES, + number=4, + oneof="end_qualifier", + ) + end_qualifier_open = proto.Field( + proto.BYTES, + number=5, + oneof="end_qualifier", ) - start_qualifier_open = proto.Field(proto.BYTES, number=3, oneof="start_qualifier",) - end_qualifier_closed = proto.Field(proto.BYTES, number=4, oneof="end_qualifier",) - end_qualifier_open = proto.Field(proto.BYTES, number=5, oneof="end_qualifier",) class TimestampRange(proto.Message): @@ -240,8 +310,14 @@ class TimestampRange(proto.Message): interpreted as infinity. """ - start_timestamp_micros = proto.Field(proto.INT64, number=1,) - end_timestamp_micros = proto.Field(proto.INT64, number=2,) + start_timestamp_micros = proto.Field( + proto.INT64, + number=1, + ) + end_timestamp_micros = proto.Field( + proto.INT64, + number=2, + ) class ValueRange(proto.Message): @@ -277,10 +353,26 @@ class ValueRange(proto.Message): This field is a member of `oneof`_ ``end_value``. """ - start_value_closed = proto.Field(proto.BYTES, number=1, oneof="start_value",) - start_value_open = proto.Field(proto.BYTES, number=2, oneof="start_value",) - end_value_closed = proto.Field(proto.BYTES, number=3, oneof="end_value",) - end_value_open = proto.Field(proto.BYTES, number=4, oneof="end_value",) + start_value_closed = proto.Field( + proto.BYTES, + number=1, + oneof="start_value", + ) + start_value_open = proto.Field( + proto.BYTES, + number=2, + oneof="start_value", + ) + end_value_closed = proto.Field( + proto.BYTES, + number=3, + oneof="end_value", + ) + end_value_open = proto.Field( + proto.BYTES, + number=4, + oneof="end_value", + ) class RowFilter(proto.Message): @@ -546,7 +638,11 @@ class Chain(proto.Message): atomically. """ - filters = proto.RepeatedField(proto.MESSAGE, number=1, message="RowFilter",) + filters = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="RowFilter", + ) class Interleave(proto.Message): r"""A RowFilter which sends each row to each of several component @@ -584,7 +680,11 @@ class Interleave(proto.Message): All interleaved filters are executed atomically. """ - filters = proto.RepeatedField(proto.MESSAGE, number=1, message="RowFilter",) + filters = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="RowFilter", + ) class Condition(proto.Message): r"""A RowFilter which evaluates one of two possible RowFilters, @@ -611,37 +711,123 @@ class Condition(proto.Message): will be returned in the false case. """ - predicate_filter = proto.Field(proto.MESSAGE, number=1, message="RowFilter",) - true_filter = proto.Field(proto.MESSAGE, number=2, message="RowFilter",) - false_filter = proto.Field(proto.MESSAGE, number=3, message="RowFilter",) - - chain = proto.Field(proto.MESSAGE, number=1, oneof="filter", message=Chain,) + predicate_filter = proto.Field( + proto.MESSAGE, + number=1, + message="RowFilter", + ) + true_filter = proto.Field( + proto.MESSAGE, + number=2, + message="RowFilter", + ) + false_filter = proto.Field( + proto.MESSAGE, + number=3, + message="RowFilter", + ) + + chain = proto.Field( + proto.MESSAGE, + number=1, + oneof="filter", + message=Chain, + ) interleave = proto.Field( - proto.MESSAGE, number=2, oneof="filter", message=Interleave, - ) - condition = proto.Field(proto.MESSAGE, number=3, oneof="filter", message=Condition,) - sink = proto.Field(proto.BOOL, number=16, oneof="filter",) - pass_all_filter = proto.Field(proto.BOOL, number=17, oneof="filter",) - block_all_filter = proto.Field(proto.BOOL, number=18, oneof="filter",) - row_key_regex_filter = proto.Field(proto.BYTES, number=4, oneof="filter",) - row_sample_filter = proto.Field(proto.DOUBLE, number=14, oneof="filter",) - family_name_regex_filter = proto.Field(proto.STRING, number=5, oneof="filter",) - column_qualifier_regex_filter = proto.Field(proto.BYTES, number=6, oneof="filter",) + proto.MESSAGE, + number=2, + oneof="filter", + message=Interleave, + ) + condition = proto.Field( + proto.MESSAGE, + number=3, + oneof="filter", + message=Condition, + ) + sink = proto.Field( + proto.BOOL, + number=16, + oneof="filter", + ) + pass_all_filter = proto.Field( + proto.BOOL, + number=17, + oneof="filter", + ) + block_all_filter = proto.Field( + proto.BOOL, + number=18, + oneof="filter", + ) + row_key_regex_filter = proto.Field( + proto.BYTES, + number=4, + oneof="filter", + ) + row_sample_filter = proto.Field( + proto.DOUBLE, + number=14, + oneof="filter", + ) + family_name_regex_filter = proto.Field( + proto.STRING, + number=5, + oneof="filter", + ) + column_qualifier_regex_filter = proto.Field( + proto.BYTES, + number=6, + oneof="filter", + ) column_range_filter = proto.Field( - proto.MESSAGE, number=7, oneof="filter", message="ColumnRange", + proto.MESSAGE, + number=7, + oneof="filter", + message="ColumnRange", ) timestamp_range_filter = proto.Field( - proto.MESSAGE, number=8, oneof="filter", message="TimestampRange", + proto.MESSAGE, + number=8, + oneof="filter", + message="TimestampRange", + ) + value_regex_filter = proto.Field( + proto.BYTES, + number=9, + oneof="filter", ) - value_regex_filter = proto.Field(proto.BYTES, number=9, oneof="filter",) value_range_filter = proto.Field( - proto.MESSAGE, number=15, oneof="filter", message="ValueRange", + proto.MESSAGE, + number=15, + oneof="filter", + message="ValueRange", + ) + cells_per_row_offset_filter = proto.Field( + proto.INT32, + number=10, + oneof="filter", + ) + cells_per_row_limit_filter = proto.Field( + proto.INT32, + number=11, + oneof="filter", + ) + cells_per_column_limit_filter = proto.Field( + proto.INT32, + number=12, + oneof="filter", + ) + strip_value_transformer = proto.Field( + proto.BOOL, + number=13, + oneof="filter", + ) + apply_label_transformer = proto.Field( + proto.STRING, + number=19, + oneof="filter", ) - cells_per_row_offset_filter = proto.Field(proto.INT32, number=10, oneof="filter",) - cells_per_row_limit_filter = proto.Field(proto.INT32, number=11, oneof="filter",) - cells_per_column_limit_filter = proto.Field(proto.INT32, number=12, oneof="filter",) - strip_value_transformer = proto.Field(proto.BOOL, number=13, oneof="filter",) - apply_label_transformer = proto.Field(proto.STRING, number=19, oneof="filter",) class Mutation(proto.Message): @@ -698,10 +884,22 @@ class SetCell(proto.Message): cell. """ - family_name = proto.Field(proto.STRING, number=1,) - column_qualifier = proto.Field(proto.BYTES, number=2,) - timestamp_micros = proto.Field(proto.INT64, number=3,) - value = proto.Field(proto.BYTES, number=4,) + family_name = proto.Field( + proto.STRING, + number=1, + ) + column_qualifier = proto.Field( + proto.BYTES, + number=2, + ) + timestamp_micros = proto.Field( + proto.INT64, + number=3, + ) + value = proto.Field( + proto.BYTES, + number=4, + ) class DeleteFromColumn(proto.Message): r"""A Mutation which deletes cells from the specified column, @@ -720,9 +918,19 @@ class DeleteFromColumn(proto.Message): should be deleted. """ - family_name = proto.Field(proto.STRING, number=1,) - column_qualifier = proto.Field(proto.BYTES, number=2,) - time_range = proto.Field(proto.MESSAGE, number=3, message="TimestampRange",) + family_name = proto.Field( + proto.STRING, + number=1, + ) + column_qualifier = proto.Field( + proto.BYTES, + number=2, + ) + time_range = proto.Field( + proto.MESSAGE, + number=3, + message="TimestampRange", + ) class DeleteFromFamily(proto.Message): r"""A Mutation which deletes all cells from the specified column @@ -734,21 +942,37 @@ class DeleteFromFamily(proto.Message): Must match ``[-_.a-zA-Z0-9]+`` """ - family_name = proto.Field(proto.STRING, number=1,) + family_name = proto.Field( + proto.STRING, + number=1, + ) class DeleteFromRow(proto.Message): - r"""A Mutation which deletes all cells from the containing row. - """ + r"""A Mutation which deletes all cells from the containing row.""" - set_cell = proto.Field(proto.MESSAGE, number=1, oneof="mutation", message=SetCell,) + set_cell = proto.Field( + proto.MESSAGE, + number=1, + oneof="mutation", + message=SetCell, + ) delete_from_column = proto.Field( - proto.MESSAGE, number=2, oneof="mutation", message=DeleteFromColumn, + proto.MESSAGE, + number=2, + oneof="mutation", + message=DeleteFromColumn, ) delete_from_family = proto.Field( - proto.MESSAGE, number=3, oneof="mutation", message=DeleteFromFamily, + proto.MESSAGE, + number=3, + oneof="mutation", + message=DeleteFromFamily, ) delete_from_row = proto.Field( - proto.MESSAGE, number=4, oneof="mutation", message=DeleteFromRow, + proto.MESSAGE, + number=4, + oneof="mutation", + message=DeleteFromRow, ) @@ -788,10 +1012,24 @@ class ReadModifyWriteRule(proto.Message): This field is a member of `oneof`_ ``rule``. """ - family_name = proto.Field(proto.STRING, number=1,) - column_qualifier = proto.Field(proto.BYTES, number=2,) - append_value = proto.Field(proto.BYTES, number=3, oneof="rule",) - increment_amount = proto.Field(proto.INT64, number=4, oneof="rule",) + family_name = proto.Field( + proto.STRING, + number=1, + ) + column_qualifier = proto.Field( + proto.BYTES, + number=2, + ) + append_value = proto.Field( + proto.BYTES, + number=3, + oneof="rule", + ) + increment_amount = proto.Field( + proto.INT64, + number=4, + oneof="rule", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 6ae044f00..73ebd799c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -24,7 +24,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -59,7 +59,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -69,7 +71,8 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) diff --git a/samples/beam/noxfile.py b/samples/beam/noxfile.py index d9d4d1469..05df27cdb 100644 --- a/samples/beam/noxfile.py +++ b/samples/beam/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/hello/noxfile.py b/samples/hello/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/hello/noxfile.py +++ b/samples/hello/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/hello_happybase/noxfile.py b/samples/hello_happybase/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/hello_happybase/noxfile.py +++ b/samples/hello_happybase/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/instanceadmin/noxfile.py b/samples/instanceadmin/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/instanceadmin/noxfile.py +++ b/samples/instanceadmin/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/metricscaler/noxfile.py b/samples/metricscaler/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/metricscaler/noxfile.py +++ b/samples/metricscaler/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/quickstart/noxfile.py b/samples/quickstart/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/quickstart/noxfile.py +++ b/samples/quickstart/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/quickstart_happybase/noxfile.py b/samples/quickstart_happybase/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/quickstart_happybase/noxfile.py +++ b/samples/quickstart_happybase/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/snippets/filters/noxfile.py b/samples/snippets/filters/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/snippets/filters/noxfile.py +++ b/samples/snippets/filters/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/snippets/reads/noxfile.py b/samples/snippets/reads/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/snippets/reads/noxfile.py +++ b/samples/snippets/reads/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/snippets/writes/noxfile.py b/samples/snippets/writes/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/snippets/writes/noxfile.py +++ b/samples/snippets/writes/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/samples/tableadmin/noxfile.py b/samples/tableadmin/noxfile.py index 4c808af73..949e0fde9 100644 --- a/samples/tableadmin/noxfile.py +++ b/samples/tableadmin/noxfile.py @@ -29,7 +29,7 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" # Copy `noxfile_config.py` to your directory and modify it instead. diff --git a/tests/system/_helpers.py b/tests/system/_helpers.py index ab4b54b05..95261879e 100644 --- a/tests/system/_helpers.py +++ b/tests/system/_helpers.py @@ -33,7 +33,9 @@ def _retry_on_unavailable(exc): retry_grpc_unavailable = retry.RetryErrors( - core_exceptions.GrpcRendezvous, error_predicate=_retry_on_unavailable, max_tries=9, + core_exceptions.GrpcRendezvous, + error_predicate=_retry_on_unavailable, + max_tries=9, ) diff --git a/tests/system/conftest.py b/tests/system/conftest.py index fdf111a53..23052f4f4 100644 --- a/tests/system/conftest.py +++ b/tests/system/conftest.py @@ -103,7 +103,9 @@ def admin_instance(admin_client, admin_instance_id, instance_labels): @pytest.fixture(scope="session") def admin_cluster(admin_instance, admin_cluster_id, location_id, serve_nodes): return admin_instance.cluster( - admin_cluster_id, location_id=location_id, serve_nodes=serve_nodes, + admin_cluster_id, + location_id=location_id, + serve_nodes=serve_nodes, ) @@ -169,7 +171,9 @@ def data_instance_populated( # See: https://cloud.google.com/bigtable/docs/emulator if not in_emulator: cluster = instance.cluster( - data_cluster_id, location_id=location_id, serve_nodes=serve_nodes, + data_cluster_id, + location_id=location_id, + serve_nodes=serve_nodes, ) operation = instance.create(clusters=[cluster]) operation.result(timeout=30) diff --git a/tests/system/test_instance_admin.py b/tests/system/test_instance_admin.py index 36b61d6dd..8c09f6d87 100644 --- a/tests/system/test_instance_admin.py +++ b/tests/system/test_instance_admin.py @@ -150,7 +150,9 @@ def test_instance_create_prod( alt_cluster_id = f"{alt_instance_id}-cluster" serve_nodes = 1 cluster = instance.cluster( - alt_cluster_id, location_id=location_id, serve_nodes=serve_nodes, + alt_cluster_id, + location_id=location_id, + serve_nodes=serve_nodes, ) operation = instance.create(clusters=[cluster]) @@ -532,7 +534,10 @@ def test_instance_update_w_type( labels=instance_labels, ) alt_cluster_id = f"{alt_instance_id}-cluster" - cluster = instance.cluster(alt_cluster_id, location_id=location_id,) + cluster = instance.cluster( + alt_cluster_id, + location_id=location_id, + ) operation = instance.create(clusters=[cluster]) instances_to_delete.append(instance) @@ -560,7 +565,9 @@ def test_cluster_exists_miss(admin_instance_populated, skip_on_emulator): def test_cluster_create( - admin_instance_populated, admin_instance_id, skip_on_emulator, + admin_instance_populated, + admin_instance_id, + skip_on_emulator, ): alt_cluster_id = f"{admin_instance_id}-c2" alt_location_id = "us-central1-f" @@ -592,7 +599,9 @@ def test_cluster_create( def test_cluster_create_w_autoscaling( - admin_instance_populated, admin_instance_id, skip_on_emulator, + admin_instance_populated, + admin_instance_id, + skip_on_emulator, ): alt_cluster_id = f"{admin_instance_id}-c2" alt_location_id = "us-central1-f" diff --git a/tests/system/test_table_admin.py b/tests/system/test_table_admin.py index 1ed540d63..92283d328 100644 --- a/tests/system/test_table_admin.py +++ b/tests/system/test_table_admin.py @@ -94,7 +94,8 @@ def test_table_create(data_instance_populated, shared_table, tables_to_delete): def test_table_create_w_families( - data_instance_populated, tables_to_delete, + data_instance_populated, + tables_to_delete, ): from google.cloud.bigtable.column_family import MaxVersionsGCRule @@ -236,7 +237,9 @@ def test_table_set_iam_policy( def test_table_test_iam_permissions( - data_instance_populated, tables_to_delete, skip_on_emulator, + data_instance_populated, + tables_to_delete, + skip_on_emulator, ): temp_table_id = "test-test-iam-policy-table" temp_table = data_instance_populated.table(temp_table_id) @@ -337,7 +340,9 @@ def test_table_backup( alt_cluster_id = f"{alt_instance_id}-cluster" alt_instance = admin_client.instance(alt_instance_id, labels=instance_labels) alt_cluster = alt_instance.cluster( - cluster_id=alt_cluster_id, location_id=location_id, serve_nodes=1, + cluster_id=alt_cluster_id, + location_id=location_id, + serve_nodes=1, ) create_op = alt_instance.create(clusters=[alt_cluster]) instances_to_delete.append(alt_instance) diff --git a/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py b/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py index 226f5acf7..99ba13137 100644 --- a/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py +++ b/tests/unit/gapic/bigtable_admin_v2/test_bigtable_instance_admin.py @@ -104,7 +104,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [BigtableInstanceAdminClient, BigtableInstanceAdminAsyncClient,] + "client_class", + [ + BigtableInstanceAdminClient, + BigtableInstanceAdminAsyncClient, + ], ) def test_bigtable_instance_admin_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -146,7 +150,11 @@ def test_bigtable_instance_admin_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [BigtableInstanceAdminClient, BigtableInstanceAdminAsyncClient,] + "client_class", + [ + BigtableInstanceAdminClient, + BigtableInstanceAdminAsyncClient, + ], ) def test_bigtable_instance_admin_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -528,7 +536,9 @@ def test_bigtable_instance_admin_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -677,11 +687,16 @@ def test_bigtable_instance_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.CreateInstanceRequest, dict,] + "request_type", + [ + bigtable_instance_admin.CreateInstanceRequest, + dict, + ], ) def test_create_instance(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -707,7 +722,8 @@ def test_create_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -724,7 +740,8 @@ async def test_create_instance_async( request_type=bigtable_instance_admin.CreateInstanceRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -776,7 +793,10 @@ def test_create_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -805,7 +825,10 @@ async def test_create_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_instance_flattened(): @@ -921,11 +944,16 @@ async def test_create_instance_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.GetInstanceRequest, dict,] + "request_type", + [ + bigtable_instance_admin.GetInstanceRequest, + dict, + ], ) def test_get_instance(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -960,7 +988,8 @@ def test_get_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -977,7 +1006,8 @@ async def test_get_instance_async( request_type=bigtable_instance_admin.GetInstanceRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1038,7 +1068,10 @@ def test_get_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1065,7 +1098,10 @@ async def test_get_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_instance_flattened(): @@ -1079,7 +1115,9 @@ def test_get_instance_flattened(): call.return_value = instance.Instance() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_instance(name="name_value",) + client.get_instance( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1099,7 +1137,8 @@ def test_get_instance_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_instance( - bigtable_instance_admin.GetInstanceRequest(), name="name_value", + bigtable_instance_admin.GetInstanceRequest(), + name="name_value", ) @@ -1117,7 +1156,9 @@ async def test_get_instance_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(instance.Instance()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_instance(name="name_value",) + response = await client.get_instance( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1138,16 +1179,22 @@ async def test_get_instance_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_instance( - bigtable_instance_admin.GetInstanceRequest(), name="name_value", + bigtable_instance_admin.GetInstanceRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.ListInstancesRequest, dict,] + "request_type", + [ + bigtable_instance_admin.ListInstancesRequest, + dict, + ], ) def test_list_instances(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1179,7 +1226,8 @@ def test_list_instances_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1196,7 +1244,8 @@ async def test_list_instances_async( request_type=bigtable_instance_admin.ListInstancesRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1253,7 +1302,10 @@ def test_list_instances_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1282,7 +1334,10 @@ async def test_list_instances_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_instances_flattened(): @@ -1296,7 +1351,9 @@ def test_list_instances_flattened(): call.return_value = bigtable_instance_admin.ListInstancesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_instances(parent="parent_value",) + client.list_instances( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1316,7 +1373,8 @@ def test_list_instances_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_instances( - bigtable_instance_admin.ListInstancesRequest(), parent="parent_value", + bigtable_instance_admin.ListInstancesRequest(), + parent="parent_value", ) @@ -1336,7 +1394,9 @@ async def test_list_instances_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_instances(parent="parent_value",) + response = await client.list_instances( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1357,14 +1417,22 @@ async def test_list_instances_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_instances( - bigtable_instance_admin.ListInstancesRequest(), parent="parent_value", + bigtable_instance_admin.ListInstancesRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [instance.Instance, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + instance.Instance, + dict, + ], +) def test_update_instance(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1399,7 +1467,8 @@ def test_update_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1415,7 +1484,8 @@ async def test_update_instance_async( transport: str = "grpc_asyncio", request_type=instance.Instance ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1476,7 +1546,10 @@ def test_update_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1503,15 +1576,23 @@ async def test_update_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.PartialUpdateInstanceRequest, dict,] + "request_type", + [ + bigtable_instance_admin.PartialUpdateInstanceRequest, + dict, + ], ) def test_partial_update_instance(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1539,7 +1620,8 @@ def test_partial_update_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1558,7 +1640,8 @@ async def test_partial_update_instance_async( request_type=bigtable_instance_admin.PartialUpdateInstanceRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1614,9 +1697,10 @@ def test_partial_update_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "instance.name=instance.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "instance.name=instance.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1647,9 +1731,10 @@ async def test_partial_update_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "instance.name=instance.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "instance.name=instance.name/value", + ) in kw["metadata"] def test_partial_update_instance_flattened(): @@ -1749,11 +1834,16 @@ async def test_partial_update_instance_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.DeleteInstanceRequest, dict,] + "request_type", + [ + bigtable_instance_admin.DeleteInstanceRequest, + dict, + ], ) def test_delete_instance(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1779,7 +1869,8 @@ def test_delete_instance_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1796,7 +1887,8 @@ async def test_delete_instance_async( request_type=bigtable_instance_admin.DeleteInstanceRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1846,7 +1938,10 @@ def test_delete_instance_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1873,7 +1968,10 @@ async def test_delete_instance_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_instance_flattened(): @@ -1887,7 +1985,9 @@ def test_delete_instance_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_instance(name="name_value",) + client.delete_instance( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1907,7 +2007,8 @@ def test_delete_instance_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_instance( - bigtable_instance_admin.DeleteInstanceRequest(), name="name_value", + bigtable_instance_admin.DeleteInstanceRequest(), + name="name_value", ) @@ -1925,7 +2026,9 @@ async def test_delete_instance_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_instance(name="name_value",) + response = await client.delete_instance( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1946,16 +2049,22 @@ async def test_delete_instance_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_instance( - bigtable_instance_admin.DeleteInstanceRequest(), name="name_value", + bigtable_instance_admin.DeleteInstanceRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.CreateClusterRequest, dict,] + "request_type", + [ + bigtable_instance_admin.CreateClusterRequest, + dict, + ], ) def test_create_cluster(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1981,7 +2090,8 @@ def test_create_cluster_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1998,7 +2108,8 @@ async def test_create_cluster_async( request_type=bigtable_instance_admin.CreateClusterRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2050,7 +2161,10 @@ def test_create_cluster_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2079,7 +2193,10 @@ async def test_create_cluster_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_cluster_flattened(): @@ -2185,11 +2302,16 @@ async def test_create_cluster_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.GetClusterRequest, dict,] + "request_type", + [ + bigtable_instance_admin.GetClusterRequest, + dict, + ], ) def test_get_cluster(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2231,7 +2353,8 @@ def test_get_cluster_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2248,7 +2371,8 @@ async def test_get_cluster_async( request_type=bigtable_instance_admin.GetClusterRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2311,7 +2435,10 @@ def test_get_cluster_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2338,7 +2465,10 @@ async def test_get_cluster_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_cluster_flattened(): @@ -2352,7 +2482,9 @@ def test_get_cluster_flattened(): call.return_value = instance.Cluster() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_cluster(name="name_value",) + client.get_cluster( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2372,7 +2504,8 @@ def test_get_cluster_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_cluster( - bigtable_instance_admin.GetClusterRequest(), name="name_value", + bigtable_instance_admin.GetClusterRequest(), + name="name_value", ) @@ -2390,7 +2523,9 @@ async def test_get_cluster_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(instance.Cluster()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_cluster(name="name_value",) + response = await client.get_cluster( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2411,16 +2546,22 @@ async def test_get_cluster_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_cluster( - bigtable_instance_admin.GetClusterRequest(), name="name_value", + bigtable_instance_admin.GetClusterRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.ListClustersRequest, dict,] + "request_type", + [ + bigtable_instance_admin.ListClustersRequest, + dict, + ], ) def test_list_clusters(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2452,7 +2593,8 @@ def test_list_clusters_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2469,7 +2611,8 @@ async def test_list_clusters_async( request_type=bigtable_instance_admin.ListClustersRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2526,7 +2669,10 @@ def test_list_clusters_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2555,7 +2701,10 @@ async def test_list_clusters_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_clusters_flattened(): @@ -2569,7 +2718,9 @@ def test_list_clusters_flattened(): call.return_value = bigtable_instance_admin.ListClustersResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_clusters(parent="parent_value",) + client.list_clusters( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2589,7 +2740,8 @@ def test_list_clusters_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_clusters( - bigtable_instance_admin.ListClustersRequest(), parent="parent_value", + bigtable_instance_admin.ListClustersRequest(), + parent="parent_value", ) @@ -2609,7 +2761,9 @@ async def test_list_clusters_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_clusters(parent="parent_value",) + response = await client.list_clusters( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2630,14 +2784,22 @@ async def test_list_clusters_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_clusters( - bigtable_instance_admin.ListClustersRequest(), parent="parent_value", + bigtable_instance_admin.ListClustersRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [instance.Cluster, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + instance.Cluster, + dict, + ], +) def test_update_cluster(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2663,7 +2825,8 @@ def test_update_cluster_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2679,7 +2842,8 @@ async def test_update_cluster_async( transport: str = "grpc_asyncio", request_type=instance.Cluster ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2731,7 +2895,10 @@ def test_update_cluster_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2760,15 +2927,23 @@ async def test_update_cluster_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.PartialUpdateClusterRequest, dict,] + "request_type", + [ + bigtable_instance_admin.PartialUpdateClusterRequest, + dict, + ], ) def test_partial_update_cluster(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2796,7 +2971,8 @@ def test_partial_update_cluster_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2815,7 +2991,8 @@ async def test_partial_update_cluster_async( request_type=bigtable_instance_admin.PartialUpdateClusterRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2871,9 +3048,10 @@ def test_partial_update_cluster_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "cluster.name=cluster.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "cluster.name=cluster.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2904,9 +3082,10 @@ async def test_partial_update_cluster_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "cluster.name=cluster.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "cluster.name=cluster.name/value", + ) in kw["metadata"] def test_partial_update_cluster_flattened(): @@ -3006,11 +3185,16 @@ async def test_partial_update_cluster_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.DeleteClusterRequest, dict,] + "request_type", + [ + bigtable_instance_admin.DeleteClusterRequest, + dict, + ], ) def test_delete_cluster(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3036,7 +3220,8 @@ def test_delete_cluster_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3053,7 +3238,8 @@ async def test_delete_cluster_async( request_type=bigtable_instance_admin.DeleteClusterRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3103,7 +3289,10 @@ def test_delete_cluster_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3130,7 +3319,10 @@ async def test_delete_cluster_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_cluster_flattened(): @@ -3144,7 +3336,9 @@ def test_delete_cluster_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_cluster(name="name_value",) + client.delete_cluster( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3164,7 +3358,8 @@ def test_delete_cluster_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_cluster( - bigtable_instance_admin.DeleteClusterRequest(), name="name_value", + bigtable_instance_admin.DeleteClusterRequest(), + name="name_value", ) @@ -3182,7 +3377,9 @@ async def test_delete_cluster_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_cluster(name="name_value",) + response = await client.delete_cluster( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3203,16 +3400,22 @@ async def test_delete_cluster_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_cluster( - bigtable_instance_admin.DeleteClusterRequest(), name="name_value", + bigtable_instance_admin.DeleteClusterRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.CreateAppProfileRequest, dict,] + "request_type", + [ + bigtable_instance_admin.CreateAppProfileRequest, + dict, + ], ) def test_create_app_profile(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3250,7 +3453,8 @@ def test_create_app_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3269,7 +3473,8 @@ async def test_create_app_profile_async( request_type=bigtable_instance_admin.CreateAppProfileRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3283,7 +3488,9 @@ async def test_create_app_profile_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( instance.AppProfile( - name="name_value", etag="etag_value", description="description_value", + name="name_value", + etag="etag_value", + description="description_value", ) ) response = await client.create_app_profile(request) @@ -3330,7 +3537,10 @@ def test_create_app_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3359,7 +3569,10 @@ async def test_create_app_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_app_profile_flattened(): @@ -3467,11 +3680,16 @@ async def test_create_app_profile_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.GetAppProfileRequest, dict,] + "request_type", + [ + bigtable_instance_admin.GetAppProfileRequest, + dict, + ], ) def test_get_app_profile(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3507,7 +3725,8 @@ def test_get_app_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3524,7 +3743,8 @@ async def test_get_app_profile_async( request_type=bigtable_instance_admin.GetAppProfileRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3536,7 +3756,9 @@ async def test_get_app_profile_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( instance.AppProfile( - name="name_value", etag="etag_value", description="description_value", + name="name_value", + etag="etag_value", + description="description_value", ) ) response = await client.get_app_profile(request) @@ -3581,7 +3803,10 @@ def test_get_app_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3608,7 +3833,10 @@ async def test_get_app_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_app_profile_flattened(): @@ -3622,7 +3850,9 @@ def test_get_app_profile_flattened(): call.return_value = instance.AppProfile() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_app_profile(name="name_value",) + client.get_app_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3642,7 +3872,8 @@ def test_get_app_profile_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_app_profile( - bigtable_instance_admin.GetAppProfileRequest(), name="name_value", + bigtable_instance_admin.GetAppProfileRequest(), + name="name_value", ) @@ -3660,7 +3891,9 @@ async def test_get_app_profile_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(instance.AppProfile()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_app_profile(name="name_value",) + response = await client.get_app_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3681,16 +3914,22 @@ async def test_get_app_profile_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_app_profile( - bigtable_instance_admin.GetAppProfileRequest(), name="name_value", + bigtable_instance_admin.GetAppProfileRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.ListAppProfilesRequest, dict,] + "request_type", + [ + bigtable_instance_admin.ListAppProfilesRequest, + dict, + ], ) def test_list_app_profiles(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3723,7 +3962,8 @@ def test_list_app_profiles_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3742,7 +3982,8 @@ async def test_list_app_profiles_async( request_type=bigtable_instance_admin.ListAppProfilesRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3803,7 +4044,10 @@ def test_list_app_profiles_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3834,7 +4078,10 @@ async def test_list_app_profiles_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_app_profiles_flattened(): @@ -3850,7 +4097,9 @@ def test_list_app_profiles_flattened(): call.return_value = bigtable_instance_admin.ListAppProfilesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_app_profiles(parent="parent_value",) + client.list_app_profiles( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3870,7 +4119,8 @@ def test_list_app_profiles_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_app_profiles( - bigtable_instance_admin.ListAppProfilesRequest(), parent="parent_value", + bigtable_instance_admin.ListAppProfilesRequest(), + parent="parent_value", ) @@ -3892,7 +4142,9 @@ async def test_list_app_profiles_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_app_profiles(parent="parent_value",) + response = await client.list_app_profiles( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3913,13 +4165,15 @@ async def test_list_app_profiles_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_app_profiles( - bigtable_instance_admin.ListAppProfilesRequest(), parent="parent_value", + bigtable_instance_admin.ListAppProfilesRequest(), + parent="parent_value", ) def test_list_app_profiles_pager(transport_name: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3937,13 +4191,20 @@ def test_list_app_profiles_pager(transport_name: str = "grpc"): next_page_token="abc", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[], next_page_token="def", + app_profiles=[], + next_page_token="def", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(),], next_page_token="ghi", + app_profiles=[ + instance.AppProfile(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(), instance.AppProfile(),], + app_profiles=[ + instance.AppProfile(), + instance.AppProfile(), + ], ), RuntimeError, ) @@ -3963,7 +4224,8 @@ def test_list_app_profiles_pager(transport_name: str = "grpc"): def test_list_app_profiles_pages(transport_name: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3981,13 +4243,20 @@ def test_list_app_profiles_pages(transport_name: str = "grpc"): next_page_token="abc", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[], next_page_token="def", + app_profiles=[], + next_page_token="def", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(),], next_page_token="ghi", + app_profiles=[ + instance.AppProfile(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(), instance.AppProfile(),], + app_profiles=[ + instance.AppProfile(), + instance.AppProfile(), + ], ), RuntimeError, ) @@ -4019,17 +4288,26 @@ async def test_list_app_profiles_async_pager(): next_page_token="abc", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[], next_page_token="def", + app_profiles=[], + next_page_token="def", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(),], next_page_token="ghi", + app_profiles=[ + instance.AppProfile(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(), instance.AppProfile(),], + app_profiles=[ + instance.AppProfile(), + instance.AppProfile(), + ], ), RuntimeError, ) - async_pager = await client.list_app_profiles(request={},) + async_pager = await client.list_app_profiles( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -4062,13 +4340,20 @@ async def test_list_app_profiles_async_pages(): next_page_token="abc", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[], next_page_token="def", + app_profiles=[], + next_page_token="def", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(),], next_page_token="ghi", + app_profiles=[ + instance.AppProfile(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListAppProfilesResponse( - app_profiles=[instance.AppProfile(), instance.AppProfile(),], + app_profiles=[ + instance.AppProfile(), + instance.AppProfile(), + ], ), RuntimeError, ) @@ -4080,11 +4365,16 @@ async def test_list_app_profiles_async_pages(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.UpdateAppProfileRequest, dict,] + "request_type", + [ + bigtable_instance_admin.UpdateAppProfileRequest, + dict, + ], ) def test_update_app_profile(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4112,7 +4402,8 @@ def test_update_app_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4131,7 +4422,8 @@ async def test_update_app_profile_async( request_type=bigtable_instance_admin.UpdateAppProfileRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4187,9 +4479,10 @@ def test_update_app_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "app_profile.name=app_profile.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "app_profile.name=app_profile.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4220,9 +4513,10 @@ async def test_update_app_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "app_profile.name=app_profile.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "app_profile.name=app_profile.name/value", + ) in kw["metadata"] def test_update_app_profile_flattened(): @@ -4322,11 +4616,16 @@ async def test_update_app_profile_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.DeleteAppProfileRequest, dict,] + "request_type", + [ + bigtable_instance_admin.DeleteAppProfileRequest, + dict, + ], ) def test_delete_app_profile(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4354,7 +4653,8 @@ def test_delete_app_profile_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4373,7 +4673,8 @@ async def test_delete_app_profile_async( request_type=bigtable_instance_admin.DeleteAppProfileRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4427,7 +4728,10 @@ def test_delete_app_profile_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4456,7 +4760,10 @@ async def test_delete_app_profile_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_app_profile_flattened(): @@ -4472,7 +4779,9 @@ def test_delete_app_profile_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_app_profile(name="name_value",) + client.delete_app_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4492,7 +4801,8 @@ def test_delete_app_profile_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_app_profile( - bigtable_instance_admin.DeleteAppProfileRequest(), name="name_value", + bigtable_instance_admin.DeleteAppProfileRequest(), + name="name_value", ) @@ -4512,7 +4822,9 @@ async def test_delete_app_profile_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_app_profile(name="name_value",) + response = await client.delete_app_profile( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4533,14 +4845,22 @@ async def test_delete_app_profile_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_app_profile( - bigtable_instance_admin.DeleteAppProfileRequest(), name="name_value", + bigtable_instance_admin.DeleteAppProfileRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) def test_get_iam_policy(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4550,7 +4870,10 @@ def test_get_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -4568,7 +4891,8 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4584,7 +4908,8 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4595,7 +4920,10 @@ async def test_get_iam_policy_async( with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -4638,7 +4966,10 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4665,7 +4996,10 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_get_iam_policy_from_dict_foreign(): @@ -4696,7 +5030,9 @@ def test_get_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_iam_policy(resource="resource_value",) + client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4716,7 +5052,8 @@ def test_get_iam_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) @@ -4734,7 +5071,9 @@ async def test_get_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_iam_policy(resource="resource_value",) + response = await client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4755,14 +5094,22 @@ async def test_get_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.SetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) def test_set_iam_policy(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4772,7 +5119,10 @@ def test_set_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -4790,7 +5140,8 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4806,7 +5157,8 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4817,7 +5169,10 @@ async def test_set_iam_policy_async( with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -4860,7 +5215,10 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4887,7 +5245,10 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_set_iam_policy_from_dict_foreign(): @@ -4918,7 +5279,9 @@ def test_set_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.set_iam_policy(resource="resource_value",) + client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4938,7 +5301,8 @@ def test_set_iam_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) @@ -4956,7 +5320,9 @@ async def test_set_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.set_iam_policy(resource="resource_value",) + response = await client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4977,16 +5343,22 @@ async def test_set_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) @pytest.mark.parametrize( - "request_type", [iam_policy_pb2.TestIamPermissionsRequest, dict,] + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5017,7 +5389,8 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5036,7 +5409,8 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5095,7 +5469,10 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5126,7 +5503,10 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict_foreign(): @@ -5162,7 +5542,8 @@ def test_test_iam_permissions_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -5211,7 +5592,8 @@ async def test_test_iam_permissions_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -5243,11 +5625,16 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_instance_admin.ListHotTabletsRequest, dict,] + "request_type", + [ + bigtable_instance_admin.ListHotTabletsRequest, + dict, + ], ) def test_list_hot_tablets(request_type, transport: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5276,7 +5663,8 @@ def test_list_hot_tablets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5293,7 +5681,8 @@ async def test_list_hot_tablets_async( request_type=bigtable_instance_admin.ListHotTabletsRequest, ): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5348,7 +5737,10 @@ def test_list_hot_tablets_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5377,7 +5769,10 @@ async def test_list_hot_tablets_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_hot_tablets_flattened(): @@ -5391,7 +5786,9 @@ def test_list_hot_tablets_flattened(): call.return_value = bigtable_instance_admin.ListHotTabletsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_hot_tablets(parent="parent_value",) + client.list_hot_tablets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5411,7 +5808,8 @@ def test_list_hot_tablets_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_hot_tablets( - bigtable_instance_admin.ListHotTabletsRequest(), parent="parent_value", + bigtable_instance_admin.ListHotTabletsRequest(), + parent="parent_value", ) @@ -5431,7 +5829,9 @@ async def test_list_hot_tablets_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_hot_tablets(parent="parent_value",) + response = await client.list_hot_tablets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5452,13 +5852,15 @@ async def test_list_hot_tablets_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_hot_tablets( - bigtable_instance_admin.ListHotTabletsRequest(), parent="parent_value", + bigtable_instance_admin.ListHotTabletsRequest(), + parent="parent_value", ) def test_list_hot_tablets_pager(transport_name: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5474,13 +5876,20 @@ def test_list_hot_tablets_pager(transport_name: str = "grpc"): next_page_token="abc", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[], next_page_token="def", + hot_tablets=[], + next_page_token="def", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + hot_tablets=[ + instance.HotTablet(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + ], ), RuntimeError, ) @@ -5500,7 +5909,8 @@ def test_list_hot_tablets_pager(transport_name: str = "grpc"): def test_list_hot_tablets_pages(transport_name: str = "grpc"): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5516,13 +5926,20 @@ def test_list_hot_tablets_pages(transport_name: str = "grpc"): next_page_token="abc", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[], next_page_token="def", + hot_tablets=[], + next_page_token="def", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + hot_tablets=[ + instance.HotTablet(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + ], ), RuntimeError, ) @@ -5552,17 +5969,26 @@ async def test_list_hot_tablets_async_pager(): next_page_token="abc", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[], next_page_token="def", + hot_tablets=[], + next_page_token="def", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + hot_tablets=[ + instance.HotTablet(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + ], ), RuntimeError, ) - async_pager = await client.list_hot_tablets(request={},) + async_pager = await client.list_hot_tablets( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -5593,13 +6019,20 @@ async def test_list_hot_tablets_async_pages(): next_page_token="abc", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[], next_page_token="def", + hot_tablets=[], + next_page_token="def", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(),], next_page_token="ghi", + hot_tablets=[ + instance.HotTablet(), + ], + next_page_token="ghi", ), bigtable_instance_admin.ListHotTabletsResponse( - hot_tablets=[instance.HotTablet(), instance.HotTablet(),], + hot_tablets=[ + instance.HotTablet(), + instance.HotTablet(), + ], ), RuntimeError, ) @@ -5617,7 +6050,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -5638,7 +6072,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = BigtableInstanceAdminClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -5655,7 +6090,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BigtableInstanceAdminClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5703,7 +6139,10 @@ def test_transport_grpc_default(): client = BigtableInstanceAdminClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.BigtableInstanceAdminGrpcTransport,) + assert isinstance( + client.transport, + transports.BigtableInstanceAdminGrpcTransport, + ) def test_bigtable_instance_admin_base_transport_error(): @@ -5773,7 +6212,8 @@ def test_bigtable_instance_admin_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BigtableInstanceAdminTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5967,7 +6407,8 @@ def test_bigtable_instance_admin_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.BigtableInstanceAdminGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5979,7 +6420,8 @@ def test_bigtable_instance_admin_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.BigtableInstanceAdminGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6088,12 +6530,16 @@ def test_bigtable_instance_admin_transport_channel_mtls_with_adc(transport_class def test_bigtable_instance_admin_grpc_lro_client(): client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6101,12 +6547,16 @@ def test_bigtable_instance_admin_grpc_lro_client(): def test_bigtable_instance_admin_grpc_lro_async_client(): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6116,8 +6566,12 @@ def test_app_profile_path(): project = "squid" instance = "clam" app_profile = "whelk" - expected = "projects/{project}/instances/{instance}/appProfiles/{app_profile}".format( - project=project, instance=instance, app_profile=app_profile, + expected = ( + "projects/{project}/instances/{instance}/appProfiles/{app_profile}".format( + project=project, + instance=instance, + app_profile=app_profile, + ) ) actual = BigtableInstanceAdminClient.app_profile_path( project, instance, app_profile @@ -6143,7 +6597,9 @@ def test_cluster_path(): instance = "mussel" cluster = "winkle" expected = "projects/{project}/instances/{instance}/clusters/{cluster}".format( - project=project, instance=instance, cluster=cluster, + project=project, + instance=instance, + cluster=cluster, ) actual = BigtableInstanceAdminClient.cluster_path(project, instance, cluster) assert expected == actual @@ -6168,7 +6624,10 @@ def test_crypto_key_path(): key_ring = "whelk" crypto_key = "octopus" expected = "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format( - project=project, location=location, key_ring=key_ring, crypto_key=crypto_key, + project=project, + location=location, + key_ring=key_ring, + crypto_key=crypto_key, ) actual = BigtableInstanceAdminClient.crypto_key_path( project, location, key_ring, crypto_key @@ -6196,7 +6655,10 @@ def test_hot_tablet_path(): cluster = "scallop" hot_tablet = "abalone" expected = "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}".format( - project=project, instance=instance, cluster=cluster, hot_tablet=hot_tablet, + project=project, + instance=instance, + cluster=cluster, + hot_tablet=hot_tablet, ) actual = BigtableInstanceAdminClient.hot_tablet_path( project, instance, cluster, hot_tablet @@ -6222,7 +6684,8 @@ def test_instance_path(): project = "oyster" instance = "nudibranch" expected = "projects/{project}/instances/{instance}".format( - project=project, instance=instance, + project=project, + instance=instance, ) actual = BigtableInstanceAdminClient.instance_path(project, instance) assert expected == actual @@ -6245,7 +6708,9 @@ def test_table_path(): instance = "nautilus" table = "scallop" expected = "projects/{project}/instances/{instance}/tables/{table}".format( - project=project, instance=instance, table=table, + project=project, + instance=instance, + table=table, ) actual = BigtableInstanceAdminClient.table_path(project, instance, table) assert expected == actual @@ -6286,7 +6751,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = BigtableInstanceAdminClient.common_folder_path(folder) assert expected == actual @@ -6304,7 +6771,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = BigtableInstanceAdminClient.common_organization_path(organization) assert expected == actual @@ -6322,7 +6791,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = BigtableInstanceAdminClient.common_project_path(project) assert expected == actual @@ -6342,7 +6813,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = BigtableInstanceAdminClient.common_location_path(project, location) assert expected == actual @@ -6367,7 +6839,8 @@ def test_client_with_default_client_info(): transports.BigtableInstanceAdminTransport, "_prep_wrapped_messages" ) as prep: client = BigtableInstanceAdminClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6376,7 +6849,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BigtableInstanceAdminClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6384,7 +6858,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = BigtableInstanceAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/bigtable_admin_v2/test_bigtable_table_admin.py b/tests/unit/gapic/bigtable_admin_v2/test_bigtable_table_admin.py index 439b62113..f549bde0d 100644 --- a/tests/unit/gapic/bigtable_admin_v2/test_bigtable_table_admin.py +++ b/tests/unit/gapic/bigtable_admin_v2/test_bigtable_table_admin.py @@ -106,7 +106,11 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [BigtableTableAdminClient, BigtableTableAdminAsyncClient,] + "client_class", + [ + BigtableTableAdminClient, + BigtableTableAdminAsyncClient, + ], ) def test_bigtable_table_admin_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() @@ -148,7 +152,11 @@ def test_bigtable_table_admin_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [BigtableTableAdminClient, BigtableTableAdminAsyncClient,] + "client_class", + [ + BigtableTableAdminClient, + BigtableTableAdminAsyncClient, + ], ) def test_bigtable_table_admin_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() @@ -522,7 +530,9 @@ def test_bigtable_table_admin_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -670,11 +680,16 @@ def test_bigtable_table_admin_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.CreateTableRequest, dict,] + "request_type", + [ + bigtable_table_admin.CreateTableRequest, + dict, + ], ) def test_create_table(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -685,7 +700,8 @@ def test_create_table(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.create_table), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = gba_table.Table( - name="name_value", granularity=gba_table.Table.TimestampGranularity.MILLIS, + name="name_value", + granularity=gba_table.Table.TimestampGranularity.MILLIS, ) response = client.create_table(request) @@ -704,7 +720,8 @@ def test_create_table_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -721,7 +738,8 @@ async def test_create_table_async( request_type=bigtable_table_admin.CreateTableRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -778,7 +796,10 @@ def test_create_table_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -805,7 +826,10 @@ async def test_create_table_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_table_flattened(): @@ -909,11 +933,16 @@ async def test_create_table_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.CreateTableFromSnapshotRequest, dict,] + "request_type", + [ + bigtable_table_admin.CreateTableFromSnapshotRequest, + dict, + ], ) def test_create_table_from_snapshot(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -941,7 +970,8 @@ def test_create_table_from_snapshot_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -960,7 +990,8 @@ async def test_create_table_from_snapshot_async( request_type=bigtable_table_admin.CreateTableFromSnapshotRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1016,7 +1047,10 @@ def test_create_table_from_snapshot_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1047,7 +1081,10 @@ async def test_create_table_from_snapshot_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_table_from_snapshot_flattened(): @@ -1157,11 +1194,16 @@ async def test_create_table_from_snapshot_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.ListTablesRequest, dict,] + "request_type", + [ + bigtable_table_admin.ListTablesRequest, + dict, + ], ) def test_list_tables(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1190,7 +1232,8 @@ def test_list_tables_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1206,7 +1249,8 @@ async def test_list_tables_async( transport: str = "grpc_asyncio", request_type=bigtable_table_admin.ListTablesRequest ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1261,7 +1305,10 @@ def test_list_tables_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1290,7 +1337,10 @@ async def test_list_tables_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_tables_flattened(): @@ -1304,7 +1354,9 @@ def test_list_tables_flattened(): call.return_value = bigtable_table_admin.ListTablesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_tables(parent="parent_value",) + client.list_tables( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1324,7 +1376,8 @@ def test_list_tables_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_tables( - bigtable_table_admin.ListTablesRequest(), parent="parent_value", + bigtable_table_admin.ListTablesRequest(), + parent="parent_value", ) @@ -1344,7 +1397,9 @@ async def test_list_tables_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_tables(parent="parent_value",) + response = await client.list_tables( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1365,13 +1420,15 @@ async def test_list_tables_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_tables( - bigtable_table_admin.ListTablesRequest(), parent="parent_value", + bigtable_table_admin.ListTablesRequest(), + parent="parent_value", ) def test_list_tables_pager(transport_name: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1379,15 +1436,28 @@ def test_list_tables_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(), table.Table(),], + tables=[ + table.Table(), + table.Table(), + table.Table(), + ], next_page_token="abc", ), - bigtable_table_admin.ListTablesResponse(tables=[], next_page_token="def",), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(),], next_page_token="ghi", + tables=[], + next_page_token="def", ), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(),], + tables=[ + table.Table(), + ], + next_page_token="ghi", + ), + bigtable_table_admin.ListTablesResponse( + tables=[ + table.Table(), + table.Table(), + ], ), RuntimeError, ) @@ -1407,7 +1477,8 @@ def test_list_tables_pager(transport_name: str = "grpc"): def test_list_tables_pages(transport_name: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1415,15 +1486,28 @@ def test_list_tables_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(), table.Table(),], + tables=[ + table.Table(), + table.Table(), + table.Table(), + ], next_page_token="abc", ), - bigtable_table_admin.ListTablesResponse(tables=[], next_page_token="def",), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(),], next_page_token="ghi", + tables=[], + next_page_token="def", + ), + bigtable_table_admin.ListTablesResponse( + tables=[ + table.Table(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(),], + tables=[ + table.Table(), + table.Table(), + ], ), RuntimeError, ) @@ -1445,19 +1529,34 @@ async def test_list_tables_async_pager(): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(), table.Table(),], + tables=[ + table.Table(), + table.Table(), + table.Table(), + ], next_page_token="abc", ), - bigtable_table_admin.ListTablesResponse(tables=[], next_page_token="def",), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(),], next_page_token="ghi", + tables=[], + next_page_token="def", ), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(),], + tables=[ + table.Table(), + ], + next_page_token="ghi", + ), + bigtable_table_admin.ListTablesResponse( + tables=[ + table.Table(), + table.Table(), + ], ), RuntimeError, ) - async_pager = await client.list_tables(request={},) + async_pager = await client.list_tables( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -1480,15 +1579,28 @@ async def test_list_tables_async_pages(): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(), table.Table(),], + tables=[ + table.Table(), + table.Table(), + table.Table(), + ], next_page_token="abc", ), - bigtable_table_admin.ListTablesResponse(tables=[], next_page_token="def",), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(),], next_page_token="ghi", + tables=[], + next_page_token="def", + ), + bigtable_table_admin.ListTablesResponse( + tables=[ + table.Table(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListTablesResponse( - tables=[table.Table(), table.Table(),], + tables=[ + table.Table(), + table.Table(), + ], ), RuntimeError, ) @@ -1499,10 +1611,17 @@ async def test_list_tables_async_pages(): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [bigtable_table_admin.GetTableRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable_table_admin.GetTableRequest, + dict, + ], +) def test_get_table(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1513,7 +1632,8 @@ def test_get_table(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.get_table), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = table.Table( - name="name_value", granularity=table.Table.TimestampGranularity.MILLIS, + name="name_value", + granularity=table.Table.TimestampGranularity.MILLIS, ) response = client.get_table(request) @@ -1532,7 +1652,8 @@ def test_get_table_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1548,7 +1669,8 @@ async def test_get_table_async( transport: str = "grpc_asyncio", request_type=bigtable_table_admin.GetTableRequest ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1560,7 +1682,8 @@ async def test_get_table_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( table.Table( - name="name_value", granularity=table.Table.TimestampGranularity.MILLIS, + name="name_value", + granularity=table.Table.TimestampGranularity.MILLIS, ) ) response = await client.get_table(request) @@ -1604,7 +1727,10 @@ def test_get_table_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1631,7 +1757,10 @@ async def test_get_table_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_table_flattened(): @@ -1645,7 +1774,9 @@ def test_get_table_flattened(): call.return_value = table.Table() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_table(name="name_value",) + client.get_table( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1665,7 +1796,8 @@ def test_get_table_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_table( - bigtable_table_admin.GetTableRequest(), name="name_value", + bigtable_table_admin.GetTableRequest(), + name="name_value", ) @@ -1683,7 +1815,9 @@ async def test_get_table_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(table.Table()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_table(name="name_value",) + response = await client.get_table( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1704,16 +1838,22 @@ async def test_get_table_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_table( - bigtable_table_admin.GetTableRequest(), name="name_value", + bigtable_table_admin.GetTableRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.DeleteTableRequest, dict,] + "request_type", + [ + bigtable_table_admin.DeleteTableRequest, + dict, + ], ) def test_delete_table(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1739,7 +1879,8 @@ def test_delete_table_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1756,7 +1897,8 @@ async def test_delete_table_async( request_type=bigtable_table_admin.DeleteTableRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1806,7 +1948,10 @@ def test_delete_table_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1833,7 +1978,10 @@ async def test_delete_table_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_table_flattened(): @@ -1847,7 +1995,9 @@ def test_delete_table_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_table(name="name_value",) + client.delete_table( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1867,7 +2017,8 @@ def test_delete_table_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_table( - bigtable_table_admin.DeleteTableRequest(), name="name_value", + bigtable_table_admin.DeleteTableRequest(), + name="name_value", ) @@ -1885,7 +2036,9 @@ async def test_delete_table_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_table(name="name_value",) + response = await client.delete_table( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1906,16 +2059,22 @@ async def test_delete_table_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_table( - bigtable_table_admin.DeleteTableRequest(), name="name_value", + bigtable_table_admin.DeleteTableRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.ModifyColumnFamiliesRequest, dict,] + "request_type", + [ + bigtable_table_admin.ModifyColumnFamiliesRequest, + dict, + ], ) def test_modify_column_families(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1928,7 +2087,8 @@ def test_modify_column_families(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = table.Table( - name="name_value", granularity=table.Table.TimestampGranularity.MILLIS, + name="name_value", + granularity=table.Table.TimestampGranularity.MILLIS, ) response = client.modify_column_families(request) @@ -1947,7 +2107,8 @@ def test_modify_column_families_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1966,7 +2127,8 @@ async def test_modify_column_families_async( request_type=bigtable_table_admin.ModifyColumnFamiliesRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1980,7 +2142,8 @@ async def test_modify_column_families_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( table.Table( - name="name_value", granularity=table.Table.TimestampGranularity.MILLIS, + name="name_value", + granularity=table.Table.TimestampGranularity.MILLIS, ) ) response = await client.modify_column_families(request) @@ -2026,7 +2189,10 @@ def test_modify_column_families_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2055,7 +2221,10 @@ async def test_modify_column_families_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_modify_column_families_flattened(): @@ -2173,11 +2342,16 @@ async def test_modify_column_families_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.DropRowRangeRequest, dict,] + "request_type", + [ + bigtable_table_admin.DropRowRangeRequest, + dict, + ], ) def test_drop_row_range(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2203,7 +2377,8 @@ def test_drop_row_range_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2220,7 +2395,8 @@ async def test_drop_row_range_async( request_type=bigtable_table_admin.DropRowRangeRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2270,7 +2446,10 @@ def test_drop_row_range_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2297,15 +2476,23 @@ async def test_drop_row_range_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.GenerateConsistencyTokenRequest, dict,] + "request_type", + [ + bigtable_table_admin.GenerateConsistencyTokenRequest, + dict, + ], ) def test_generate_consistency_token(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2336,7 +2523,8 @@ def test_generate_consistency_token_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2355,7 +2543,8 @@ async def test_generate_consistency_token_async( request_type=bigtable_table_admin.GenerateConsistencyTokenRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2414,7 +2603,10 @@ def test_generate_consistency_token_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2445,7 +2637,10 @@ async def test_generate_consistency_token_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_generate_consistency_token_flattened(): @@ -2461,7 +2656,9 @@ def test_generate_consistency_token_flattened(): call.return_value = bigtable_table_admin.GenerateConsistencyTokenResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.generate_consistency_token(name="name_value",) + client.generate_consistency_token( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2481,7 +2678,8 @@ def test_generate_consistency_token_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.generate_consistency_token( - bigtable_table_admin.GenerateConsistencyTokenRequest(), name="name_value", + bigtable_table_admin.GenerateConsistencyTokenRequest(), + name="name_value", ) @@ -2503,7 +2701,9 @@ async def test_generate_consistency_token_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.generate_consistency_token(name="name_value",) + response = await client.generate_consistency_token( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2524,16 +2724,22 @@ async def test_generate_consistency_token_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.generate_consistency_token( - bigtable_table_admin.GenerateConsistencyTokenRequest(), name="name_value", + bigtable_table_admin.GenerateConsistencyTokenRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.CheckConsistencyRequest, dict,] + "request_type", + [ + bigtable_table_admin.CheckConsistencyRequest, + dict, + ], ) def test_check_consistency(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2564,7 +2770,8 @@ def test_check_consistency_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2583,7 +2790,8 @@ async def test_check_consistency_async( request_type=bigtable_table_admin.CheckConsistencyRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2596,7 +2804,9 @@ async def test_check_consistency_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - bigtable_table_admin.CheckConsistencyResponse(consistent=True,) + bigtable_table_admin.CheckConsistencyResponse( + consistent=True, + ) ) response = await client.check_consistency(request) @@ -2640,7 +2850,10 @@ def test_check_consistency_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2671,7 +2884,10 @@ async def test_check_consistency_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_check_consistency_flattened(): @@ -2688,7 +2904,8 @@ def test_check_consistency_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.check_consistency( - name="name_value", consistency_token="consistency_token_value", + name="name_value", + consistency_token="consistency_token_value", ) # Establish that the underlying call was made with the expected @@ -2737,7 +2954,8 @@ async def test_check_consistency_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.check_consistency( - name="name_value", consistency_token="consistency_token_value", + name="name_value", + consistency_token="consistency_token_value", ) # Establish that the underlying call was made with the expected @@ -2769,11 +2987,16 @@ async def test_check_consistency_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.SnapshotTableRequest, dict,] + "request_type", + [ + bigtable_table_admin.SnapshotTableRequest, + dict, + ], ) def test_snapshot_table(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2799,7 +3022,8 @@ def test_snapshot_table_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2816,7 +3040,8 @@ async def test_snapshot_table_async( request_type=bigtable_table_admin.SnapshotTableRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2868,7 +3093,10 @@ def test_snapshot_table_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2897,7 +3125,10 @@ async def test_snapshot_table_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_snapshot_table_flattened(): @@ -3013,11 +3244,16 @@ async def test_snapshot_table_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.GetSnapshotRequest, dict,] + "request_type", + [ + bigtable_table_admin.GetSnapshotRequest, + dict, + ], ) def test_get_snapshot(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3052,7 +3288,8 @@ def test_get_snapshot_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3069,7 +3306,8 @@ async def test_get_snapshot_async( request_type=bigtable_table_admin.GetSnapshotRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3130,7 +3368,10 @@ def test_get_snapshot_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3157,7 +3398,10 @@ async def test_get_snapshot_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_snapshot_flattened(): @@ -3171,7 +3415,9 @@ def test_get_snapshot_flattened(): call.return_value = table.Snapshot() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_snapshot(name="name_value",) + client.get_snapshot( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3191,7 +3437,8 @@ def test_get_snapshot_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_snapshot( - bigtable_table_admin.GetSnapshotRequest(), name="name_value", + bigtable_table_admin.GetSnapshotRequest(), + name="name_value", ) @@ -3209,7 +3456,9 @@ async def test_get_snapshot_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(table.Snapshot()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_snapshot(name="name_value",) + response = await client.get_snapshot( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3230,16 +3479,22 @@ async def test_get_snapshot_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_snapshot( - bigtable_table_admin.GetSnapshotRequest(), name="name_value", + bigtable_table_admin.GetSnapshotRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.ListSnapshotsRequest, dict,] + "request_type", + [ + bigtable_table_admin.ListSnapshotsRequest, + dict, + ], ) def test_list_snapshots(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3268,7 +3523,8 @@ def test_list_snapshots_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3285,7 +3541,8 @@ async def test_list_snapshots_async( request_type=bigtable_table_admin.ListSnapshotsRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3340,7 +3597,10 @@ def test_list_snapshots_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3369,7 +3629,10 @@ async def test_list_snapshots_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_snapshots_flattened(): @@ -3383,7 +3646,9 @@ def test_list_snapshots_flattened(): call.return_value = bigtable_table_admin.ListSnapshotsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_snapshots(parent="parent_value",) + client.list_snapshots( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3403,7 +3668,8 @@ def test_list_snapshots_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_snapshots( - bigtable_table_admin.ListSnapshotsRequest(), parent="parent_value", + bigtable_table_admin.ListSnapshotsRequest(), + parent="parent_value", ) @@ -3423,7 +3689,9 @@ async def test_list_snapshots_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_snapshots(parent="parent_value",) + response = await client.list_snapshots( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3444,13 +3712,15 @@ async def test_list_snapshots_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_snapshots( - bigtable_table_admin.ListSnapshotsRequest(), parent="parent_value", + bigtable_table_admin.ListSnapshotsRequest(), + parent="parent_value", ) def test_list_snapshots_pager(transport_name: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3458,17 +3728,28 @@ def test_list_snapshots_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + table.Snapshot(), + ], next_page_token="abc", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[], next_page_token="def", + snapshots=[], + next_page_token="def", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(),], next_page_token="ghi", + snapshots=[ + table.Snapshot(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + ], ), RuntimeError, ) @@ -3488,7 +3769,8 @@ def test_list_snapshots_pager(transport_name: str = "grpc"): def test_list_snapshots_pages(transport_name: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3496,17 +3778,28 @@ def test_list_snapshots_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + table.Snapshot(), + ], next_page_token="abc", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[], next_page_token="def", + snapshots=[], + next_page_token="def", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(),], next_page_token="ghi", + snapshots=[ + table.Snapshot(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + ], ), RuntimeError, ) @@ -3528,21 +3821,34 @@ async def test_list_snapshots_async_pager(): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + table.Snapshot(), + ], next_page_token="abc", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[], next_page_token="def", + snapshots=[], + next_page_token="def", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(),], next_page_token="ghi", + snapshots=[ + table.Snapshot(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + ], ), RuntimeError, ) - async_pager = await client.list_snapshots(request={},) + async_pager = await client.list_snapshots( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -3565,17 +3871,28 @@ async def test_list_snapshots_async_pages(): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + table.Snapshot(), + ], next_page_token="abc", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[], next_page_token="def", + snapshots=[], + next_page_token="def", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(),], next_page_token="ghi", + snapshots=[ + table.Snapshot(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListSnapshotsResponse( - snapshots=[table.Snapshot(), table.Snapshot(),], + snapshots=[ + table.Snapshot(), + table.Snapshot(), + ], ), RuntimeError, ) @@ -3587,11 +3904,16 @@ async def test_list_snapshots_async_pages(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.DeleteSnapshotRequest, dict,] + "request_type", + [ + bigtable_table_admin.DeleteSnapshotRequest, + dict, + ], ) def test_delete_snapshot(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3617,7 +3939,8 @@ def test_delete_snapshot_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3634,7 +3957,8 @@ async def test_delete_snapshot_async( request_type=bigtable_table_admin.DeleteSnapshotRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3684,7 +4008,10 @@ def test_delete_snapshot_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3711,7 +4038,10 @@ async def test_delete_snapshot_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_snapshot_flattened(): @@ -3725,7 +4055,9 @@ def test_delete_snapshot_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_snapshot(name="name_value",) + client.delete_snapshot( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3745,7 +4077,8 @@ def test_delete_snapshot_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_snapshot( - bigtable_table_admin.DeleteSnapshotRequest(), name="name_value", + bigtable_table_admin.DeleteSnapshotRequest(), + name="name_value", ) @@ -3763,7 +4096,9 @@ async def test_delete_snapshot_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_snapshot(name="name_value",) + response = await client.delete_snapshot( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3784,16 +4119,22 @@ async def test_delete_snapshot_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_snapshot( - bigtable_table_admin.DeleteSnapshotRequest(), name="name_value", + bigtable_table_admin.DeleteSnapshotRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.CreateBackupRequest, dict,] + "request_type", + [ + bigtable_table_admin.CreateBackupRequest, + dict, + ], ) def test_create_backup(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3819,7 +4160,8 @@ def test_create_backup_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3836,7 +4178,8 @@ async def test_create_backup_async( request_type=bigtable_table_admin.CreateBackupRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3888,7 +4231,10 @@ def test_create_backup_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3917,7 +4263,10 @@ async def test_create_backup_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_backup_flattened(): @@ -4022,10 +4371,17 @@ async def test_create_backup_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [bigtable_table_admin.GetBackupRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable_table_admin.GetBackupRequest, + dict, + ], +) def test_get_backup(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4060,7 +4416,8 @@ def test_get_backup_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4076,7 +4433,8 @@ async def test_get_backup_async( transport: str = "grpc_asyncio", request_type=bigtable_table_admin.GetBackupRequest ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4137,7 +4495,10 @@ def test_get_backup_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4164,7 +4525,10 @@ async def test_get_backup_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_backup_flattened(): @@ -4178,7 +4542,9 @@ def test_get_backup_flattened(): call.return_value = table.Backup() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_backup(name="name_value",) + client.get_backup( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4198,7 +4564,8 @@ def test_get_backup_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_backup( - bigtable_table_admin.GetBackupRequest(), name="name_value", + bigtable_table_admin.GetBackupRequest(), + name="name_value", ) @@ -4216,7 +4583,9 @@ async def test_get_backup_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(table.Backup()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_backup(name="name_value",) + response = await client.get_backup( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4237,16 +4606,22 @@ async def test_get_backup_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_backup( - bigtable_table_admin.GetBackupRequest(), name="name_value", + bigtable_table_admin.GetBackupRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.UpdateBackupRequest, dict,] + "request_type", + [ + bigtable_table_admin.UpdateBackupRequest, + dict, + ], ) def test_update_backup(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4281,7 +4656,8 @@ def test_update_backup_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4298,7 +4674,8 @@ async def test_update_backup_async( request_type=bigtable_table_admin.UpdateBackupRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4359,7 +4736,10 @@ def test_update_backup_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "backup.name=backup.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "backup.name=backup.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4386,7 +4766,10 @@ async def test_update_backup_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "backup.name=backup.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "backup.name=backup.name/value", + ) in kw["metadata"] def test_update_backup_flattened(): @@ -4480,11 +4863,16 @@ async def test_update_backup_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.DeleteBackupRequest, dict,] + "request_type", + [ + bigtable_table_admin.DeleteBackupRequest, + dict, + ], ) def test_delete_backup(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4510,7 +4898,8 @@ def test_delete_backup_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4527,7 +4916,8 @@ async def test_delete_backup_async( request_type=bigtable_table_admin.DeleteBackupRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4577,7 +4967,10 @@ def test_delete_backup_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4604,7 +4997,10 @@ async def test_delete_backup_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_backup_flattened(): @@ -4618,7 +5014,9 @@ def test_delete_backup_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_backup(name="name_value",) + client.delete_backup( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4638,7 +5036,8 @@ def test_delete_backup_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_backup( - bigtable_table_admin.DeleteBackupRequest(), name="name_value", + bigtable_table_admin.DeleteBackupRequest(), + name="name_value", ) @@ -4656,7 +5055,9 @@ async def test_delete_backup_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_backup(name="name_value",) + response = await client.delete_backup( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4677,16 +5078,22 @@ async def test_delete_backup_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_backup( - bigtable_table_admin.DeleteBackupRequest(), name="name_value", + bigtable_table_admin.DeleteBackupRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.ListBackupsRequest, dict,] + "request_type", + [ + bigtable_table_admin.ListBackupsRequest, + dict, + ], ) def test_list_backups(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4715,7 +5122,8 @@ def test_list_backups_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4732,7 +5140,8 @@ async def test_list_backups_async( request_type=bigtable_table_admin.ListBackupsRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4787,7 +5196,10 @@ def test_list_backups_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4816,7 +5228,10 @@ async def test_list_backups_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_backups_flattened(): @@ -4830,7 +5245,9 @@ def test_list_backups_flattened(): call.return_value = bigtable_table_admin.ListBackupsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_backups(parent="parent_value",) + client.list_backups( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4850,7 +5267,8 @@ def test_list_backups_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_backups( - bigtable_table_admin.ListBackupsRequest(), parent="parent_value", + bigtable_table_admin.ListBackupsRequest(), + parent="parent_value", ) @@ -4870,7 +5288,9 @@ async def test_list_backups_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_backups(parent="parent_value",) + response = await client.list_backups( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4891,13 +5311,15 @@ async def test_list_backups_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_backups( - bigtable_table_admin.ListBackupsRequest(), parent="parent_value", + bigtable_table_admin.ListBackupsRequest(), + parent="parent_value", ) def test_list_backups_pager(transport_name: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4905,17 +5327,28 @@ def test_list_backups_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + table.Backup(), + ], next_page_token="abc", ), bigtable_table_admin.ListBackupsResponse( - backups=[], next_page_token="def", + backups=[], + next_page_token="def", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(),], next_page_token="ghi", + backups=[ + table.Backup(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + ], ), RuntimeError, ) @@ -4935,7 +5368,8 @@ def test_list_backups_pager(transport_name: str = "grpc"): def test_list_backups_pages(transport_name: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4943,17 +5377,28 @@ def test_list_backups_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + table.Backup(), + ], next_page_token="abc", ), bigtable_table_admin.ListBackupsResponse( - backups=[], next_page_token="def", + backups=[], + next_page_token="def", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(),], next_page_token="ghi", + backups=[ + table.Backup(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + ], ), RuntimeError, ) @@ -4975,21 +5420,34 @@ async def test_list_backups_async_pager(): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + table.Backup(), + ], next_page_token="abc", ), bigtable_table_admin.ListBackupsResponse( - backups=[], next_page_token="def", + backups=[], + next_page_token="def", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(),], next_page_token="ghi", + backups=[ + table.Backup(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + ], ), RuntimeError, ) - async_pager = await client.list_backups(request={},) + async_pager = await client.list_backups( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] async for response in async_pager: @@ -5012,17 +5470,28 @@ async def test_list_backups_async_pages(): # Set the response to a series of pages. call.side_effect = ( bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + table.Backup(), + ], next_page_token="abc", ), bigtable_table_admin.ListBackupsResponse( - backups=[], next_page_token="def", + backups=[], + next_page_token="def", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(),], next_page_token="ghi", + backups=[ + table.Backup(), + ], + next_page_token="ghi", ), bigtable_table_admin.ListBackupsResponse( - backups=[table.Backup(), table.Backup(),], + backups=[ + table.Backup(), + table.Backup(), + ], ), RuntimeError, ) @@ -5034,11 +5503,16 @@ async def test_list_backups_async_pages(): @pytest.mark.parametrize( - "request_type", [bigtable_table_admin.RestoreTableRequest, dict,] + "request_type", + [ + bigtable_table_admin.RestoreTableRequest, + dict, + ], ) def test_restore_table(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5064,7 +5538,8 @@ def test_restore_table_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5081,7 +5556,8 @@ async def test_restore_table_async( request_type=bigtable_table_admin.RestoreTableRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5133,7 +5609,10 @@ def test_restore_table_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5162,13 +5641,23 @@ async def test_restore_table_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) def test_get_iam_policy(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5178,7 +5667,10 @@ def test_get_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -5196,7 +5688,8 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5212,7 +5705,8 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5223,7 +5717,10 @@ async def test_get_iam_policy_async( with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -5266,7 +5763,10 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5293,7 +5793,10 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_get_iam_policy_from_dict_foreign(): @@ -5324,7 +5827,9 @@ def test_get_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_iam_policy(resource="resource_value",) + client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5344,7 +5849,8 @@ def test_get_iam_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) @@ -5362,7 +5868,9 @@ async def test_get_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_iam_policy(resource="resource_value",) + response = await client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5383,14 +5891,22 @@ async def test_get_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.SetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) def test_set_iam_policy(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5400,7 +5916,10 @@ def test_set_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -5418,7 +5937,8 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5434,7 +5954,8 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5445,7 +5966,10 @@ async def test_set_iam_policy_async( with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -5488,7 +6012,10 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5515,7 +6042,10 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_set_iam_policy_from_dict_foreign(): @@ -5546,7 +6076,9 @@ def test_set_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.set_iam_policy(resource="resource_value",) + client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5566,7 +6098,8 @@ def test_set_iam_policy_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) @@ -5584,7 +6117,9 @@ async def test_set_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.set_iam_policy(resource="resource_value",) + response = await client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5605,16 +6140,22 @@ async def test_set_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) @pytest.mark.parametrize( - "request_type", [iam_policy_pb2.TestIamPermissionsRequest, dict,] + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5645,7 +6186,8 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5664,7 +6206,8 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5723,7 +6266,10 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5754,7 +6300,10 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict_foreign(): @@ -5790,7 +6339,8 @@ def test_test_iam_permissions_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -5839,7 +6389,8 @@ async def test_test_iam_permissions_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -5877,7 +6428,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -5897,7 +6449,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = BigtableTableAdminClient(client_options=options, transport=transport,) + client = BigtableTableAdminClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -5913,7 +6468,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BigtableTableAdminClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5961,7 +6517,10 @@ def test_transport_grpc_default(): client = BigtableTableAdminClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.BigtableTableAdminGrpcTransport,) + assert isinstance( + client.transport, + transports.BigtableTableAdminGrpcTransport, + ) def test_bigtable_table_admin_base_transport_error(): @@ -6032,7 +6591,8 @@ def test_bigtable_table_admin_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BigtableTableAdminTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -6220,7 +6780,8 @@ def test_bigtable_table_admin_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.BigtableTableAdminGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6232,7 +6793,8 @@ def test_bigtable_table_admin_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.BigtableTableAdminGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6341,12 +6903,16 @@ def test_bigtable_table_admin_transport_channel_mtls_with_adc(transport_class): def test_bigtable_table_admin_grpc_lro_client(): client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6354,12 +6920,16 @@ def test_bigtable_table_admin_grpc_lro_client(): def test_bigtable_table_admin_grpc_lro_async_client(): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6371,7 +6941,10 @@ def test_backup_path(): cluster = "whelk" backup = "octopus" expected = "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}".format( - project=project, instance=instance, cluster=cluster, backup=backup, + project=project, + instance=instance, + cluster=cluster, + backup=backup, ) actual = BigtableTableAdminClient.backup_path(project, instance, cluster, backup) assert expected == actual @@ -6396,7 +6969,9 @@ def test_cluster_path(): instance = "nautilus" cluster = "scallop" expected = "projects/{project}/instances/{instance}/clusters/{cluster}".format( - project=project, instance=instance, cluster=cluster, + project=project, + instance=instance, + cluster=cluster, ) actual = BigtableTableAdminClient.cluster_path(project, instance, cluster) assert expected == actual @@ -6453,7 +7028,8 @@ def test_instance_path(): project = "squid" instance = "clam" expected = "projects/{project}/instances/{instance}".format( - project=project, instance=instance, + project=project, + instance=instance, ) actual = BigtableTableAdminClient.instance_path(project, instance) assert expected == actual @@ -6477,7 +7053,10 @@ def test_snapshot_path(): cluster = "cuttlefish" snapshot = "mussel" expected = "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}".format( - project=project, instance=instance, cluster=cluster, snapshot=snapshot, + project=project, + instance=instance, + cluster=cluster, + snapshot=snapshot, ) actual = BigtableTableAdminClient.snapshot_path( project, instance, cluster, snapshot @@ -6504,7 +7083,9 @@ def test_table_path(): instance = "clam" table = "whelk" expected = "projects/{project}/instances/{instance}/tables/{table}".format( - project=project, instance=instance, table=table, + project=project, + instance=instance, + table=table, ) actual = BigtableTableAdminClient.table_path(project, instance, table) assert expected == actual @@ -6545,7 +7126,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = BigtableTableAdminClient.common_folder_path(folder) assert expected == actual @@ -6563,7 +7146,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = BigtableTableAdminClient.common_organization_path(organization) assert expected == actual @@ -6581,7 +7166,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = BigtableTableAdminClient.common_project_path(project) assert expected == actual @@ -6601,7 +7188,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = BigtableTableAdminClient.common_location_path(project, location) assert expected == actual @@ -6626,7 +7214,8 @@ def test_client_with_default_client_info(): transports.BigtableTableAdminTransport, "_prep_wrapped_messages" ) as prep: client = BigtableTableAdminClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6635,7 +7224,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BigtableTableAdminClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6643,7 +7233,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = BigtableTableAdminAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/bigtable_v2/test_bigtable.py b/tests/unit/gapic/bigtable_v2/test_bigtable.py index f8d186088..d8b694bc0 100644 --- a/tests/unit/gapic/bigtable_v2/test_bigtable.py +++ b/tests/unit/gapic/bigtable_v2/test_bigtable.py @@ -79,7 +79,13 @@ def test__get_default_mtls_endpoint(): assert BigtableClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [BigtableClient, BigtableAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + BigtableClient, + BigtableAsyncClient, + ], +) def test_bigtable_client_from_service_account_info(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -119,7 +125,13 @@ def test_bigtable_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [BigtableClient, BigtableAsyncClient,]) +@pytest.mark.parametrize( + "client_class", + [ + BigtableClient, + BigtableAsyncClient, + ], +) def test_bigtable_client_from_service_account_file(client_class): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( @@ -464,7 +476,9 @@ def test_bigtable_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -599,10 +613,17 @@ def test_bigtable_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [bigtable.ReadRowsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable.ReadRowsRequest, + dict, + ], +) def test_read_rows(request_type, transport: str = "grpc"): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -629,7 +650,8 @@ def test_read_rows_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -645,7 +667,8 @@ async def test_read_rows_async( transport: str = "grpc_asyncio", request_type=bigtable.ReadRowsRequest ): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -677,7 +700,9 @@ async def test_read_rows_async_from_dict(): def test_read_rows_routing_parameters(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -718,7 +743,9 @@ def test_read_rows_routing_parameters(): def test_read_rows_flattened(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.read_rows), "__call__") as call: @@ -727,7 +754,8 @@ def test_read_rows_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.read_rows( - table_name="table_name_value", app_profile_id="app_profile_id_value", + table_name="table_name_value", + app_profile_id="app_profile_id_value", ) # Establish that the underlying call was made with the expected @@ -743,7 +771,9 @@ def test_read_rows_flattened(): def test_read_rows_flattened_error(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -757,7 +787,9 @@ def test_read_rows_flattened_error(): @pytest.mark.asyncio async def test_read_rows_flattened_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.read_rows), "__call__") as call: @@ -768,7 +800,8 @@ async def test_read_rows_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.read_rows( - table_name="table_name_value", app_profile_id="app_profile_id_value", + table_name="table_name_value", + app_profile_id="app_profile_id_value", ) # Establish that the underlying call was made with the expected @@ -785,7 +818,9 @@ async def test_read_rows_flattened_async(): @pytest.mark.asyncio async def test_read_rows_flattened_error_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -797,10 +832,17 @@ async def test_read_rows_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [bigtable.SampleRowKeysRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable.SampleRowKeysRequest, + dict, + ], +) def test_sample_row_keys(request_type, transport: str = "grpc"): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -827,7 +869,8 @@ def test_sample_row_keys_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -843,7 +886,8 @@ async def test_sample_row_keys_async( transport: str = "grpc_asyncio", request_type=bigtable.SampleRowKeysRequest ): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -875,7 +919,9 @@ async def test_sample_row_keys_async_from_dict(): def test_sample_row_keys_routing_parameters(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -916,7 +962,9 @@ def test_sample_row_keys_routing_parameters(): def test_sample_row_keys_flattened(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.sample_row_keys), "__call__") as call: @@ -925,7 +973,8 @@ def test_sample_row_keys_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.sample_row_keys( - table_name="table_name_value", app_profile_id="app_profile_id_value", + table_name="table_name_value", + app_profile_id="app_profile_id_value", ) # Establish that the underlying call was made with the expected @@ -941,7 +990,9 @@ def test_sample_row_keys_flattened(): def test_sample_row_keys_flattened_error(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -955,7 +1006,9 @@ def test_sample_row_keys_flattened_error(): @pytest.mark.asyncio async def test_sample_row_keys_flattened_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.sample_row_keys), "__call__") as call: @@ -966,7 +1019,8 @@ async def test_sample_row_keys_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.sample_row_keys( - table_name="table_name_value", app_profile_id="app_profile_id_value", + table_name="table_name_value", + app_profile_id="app_profile_id_value", ) # Establish that the underlying call was made with the expected @@ -983,7 +1037,9 @@ async def test_sample_row_keys_flattened_async(): @pytest.mark.asyncio async def test_sample_row_keys_flattened_error_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -995,10 +1051,17 @@ async def test_sample_row_keys_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [bigtable.MutateRowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable.MutateRowRequest, + dict, + ], +) def test_mutate_row(request_type, transport: str = "grpc"): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1024,7 +1087,8 @@ def test_mutate_row_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1040,7 +1104,8 @@ async def test_mutate_row_async( transport: str = "grpc_asyncio", request_type=bigtable.MutateRowRequest ): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1070,7 +1135,9 @@ async def test_mutate_row_async_from_dict(): def test_mutate_row_routing_parameters(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1111,7 +1178,9 @@ def test_mutate_row_routing_parameters(): def test_mutate_row_flattened(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.mutate_row), "__call__") as call: @@ -1153,7 +1222,9 @@ def test_mutate_row_flattened(): def test_mutate_row_flattened_error(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1173,7 +1244,9 @@ def test_mutate_row_flattened_error(): @pytest.mark.asyncio async def test_mutate_row_flattened_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.mutate_row), "__call__") as call: @@ -1220,7 +1293,9 @@ async def test_mutate_row_flattened_async(): @pytest.mark.asyncio async def test_mutate_row_flattened_error_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1238,10 +1313,17 @@ async def test_mutate_row_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [bigtable.MutateRowsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable.MutateRowsRequest, + dict, + ], +) def test_mutate_rows(request_type, transport: str = "grpc"): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1268,7 +1350,8 @@ def test_mutate_rows_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1284,7 +1367,8 @@ async def test_mutate_rows_async( transport: str = "grpc_asyncio", request_type=bigtable.MutateRowsRequest ): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1316,7 +1400,9 @@ async def test_mutate_rows_async_from_dict(): def test_mutate_rows_routing_parameters(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1357,7 +1443,9 @@ def test_mutate_rows_routing_parameters(): def test_mutate_rows_flattened(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.mutate_rows), "__call__") as call: @@ -1387,7 +1475,9 @@ def test_mutate_rows_flattened(): def test_mutate_rows_flattened_error(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1402,7 +1492,9 @@ def test_mutate_rows_flattened_error(): @pytest.mark.asyncio async def test_mutate_rows_flattened_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.mutate_rows), "__call__") as call: @@ -1435,7 +1527,9 @@ async def test_mutate_rows_flattened_async(): @pytest.mark.asyncio async def test_mutate_rows_flattened_error_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1448,10 +1542,17 @@ async def test_mutate_rows_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [bigtable.CheckAndMutateRowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable.CheckAndMutateRowRequest, + dict, + ], +) def test_check_and_mutate_row(request_type, transport: str = "grpc"): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1463,7 +1564,9 @@ def test_check_and_mutate_row(request_type, transport: str = "grpc"): type(client.transport.check_and_mutate_row), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = bigtable.CheckAndMutateRowResponse(predicate_matched=True,) + call.return_value = bigtable.CheckAndMutateRowResponse( + predicate_matched=True, + ) response = client.check_and_mutate_row(request) # Establish that the underlying gRPC stub method was called. @@ -1480,7 +1583,8 @@ def test_check_and_mutate_row_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1498,7 +1602,8 @@ async def test_check_and_mutate_row_async( transport: str = "grpc_asyncio", request_type=bigtable.CheckAndMutateRowRequest ): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1511,7 +1616,9 @@ async def test_check_and_mutate_row_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - bigtable.CheckAndMutateRowResponse(predicate_matched=True,) + bigtable.CheckAndMutateRowResponse( + predicate_matched=True, + ) ) response = await client.check_and_mutate_row(request) @@ -1531,7 +1638,9 @@ async def test_check_and_mutate_row_async_from_dict(): def test_check_and_mutate_row_routing_parameters(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1576,7 +1685,9 @@ def test_check_and_mutate_row_routing_parameters(): def test_check_and_mutate_row_flattened(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1654,7 +1765,9 @@ def test_check_and_mutate_row_flattened(): def test_check_and_mutate_row_flattened_error(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1690,7 +1803,9 @@ def test_check_and_mutate_row_flattened_error(): @pytest.mark.asyncio async def test_check_and_mutate_row_flattened_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1773,7 +1888,9 @@ async def test_check_and_mutate_row_flattened_async(): @pytest.mark.asyncio async def test_check_and_mutate_row_flattened_error_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1807,10 +1924,17 @@ async def test_check_and_mutate_row_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [bigtable.PingAndWarmRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable.PingAndWarmRequest, + dict, + ], +) def test_ping_and_warm(request_type, transport: str = "grpc"): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1836,7 +1960,8 @@ def test_ping_and_warm_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1852,7 +1977,8 @@ async def test_ping_and_warm_async( transport: str = "grpc_asyncio", request_type=bigtable.PingAndWarmRequest ): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1882,7 +2008,9 @@ async def test_ping_and_warm_async_from_dict(): def test_ping_and_warm_routing_parameters(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1923,7 +2051,9 @@ def test_ping_and_warm_routing_parameters(): def test_ping_and_warm_flattened(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.ping_and_warm), "__call__") as call: @@ -1932,7 +2062,8 @@ def test_ping_and_warm_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.ping_and_warm( - name="name_value", app_profile_id="app_profile_id_value", + name="name_value", + app_profile_id="app_profile_id_value", ) # Establish that the underlying call was made with the expected @@ -1948,7 +2079,9 @@ def test_ping_and_warm_flattened(): def test_ping_and_warm_flattened_error(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1962,7 +2095,9 @@ def test_ping_and_warm_flattened_error(): @pytest.mark.asyncio async def test_ping_and_warm_flattened_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.ping_and_warm), "__call__") as call: @@ -1975,7 +2110,8 @@ async def test_ping_and_warm_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.ping_and_warm( - name="name_value", app_profile_id="app_profile_id_value", + name="name_value", + app_profile_id="app_profile_id_value", ) # Establish that the underlying call was made with the expected @@ -1992,7 +2128,9 @@ async def test_ping_and_warm_flattened_async(): @pytest.mark.asyncio async def test_ping_and_warm_flattened_error_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2004,10 +2142,17 @@ async def test_ping_and_warm_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [bigtable.ReadModifyWriteRowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + bigtable.ReadModifyWriteRowRequest, + dict, + ], +) def test_read_modify_write_row(request_type, transport: str = "grpc"): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2035,7 +2180,8 @@ def test_read_modify_write_row_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2053,7 +2199,8 @@ async def test_read_modify_write_row_async( transport: str = "grpc_asyncio", request_type=bigtable.ReadModifyWriteRowRequest ): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2085,7 +2232,9 @@ async def test_read_modify_write_row_async_from_dict(): def test_read_modify_write_row_routing_parameters(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2130,7 +2279,9 @@ def test_read_modify_write_row_routing_parameters(): def test_read_modify_write_row_flattened(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2166,7 +2317,9 @@ def test_read_modify_write_row_flattened(): def test_read_modify_write_row_flattened_error(): - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2182,7 +2335,9 @@ def test_read_modify_write_row_flattened_error(): @pytest.mark.asyncio async def test_read_modify_write_row_flattened_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2223,7 +2378,9 @@ async def test_read_modify_write_row_flattened_async(): @pytest.mark.asyncio async def test_read_modify_write_row_flattened_error_async(): - client = BigtableAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = BigtableAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2244,7 +2401,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2264,7 +2422,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = BigtableClient(client_options=options, transport=transport,) + client = BigtableClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2280,7 +2441,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = BigtableClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2310,7 +2472,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.BigtableGrpcTransport, transports.BigtableGrpcAsyncIOTransport,], + [ + transports.BigtableGrpcTransport, + transports.BigtableGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2322,8 +2487,13 @@ def test_transport_adc(transport_class): def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = BigtableClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.BigtableGrpcTransport,) + client = BigtableClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.BigtableGrpcTransport, + ) def test_bigtable_base_transport_error(): @@ -2374,7 +2544,8 @@ def test_bigtable_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.BigtableTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2423,7 +2594,10 @@ def test_bigtable_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.BigtableGrpcTransport, transports.BigtableGrpcAsyncIOTransport,], + [ + transports.BigtableGrpcTransport, + transports.BigtableGrpcAsyncIOTransport, + ], ) def test_bigtable_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2554,7 +2728,8 @@ def test_bigtable_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.BigtableGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2566,7 +2741,8 @@ def test_bigtable_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.BigtableGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2669,7 +2845,8 @@ def test_instance_path(): project = "squid" instance = "clam" expected = "projects/{project}/instances/{instance}".format( - project=project, instance=instance, + project=project, + instance=instance, ) actual = BigtableClient.instance_path(project, instance) assert expected == actual @@ -2692,7 +2869,9 @@ def test_table_path(): instance = "nudibranch" table = "cuttlefish" expected = "projects/{project}/instances/{instance}/tables/{table}".format( - project=project, instance=instance, table=table, + project=project, + instance=instance, + table=table, ) actual = BigtableClient.table_path(project, instance, table) assert expected == actual @@ -2733,7 +2912,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = BigtableClient.common_folder_path(folder) assert expected == actual @@ -2751,7 +2932,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = BigtableClient.common_organization_path(organization) assert expected == actual @@ -2769,7 +2952,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = BigtableClient.common_project_path(project) assert expected == actual @@ -2789,7 +2974,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = BigtableClient.common_location_path(project, location) assert expected == actual @@ -2814,7 +3000,8 @@ def test_client_with_default_client_info(): transports.BigtableTransport, "_prep_wrapped_messages" ) as prep: client = BigtableClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2823,7 +3010,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = BigtableClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2831,7 +3019,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = BigtableAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/test_app_profile.py b/tests/unit/test_app_profile.py index 07c686fb8..d45c9ca0a 100644 --- a/tests/unit/test_app_profile.py +++ b/tests/unit/test_app_profile.py @@ -70,7 +70,10 @@ def test_app_profile_constructor_explicit(): instance = _Instance(INSTANCE_ID, client) app_profile1 = _make_app_profile( - APP_PROFILE_ID, instance, routing_policy_type=ANY, description=DESCRIPTION_1, + APP_PROFILE_ID, + instance, + routing_policy_type=ANY, + description=DESCRIPTION_1, ) app_profile2 = _make_app_profile( APP_PROFILE_ID_2, @@ -176,7 +179,8 @@ def test_app_profile_from_pb_success_w_routing_single(): allow_transactional_writes = True routing = RoutingPolicyType.SINGLE single_cluster_routing = data_v2_pb2.AppProfile.SingleClusterRouting( - cluster_id=CLUSTER_ID, allow_transactional_writes=allow_transactional_writes, + cluster_id=CLUSTER_ID, + allow_transactional_writes=allow_transactional_writes, ) app_profile_pb = data_v2_pb2.AppProfile( @@ -253,7 +257,10 @@ def test_app_profile_reload_w_routing_any(): description = "routing policy any" app_profile = _make_app_profile( - APP_PROFILE_ID, instance, routing_policy_type=routing, description=description, + APP_PROFILE_ID, + instance, + routing_policy_type=routing, + description=description, ) # Create response_pb @@ -345,7 +352,10 @@ def test_app_profile_create_w_routing_any(): ignore_warnings = True app_profile = _make_app_profile( - APP_PROFILE_ID, instance, routing_policy_type=routing, description=description, + APP_PROFILE_ID, + instance, + routing_policy_type=routing, + description=description, ) expected_request_app_profile = app_profile._to_pb() diff --git a/tests/unit/test_backup.py b/tests/unit/test_backup.py index 92e9d7307..9882ca339 100644 --- a/tests/unit/test_backup.py +++ b/tests/unit/test_backup.py @@ -217,7 +217,10 @@ def test_backup_cluster_setter(): def test_backup_parent_none(): - backup = _make_backup(BACKUP_ID, _Instance(INSTANCE_NAME),) + backup = _make_backup( + BACKUP_ID, + _Instance(INSTANCE_NAME), + ) assert backup.parent is None @@ -361,7 +364,8 @@ def test_backup_create_w_grpc_error(): ) backup_pb = table.Backup( - source_table=TABLE_NAME, expire_time=_datetime_to_pb_timestamp(timestamp), + source_table=TABLE_NAME, + expire_time=_datetime_to_pb_timestamp(timestamp), ) with pytest.raises(GoogleAPICallError): @@ -390,7 +394,8 @@ def test_backup_create_w_already_exists(): ) backup_pb = table.Backup( - source_table=TABLE_NAME, expire_time=_datetime_to_pb_timestamp(timestamp), + source_table=TABLE_NAME, + expire_time=_datetime_to_pb_timestamp(timestamp), ) with pytest.raises(Conflict): @@ -419,7 +424,8 @@ def test_backup_create_w_instance_not_found(): ) backup_pb = table.Backup( - source_table=TABLE_NAME, expire_time=_datetime_to_pb_timestamp(timestamp), + source_table=TABLE_NAME, + expire_time=_datetime_to_pb_timestamp(timestamp), ) with pytest.raises(NotFound): @@ -444,7 +450,9 @@ def test_backup_create_w_cluster_not_set(): def test_backup_create_w_table_not_set(): backup = _make_backup( - BACKUP_ID, _Instance(INSTANCE_NAME), expire_time=_make_timestamp(), + BACKUP_ID, + _Instance(INSTANCE_NAME), + expire_time=_make_timestamp(), ) with pytest.raises(ValueError): @@ -452,7 +460,11 @@ def test_backup_create_w_table_not_set(): def test_backup_create_w_expire_time_not_set(): - backup = _make_backup(BACKUP_ID, _Instance(INSTANCE_NAME), table_id=TABLE_ID,) + backup = _make_backup( + BACKUP_ID, + _Instance(INSTANCE_NAME), + table_id=TABLE_ID, + ) with pytest.raises(ValueError): backup.create(CLUSTER_ID) @@ -478,7 +490,8 @@ def test_backup_create_success(): ) backup_pb = table.Backup( - source_table=TABLE_NAME, expire_time=_datetime_to_pb_timestamp(timestamp), + source_table=TABLE_NAME, + expire_time=_datetime_to_pb_timestamp(timestamp), ) future = backup.create(CLUSTER_ID) @@ -657,7 +670,8 @@ def test_backup_update_expire_time_w_grpc_error(): backup.update_expire_time(expire_time) backup_update = table.Backup( - name=BACKUP_NAME, expire_time=_datetime_to_pb_timestamp(expire_time), + name=BACKUP_NAME, + expire_time=_datetime_to_pb_timestamp(expire_time), ) update_mask = field_mask_pb2.FieldMask(paths=["expire_time"]) api.update_backup.assert_called_once_with( @@ -682,7 +696,8 @@ def test_backup_update_expire_time_w_not_found(): backup.update_expire_time(expire_time) backup_update = table.Backup( - name=BACKUP_NAME, expire_time=_datetime_to_pb_timestamp(expire_time), + name=BACKUP_NAME, + expire_time=_datetime_to_pb_timestamp(expire_time), ) update_mask = field_mask_pb2.FieldMask(paths=["expire_time"]) api.update_backup.assert_called_once_with( @@ -705,7 +720,8 @@ def test_backup_update_expire_time_success(): backup.update_expire_time(expire_time) backup_update = table.Backup( - name=BACKUP_NAME, expire_time=_datetime_to_pb_timestamp(expire_time), + name=BACKUP_NAME, + expire_time=_datetime_to_pb_timestamp(expire_time), ) update_mask = field_mask_pb2.FieldMask(paths=["expire_time"]) api.update_backup.assert_called_once_with( diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 00f8524bc..5944c58a3 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -162,7 +162,10 @@ def test_client_constructor_w_both_admin_and_read_only(): credentials = _make_credentials() with pytest.raises(ValueError): _make_client( - project=PROJECT, credentials=credentials, admin=True, read_only=True, + project=PROJECT, + credentials=credentials, + admin=True, + read_only=True, ) @@ -275,7 +278,9 @@ def test_client__emulator_channel_w_sync(): assert channel is patched.return_value patched.assert_called_once_with( - emulator_host, lcc.return_value, options=options, + emulator_host, + lcc.return_value, + options=options, ) @@ -295,7 +300,9 @@ def test_client__emulator_channel_w_async(): assert channel is patched.return_value patched.assert_called_once_with( - emulator_host, lcc.return_value, options=options, + emulator_host, + lcc.return_value, + options=options, ) @@ -328,7 +335,8 @@ def test_client__local_composite_credentials(): wsir_patched.assert_called_once_with(client._credentials, None) request_patched.assert_called_once_with() amp_patched.assert_called_once_with( - wsir_patched.return_value, request_patched.return_value, + wsir_patched.return_value, + request_patched.return_value, ) grpc_mcc.assert_called_once_with(amp_patched.return_value) grpc_lcc.assert_called_once_with() @@ -344,7 +352,8 @@ def _create_gapic_client_channel_helper(endpoint=None, emulator_host=None): if endpoint is not None: client._client_options = mock.Mock( - spec=["api_endpoint"], api_endpoint=endpoint, + spec=["api_endpoint"], + api_endpoint=endpoint, ) expected_host = endpoint else: @@ -363,10 +372,12 @@ def _create_gapic_client_channel_helper(endpoint=None, emulator_host=None): if emulator_host is not None: client._emulator_channel.assert_called_once_with( - transport=grpc_transport, options=_GRPC_CHANNEL_OPTIONS, + transport=grpc_transport, + options=_GRPC_CHANNEL_OPTIONS, ) grpc_transport.assert_called_once_with( - channel=client._emulator_channel.return_value, host=expected_host, + channel=client._emulator_channel.return_value, + host=expected_host, ) else: grpc_transport.create_channel.assert_called_once_with( @@ -375,7 +386,8 @@ def _create_gapic_client_channel_helper(endpoint=None, emulator_host=None): options=_GRPC_CHANNEL_OPTIONS, ) grpc_transport.assert_called_once_with( - channel=grpc_transport.create_channel.return_value, host=expected_host, + channel=grpc_transport.create_channel.return_value, + host=expected_host, ) @@ -490,7 +502,10 @@ def test_client_table_admin_client_not_initialized_w_client_info(): credentials = _make_credentials() client_info = mock.Mock() client = _make_client( - project=PROJECT, credentials=credentials, admin=True, client_info=client_info, + project=PROJECT, + credentials=credentials, + admin=True, + client_info=client_info, ) table_admin_client = client.table_admin_client @@ -557,7 +572,10 @@ def test_client_instance_admin_client_not_initialized_w_client_info(): credentials = _make_credentials() client_info = mock.Mock() client = _make_client( - project=PROJECT, credentials=credentials, admin=True, client_info=client_info, + project=PROJECT, + credentials=credentials, + admin=True, + client_info=client_info, ) instance_admin_client = client.instance_admin_client diff --git a/tests/unit/test_cluster.py b/tests/unit/test_cluster.py index 56c0a3cc5..cb0312b0c 100644 --- a/tests/unit/test_cluster.py +++ b/tests/unit/test_cluster.py @@ -217,7 +217,8 @@ def test_cluster_from_pb_w_autoscaling(): cluster_config = data_v2_pb2.Cluster.ClusterConfig( cluster_autoscaling_config=data_v2_pb2.Cluster.ClusterAutoscalingConfig( autoscaling_limits=data_v2_pb2.AutoscalingLimits( - min_serve_nodes=MIN_SERVE_NODES, max_serve_nodes=MAX_SERVE_NODES, + min_serve_nodes=MIN_SERVE_NODES, + max_serve_nodes=MAX_SERVE_NODES, ), autoscaling_targets=data_v2_pb2.AutoscalingTargets( cpu_utilization_percent=CPU_UTILIZATION_PERCENT @@ -569,7 +570,8 @@ def test_cluster_create_w_autoscaling(): cluster_config = instance_v2_pb2.Cluster.ClusterConfig( cluster_autoscaling_config=instance_v2_pb2.Cluster.ClusterAutoscalingConfig( autoscaling_limits=instance_v2_pb2.AutoscalingLimits( - min_serve_nodes=MIN_SERVE_NODES, max_serve_nodes=MAX_SERVE_NODES, + min_serve_nodes=MIN_SERVE_NODES, + max_serve_nodes=MAX_SERVE_NODES, ), autoscaling_targets=instance_v2_pb2.AutoscalingTargets( cpu_utilization_percent=CPU_UTILIZATION_PERCENT diff --git a/tests/unit/test_column_family.py b/tests/unit/test_column_family.py index 9d4632e2a..b464024a7 100644 --- a/tests/unit/test_column_family.py +++ b/tests/unit/test_column_family.py @@ -265,7 +265,7 @@ def _make_client(*args, **kwargs): def test_column_family_constructor(): - column_family_id = u"column-family-id" + column_family_id = "column-family-id" table = object() gc_rule = object() column_family = _make_column_family(column_family_id, table, gc_rule=gc_rule) @@ -276,7 +276,7 @@ def test_column_family_constructor(): def test_column_family_name_property(): - column_family_id = u"column-family-id" + column_family_id = "column-family-id" table_name = "table_name" table = _Table(table_name) column_family = _make_column_family(column_family_id, table) diff --git a/tests/unit/test_instance.py b/tests/unit/test_instance.py index def7e3e38..c577adca5 100644 --- a/tests/unit/test_instance.py +++ b/tests/unit/test_instance.py @@ -110,7 +110,10 @@ def test_instance__update_from_pb_success(): state = enums.Instance.State.READY # todo type to type_? instance_pb = data_v2_pb2.Instance( - display_name=DISPLAY_NAME, type_=instance_type, labels=LABELS, state=state, + display_name=DISPLAY_NAME, + type_=instance_type, + labels=LABELS, + state=state, ) instance = _make_instance(None, None) @@ -309,7 +312,11 @@ def test_instance_create(): credentials = _make_credentials() client = _make_client(project=PROJECT, credentials=credentials, admin=True) instance = _make_instance( - INSTANCE_ID, client, DISPLAY_NAME, enums.Instance.Type.PRODUCTION, LABELS, + INSTANCE_ID, + client, + DISPLAY_NAME, + enums.Instance.Type.PRODUCTION, + LABELS, ) api, response = _instance_api_response_for_create() client._instance_admin_client = api @@ -327,7 +334,9 @@ def test_instance_create(): default_storage_type=enums.StorageType.UNSPECIFIED, ) instance_pb = Instance( - display_name=DISPLAY_NAME, type_=enums.Instance.Type.PRODUCTION, labels=LABELS, + display_name=DISPLAY_NAME, + type_=enums.Instance.Type.PRODUCTION, + labels=LABELS, ) cluster_id = "{}-cluster".format(INSTANCE_ID) api.create_instance.assert_called_once_with( @@ -352,7 +361,11 @@ def test_instance_create_w_clusters(): credentials = _make_credentials() client = _make_client(project=PROJECT, credentials=credentials, admin=True) instance = _make_instance( - INSTANCE_ID, client, DISPLAY_NAME, enums.Instance.Type.PRODUCTION, LABELS, + INSTANCE_ID, + client, + DISPLAY_NAME, + enums.Instance.Type.PRODUCTION, + LABELS, ) api, response = _instance_api_response_for_create() client._instance_admin_client = api @@ -393,7 +406,9 @@ def test_instance_create_w_clusters(): default_storage_type=enums.StorageType.UNSPECIFIED, ) instance_pb = instance_pb( - display_name=DISPLAY_NAME, type_=enums.Instance.Type.PRODUCTION, labels=LABELS, + display_name=DISPLAY_NAME, + type_=enums.Instance.Type.PRODUCTION, + labels=LABELS, ) api.create_instance.assert_called_once_with( request={ @@ -460,7 +475,7 @@ def test_instance_reload(): from google.cloud.bigtable_admin_v2.types import instance as data_v2_pb2 from google.cloud.bigtable import enums - DISPLAY_NAME = u"hey-hi-hello" + DISPLAY_NAME = "hey-hi-hello" credentials = _make_credentials() client = _make_client(project=PROJECT, credentials=credentials, admin=True) instance = _make_instance(INSTANCE_ID, client) diff --git a/tests/unit/test_policy.py b/tests/unit/test_policy.py index 1b1adbed5..77674517e 100644 --- a/tests/unit/test_policy.py +++ b/tests/unit/test_policy.py @@ -150,7 +150,11 @@ def test_policy_from_pb_w_condition(): }, } ] - message = policy_pb2.Policy(etag=ETAG, version=VERSION, bindings=BINDINGS,) + message = policy_pb2.Policy( + etag=ETAG, + version=VERSION, + bindings=BINDINGS, + ) policy = Policy.from_pb(message) assert policy.etag == ETAG assert policy.version == VERSION @@ -219,7 +223,9 @@ def test_policy_to_pb_w_condition(): version=VERSION, bindings=[ policy_pb2.Binding( - role=BIGTABLE_ADMIN_ROLE, members=sorted(members), condition=condition, + role=BIGTABLE_ADMIN_ROLE, + members=sorted(members), + condition=condition, ) ], ) diff --git a/tests/unit/test_row.py b/tests/unit/test_row.py index 774756314..49bbfc45c 100644 --- a/tests/unit/test_row.py +++ b/tests/unit/test_row.py @@ -70,7 +70,7 @@ def test_direct_row_constructor(): def test_direct_row_constructor_with_unicode(): - row_key = u"row_key" + row_key = "row_key" row_key_bytes = b"row_key" table = object() @@ -97,8 +97,8 @@ def test_direct_row_get_mutations_size(): row_key = b"row_key" row = _make_direct_row(row_key, None) - column_family_id1 = u"column_family_id1" - column_family_id2 = u"column_family_id2" + column_family_id1 = "column_family_id1" + column_family_id2 = "column_family_id2" column1 = b"column1" column2 = b"column2" number_of_bytes = 1 * 1024 * 1024 @@ -124,7 +124,7 @@ def _set_cell_helper( import struct row_key = b"row_key" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" if column is None: column = b"column" table = object() @@ -151,7 +151,7 @@ def test_direct_row_set_cell(): def test_direct_row_set_cell_with_string_column(): column_bytes = b"column" - column_non_bytes = u"column" + column_non_bytes = "column" _set_cell_helper(column=column_non_bytes, column_bytes=column_bytes) @@ -163,7 +163,7 @@ def test_direct_row_set_cell_with_integer_value(): def test_direct_row_set_cell_with_non_bytes_value(): row_key = b"row_key" column = b"column" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" table = object() row = _make_direct_row(row_key, table) @@ -208,7 +208,7 @@ def _delete_cells(self, *args, **kwargs): row_key = b"row_key" column = b"column" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" table = object() mock_row = MockRow(row_key, table) @@ -227,7 +227,7 @@ def _delete_cells(self, *args, **kwargs): def test_direct_row_delete_cells_non_iterable(): row_key = b"row_key" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" table = object() row = _make_direct_row(row_key, table) @@ -240,7 +240,7 @@ def test_direct_row_delete_cells_all_columns(): from google.cloud.bigtable.row import DirectRow row_key = b"row_key" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" table = object() row = _make_direct_row(row_key, table) @@ -255,7 +255,7 @@ def test_direct_row_delete_cells_all_columns(): def test_direct_row_delete_cells_no_columns(): row_key = b"row_key" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" table = object() row = _make_direct_row(row_key, table) @@ -268,7 +268,7 @@ def test_direct_row_delete_cells_no_columns(): def _delete_cells_helper(time_range=None): row_key = b"row_key" column = b"column" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" table = object() row = _make_direct_row(row_key, table) @@ -306,7 +306,7 @@ def test_direct_row_delete_cells_with_bad_column(): # the row's mutations in a bad state. row_key = b"row_key" column = b"column" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" table = object() row = _make_direct_row(row_key, table) @@ -319,10 +319,10 @@ def test_direct_row_delete_cells_with_bad_column(): def test_direct_row_delete_cells_with_string_columns(): row_key = b"row_key" - column_family_id = u"column_family_id" - column1 = u"column1" + column_family_id = "column_family_id" + column1 = "column1" column1_bytes = b"column1" - column2 = u"column2" + column2 = "column2" column2_bytes = b"column2" table = object() @@ -348,7 +348,7 @@ def test_direct_row_commit(): project_id = "project-id" row_key = b"row_key" table_name = "projects/more-stuff" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" column = b"column" credentials = _make_credentials() @@ -369,7 +369,7 @@ def test_direct_row_commit_with_exception(): project_id = "project-id" row_key = b"row_key" table_name = "projects/more-stuff" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" column = b"column" credentials = _make_credentials() @@ -424,9 +424,9 @@ def test_conditional_row_commit(): row_key = b"row_key" table_name = "projects/more-stuff" app_profile_id = "app_profile_id" - column_family_id1 = u"column_family_id1" - column_family_id2 = u"column_family_id2" - column_family_id3 = u"column_family_id3" + column_family_id1 = "column_family_id1" + column_family_id2 = "column_family_id2" + column_family_id3 = "column_family_id3" column1 = b"column1" column2 = b"column2" @@ -535,7 +535,7 @@ def test_append_row_append_cell_value(): assert row._rule_pb_list == [] column = b"column" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" value = b"bytes-val" row.append_cell_value(column_family_id, column, value) expected_pb = _ReadModifyWriteRulePB( @@ -551,7 +551,7 @@ def test_append_row_increment_cell_value(): assert row._rule_pb_list == [] column = b"column" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" int_value = 281330 row.increment_cell_value(column_family_id, column, int_value) expected_pb = _ReadModifyWriteRulePB( @@ -571,7 +571,7 @@ def test_append_row_commit(): row_key = b"row_key" table_name = "projects/more-stuff" app_profile_id = "app_profile_id" - column_family_id = u"column_family_id" + column_family_id = "column_family_id" column = b"column" api = mock.create_autospec(BigtableClient) @@ -646,8 +646,8 @@ def test__parse_rmw_row_response(): from google.cloud._helpers import _datetime_from_microseconds from google.cloud.bigtable.row import _parse_rmw_row_response - col_fam1 = u"col-fam-id" - col_fam2 = u"col-fam-id2" + col_fam1 = "col-fam-id" + col_fam2 = "col-fam-id2" col_name1 = b"col-name1" col_name2 = b"col-name2" col_name3 = b"col-name3-but-other-fam" @@ -702,7 +702,7 @@ def test__parse_family_pb(): from google.cloud._helpers import _datetime_from_microseconds from google.cloud.bigtable.row import _parse_family_pb - col_fam1 = u"col-fam-id" + col_fam1 = "col-fam-id" col_name1 = b"col-name1" col_name2 = b"col-name2" cell_val1 = b"cell-val" diff --git a/tests/unit/test_row_data.py b/tests/unit/test_row_data.py index 60a138800..d647bbaba 100644 --- a/tests/unit/test_row_data.py +++ b/tests/unit/test_row_data.py @@ -22,7 +22,7 @@ TIMESTAMP_MICROS = 18738724000 # Make sure millis granularity ROW_KEY = b"row-key" -FAMILY_NAME = u"family" +FAMILY_NAME = "family" QUALIFIER = b"qualifier" TIMESTAMP_MICROS = 100 VALUE = b"value" @@ -64,7 +64,7 @@ def test_cell_from_pb(): def test_cell_from_pb_with_labels(): - labels = [u"label1", u"label2"] + labels = ["label1", "label2"] _cell_from_pb_test_helper(labels) @@ -156,8 +156,8 @@ def test_partial_row_data_to_dict(): cell2 = object() cell3 = object() - family_name1 = u"name1" - family_name2 = u"name2" + family_name1 = "name1" + family_name2 = "name2" qual1 = b"col1" qual2 = b"col2" qual3 = b"col3" @@ -178,7 +178,7 @@ def test_partial_row_data_to_dict(): def test_partial_row_data_cell_value(): - family_name = u"name1" + family_name = "name1" qualifier = b"col1" cell = _make_cell_pb(b"value-bytes") @@ -190,7 +190,7 @@ def test_partial_row_data_cell_value(): def test_partial_row_data_cell_value_invalid_index(): - family_name = u"name1" + family_name = "name1" qualifier = b"col1" cell = _make_cell_pb(b"") @@ -202,7 +202,7 @@ def test_partial_row_data_cell_value_invalid_index(): def test_partial_row_data_cell_value_invalid_column_family_key(): - family_name = u"name1" + family_name = "name1" qualifier = b"col1" partial_row_data = _make_partial_row_data(None) @@ -212,7 +212,7 @@ def test_partial_row_data_cell_value_invalid_column_family_key(): def test_partial_row_data_cell_value_invalid_column_key(): - family_name = u"name1" + family_name = "name1" qualifier = b"col1" partial_row_data = _make_partial_row_data(None) @@ -223,7 +223,7 @@ def test_partial_row_data_cell_value_invalid_column_key(): def test_partial_row_data_cell_values(): - family_name = u"name1" + family_name = "name1" qualifier = b"col1" cell = _make_cell_pb(b"value-bytes") @@ -238,7 +238,7 @@ def test_partial_row_data_cell_values(): def test_partial_row_data_cell_values_with_max_count(): - family_name = u"name1" + family_name = "name1" qualifier = b"col1" cell_1 = _make_cell_pb(b"value-bytes-1") cell_2 = _make_cell_pb(b"value-bytes-2") @@ -574,7 +574,7 @@ def test_partial_rows_data__copy_from_previous_unset(): cell = _PartialCellData() yrd._copy_from_previous(cell) assert cell.row_key == b"" - assert cell.family_name == u"" + assert cell.family_name == "" assert cell.qualifier is None assert cell.timestamp_micros == 0 assert cell.labels == [] @@ -582,7 +582,7 @@ def test_partial_rows_data__copy_from_previous_unset(): def test_partial_rows_data__copy_from_previous_blank(): ROW_KEY = "RK" - FAMILY_NAME = u"A" + FAMILY_NAME = "A" QUALIFIER = b"C" TIMESTAMP_MICROS = 100 LABELS = ["L1", "L2"] @@ -610,7 +610,7 @@ def test_partial_rows_data__copy_from_previous_filled(): from google.cloud.bigtable_v2.services.bigtable import BigtableClient ROW_KEY = "RK" - FAMILY_NAME = u"A" + FAMILY_NAME = "A" QUALIFIER = b"C" TIMESTAMP_MICROS = 100 LABELS = ["L1", "L2"] @@ -1324,13 +1324,13 @@ def _flatten_cells(prd): for qualifier, column in family.items(): for cell in column: yield { - u"rk": _bytes_to_unicode(row_key), - u"fm": family_name, - u"qual": _bytes_to_unicode(qualifier), - u"ts": _microseconds_from_datetime(cell.timestamp), - u"value": _bytes_to_unicode(cell.value), - u"label": u" ".join(cell.labels), - u"error": False, + "rk": _bytes_to_unicode(row_key), + "fm": family_name, + "qual": _bytes_to_unicode(qualifier), + "ts": _microseconds_from_datetime(cell.timestamp), + "value": _bytes_to_unicode(cell.value), + "label": " ".join(cell.labels), + "error": False, } @@ -1363,7 +1363,7 @@ def next(self): class _PartialCellData(object): row_key = b"" - family_name = u"" + family_name = "" qualifier = None timestamp_micros = 0 last_scanned_row_key = "" diff --git a/tests/unit/test_row_filters.py b/tests/unit/test_row_filters.py index 8c591e03c..b312cb942 100644 --- a/tests/unit/test_row_filters.py +++ b/tests/unit/test_row_filters.py @@ -92,7 +92,7 @@ def test_regex_filterconstructor(): def test_regex_filterconstructor_non_bytes(): from google.cloud.bigtable.row_filters import _RegexFilter - regex = u"abc" + regex = "abc" row_filter = _RegexFilter(regex) assert row_filter.regex == b"abc" @@ -183,7 +183,7 @@ def test_row_sample_filter_to_pb(): def test_family_name_regex_filter_to_pb(): from google.cloud.bigtable.row_filters import FamilyNameRegexFilter - regex = u"family-regex" + regex = "family-regex" row_filter = FamilyNameRegexFilter(regex) pb_val = row_filter.to_pb() expected_pb = _RowFilterPB(family_name_regex_filter=regex) @@ -450,7 +450,7 @@ def test_column_range_filter___ne__(): def test_column_range_filter_to_pb(): from google.cloud.bigtable.row_filters import ColumnRangeFilter - column_family_id = u"column-family-id" + column_family_id = "column-family-id" row_filter = ColumnRangeFilter(column_family_id) col_range_pb = _ColumnRangePB(family_name=column_family_id) expected_pb = _RowFilterPB(column_range_filter=col_range_pb) @@ -460,7 +460,7 @@ def test_column_range_filter_to_pb(): def test_column_range_filter_to_pb_inclusive_start(): from google.cloud.bigtable.row_filters import ColumnRangeFilter - column_family_id = u"column-family-id" + column_family_id = "column-family-id" column = b"column" row_filter = ColumnRangeFilter(column_family_id, start_column=column) col_range_pb = _ColumnRangePB( @@ -473,7 +473,7 @@ def test_column_range_filter_to_pb_inclusive_start(): def test_column_range_filter_to_pb_exclusive_start(): from google.cloud.bigtable.row_filters import ColumnRangeFilter - column_family_id = u"column-family-id" + column_family_id = "column-family-id" column = b"column" row_filter = ColumnRangeFilter( column_family_id, start_column=column, inclusive_start=False @@ -488,7 +488,7 @@ def test_column_range_filter_to_pb_exclusive_start(): def test_column_range_filter_to_pb_inclusive_end(): from google.cloud.bigtable.row_filters import ColumnRangeFilter - column_family_id = u"column-family-id" + column_family_id = "column-family-id" column = b"column" row_filter = ColumnRangeFilter(column_family_id, end_column=column) col_range_pb = _ColumnRangePB( @@ -501,7 +501,7 @@ def test_column_range_filter_to_pb_inclusive_end(): def test_column_range_filter_to_pb_exclusive_end(): from google.cloud.bigtable.row_filters import ColumnRangeFilter - column_family_id = u"column-family-id" + column_family_id = "column-family-id" column = b"column" row_filter = ColumnRangeFilter( column_family_id, end_column=column, inclusive_end=False @@ -526,7 +526,7 @@ def test_value_regex_filter_to_pb_w_bytes(): def test_value_regex_filter_to_pb_w_str(): from google.cloud.bigtable.row_filters import ValueRegexFilter - value = u"value-regex" + value = "value-regex" regex = value.encode("ascii") row_filter = ValueRegexFilter(value) pb_val = row_filter.to_pb() @@ -547,7 +547,7 @@ def test_exact_value_filter_to_pb_w_bytes(): def test_exact_value_filter_to_pb_w_str(): from google.cloud.bigtable.row_filters import ExactValueFilter - value = u"value-regex" + value = "value-regex" regex = value.encode("ascii") row_filter = ExactValueFilter(value) pb_val = row_filter.to_pb() @@ -846,7 +846,7 @@ def test_apply_label_filter___ne__(): def test_apply_label_filter_to_pb(): from google.cloud.bigtable.row_filters import ApplyLabelFilter - label = u"label" + label = "label" row_filter = ApplyLabelFilter(label) pb_val = row_filter.to_pb() expected_pb = _RowFilterPB(apply_label_transformer=label) diff --git a/tests/unit/test_table.py b/tests/unit/test_table.py index eacde3c3e..fb4ec3539 100644 --- a/tests/unit/test_table.py +++ b/tests/unit/test_table.py @@ -197,7 +197,9 @@ def test_table_name(): spec=["project", "table_data_client"], ) instance = mock.Mock( - _client=client, instance_id=INSTANCE_ID, spec=["_client", "instance_id"], + _client=client, + instance_id=INSTANCE_ID, + spec=["_client", "instance_id"], ) table = _make_table(TABLE_ID, instance) @@ -964,7 +966,9 @@ def test_table_read_retry_rows(): assert result.row_key == ROW_KEY_2 expected_request = _create_row_request( - table.name, start_key=ROW_KEY_1, end_key=ROW_KEY_2, + table.name, + start_key=ROW_KEY_1, + end_key=ROW_KEY_2, ) data_api.read_rows.mock_calls = [expected_request] * 3 @@ -1024,7 +1028,9 @@ def test_table_yield_retry_rows(): assert result.row_key == ROW_KEY_2 expected_request = _create_row_request( - table.name, start_key=ROW_KEY_1, end_key=ROW_KEY_2, + table.name, + start_key=ROW_KEY_1, + end_key=ROW_KEY_2, ) data_api.read_rows.mock_calls = [expected_request] * 3 @@ -1095,7 +1101,9 @@ def test_table_yield_rows_with_row_set(): assert rows[2].row_key == ROW_KEY_3 expected_request = _create_row_request( - table.name, start_key=ROW_KEY_1, end_key=ROW_KEY_2, + table.name, + start_key=ROW_KEY_1, + end_key=ROW_KEY_2, ) expected_request.rows.row_keys.append(ROW_KEY_3) data_api.read_rows.assert_called_once_with(expected_request, timeout=61.0) @@ -1146,7 +1154,8 @@ def test_table_truncate_w_timeout(): assert result is None table_api.drop_row_range.assert_called_once_with( - request={"name": TABLE_NAME, "delete_all_data_from_table": True}, timeout=120, + request={"name": TABLE_NAME, "delete_all_data_from_table": True}, + timeout=120, ) @@ -1183,7 +1192,8 @@ def test_table_drop_by_prefix_w_timeout(): assert result is None table_api.drop_row_range.assert_called_once_with( - request={"name": TABLE_NAME, "row_key_prefix": row_key_prefix}, timeout=120, + request={"name": TABLE_NAME, "row_key_prefix": row_key_prefix}, + timeout=120, ) @@ -1326,7 +1336,11 @@ def test_table_backup_factory_non_defaults(): instance = Instance(INSTANCE_ID, None) table = _make_table(TABLE_ID, instance) timestamp = datetime.datetime.utcnow().replace(tzinfo=UTC) - backup = table.backup(BACKUP_ID, cluster_id=CLUSTER_ID, expire_time=timestamp,) + backup = table.backup( + BACKUP_ID, + cluster_id=CLUSTER_ID, + expire_time=timestamp, + ) assert isinstance(backup, Backup) assert backup.backup_id == BACKUP_ID @@ -1624,7 +1638,8 @@ def _do_mutate_retryable_rows_helper( if prior_status is None or prior_status.code in RETRYABLES: mutations = row._get_mutations().copy() # row clears on success entry = data_messages_v2_pb2.MutateRowsRequest.Entry( - row_key=row.row_key, mutations=mutations, + row_key=row.row_key, + mutations=mutations, ) expected_entries.append(entry) @@ -1698,7 +1713,9 @@ def test_rmrw_do_mutate_retryable_rows_w_timeout(): timeout = 5 # seconds _do_mutate_retryable_rows_helper( - row_cells, responses, timeout=timeout, + row_cells, + responses, + timeout=timeout, ) @@ -1720,7 +1737,9 @@ def test_rmrw_do_mutate_retryable_rows_w_retryable_error(): responses = () _do_mutate_retryable_rows_helper( - row_cells, responses, retryable_error=True, + row_cells, + responses, + retryable_error=True, ) @@ -1744,7 +1763,9 @@ def test_rmrw_do_mutate_retryable_rows_retry(): responses = [SUCCESS, RETRYABLE_1, NON_RETRYABLE] _do_mutate_retryable_rows_helper( - row_cells, responses, raising_retry=True, + row_cells, + responses, + raising_retry=True, ) From 3ec3f3a4d2e4bb53cf637fa5d53026f23e69dbe4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 16:56:29 +0000 Subject: [PATCH 05/11] chore(python): add E231 to .flake8 ignore list (#546) Source-Link: https://github.com/googleapis/synthtool/commit/7ff4aad2ec5af0380e8bd6da1fa06eaadf24ec81 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 29227d4cf..2e4387498 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 87dd00611..9e0a9356b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe + digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 From 95112065faaa1f55f91d0b857531b7c35cd30c3a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:18:27 +0000 Subject: [PATCH 06/11] chore(python): update .pre-commit-config.yaml to use black==22.3.0 (#548) Source-Link: https://github.com/googleapis/synthtool/commit/7804ade3daae0d66649bee8df6c55484c6580b8d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d --- .github/.OwlBot.lock.yaml | 3 ++- .pre-commit-config.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 9e0a9356b..22cc254af 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244 + digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d +# created: 2022-03-30T23:44:26.560599165Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a77d..46d237160 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 From 1c744e30846fb490a63763c1e7c283b51c7b5e41 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 02:06:23 +0000 Subject: [PATCH 07/11] chore(python): Enable size-label bot (#550) Source-Link: https://github.com/googleapis/synthtool/commit/06e82790dd719a165ad32b8a06f8f6ec3e3cae0f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce --- .github/.OwlBot.lock.yaml | 4 ++-- .github/auto-label.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .github/auto-label.yaml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 22cc254af..58a0b153b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d -# created: 2022-03-30T23:44:26.560599165Z + digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce +# created: 2022-04-01T01:42:03.609279246Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 000000000..09c8d735b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,2 @@ +requestsize: + enabled: true From 284b0601f30b49603bfd19c0b30fab8ff8db2c42 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:32:41 +0000 Subject: [PATCH 08/11] chore(python): refactor unit / system test dependency install (#551) Source-Link: https://github.com/googleapis/synthtool/commit/993985f0fc4b37152e588f0549bcbdaf34666023 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd --- .github/.OwlBot.lock.yaml | 4 +- noxfile.py | 105 ++++++++++++++++++++++++++++++-------- 2 files changed, 87 insertions(+), 22 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 58a0b153b..fa5762290 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce -# created: 2022-04-01T01:42:03.609279246Z + digest: sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd +# created: 2022-04-01T15:48:07.524222836Z diff --git a/noxfile.py b/noxfile.py index 73ebd799c..9d1df22ae 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,40 @@ import os import pathlib import shutil +import warnings import nox - BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -93,23 +117,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -133,6 +175,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system_emulated(session): import subprocess @@ -182,13 +253,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: From f008eea69a6c7c1a027cefc7f16d46042b524db1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 3 Apr 2022 19:40:13 +0000 Subject: [PATCH 09/11] docs: Update `cpu_utilization_percent` limit (#547) - [ ] Regenerate this pull request now. docs: Remove the limitation that all clusters in a CMEK instance must use the same key PiperOrigin-RevId: 438385300 Source-Link: https://github.com/googleapis/googleapis/commit/c59f02e87d3ce01699ebf2adda7381af7c5eca31 Source-Link: https://github.com/googleapis/googleapis-gen/commit/04d03d17aafa7b4422f73c93600f040542817fcd Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDRkMDNkMTdhYWZhN2I0NDIyZjczYzkzNjAwZjA0MDU0MjgxN2ZjZCJ9 --- google/cloud/bigtable_admin_v2/types/instance.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/google/cloud/bigtable_admin_v2/types/instance.py b/google/cloud/bigtable_admin_v2/types/instance.py index 76733b615..26c502b04 100644 --- a/google/cloud/bigtable_admin_v2/types/instance.py +++ b/google/cloud/bigtable_admin_v2/types/instance.py @@ -121,10 +121,10 @@ class AutoscalingTargets(proto.Message): Attributes: cpu_utilization_percent (int): - The cpu utilization that the Autoscaler - should be trying to achieve. This number is on a - scale from 0 (no utilization) to 100 (total - utilization). + The cpu utilization that the Autoscaler should be trying to + achieve. This number is on a scale from 0 (no utilization) + to 100 (total utilization), and is limited between 10 and + 80, otherwise it will return INVALID_ARGUMENT error. """ cpu_utilization_percent = proto.Field( @@ -254,8 +254,6 @@ class EncryptionConfig(proto.Message): key. 2) Only regional keys can be used and the region of the CMEK key must match the region of the cluster. - 3) All clusters within an instance must use the same CMEK - key. """ kms_key_name = proto.Field( From de6692348792c4c614e8fc1fa58e6c817c60c06b Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Apr 2022 12:32:20 -0400 Subject: [PATCH 10/11] chore: allow releases on previous major versions (#552) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: allow releases on previous major versions * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .github/release-please.yml | 9 +++++++++ owlbot.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e5b..29601ad46 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,11 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v1 + handleGHRelease: true + releaseType: python +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/owlbot.py b/owlbot.py index 015670675..ba43cae94 100644 --- a/owlbot.py +++ b/owlbot.py @@ -219,6 +219,8 @@ def lint_setup_py(session): python.py_samples(skip_readmes=True) +python.configure_previous_major_version_branches() + s.replace( "samples/beam/noxfile.py", """INSTALL_LIBRARY_FROM_SOURCE \= os.environ.get\("INSTALL_LIBRARY_FROM_SOURCE", False\) in \( From 20de2b6f142827898bc86e57ecf18dbb714e3dd1 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 14:27:12 -0700 Subject: [PATCH 11/11] chore(main): release 2.8.0 (#544) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 14 ++++++++++++++ setup.py | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45f5756a3..09a408aba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ [1]: https://pypi.org/project/google-cloud-bigtable/#history +## [2.8.0](https://github.com/googleapis/python-bigtable/compare/v2.7.1...v2.8.0) (2022-04-04) + + +### Features + +* Add ListHotTablets API method and protobufs ([#542](https://github.com/googleapis/python-bigtable/issues/542)) ([483f139](https://github.com/googleapis/python-bigtable/commit/483f139f5065d55378bd850c33e89db460119fc1)) + + +### Documentation + +* explain mutate vs mutate_rows ([#543](https://github.com/googleapis/python-bigtable/issues/543)) ([84cfb0a](https://github.com/googleapis/python-bigtable/commit/84cfb0abdfabd8aa2f292fc0bb7e6deab50f87f1)) +* Remove the limitation that all clusters in a CMEK instance must use the same key ([f008eea](https://github.com/googleapis/python-bigtable/commit/f008eea69a6c7c1a027cefc7f16d46042b524db1)) +* Update `cpu_utilization_percent` limit ([#547](https://github.com/googleapis/python-bigtable/issues/547)) ([f008eea](https://github.com/googleapis/python-bigtable/commit/f008eea69a6c7c1a027cefc7f16d46042b524db1)) + ### [2.7.1](https://github.com/googleapis/python-bigtable/compare/v2.7.0...v2.7.1) (2022-03-17) diff --git a/setup.py b/setup.py index 5869995b2..351622914 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-bigtable" description = "Google Cloud Bigtable API client library" -version = "2.7.1" +version = "2.8.0" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta'