Skip to content

Commit 245bd08

Browse files
committed
removed conversion decorators
1 parent 48bb06f commit 245bd08

File tree

11 files changed

+0
-211
lines changed

11 files changed

+0
-211
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ class _EntryWithProto: # noqa: F811
6262
proto: types_pb.MutateRowsRequest.Entry
6363

6464

65-
@CrossSync.export_sync(
66-
path="google.cloud.bigtable.data._sync._mutate_rows._MutateRowsOperation",
67-
)
6865
class _MutateRowsOperationAsync:
6966
"""
7067
MutateRowsOperation manages the logic of sending a set of row mutations,
@@ -84,12 +81,6 @@ class _MutateRowsOperationAsync:
8481
If not specified, the request will run until operation_timeout is reached.
8582
"""
8683

87-
@CrossSync.convert(
88-
replace_symbols={
89-
"BigtableAsyncClient": "BigtableClient",
90-
"TableAsync": "Table",
91-
}
92-
)
9384
def __init__(
9485
self,
9586
gapic_client: "BigtableAsyncClient",
@@ -141,7 +132,6 @@ def __init__(
141132
self.remaining_indices = list(range(len(self.mutations)))
142133
self.errors: dict[int, list[Exception]] = {}
143134

144-
@CrossSync.convert
145135
async def start(self):
146136
"""
147137
Start the operation, and run until completion
@@ -174,7 +164,6 @@ async def start(self):
174164
if all_errors:
175165
raise MutationsExceptionGroup(all_errors, len(self.mutations))
176166

177-
@CrossSync.convert
178167
async def _run_attempt(self):
179168
"""
180169
Run a single attempt of the mutate_rows rpc.

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ def __init__(self, chunk):
5151
self.chunk = chunk
5252

5353

54-
@CrossSync.export_sync(
55-
path="google.cloud.bigtable.data._sync._read_rows._ReadRowsOperation",
56-
)
5754
class _ReadRowsOperationAsync:
5855
"""
5956
ReadRowsOperation handles the logic of merging chunks from a ReadRowsResponse stream
@@ -85,7 +82,6 @@ class _ReadRowsOperationAsync:
8582
"_remaining_count",
8683
)
8784

88-
@CrossSync.convert(replace_symbols={"TableAsync": "Table"})
8985
def __init__(
9086
self,
9187
query: ReadRowsQuery,
@@ -166,7 +162,6 @@ def _read_rows_attempt(self) -> CrossSync.Iterable[Row]:
166162
chunked_stream = self.chunk_stream(gapic_stream)
167163
return self.merge_rows(chunked_stream)
168164

169-
@CrossSync.convert
170165
async def chunk_stream(
171166
self, stream: CrossSync.Awaitable[CrossSync.Iterable[ReadRowsResponsePB]]
172167
) -> CrossSync.Iterable[ReadRowsResponsePB.CellChunk]:
@@ -219,9 +214,6 @@ async def chunk_stream(
219214
current_key = None
220215

221216
@staticmethod
222-
@CrossSync.convert(
223-
replace_symbols={"__aiter__": "__iter__", "__anext__": "__next__"}
224-
)
225217
async def merge_rows(
226218
chunks: CrossSync.Iterable[ReadRowsResponsePB.CellChunk] | None,
227219
) -> CrossSync.Iterable[Row]:

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

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,7 @@
110110
from google.cloud.bigtable.data._helpers import ShardedQuery
111111

112112

113-
@CrossSync.export_sync(
114-
path="google.cloud.bigtable.data._sync.client.BigtableDataClient",
115-
)
116113
class BigtableDataClientAsync(ClientWithProject):
117-
@CrossSync.convert(
118-
replace_symbols={
119-
"BigtableAsyncClient": "BigtableClient",
120-
"PooledBigtableGrpcAsyncIOTransport": "PooledBigtableGrpcTransport",
121-
"AsyncPooledChannel": "PooledChannel",
122-
}
123-
)
124114
def __init__(
125115
self,
126116
*,
@@ -266,7 +256,6 @@ def _start_background_channel_refresh(self) -> None:
266256
lambda _: self._channel_refresh_tasks.remove(refresh_task) if refresh_task in self._channel_refresh_tasks else None
267257
)
268258

269-
@CrossSync.convert
270259
async def close(self, timeout: float | None = None):
271260
"""
272261
Cancel all background tasks
@@ -279,7 +268,6 @@ async def close(self, timeout: float | None = None):
279268
self._executor.shutdown(wait=False)
280269
await CrossSync.wait(self._channel_refresh_tasks, timeout=timeout)
281270

282-
@CrossSync.convert
283271
async def _ping_and_warm_instances(
284272
self, channel: Channel, instance_key: _helpers._WarmedInstanceKey | None = None
285273
) -> list[BaseException | None]:
@@ -321,7 +309,6 @@ async def _ping_and_warm_instances(
321309
)
322310
return [r or None for r in result_list]
323311

324-
@CrossSync.convert
325312
async def _manage_channel(
326313
self,
327314
channel_idx: int,
@@ -378,7 +365,6 @@ async def _manage_channel(
378365
next_refresh = random.uniform(refresh_interval_min, refresh_interval_max)
379366
next_sleep = next_refresh - (time.monotonic() - start_timestamp)
380367

381-
@CrossSync.convert(replace_symbols={"TableAsync": "Table"})
382368
async def _register_instance(self, instance_id: str, owner: TableAsync) -> None:
383369
"""
384370
Registers an instance with the client, and warms the channel pool
@@ -409,7 +395,6 @@ async def _register_instance(self, instance_id: str, owner: TableAsync) -> None:
409395
# refresh tasks aren't active. start them as background tasks
410396
self._start_background_channel_refresh()
411397

412-
@CrossSync.convert(replace_symbols={"TableAsync": "Table"})
413398
async def _remove_instance_registration(
414399
self, instance_id: str, owner: TableAsync
415400
) -> bool:
@@ -440,7 +425,6 @@ async def _remove_instance_registration(
440425
except KeyError:
441426
return False
442427

443-
@CrossSync.convert(replace_symbols={"TableAsync": "Table"})
444428
def get_table(self, instance_id: str, table_id: str, *args, **kwargs) -> TableAsync:
445429
"""
446430
Returns a table instance for making data API requests. All arguments are passed
@@ -482,18 +466,15 @@ def get_table(self, instance_id: str, table_id: str, *args, **kwargs) -> TableAs
482466
"""
483467
return TableAsync(self, instance_id, table_id, *args, **kwargs)
484468

485-
@CrossSync.convert(sync_name="__enter__")
486469
async def __aenter__(self):
487470
self._start_background_channel_refresh()
488471
return self
489472

490-
@CrossSync.convert(sync_name="__exit__", replace_symbols={"__aexit__": "__exit__"})
491473
async def __aexit__(self, exc_type, exc_val, exc_tb):
492474
await self.close()
493475
await self._gapic_client.__aexit__(exc_type, exc_val, exc_tb)
494476

495477

496-
@CrossSync.export_sync(path="google.cloud.bigtable.data._sync.client.Table")
497478
class TableAsync:
498479
"""
499480
Main Data API surface
@@ -502,9 +483,6 @@ class TableAsync:
502483
each call
503484
"""
504485

505-
@CrossSync.convert(
506-
replace_symbols={"BigtableDataClientAsync": "BigtableDataClient"}
507-
)
508486
def __init__(
509487
self,
510488
client: BigtableDataClientAsync,
@@ -625,12 +603,6 @@ def __init__(
625603
f"{self.__class__.__name__} must be created within an async event loop context."
626604
) from e
627605

628-
@CrossSync.convert(
629-
replace_symbols={
630-
"AsyncIterable": "Iterable",
631-
"_ReadRowsOperationAsync": "_ReadRowsOperation",
632-
}
633-
)
634606
async def read_rows_stream(
635607
self,
636608
query: ReadRowsQuery,
@@ -681,7 +653,6 @@ async def read_rows_stream(
681653
)
682654
return row_merger.start_operation()
683655

684-
@CrossSync.convert
685656
async def read_rows(
686657
self,
687658
query: ReadRowsQuery,
@@ -729,7 +700,6 @@ async def read_rows(
729700
)
730701
return [row async for row in row_generator]
731702

732-
@CrossSync.convert
733703
async def read_row(
734704
self,
735705
row_key: str | bytes,
@@ -779,7 +749,6 @@ async def read_row(
779749
return None
780750
return results[0]
781751

782-
@CrossSync.convert
783752
async def read_rows_sharded(
784753
self,
785754
sharded_query: ShardedQuery,
@@ -879,7 +848,6 @@ async def read_rows_with_semaphore(query):
879848
)
880849
return results_list
881850

882-
@CrossSync.convert
883851
async def row_exists(
884852
self,
885853
row_key: str | bytes,
@@ -928,7 +896,6 @@ async def row_exists(
928896
)
929897
return len(results) > 0
930898

931-
@CrossSync.convert
932899
async def sample_row_keys(
933900
self,
934901
*,
@@ -1001,7 +968,6 @@ async def execute_rpc():
1001968
exception_factory=_helpers._retry_exception_factory,
1002969
)
1003970

1004-
@CrossSync.convert(replace_symbols={"MutationsBatcherAsync": "MutationsBatcher"})
1005971
def mutations_batcher(
1006972
self,
1007973
*,
@@ -1051,7 +1017,6 @@ def mutations_batcher(
10511017
batch_retryable_errors=batch_retryable_errors,
10521018
)
10531019

1054-
@CrossSync.convert
10551020
async def mutate_row(
10561021
self,
10571022
row_key: str | bytes,
@@ -1130,9 +1095,6 @@ async def mutate_row(
11301095
exception_factory=_helpers._retry_exception_factory,
11311096
)
11321097

1133-
@CrossSync.convert(
1134-
replace_symbols={"_MutateRowsOperationAsync": "_MutateRowsOperation"}
1135-
)
11361098
async def bulk_mutate_rows(
11371099
self,
11381100
mutation_entries: list[RowMutationEntry],
@@ -1188,7 +1150,6 @@ async def bulk_mutate_rows(
11881150
)
11891151
await operation.start()
11901152

1191-
@CrossSync.convert
11921153
async def check_and_mutate_row(
11931154
self,
11941155
row_key: str | bytes,
@@ -1255,7 +1216,6 @@ async def check_and_mutate_row(
12551216
)
12561217
return result.predicate_matched
12571218

1258-
@CrossSync.convert
12591219
async def read_modify_write_row(
12601220
self,
12611221
row_key: str | bytes,
@@ -1306,7 +1266,6 @@ async def read_modify_write_row(
13061266
# construct Row from result
13071267
return Row._from_pb(result.row)
13081268

1309-
@CrossSync.convert
13101269
async def close(self):
13111270
"""
13121271
Called to close the Table instance and release any resources held by it.
@@ -1315,7 +1274,6 @@ async def close(self):
13151274
self._register_instance_future.cancel()
13161275
await self.client._remove_instance_registration(self.instance_id, self)
13171276

1318-
@CrossSync.convert(sync_name="__enter__")
13191277
async def __aenter__(self):
13201278
"""
13211279
Implement async context manager protocol
@@ -1327,7 +1285,6 @@ async def __aenter__(self):
13271285
await self._register_instance_future
13281286
return self
13291287

1330-
@CrossSync.convert(sync_name="__exit__")
13311288
async def __aexit__(self, exc_type, exc_val, exc_tb):
13321289
"""
13331290
Implement async context manager protocol

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@
5151
from google.cloud.bigtable.data._sync.client import Table # noqa: F401
5252

5353

54-
@CrossSync.export_sync(
55-
path="google.cloud.bigtable.data._sync.mutations_batcher._FlowControl"
56-
)
5754
class _FlowControlAsync:
5855
"""
5956
Manages flow control for batched mutations. Mutations are registered against
@@ -110,7 +107,6 @@ def _has_capacity(self, additional_count: int, additional_size: int) -> bool:
110107
new_count = self._in_flight_mutation_count + additional_count
111108
return new_size <= acceptable_size and new_count <= acceptable_count
112109

113-
@CrossSync.convert
114110
async def remove_from_flow(
115111
self, mutations: RowMutationEntry | list[RowMutationEntry]
116112
) -> None:
@@ -132,7 +128,6 @@ async def remove_from_flow(
132128
async with self._capacity_condition:
133129
self._capacity_condition.notify_all()
134130

135-
@CrossSync.convert
136131
async def add_to_flow(self, mutations: RowMutationEntry | list[RowMutationEntry]):
137132
"""
138133
Generator function that registers mutations with flow control. As mutations
@@ -182,10 +177,6 @@ async def add_to_flow(self, mutations: RowMutationEntry | list[RowMutationEntry]
182177
yield mutations[start_idx:end_idx]
183178

184179

185-
@CrossSync.export_sync(
186-
path="google.cloud.bigtable.data._sync.mutations_batcher.MutationsBatcher",
187-
mypy_ignore=["unreachable"],
188-
)
189180
class MutationsBatcherAsync:
190181
"""
191182
Allows users to send batches using context manager API:
@@ -217,9 +208,6 @@ class MutationsBatcherAsync:
217208
Defaults to the Table's default_mutate_rows_retryable_errors.
218209
"""
219210

220-
@CrossSync.convert(
221-
replace_symbols={"TableAsync": "Table", "_FlowControlAsync": "_FlowControl"}
222-
)
223211
def __init__(
224212
self,
225213
table: TableAsync,
@@ -275,7 +263,6 @@ def __init__(
275263
# clean up on program exit
276264
atexit.register(self._on_exit)
277265

278-
@CrossSync.convert
279266
async def _timer_routine(self, interval: float | None) -> None:
280267
"""
281268
Set up a background task to flush the batcher every interval seconds
@@ -296,7 +283,6 @@ async def _timer_routine(self, interval: float | None) -> None:
296283
if not self._closed.is_set() and self._staged_entries:
297284
self._schedule_flush()
298285

299-
@CrossSync.convert
300286
async def append(self, mutation_entry: RowMutationEntry):
301287
"""
302288
Add a new set of mutations to the internal queue
@@ -346,7 +332,6 @@ def _schedule_flush(self) -> CrossSync.Future[None] | None:
346332
return new_task
347333
return None
348334

349-
@CrossSync.convert
350335
async def _flush_internal(self, new_entries: list[RowMutationEntry]):
351336
"""
352337
Flushes a set of mutations to the server, and updates internal state
@@ -367,9 +352,6 @@ async def _flush_internal(self, new_entries: list[RowMutationEntry]):
367352
self._entries_processed_since_last_raise += len(new_entries)
368353
self._add_exceptions(found_exceptions)
369354

370-
@CrossSync.convert(
371-
replace_symbols={"_MutateRowsOperationAsync": "_MutateRowsOperation"}
372-
)
373355
async def _execute_mutate_rows(
374356
self, batch: list[RowMutationEntry]
375357
) -> list[FailedMutationEntryError]:
@@ -450,12 +432,10 @@ def _raise_exceptions(self):
450432
entry_count=entry_count,
451433
)
452434

453-
@CrossSync.convert(sync_name="__enter__")
454435
async def __aenter__(self):
455436
"""Allow use of context manager API"""
456437
return self
457438

458-
@CrossSync.convert(sync_name="__exit__")
459439
async def __aexit__(self, exc_type, exc, tb):
460440
"""
461441
Allow use of context manager API.
@@ -472,7 +452,6 @@ def closed(self) -> bool:
472452
"""
473453
return self._closed.is_set()
474454

475-
@CrossSync.convert
476455
async def close(self):
477456
"""
478457
Flush queue and clean up resources
@@ -500,7 +479,6 @@ def _on_exit(self):
500479
)
501480

502481
@staticmethod
503-
@CrossSync.convert
504482
async def _wait_for_batch_results(
505483
*tasks: CrossSync.Future[list[FailedMutationEntryError]]
506484
| CrossSync.Future[None],

0 commit comments

Comments
 (0)