From 96222ba806fdf5fd414ede687c506fa158f6ab0a Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 11 Dec 2023 13:22:21 -0800 Subject: [PATCH] ran blacken --- google/cloud/bigtable/batcher.py | 4 +++- tests/system/test_data_api.py | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/google/cloud/bigtable/batcher.py b/google/cloud/bigtable/batcher.py index 21fb99345..f826cea77 100644 --- a/google/cloud/bigtable/batcher.py +++ b/google/cloud/bigtable/batcher.py @@ -347,7 +347,9 @@ def _flush_async(self): self.flow_control.control_flow(batch_info) future = self._executor.submit(self._flush_rows, rows_to_flush) # schedule release of resources from flow control - future.add_done_callback(partial(self._batch_completed_callback, copy(batch_info))) + future.add_done_callback( + partial(self._batch_completed_callback, copy(batch_info)) + ) def _batch_completed_callback(self, batch_info, future): """Callback for when the mutation has finished to clean up the current batch diff --git a/tests/system/test_data_api.py b/tests/system/test_data_api.py index 9608f1e54..c833b0a77 100644 --- a/tests/system/test_data_api.py +++ b/tests/system/test_data_api.py @@ -402,12 +402,21 @@ def callback(results): assert results <= max_elements_per_batch # override flow control max elements - with mock.patch("google.cloud.bigtable.batcher.MAX_OUTSTANDING_ELEMENTS", max_elements_per_batch): - with MutationsBatcher(data_table, flush_count=5, flush_interval=0.07, batch_completed_callback=callback) as batcher: + with mock.patch( + "google.cloud.bigtable.batcher.MAX_OUTSTANDING_ELEMENTS", max_elements_per_batch + ): + with MutationsBatcher( + data_table, + flush_count=5, + flush_interval=0.07, + batch_completed_callback=callback, + ) as batcher: # send mutations in a way that timed flushes and count flushes interleave for i in range(num_sent): row = data_table.direct_row("row{}".format(i)) - row.set_cell(COLUMN_FAMILY_ID1, COL_NAME1, "val{}".format(i).encode("utf-8")) + row.set_cell( + COLUMN_FAMILY_ID1, COL_NAME1, "val{}".format(i).encode("utf-8") + ) rows_to_delete.append(row) batcher.mutate(row) time.sleep(0.01)