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

Commit c560589

Browse files
committed
fixed lint
1 parent fb84b4b commit c560589

7 files changed

Lines changed: 323 additions & 155 deletions

File tree

google/cloud/bigtable/data/_async/_mutate_rows.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
from typing import Sequence, TYPE_CHECKING
1818

19-
from functools import partial
20-
2119
from google.api_core import exceptions as core_exceptions
2220
from google.api_core import retry as retries
2321
import google.cloud.bigtable_v2.types.bigtable as types_pb

google/cloud/bigtable/data/_async/_read_rows.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from typing import Sequence, TYPE_CHECKING
1919

2020
import time
21-
from functools import partial
2221

2322
from google.cloud.bigtable_v2.types import ReadRowsRequest as ReadRowsRequestPB
2423
from google.cloud.bigtable_v2.types import ReadRowsResponse as ReadRowsResponsePB

google/cloud/bigtable/data/_async/metrics_interceptor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ async def intercept_unary_stream(
156156
):
157157
async def response_wrapper(call):
158158
# only track has_first response for READ_ROWS
159-
has_first_response = operation.first_response_latency_ns is not None or operation.op_type != OperationType.READ_ROWS
159+
has_first_response = (
160+
operation.first_response_latency_ns is not None
161+
or operation.op_type != OperationType.READ_ROWS
162+
)
160163
encountered_exc = None
161164
try:
162165
async for response in call:

google/cloud/bigtable/data/_helpers.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def _retry_exception_factory(
123123

124124
def _tracked_exception_factory(
125125
operation: "ActiveOperationMetric",
126-
) -> Callable[[list[Exception], RetryFailureReason, float | None], tuple[Exception, Exception | None]]:
126+
) -> Callable[
127+
[list[Exception], RetryFailureReason, float | None],
128+
tuple[Exception, Exception | None],
129+
]:
127130
"""
128131
wraps and extends _retry_exception_factory to add client-side metrics tracking.
129132
@@ -143,19 +146,28 @@ def _tracked_exception_factory(
143146
tuple[Exception, Exception|None]:
144147
tuple of the exception to raise, and a cause exception if applicabl
145148
"""
146-
def wrapper(exc_list: list[Exception], reason: RetryFailureReason, timeout_val: float | None) -> tuple[Exception, Exception | None]:
149+
150+
def wrapper(
151+
exc_list: list[Exception], reason: RetryFailureReason, timeout_val: float | None
152+
) -> tuple[Exception, Exception | None]:
147153
source_exc, cause_exc = _retry_exception_factory(exc_list, reason, timeout_val)
148154
try:
149155
# record metadata from failed rpc
150-
if isinstance(source_exc, core_exceptions.GoogleAPICallError) and source_exc.errors:
156+
if (
157+
isinstance(source_exc, core_exceptions.GoogleAPICallError)
158+
and source_exc.errors
159+
):
151160
rpc_error = source_exc.errors[-1]
152-
metadata = list(rpc_error.trailing_metadata()) + list(rpc_error.initial_metadata())
153-
operation.add_response_metadata({k:v for k,v in metadata})
161+
metadata = list(rpc_error.trailing_metadata()) + list(
162+
rpc_error.initial_metadata()
163+
)
164+
operation.add_response_metadata({k: v for k, v in metadata})
154165
except Exception:
155166
# ignore errors in metadata collection
156167
pass
157168
operation.end_with_status(source_exc)
158169
return source_exc, cause_exc
170+
159171
return wrapper
160172

161173

tests/system/data/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
#
1616
import pytest
1717
import uuid
18-
from google.cloud.bigtable.data._cross_sync import CrossSync
1918

2019
TEST_FAMILY = "test-family"
2120
TEST_FAMILY_2 = "test-family-2"
2221
TEST_AGGREGATE_FAMILY = "test-aggregate-family"
2322

23+
2424
class SystemTestRunner:
2525
"""
2626
configures a system test class with configuration for clusters/tables/etc
@@ -67,4 +67,4 @@ def column_family_config(self):
6767
TEST_AGGREGATE_FAMILY: types.ColumnFamily(
6868
value_type=types.Type(aggregate_type=int_aggregate_type)
6969
),
70-
}
70+
}

0 commit comments

Comments
 (0)