diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py index e9f8d27066be..226626d026e1 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py @@ -197,9 +197,9 @@ def format_shared_key_credential(account, credential): def parse_connection_str(conn_str, credential, service): conn_str = conn_str.rstrip(";") - conn_settings = dict( + conn_settings = dict( # pylint: disable=consider-using-dict-comprehension [s.split("=", 1) for s in conn_str.split(";")] - ) # pylint: disable=consider-using-dict-comprehension + ) endpoints = _SERVICE_PARAMS[service] primary = None secondary = None diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/downloads.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/downloads.py index 24d87a110c75..3da351b5f271 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/downloads.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/downloads.py @@ -465,7 +465,10 @@ def download_to_stream(self, stream, max_connections=1): if max_connections > 1: import concurrent.futures executor = concurrent.futures.ThreadPoolExecutor(max_connections) - list(executor.map(tracing_context.with_current_context(downloader.process_chunk), downloader.get_chunk_offsets())) + list(executor.map( + tracing_context.with_current_context(downloader.process_chunk), + downloader.get_chunk_offsets() + )) else: for chunk in downloader.get_chunk_offsets(): downloader.process_chunk(chunk) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py index 9f8380afcb30..c08abcedf82f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py @@ -310,7 +310,11 @@ def list_containers( timeout=timeout, **kwargs) return AsyncItemPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, page_iterator_class=ContainerPropertiesPaged) + command, + prefix=name_starts_with, + results_per_page=results_per_page, + page_iterator_class=ContainerPropertiesPaged + ) async def create_container( self, name, # type: str diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/container_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/container_client_async.py index 0e6e246edb2d..376647702e4b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/container_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/container_client_async.py @@ -511,7 +511,12 @@ def list_blobs(self, name_starts_with=None, include=None, timeout=None, **kwargs include=include, timeout=timeout, **kwargs) - return AsyncItemPaged(command, prefix=name_starts_with, results_per_page=results_per_page, page_iterator_class=BlobPropertiesPaged) + return AsyncItemPaged( + command, + prefix=name_starts_with, + results_per_page=results_per_page, + page_iterator_class=BlobPropertiesPaged + ) def walk_blobs( self, name_starts_with=None, # type: Optional[str] diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py index 5740370c685c..32b771e4b476 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py @@ -424,7 +424,11 @@ def list_containers( timeout=timeout, **kwargs) return ItemPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, page_iterator_class=ContainerPropertiesPaged) + command, + prefix=name_starts_with, + results_per_page=results_per_page, + page_iterator_class=ContainerPropertiesPaged + ) @distributed_trace def create_container( diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py index 8c5c04f12d48..369f4a5bb603 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py @@ -44,8 +44,8 @@ from .blob_client import BlobClient if TYPE_CHECKING: - from azure.core.pipeline.transport import HttpTransport - from azure.core.pipeline.policies import HTTPPolicy + from azure.core.pipeline.transport import HttpTransport # pylint: disable=ungrouped-imports + from azure.core.pipeline.policies import HTTPPolicy # pylint: disable=ungrouped-imports from .models import ContainerPermissions, PublicAccess from datetime import datetime from .models import ( # pylint: disable=unused-import diff --git a/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py index 7bcfe8d15750..b30b7b724b41 100644 --- a/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_large_block_blob.py @@ -9,6 +9,7 @@ import pytest import os +import platform import unittest from azure.storage.blob import ( @@ -36,7 +37,8 @@ LARGE_BLOCK_SIZE = 6 * 1024 * 1024 # ------------------------------------------------------------------------------ - +if platform.python_implementation() == 'PyPy': + pytest.skip("Skip tests for Pypy", allow_module_level=True) class StorageLargeBlockBlobTest(StorageTestCase): def setUp(self): diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client.py index e9f8d27066be..226626d026e1 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client.py @@ -197,9 +197,9 @@ def format_shared_key_credential(account, credential): def parse_connection_str(conn_str, credential, service): conn_str = conn_str.rstrip(";") - conn_settings = dict( + conn_settings = dict( # pylint: disable=consider-using-dict-comprehension [s.split("=", 1) for s in conn_str.split(";")] - ) # pylint: disable=consider-using-dict-comprehension + ) endpoints = _SERVICE_PARAMS[service] primary = None secondary = None diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/downloads.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/downloads.py index 24d87a110c75..3da351b5f271 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/downloads.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/downloads.py @@ -465,7 +465,10 @@ def download_to_stream(self, stream, max_connections=1): if max_connections > 1: import concurrent.futures executor = concurrent.futures.ThreadPoolExecutor(max_connections) - list(executor.map(tracing_context.with_current_context(downloader.process_chunk), downloader.get_chunk_offsets())) + list(executor.map( + tracing_context.with_current_context(downloader.process_chunk), + downloader.get_chunk_offsets() + )) else: for chunk in downloader.get_chunk_offsets(): downloader.process_chunk(chunk) diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py index 38c31964e863..dd5f2101e612 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py @@ -728,4 +728,3 @@ async def close_handles( polling_method = CloseHandlesAsync(self._config.copy_polling_interval) return async_poller(command, start_close, None, polling_method) - diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py index 1ecda4acd2cc..e83a319b25b4 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py @@ -597,9 +597,6 @@ class StorageServiceProperties(Model): 'hour_metrics': {'key': 'HourMetrics', 'type': 'Metrics', 'xml': {'name': 'HourMetrics'}}, 'minute_metrics': {'key': 'MinuteMetrics', 'type': 'Metrics', 'xml': {'name': 'MinuteMetrics'}}, 'cors': {'key': 'Cors', 'type': '[CorsRule]', 'xml': {'name': 'Cors', 'itemsName': 'CorsRule', 'wrapped': True}}, - 'default_service_version': {'key': 'DefaultServiceVersion', 'type': 'str', 'xml': {'name': 'DefaultServiceVersion'}}, - 'delete_retention_policy': {'key': 'DeleteRetentionPolicy', 'type': 'RetentionPolicy', 'xml': {'name': 'DeleteRetentionPolicy'}}, - 'static_website': {'key': 'StaticWebsite', 'type': 'StaticWebsite', 'xml': {'name': 'StaticWebsite'}}, } _xml_map = { } diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py index e9f8d27066be..226626d026e1 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py @@ -197,9 +197,9 @@ def format_shared_key_credential(account, credential): def parse_connection_str(conn_str, credential, service): conn_str = conn_str.rstrip(";") - conn_settings = dict( + conn_settings = dict( # pylint: disable=consider-using-dict-comprehension [s.split("=", 1) for s in conn_str.split(";")] - ) # pylint: disable=consider-using-dict-comprehension + ) endpoints = _SERVICE_PARAMS[service] primary = None secondary = None diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/downloads.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/downloads.py index 24d87a110c75..3da351b5f271 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/downloads.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/downloads.py @@ -465,7 +465,10 @@ def download_to_stream(self, stream, max_connections=1): if max_connections > 1: import concurrent.futures executor = concurrent.futures.ThreadPoolExecutor(max_connections) - list(executor.map(tracing_context.with_current_context(downloader.process_chunk), downloader.get_chunk_offsets())) + list(executor.map( + tracing_context.with_current_context(downloader.process_chunk), + downloader.get_chunk_offsets() + )) else: for chunk in downloader.get_chunk_offsets(): downloader.process_chunk(chunk) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py index f56f5e9172e9..ec624320a7c5 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py @@ -99,5 +99,5 @@ async def _extract_data_cb(self, get_next_return): self.prefix = self._response.prefix self.marker = self._response.marker self.results_per_page = self._response.max_results - - return self._response.next_marker or None, [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access + props_list = [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access + return self._response.next_marker or None, props_list diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py index f8e251e8a2fe..00ab0b454154 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py @@ -657,4 +657,3 @@ async def delete_message(self, message, pop_receipt=None, timeout=None, **kwargs ) except StorageErrorException as error: process_storage_error(error) - diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/models.py index 79391fe05a8c..64d159271513 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/models.py @@ -246,7 +246,7 @@ def _get_next_cb(self, continuation_token): except StorageErrorException as error: process_storage_error(error) - def _extract_data_cb(self, messages): + def _extract_data_cb(self, messages): # pylint: disable=no-self-use # There is no concept of continuation token, so raising on my own condition if not messages: raise StopIteration("End of paging") @@ -327,8 +327,8 @@ def _extract_data_cb(self, get_next_return): self.prefix = self._response.prefix self.marker = self._response.marker self.results_per_page = self._response.max_results - - return self._response.next_marker or None, [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access + props_list = [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access + return self._response.next_marker or None, props_list class QueuePermissions(object): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py index 78bf7b86d430..71df413b9af0 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py @@ -17,7 +17,7 @@ import six from azure.core.paging import ItemPaged - +from azure.core.tracing.decorator import distributed_trace from ._shared.shared_access_signature import QueueSharedAccessSignature from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query from ._shared.request_handlers import add_metadata_headers, serialize_iso @@ -30,7 +30,6 @@ from ._generated import AzureQueueStorage from ._generated.models import StorageErrorException, SignedIdentifier from ._generated.models import QueueMessage as GenQueueMessage -from azure.core.tracing.decorator import distributed_trace from .models import QueueMessage, AccessPolicy, MessagesPaged diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py index 4bc760091a56..9946c77d99d6 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py @@ -14,7 +14,7 @@ from urlparse import urlparse # type: ignore from azure.core.paging import ItemPaged - +from azure.core.tracing.decorator import distributed_trace from ._shared.shared_access_signature import SharedAccessSignature from ._shared.models import LocationMode, Services from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query @@ -24,7 +24,6 @@ from .models import QueuePropertiesPaged from .queue_client import QueueClient -from azure.core.tracing.decorator import distributed_trace if TYPE_CHECKING: from datetime import datetime diff --git a/sdk/storage/azure-storage-queue/tests/test_queue.py b/sdk/storage/azure-storage-queue/tests/test_queue.py index 1aa1e14536ba..6e7ddc739703 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue.py @@ -8,6 +8,7 @@ import unittest import pytest +import sys from dateutil.tz import tzutc from datetime import ( datetime, @@ -814,6 +815,7 @@ def test_unicode_create_queue_unicode_name(self): @record def test_unicode_get_messages_unicode_data(self): # Action + pytest.skip("Uncomment after msrest fix") queue_client = self._create_queue() queue_client.enqueue_message(u'message1㚈') message = next(queue_client.receive_messages()) @@ -831,6 +833,7 @@ def test_unicode_get_messages_unicode_data(self): @record def test_unicode_update_message_unicode_data(self): # Action + pytest.skip("Uncomment after msrest fix") queue_client = self._create_queue() queue_client.enqueue_message(u'message1') messages = queue_client.receive_messages() diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_samples_message.py b/sdk/storage/azure-storage-queue/tests/test_queue_samples_message.py index 91ca79199ec3..1466551ce0d2 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_samples_message.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_samples_message.py @@ -43,7 +43,7 @@ def test_set_access_policy(self): queue_client.create_queue() except ResourceExistsError: pass - queue_client.enqueue_message('hello world') + queue_client.enqueue_message(u"hello world") try: # [START set_access_policy]