Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 24a4a1d

Browse files
committed
linting
1 parent 36c2471 commit 24a4a1d

3 files changed

Lines changed: 34 additions & 14 deletions

File tree

google/cloud/bigtable/admin_v2/overlay/services/bigtable_table_admin/async_client.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,18 @@
5050
from google.cloud.bigtable.admin_v2.services.bigtable_table_admin.transports.base import (
5151
BigtableTableAdminTransport,
5252
)
53-
from google.cloud.bigtable.admin_v2.overlay.types import async_consistency, wait_for_consistency_request
53+
from google.cloud.bigtable.admin_v2.overlay.types import (
54+
async_consistency,
55+
wait_for_consistency_request,
56+
)
5457

5558
from google.cloud.bigtable.gapic_version import __version__ as bigtable_version
5659

5760

5861
DEFAULT_CLIENT_INFO = copy.copy(base_client.DEFAULT_CLIENT_INFO)
5962
DEFAULT_CLIENT_INFO.client_library_version = f"{bigtable_version}-admin-overlay-async"
6063

64+
6165
class BigtableTableAdminAsyncClient(base_client.BaseBigtableTableAdminAsyncClient):
6266
def __init__(
6367
self,
@@ -129,7 +133,6 @@ def __init__(
129133
client_info=client_info,
130134
)
131135

132-
133136
async def wait_for_consistency(
134137
self,
135138
request: Optional[
@@ -269,8 +272,9 @@ def sample_wait_for_consistency():
269272
)
270273

271274
# Block and wait until the polling harness returns True.
272-
check_consistency_future = async_consistency._AsyncCheckConsistencyPollingFuture(
273-
check_consistency_call
275+
check_consistency_future = (
276+
async_consistency._AsyncCheckConsistencyPollingFuture(
277+
check_consistency_call
278+
)
274279
)
275-
return (await check_consistency_future.result())
276-
280+
return await check_consistency_future.result()

tests/unit/admin_overlay/test_async_client.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
),
5656
],
5757
)
58-
def test_bigtable_table_admin_async_client_client_version(transport_class, transport_name):
58+
def test_bigtable_table_admin_async_client_client_version(
59+
transport_class, transport_name
60+
):
5961
with mock.patch.object(transport_class, "__init__") as patched:
6062
patched.return_value = None
6163
BigtableTableAdminAsyncClient(transport=transport_name)
@@ -143,8 +145,12 @@ async def test_bigtable_table_admin_async_client_wait_for_consistency(
143145
check_mock_side_effect = [FALSE_CONSISTENCY_RESPONSE] * (poll_count - 1)
144146
check_mock_side_effect.append(TRUE_CONSISTENCY_RESPONSE)
145147

146-
with mock.patch.object(client, "generate_consistency_token", new_callable=mock.AsyncMock) as generate_mock:
147-
with mock.patch.object(client, "check_consistency", new_callable=mock.AsyncMock) as check_mock:
148+
with mock.patch.object(
149+
client, "generate_consistency_token", new_callable=mock.AsyncMock
150+
) as generate_mock:
151+
with mock.patch.object(
152+
client, "check_consistency", new_callable=mock.AsyncMock
153+
) as check_mock:
148154
generate_mock.return_value = (
149155
bigtable_table_admin.GenerateConsistencyTokenResponse(
150156
consistency_token=CONSISTENCY_TOKEN,
@@ -189,15 +195,21 @@ async def test_bigtable_table_admin_async_client_wait_for_consistency_error_in_c
189195
)
190196

191197
with pytest.raises(exceptions.GoogleAPICallError):
192-
with mock.patch.object(client, "generate_consistency_token", new_callable=mock.AsyncMock) as generate_mock:
198+
with mock.patch.object(
199+
client, "generate_consistency_token", new_callable=mock.AsyncMock
200+
) as generate_mock:
193201
generate_mock.side_effect = exceptions.DeadlineExceeded(
194202
"Deadline Exceeded."
195203
)
196204
await client.wait_for_consistency(request)
197205

198206
with pytest.raises(exceptions.GoogleAPICallError):
199-
with mock.patch.object(client, "generate_consistency_token", new_callable=mock.AsyncMock) as generate_mock:
200-
with mock.patch.object(client, "check_consistency", new_callable=mock.AsyncMock) as check_mock:
207+
with mock.patch.object(
208+
client, "generate_consistency_token", new_callable=mock.AsyncMock
209+
) as generate_mock:
210+
with mock.patch.object(
211+
client, "check_consistency", new_callable=mock.AsyncMock
212+
) as check_mock:
201213
generate_mock.return_value = (
202214
bigtable_table_admin.GenerateConsistencyTokenResponse(
203215
consistency_token=CONSISTENCY_TOKEN,

tests/unit/admin_overlay/test_async_consistency.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ def async_mock_check_consistency_callable(max_poll_count=1):
4545

4646
def test_check_consistency_future_cancel():
4747
check_consistency_call = async_mock_check_consistency_callable()
48-
future = async_consistency._AsyncCheckConsistencyPollingFuture(check_consistency_call)
48+
future = async_consistency._AsyncCheckConsistencyPollingFuture(
49+
check_consistency_call
50+
)
4951
with pytest.raises(NotImplementedError):
5052
future.cancel()
5153

@@ -57,7 +59,9 @@ def test_check_consistency_future_cancel():
5759
async def test_check_consistency_future_result():
5860
times = 5
5961
check_consistency_call = async_mock_check_consistency_callable(times)
60-
future = async_consistency._AsyncCheckConsistencyPollingFuture(check_consistency_call)
62+
future = async_consistency._AsyncCheckConsistencyPollingFuture(
63+
check_consistency_call
64+
)
6165
is_consistent = await future.result()
6266

6367
assert is_consistent

0 commit comments

Comments
 (0)