Skip to content

Commit fa62ff2

Browse files
committed
run nox -s generate_sync
1 parent b984329 commit fa62ff2

File tree

18 files changed

+105
-162
lines changed

18 files changed

+105
-162
lines changed

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
# This file is automatically generated by CrossSync. Do not edit manually.
1717

1818
from __future__ import annotations
19-
2019
from typing import TYPE_CHECKING, Sequence
21-
2220
from google.api_core import exceptions as core_exceptions
2321
from google.api_core import retry as retries
24-
2522
import google.cloud.bigtable.data.exceptions as bt_exceptions
2623
import google.cloud.bigtable_v2.types.bigtable as types_pb
2724
from google.cloud.bigtable.data._cross_sync import CrossSync
@@ -35,10 +32,10 @@
3532
)
3633

3734
if TYPE_CHECKING:
35+
from google.cloud.bigtable.data.mutations import RowMutationEntry
3836
from google.cloud.bigtable.data._sync_autogen.client import (
3937
_DataApiTarget as TargetType,
4038
)
41-
from google.cloud.bigtable.data.mutations import RowMutationEntry
4239
from google.cloud.bigtable_v2.services.bigtable.client import (
4340
BigtableClient as GapicClientType,
4441
)
@@ -137,8 +134,7 @@ def _run_attempt(self):
137134
GoogleAPICallError: if the gapic rpc fails"""
138135
request_entries = [self.mutations[idx].proto for idx in self.remaining_indices]
139136
active_request_indices = {
140-
req_idx: orig_idx
141-
for (req_idx, orig_idx) in enumerate(self.remaining_indices)
137+
req_idx: orig_idx for req_idx, orig_idx in enumerate(self.remaining_indices)
142138
}
143139
self.remaining_indices = []
144140
if not request_entries:

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_read_rows.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
# This file is automatically generated by CrossSync. Do not edit manually.
1818

1919
from __future__ import annotations
20-
2120
from typing import TYPE_CHECKING, Sequence
22-
2321
from google.api_core import retry as retries
2422
from google.api_core.retry import exponential_sleep_generator
25-
2623
from google.cloud.bigtable.data._cross_sync import CrossSync
2724
from google.cloud.bigtable.data._helpers import (
2825
_attempt_timeout_generator,

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/_swappable_channel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
# This file is automatically generated by CrossSync. Do not edit manually.
1717

1818
from __future__ import annotations
19-
2019
from typing import Callable
21-
22-
from grpc import Channel, ChannelConnectivity
20+
from grpc import ChannelConnectivity
21+
from grpc import Channel
2322

2423

2524
class _WrappedChannel(Channel):

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/client.py

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@
1717
# This file is automatically generated by CrossSync. Do not edit manually.
1818

1919
from __future__ import annotations
20-
2120
import abc
2221
import concurrent.futures
2322
import os
2423
import random
2524
import time
2625
import warnings
2726
from functools import partial
28-
from typing import TYPE_CHECKING, Any, Callable, Iterable, Optional, Sequence, Set, cast
29-
27+
from typing import TYPE_CHECKING, Any, Callable, Optional, Sequence, Set, cast
3028
import google.auth._default
3129
import google.auth.credentials
3230
from google.api_core import client_options as client_options_lib
@@ -41,8 +39,7 @@
4139
from google.cloud.environment_vars import BIGTABLE_EMULATOR
4240
from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
4341
from google.protobuf.message import Message
44-
from grpc import Channel, insecure_channel, intercept_channel
45-
42+
from grpc import Channel
4643
from google.cloud.bigtable.client import _DEFAULT_BIGTABLE_EMULATOR_CLIENT
4744
from google.cloud.bigtable.data._cross_sync import CrossSync
4845
from google.cloud.bigtable.data._helpers import (
@@ -58,13 +55,6 @@
5855
_WarmedInstanceKey,
5956
)
6057
from google.cloud.bigtable.data._metrics import BigtableClientSideMetricsController
61-
from google.cloud.bigtable.data._sync_autogen._swappable_channel import (
62-
SwappableChannel as SwappableChannelType,
63-
)
64-
from google.cloud.bigtable.data._sync_autogen.metrics_interceptor import (
65-
BigtableMetricsInterceptor as MetricsInterceptorType,
66-
)
67-
from google.cloud.bigtable.data._sync_autogen.mutations_batcher import _MB_SIZE
6858
from google.cloud.bigtable.data.exceptions import (
6959
FailedQueryShardError,
7060
ShardedReadRowsExceptionGroup,
@@ -88,10 +78,6 @@
8878
RowFilterChain,
8979
StripValueTransformerFilter,
9080
)
91-
from google.cloud.bigtable_v2.services.bigtable import BigtableClient as GapicClient
92-
from google.cloud.bigtable_v2.services.bigtable.transports import (
93-
BigtableGrpcTransport as TransportType,
94-
)
9581
from google.cloud.bigtable_v2.services.bigtable.transports.base import (
9682
DEFAULT_CLIENT_INFO,
9783
)
@@ -102,6 +88,19 @@
10288
ReadModifyWriteRowRequest,
10389
SampleRowKeysRequest,
10490
)
91+
from typing import Iterable
92+
from grpc import insecure_channel, intercept_channel
93+
from google.cloud.bigtable.data._sync_autogen._swappable_channel import (
94+
SwappableChannel as SwappableChannelType,
95+
)
96+
from google.cloud.bigtable.data._sync_autogen.metrics_interceptor import (
97+
BigtableMetricsInterceptor as MetricsInterceptorType,
98+
)
99+
from google.cloud.bigtable.data._sync_autogen.mutations_batcher import _MB_SIZE
100+
from google.cloud.bigtable_v2.services.bigtable import BigtableClient as GapicClient
101+
from google.cloud.bigtable_v2.services.bigtable.transports import (
102+
BigtableGrpcTransport as TransportType,
103+
)
105104

106105
if TYPE_CHECKING:
107106
from google.cloud.bigtable.data._helpers import RowKeySamples, ShardedQuery
@@ -320,7 +319,7 @@ def _ping_and_warm_instances(
320319
],
321320
wait_for_ready=True,
322321
)
323-
for (instance_name, app_profile_id) in instance_list
322+
for instance_name, app_profile_id in instance_list
324323
]
325324
result_list = CrossSync._Sync_Impl.gather_partials(
326325
partial_list, return_exceptions=True, sync_executor=self._executor
@@ -669,7 +668,7 @@ def execute_query(
669668
prepare_predicate = retries.if_exception_type(
670669
*[_get_error_type(e) for e in prepare_retryable_errors]
671670
)
672-
(prepare_operation_timeout, prepare_attempt_timeout) = _align_timeouts(
671+
prepare_operation_timeout, prepare_attempt_timeout = _align_timeouts(
673672
prepare_operation_timeout, prepare_attempt_timeout
674673
)
675674
prepare_sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
@@ -695,7 +694,7 @@ def execute_query(
695694
"prepared_query": prepare_result.prepared_query,
696695
"params": pb_params,
697696
}
698-
(operation_timeout, attempt_timeout) = _align_timeouts(
697+
operation_timeout, attempt_timeout = _align_timeouts(
699698
operation_timeout, attempt_timeout
700699
)
701700
return CrossSync._Sync_Impl.ExecuteQueryIterator(
@@ -896,7 +895,7 @@ def read_rows_stream(
896895
from any retries that failed
897896
google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
898897
"""
899-
(operation_timeout, attempt_timeout) = _get_timeouts(
898+
operation_timeout, attempt_timeout = _get_timeouts(
900899
operation_timeout, attempt_timeout, self
901900
)
902901
retryable_excs = _get_retryable_errors(retryable_errors, self)
@@ -1042,7 +1041,7 @@ def read_rows_sharded(
10421041
ValueError: if the query_list is empty"""
10431042
if not sharded_query:
10441043
raise ValueError("empty sharded_query")
1045-
(operation_timeout, attempt_timeout) = _get_timeouts(
1044+
operation_timeout, attempt_timeout = _get_timeouts(
10461045
operation_timeout, attempt_timeout, self
10471046
)
10481047
rpc_timeout_generator = _attempt_timeout_generator(
@@ -1085,7 +1084,7 @@ def read_rows_with_semaphore(query):
10851084
raise ShardedReadRowsExceptionGroup(
10861085
[
10871086
FailedQueryShardError(idx, sharded_query[idx], e)
1088-
for (idx, e) in error_dict.items()
1087+
for idx, e in error_dict.items()
10891088
],
10901089
results_list,
10911090
len(sharded_query),
@@ -1175,7 +1174,7 @@ def sample_row_keys(
11751174
from any retries that failed
11761175
google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
11771176
"""
1178-
(operation_timeout, attempt_timeout) = _get_timeouts(
1177+
operation_timeout, attempt_timeout = _get_timeouts(
11791178
operation_timeout, attempt_timeout, self
11801179
)
11811180
attempt_timeout_gen = _attempt_timeout_generator(
@@ -1290,7 +1289,7 @@ def mutate_row(
12901289
google.api_core.exceptions.GoogleAPIError: raised on non-idempotent operations that cannot be
12911290
safely retried.
12921291
ValueError: if invalid arguments are provided"""
1293-
(operation_timeout, attempt_timeout) = _get_timeouts(
1292+
operation_timeout, attempt_timeout = _get_timeouts(
12941293
operation_timeout, attempt_timeout, self
12951294
)
12961295
if not mutations:
@@ -1362,7 +1361,7 @@ def bulk_mutate_rows(
13621361
MutationsExceptionGroup: if one or more mutations fails
13631362
Contains details about any failed entries in .exceptions
13641363
ValueError: if invalid arguments are provided"""
1365-
(operation_timeout, attempt_timeout) = _get_timeouts(
1364+
operation_timeout, attempt_timeout = _get_timeouts(
13661365
operation_timeout, attempt_timeout, self
13671366
)
13681367
retryable_excs = _get_retryable_errors(retryable_errors, self)
@@ -1415,7 +1414,7 @@ def check_and_mutate_row(
14151414
bool indicating whether the predicate was true or false
14161415
Raises:
14171416
google.api_core.exceptions.GoogleAPIError: exceptions from grpc call"""
1418-
(operation_timeout, _) = _get_timeouts(operation_timeout, None, self)
1417+
operation_timeout, _ = _get_timeouts(operation_timeout, None, self)
14191418
if true_case_mutations is not None and (
14201419
not isinstance(true_case_mutations, list)
14211420
):
@@ -1470,7 +1469,7 @@ def read_modify_write_row(
14701469
Raises:
14711470
google.api_core.exceptions.GoogleAPIError: exceptions from grpc call
14721471
ValueError: if invalid arguments are provided"""
1473-
(operation_timeout, _) = _get_timeouts(operation_timeout, None, self)
1472+
operation_timeout, _ = _get_timeouts(operation_timeout, None, self)
14741473
if operation_timeout <= 0:
14751474
raise ValueError("operation_timeout must be greater than 0")
14761475
if rules is not None and (not isinstance(rules, list)):

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/metrics_interceptor.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,15 @@
1515
# This file is automatically generated by CrossSync. Do not edit manually.
1616

1717
from __future__ import annotations
18-
1918
import time
2019
from functools import wraps
2120
from typing import Sequence
22-
23-
from grpc import UnaryStreamClientInterceptor, UnaryUnaryClientInterceptor
24-
2521
from google.cloud.bigtable.data._metrics.data_model import (
2622
ActiveOperationMetric,
2723
OperationState,
2824
OperationType,
2925
)
26+
from grpc import UnaryStreamClientInterceptor, UnaryUnaryClientInterceptor
3027

3128

3229
def _with_active_operation(func):
@@ -54,7 +51,7 @@ def _get_metadata(source) -> dict[str, str | bytes] | None:
5451
try:
5552
metadata: Sequence[tuple[str, str | bytes]]
5653
metadata = source.trailing_metadata() + source.initial_metadata()
57-
return {k: v for (k, v) in metadata}
54+
return {k: v for k, v in metadata}
5855
except Exception:
5956
return None
6057

packages/google-cloud-bigtable/google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
# This file is automatically generated by CrossSync. Do not edit manually.
1717

1818
from __future__ import annotations
19-
2019
import atexit
2120
import concurrent.futures
2221
import warnings
2322
from collections import deque
2423
from typing import TYPE_CHECKING, Sequence, cast
25-
2624
from google.cloud.bigtable.data._cross_sync import CrossSync
2725
from google.cloud.bigtable.data._helpers import (
2826
TABLE_DEFAULT,
@@ -39,10 +37,10 @@
3937
)
4038

4139
if TYPE_CHECKING:
40+
from google.cloud.bigtable.data.mutations import RowMutationEntry
4241
from google.cloud.bigtable.data._sync_autogen.client import (
4342
_DataApiTarget as TargetType,
4443
)
45-
from google.cloud.bigtable.data.mutations import RowMutationEntry
4644
_MB_SIZE = 1024 * 1024
4745

4846

@@ -201,7 +199,7 @@ def __init__(
201199
batch_retryable_errors: Sequence[type[Exception]]
202200
| TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
203201
):
204-
(self._operation_timeout, self._attempt_timeout) = _get_timeouts(
202+
self._operation_timeout, self._attempt_timeout = _get_timeouts(
205203
batch_operation_timeout, batch_attempt_timeout, table
206204
)
207205
self._retryable_errors: list[type[Exception]] = _get_retryable_errors(
@@ -210,7 +208,7 @@ def __init__(
210208
self._closed = CrossSync._Sync_Impl.Event()
211209
self._target = table
212210
self._staged_entries: list[RowMutationEntry] = []
213-
(self._staged_count, self._staged_bytes) = (0, 0)
211+
self._staged_count, self._staged_bytes = (0, 0)
214212
self._flow_control = CrossSync._Sync_Impl._FlowControl(
215213
flow_control_max_mutation_count, flow_control_max_bytes
216214
)
@@ -291,8 +289,8 @@ def _schedule_flush(self) -> CrossSync._Sync_Impl.Future[None] | None:
291289
Future[None] | None:
292290
future representing the background task, if started"""
293291
if self._staged_entries:
294-
(entries, self._staged_entries) = (self._staged_entries, [])
295-
(self._staged_count, self._staged_bytes) = (0, 0)
292+
entries, self._staged_entries = (self._staged_entries, [])
293+
self._staged_count, self._staged_bytes = (0, 0)
296294
new_task = CrossSync._Sync_Impl.create_task(
297295
self._flush_internal, entries, sync_executor=self._sync_flush_executor
298296
)
@@ -371,14 +369,14 @@ def _raise_exceptions(self):
371369
Raises:
372370
MutationsExceptionGroup: exception group with all unreported exceptions"""
373371
if self._oldest_exceptions or self._newest_exceptions:
374-
(oldest, self._oldest_exceptions) = (self._oldest_exceptions, [])
372+
oldest, self._oldest_exceptions = (self._oldest_exceptions, [])
375373
newest = list(self._newest_exceptions)
376374
self._newest_exceptions.clear()
377-
(entry_count, self._entries_processed_since_last_raise) = (
375+
entry_count, self._entries_processed_since_last_raise = (
378376
self._entries_processed_since_last_raise,
379377
0,
380378
)
381-
(exc_count, self._exceptions_since_last_raise) = (
379+
exc_count, self._exceptions_since_last_raise = (
382380
self._exceptions_since_last_raise,
383381
0,
384382
)

packages/google-cloud-bigtable/google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@
1616
# This file is automatically generated by CrossSync. Do not edit manually.
1717

1818
from __future__ import annotations
19-
2019
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Tuple
21-
2220
from google.api_core import retry as retries
2321
from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
2422
from google.protobuf.message import Message
25-
2623
from google.cloud.bigtable.data._cross_sync import CrossSync
2724
from google.cloud.bigtable.data._helpers import (
2825
_attempt_timeout_generator,
@@ -42,9 +39,7 @@
4239
from google.cloud.bigtable_v2.types.bigtable import (
4340
ExecuteQueryRequest as ExecuteQueryRequestPB,
4441
)
45-
from google.cloud.bigtable_v2.types.bigtable import (
46-
ExecuteQueryResponse,
47-
)
42+
from google.cloud.bigtable_v2.types.bigtable import ExecuteQueryResponse
4843

4944
if TYPE_CHECKING:
5045
from google.cloud.bigtable.data import BigtableDataClient as DataClientType

packages/google-cloud-bigtable/test_proxy/handlers/client_handler_data_sync_autogen.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ async def ExecuteQuery(self, request, **kwargs):
190190
app_profile_id = self.app_profile_id or request.get("app_profile_id", None)
191191
query = request.get("query")
192192
params = request.get("params") or {}
193-
(formatted_params, parameter_types) = sql_encoding_helpers.convert_params(
194-
params
195-
)
193+
formatted_params, parameter_types = sql_encoding_helpers.convert_params(params)
196194
operation_timeout = (
197195
kwargs.get("operation_timeout", self.per_operation_timeout) or 20
198196
)

0 commit comments

Comments
 (0)