From 82dcb1312c1b6d3cb694008814d853169648eb79 Mon Sep 17 00:00:00 2001 From: Shunping Huang Date: Mon, 10 Jun 2024 11:30:58 -0400 Subject: [PATCH] Apply formatter. --- sdks/python/apache_beam/io/gcp/gcsio.py | 7 ++++--- sdks/python/apache_beam/io/gcp/gcsio_test.py | 8 ++++---- .../apache_beam/options/pipeline_options.py | 19 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sdks/python/apache_beam/io/gcp/gcsio.py b/sdks/python/apache_beam/io/gcp/gcsio.py index 83b3829cf5ef2..08a80a42ba0ca 100644 --- a/sdks/python/apache_beam/io/gcp/gcsio.py +++ b/sdks/python/apache_beam/io/gcp/gcsio.py @@ -535,14 +535,15 @@ def is_soft_delete_enabled(self, gcs_path): bucket_name, _ = parse_gcs_path(gcs_path) bucket = self.get_bucket(bucket_name) if (bucket.soft_delete_policy is not None and - bucket.soft_delete_policy.retention_duration_seconds > 0): + bucket.soft_delete_policy.retention_duration_seconds > 0): return True except Exception: _LOGGER.warning( - "Unexpected error occurred when checking soft delete policy for %s" - % gcs_path) + "Unexpected error occurred when checking soft delete policy for %s" % + gcs_path) return False + class BeamBlobReader(BlobReader): def __init__(self, blob, chunk_size=DEFAULT_READ_BUFFER_SIZE): super().__init__(blob, chunk_size=chunk_size) diff --git a/sdks/python/apache_beam/io/gcp/gcsio_test.py b/sdks/python/apache_beam/io/gcp/gcsio_test.py index 39d74a08e6000..c1356b53095a7 100644 --- a/sdks/python/apache_beam/io/gcp/gcsio_test.py +++ b/sdks/python/apache_beam/io/gcp/gcsio_test.py @@ -607,13 +607,13 @@ def test_is_soft_delete_enabled(self, mock_get_bucket): # soft delete policy enabled bucket.soft_delete_policy.retention_duration_seconds = 1024 - self.assertTrue(self.gcs.is_soft_delete_enabled( - "gs://beam_with_soft_delete/tmp")) + self.assertTrue( + self.gcs.is_soft_delete_enabled("gs://beam_with_soft_delete/tmp")) # soft delete policy disabled bucket.soft_delete_policy.retention_duration_seconds = 0 - self.assertFalse(self.gcs.is_soft_delete_enabled( - "gs://beam_without_soft_delete/tmp")) + self.assertFalse( + self.gcs.is_soft_delete_enabled("gs://beam_without_soft_delete/tmp")) if __name__ == '__main__': diff --git a/sdks/python/apache_beam/options/pipeline_options.py b/sdks/python/apache_beam/options/pipeline_options.py index e10f7b4f06a7b..335d441daedaa 100644 --- a/sdks/python/apache_beam/options/pipeline_options.py +++ b/sdks/python/apache_beam/options/pipeline_options.py @@ -922,17 +922,16 @@ def _warn_if_soft_delete_policy_enabled(self, arg_name): try: from apache_beam.io.gcp import gcsio if gcsio.GcsIO.is_soft_delete_enabled(gcs_path): - _LOGGER.warning( - "Bucket specified in %s has soft-delete policy enabled." - " To avoid being billed for unnecessary storage costs, turn" - " off the soft delete feature on buckets that your Dataflow" - " jobs use for temporary and staging storage. For more" - " information, see" - " https://cloud.google.com/storage/docs/use-soft-delete" - "#remove-soft-delete-policy." % arg_name) + _LOGGER.warning( + "Bucket specified in %s has soft-delete policy enabled." + " To avoid being billed for unnecessary storage costs, turn" + " off the soft delete feature on buckets that your Dataflow" + " jobs use for temporary and staging storage. For more" + " information, see" + " https://cloud.google.com/storage/docs/use-soft-delete" + "#remove-soft-delete-policy." % arg_name) except ImportError: - _LOGGER.warning( - 'Unable to check soft delete policy due to import error.') + _LOGGER.warning('Unable to check soft delete policy due to import error.') # If either temp or staging location has an issue, we use the valid one for # both locations. If both are bad we return an error.