From 2fbd2fee84f86a6734caac2fbe28ab80c3c62bc8 Mon Sep 17 00:00:00 2001 From: xiafu Date: Tue, 31 Aug 2021 17:33:23 -0700 Subject: [PATCH 1/2] [Storage]Address comments for STG78 GA --- .../azure/storage/blob/_blob_client.py | 8 ++++---- .../azure-storage-blob/azure/storage/blob/_models.py | 12 ++++++------ .../azure-storage-blob/tests/test_container.py | 4 ++-- .../azure-storage-blob/tests/test_container_async.py | 4 ++-- .../azure-storage-blob/tests/test_quick_query.py | 2 +- .../azure/storage/filedatalake/_models.py | 6 +++--- .../tests/test_quick_query.py | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py index 1e05f5efa6b5..e1b1b51e8e78 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py @@ -853,9 +853,9 @@ def _quick_query_options(self, query_expression, # type: (str, **Any) -> Dict[str, Any] delimiter = '\n' input_format = kwargs.pop('blob_format', None) - if input_format == QuickQueryDialect.DelimitedJsonDialect: + if input_format == QuickQueryDialect.DelimitedJson: input_format = DelimitedJsonDialect() - if input_format == QuickQueryDialect.DelimitedTextDialect: + if input_format == QuickQueryDialect.DelimitedText: input_format = DelimitedTextDialect() input_parquet_format = input_format == "ParquetDialect" if input_format and not input_parquet_format: @@ -868,9 +868,9 @@ def _quick_query_options(self, query_expression, raise ValueError("The Type of blob_format can only be DelimitedTextDialect or " "DelimitedJsonDialect or ParquetDialect") output_format = kwargs.pop('output_format', None) - if output_format == QuickQueryDialect.DelimitedJsonDialect: + if output_format == QuickQueryDialect.DelimitedJson: output_format = DelimitedJsonDialect() - if output_format == QuickQueryDialect.DelimitedTextDialect: + if output_format == QuickQueryDialect.DelimitedText: output_format = DelimitedTextDialect() if output_format: if output_format == "ParquetDialect": diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py index eccd176af04d..443e82d3ba11 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py @@ -70,9 +70,9 @@ class PremiumPageBlobTier(str, Enum): class QuickQueryDialect(str, Enum): """Specifies the quick query input/output dialect.""" - DelimitedTextDialect = 'DelimitedTextDialect' - DelimitedJsonDialect = 'DelimitedJsonDialect' - ParquetDialect = 'ParquetDialect' + DelimitedText = 'DelimitedText' + DelimitedJson = 'DelimitedJson' + Parquet = 'Parquet' class SequenceNumberAction(str, Enum): @@ -321,7 +321,7 @@ class ContainerProperties(DictMixin): Represents whether the container has an immutability policy. :ivar bool has_legal_hold: Represents whether the container has a legal hold. - :ivar bool is_immutable_storage_with_versioning_enabled: + :ivar bool immutable_storage_with_versioning_enabled: Represents whether immutable storage with versioning enabled on the container. .. versionadded:: 12.10.0 @@ -349,7 +349,7 @@ def __init__(self, **kwargs): self.has_legal_hold = kwargs.get('x-ms-has-legal-hold') self.metadata = kwargs.get('metadata') self.encryption_scope = None - self.is_immutable_storage_with_versioning_enabled = kwargs.get('x-ms-immutable-storage-with-versioning-enabled') + self.immutable_storage_with_versioning_enabled = kwargs.get('x-ms-immutable-storage-with-versioning-enabled') default_encryption_scope = kwargs.get('x-ms-default-encryption-scope') if default_encryption_scope: self.encryption_scope = ContainerEncryptionScope( @@ -366,7 +366,7 @@ def _from_generated(cls, generated): props.lease = LeaseProperties._from_generated(generated) # pylint: disable=protected-access props.public_access = generated.properties.public_access props.has_immutability_policy = generated.properties.has_immutability_policy - props.is_immutable_storage_with_versioning_enabled = \ + props.immutable_storage_with_versioning_enabled = \ generated.properties.is_immutable_storage_with_versioning_enabled props.deleted = generated.deleted props.version = generated.version diff --git a/sdk/storage/azure-storage-blob/tests/test_container.py b/sdk/storage/azure-storage-blob/tests/test_container.py index 3c96d0c6d47c..19982645ac6f 100644 --- a/sdk/storage/azure-storage-blob/tests/test_container.py +++ b/sdk/storage/azure-storage-blob/tests/test_container.py @@ -228,7 +228,7 @@ def test_list_containers(self, resource_group, location, storage_account, storag self.assertNamedItemInContainer(containers, container.container_name) self.assertIsNotNone(containers[0].has_immutability_policy) self.assertIsNotNone(containers[0].has_legal_hold) - self.assertIsNotNone(containers[0].is_immutable_storage_with_versioning_enabled) + self.assertIsNotNone(containers[0].immutable_storage_with_versioning_enabled) @GlobalStorageAccountPreparer() def test_list_containers_with_prefix(self, resource_group, location, storage_account, storage_account_key): @@ -401,7 +401,7 @@ def test_get_container_properties(self, resource_group, location, storage_accoun # Assert self.assertIsNotNone(props) self.assertDictEqual(props.metadata, metadata) - self.assertIsNotNone(props.is_immutable_storage_with_versioning_enabled) + self.assertIsNotNone(props.immutable_storage_with_versioning_enabled) # self.assertEqual(props.lease.duration, 'infinite') # self.assertEqual(props.lease.state, 'leased') # self.assertEqual(props.lease.status, 'locked') diff --git a/sdk/storage/azure-storage-blob/tests/test_container_async.py b/sdk/storage/azure-storage-blob/tests/test_container_async.py index cf1022d97a26..eb6bcaf15673 100644 --- a/sdk/storage/azure-storage-blob/tests/test_container_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_container_async.py @@ -299,7 +299,7 @@ async def test_list_containers(self, resource_group, location, storage_account, self.assertNamedItemInContainer(containers, container.container_name) self.assertIsNotNone(containers[0].has_immutability_policy) self.assertIsNotNone(containers[0].has_legal_hold) - self.assertIsNotNone(containers[0].is_immutable_storage_with_versioning_enabled) + self.assertIsNotNone(containers[0].immutable_storage_with_versioning_enabled) @GlobalStorageAccountPreparer() @AsyncStorageTestCase.await_prepared_test @@ -500,7 +500,7 @@ async def test_get_container_properties(self, resource_group, location, storage_ # Assert self.assertIsNotNone(props) self.assertDictEqual(props.metadata, metadata) - self.assertIsNotNone(props.is_immutable_storage_with_versioning_enabled) + self.assertIsNotNone(props.immutable_storage_with_versioning_enabled) # self.assertEqual(props.lease.duration, 'infinite') # self.assertEqual(props.lease.state, 'leased') # self.assertEqual(props.lease.status, 'locked') diff --git a/sdk/storage/azure-storage-blob/tests/test_quick_query.py b/sdk/storage/azure-storage-blob/tests/test_quick_query.py index 86b0a12229ae..1e307295603e 100644 --- a/sdk/storage/azure-storage-blob/tests/test_quick_query.py +++ b/sdk/storage/azure-storage-blob/tests/test_quick_query.py @@ -986,7 +986,7 @@ def test_quick_query_input_in_parquet_format(self, resource_group, location, sto with open(parquet_path, "rb") as parquet_data: blob_client.upload_blob(parquet_data, overwrite=True) - reader = blob_client.query_blob(expression, blob_format=QuickQueryDialect.ParquetDialect) + reader = blob_client.query_blob(expression, blob_format=QuickQueryDialect.Parquet) real_data = reader.readall() self.assertEqual(real_data, expected_data) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py index fd6cf88163c2..7fc15c8cb2d4 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py @@ -724,9 +724,9 @@ class ArrowDialect(BlobArrowDialect): class QuickQueryDialect(str, Enum): """Specifies the quick query input/output dialect.""" - DelimitedTextDialect = 'DelimitedTextDialect' - DelimitedJsonDialect = 'DelimitedJsonDialect' - ParquetDialect = 'ParquetDialect' + DelimitedText = 'DelimitedText' + DelimitedJson = 'DelimitedJson' + Parquet = 'Parquet' class ArrowType(str, Enum): diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py b/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py index 96b6b7b3fad0..a16800952bf1 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_quick_query.py @@ -905,7 +905,7 @@ def test_quick_query_input_in_parquet_format(self, datalake_storage_account_name with open(parquet_path, "rb") as parquet_data: file_client.upload_data(parquet_data, overwrite=True) - reader = file_client.query_file(expression, file_format=QuickQueryDialect.ParquetDialect) + reader = file_client.query_file(expression, file_format=QuickQueryDialect.Parquet) real_data = reader.readall() self.assertEqual(real_data, expected_data) @@ -924,7 +924,7 @@ def test_quick_query_output_in_parquet_format(self, datalake_storage_account_nam with self.assertRaises(ValueError): file_client.query_file( - expression, file_format=QuickQueryDialect.ParquetDialect, - output_format=QuickQueryDialect.ParquetDialect) + expression, file_format=QuickQueryDialect.Parquet, + output_format=QuickQueryDialect.Parquet) # ------------------------------------------------------------------------------ From 86e58db2181866d8db2294070aaa3613d745ded3 Mon Sep 17 00:00:00 2001 From: xiafu Date: Tue, 31 Aug 2021 23:10:45 -0700 Subject: [PATCH 2/2] [Storage]Address comments for STG78 GA --- .../azure-storage-blob/azure/storage/blob/_models.py | 6 +++--- .../azure/storage/filedatalake/_models.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py index 443e82d3ba11..0dd2d5ac3c90 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py @@ -70,9 +70,9 @@ class PremiumPageBlobTier(str, Enum): class QuickQueryDialect(str, Enum): """Specifies the quick query input/output dialect.""" - DelimitedText = 'DelimitedText' - DelimitedJson = 'DelimitedJson' - Parquet = 'Parquet' + DelimitedText = 'DelimitedTextDialect' + DelimitedJson = 'DelimitedJsonDialect' + Parquet = 'ParquetDialect' class SequenceNumberAction(str, Enum): diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py index 7fc15c8cb2d4..6027c5f4e028 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_models.py @@ -724,9 +724,9 @@ class ArrowDialect(BlobArrowDialect): class QuickQueryDialect(str, Enum): """Specifies the quick query input/output dialect.""" - DelimitedText = 'DelimitedText' - DelimitedJson = 'DelimitedJson' - Parquet = 'Parquet' + DelimitedText = 'DelimitedTextDialect' + DelimitedJson = 'DelimitedJsonDialect' + Parquet = 'ParquetDialect' class ArrowType(str, Enum):