From 4ceff8147fbef93ebc5e228f50393d35fa7fa8e4 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 10:11:19 -0700 Subject: [PATCH 01/14] blobs internal --- .../azure/storage/blob/__init__.py | 14 +++++++------- .../blob/{blob_client.py => _blob_client.py} | 8 ++++---- ...service_client.py => _blob_service_client.py} | 10 +++++----- ...{container_client.py => _container_client.py} | 10 +++++----- .../azure/storage/blob/_deserialize.py | 2 +- .../storage/blob/{download.py => _download.py} | 0 .../azure/storage/blob/{lease.py => _lease.py} | 0 .../azure/storage/blob/{models.py => _models.py} | 0 .../azure/storage/blob/_shared/encryption.py | 2 +- .../azure/storage/blob/_shared/policies.py | 2 +- .../azure/storage/blob/_upload_helpers.py | 2 +- .../storage/blob/{version.py => _version.py} | 0 .../azure/storage/blob/aio/__init__.py | 8 ++++---- ...lob_client_async.py => _blob_client_async.py} | 12 ++++++------ ...nt_async.py => _blob_service_client_async.py} | 14 +++++++------- ...lient_async.py => _container_client_async.py} | 16 ++++++++-------- .../{download_async.py => _download_async.py} | 2 +- .../blob/aio/{lease_async.py => _lease_async.py} | 2 +- .../storage/blob/aio/{models.py => _models.py} | 2 +- .../tests/test_blob_encryption.py | 2 +- .../tests/test_blob_encryption_async.py | 2 +- .../tests/test_blob_storage_account_async.py | 2 +- sdk/storage/azure-storage-blob/tests/test_cpk.py | 4 +++- .../azure-storage-blob/tests/test_cpk_async.py | 9 +++++++-- .../azure-storage-blob/tests/test_retry_async.py | 8 ++++++-- 25 files changed, 72 insertions(+), 61 deletions(-) rename sdk/storage/azure-storage-blob/azure/storage/blob/{blob_client.py => _blob_client.py} (99%) rename sdk/storage/azure-storage-blob/azure/storage/blob/{blob_service_client.py => _blob_service_client.py} (99%) rename sdk/storage/azure-storage-blob/azure/storage/blob/{container_client.py => _container_client.py} (99%) rename sdk/storage/azure-storage-blob/azure/storage/blob/{download.py => _download.py} (100%) rename sdk/storage/azure-storage-blob/azure/storage/blob/{lease.py => _lease.py} (100%) rename sdk/storage/azure-storage-blob/azure/storage/blob/{models.py => _models.py} (100%) rename sdk/storage/azure-storage-blob/azure/storage/blob/{version.py => _version.py} (100%) rename sdk/storage/azure-storage-blob/azure/storage/blob/aio/{blob_client_async.py => _blob_client_async.py} (99%) rename sdk/storage/azure-storage-blob/azure/storage/blob/aio/{blob_service_client_async.py => _blob_service_client_async.py} (98%) rename sdk/storage/azure-storage-blob/azure/storage/blob/aio/{container_client_async.py => _container_client_async.py} (99%) rename sdk/storage/azure-storage-blob/azure/storage/blob/aio/{download_async.py => _download_async.py} (99%) rename sdk/storage/azure-storage-blob/azure/storage/blob/aio/{lease_async.py => _lease_async.py} (99%) rename sdk/storage/azure-storage-blob/azure/storage/blob/aio/{models.py => _models.py} (99%) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py index 5bab6a093b5d..ed3dc2541fea 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py @@ -7,12 +7,12 @@ import os from typing import Union, Iterable, AnyStr, IO, Any # pylint: disable=unused-import -from .version import VERSION -from .blob_client import BlobClient -from .container_client import ContainerClient -from .blob_service_client import BlobServiceClient -from .lease import LeaseClient -from .download import StorageStreamDownloader +from ._version import VERSION +from ._blob_client import BlobClient +from ._container_client import ContainerClient +from ._blob_service_client import BlobServiceClient +from ._lease import LeaseClient +from ._download import StorageStreamDownloader from ._shared.policies import ExponentialRetry, LinearRetry from ._shared.models import( LocationMode, @@ -24,7 +24,7 @@ from ._generated.models import ( RehydratePriority ) -from .models import ( +from ._models import ( BlobType, BlockState, StandardBlobTier, 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 similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/blob_client.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py index 958eeb28bdec..06886cb0af30 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 @@ -46,15 +46,15 @@ upload_block_blob, upload_append_blob, upload_page_blob) -from .models import BlobType, BlobBlock -from .download import StorageStreamDownloader -from .lease import LeaseClient, get_access_conditions +from ._models import BlobType, BlobBlock +from ._download import StorageStreamDownloader +from ._lease import LeaseClient, get_access_conditions from ._shared_access_signature import BlobSharedAccessSignature if TYPE_CHECKING: from datetime import datetime from ._generated.models import BlockList - from .models import ( # pylint: disable=unused-import + from ._models import ( # pylint: disable=unused-import ContainerProperties, BlobProperties, BlobSasPermissions, 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 similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py index 2a9d87b22598..1c201db0a393 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 @@ -26,17 +26,17 @@ parse_to_internal_user_delegation_key from ._generated import AzureBlobStorage from ._generated.models import StorageErrorException, StorageServiceProperties, KeyInfo -from .container_client import ContainerClient -from .blob_client import BlobClient -from .models import ContainerProperties, ContainerPropertiesPaged +from ._container_client import ContainerClient +from ._blob_client import BlobClient +from ._models import ContainerProperties, ContainerPropertiesPaged if TYPE_CHECKING: from datetime import datetime from azure.core.pipeline.transport import HttpTransport from azure.core.pipeline.policies import HTTPPolicy from ._shared.models import AccountSasPermissions, ResourceTypes - from .lease import LeaseClient - from .models import ( + from ._lease import LeaseClient + from ._models import ( BlobProperties, Logging, Metrics, 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 similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py index 15e9012f9b7c..4784e9ea043d 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 @@ -35,22 +35,22 @@ StorageErrorException, SignedIdentifier) from ._deserialize import deserialize_container_properties -from .models import ( # pylint: disable=unused-import +from ._models import ( # pylint: disable=unused-import ContainerProperties, BlobProperties, BlobPropertiesPaged, BlobType, BlobPrefix) -from .lease import LeaseClient, get_access_conditions -from .blob_client import BlobClient +from ._lease import LeaseClient, get_access_conditions +from ._blob_client import BlobClient from ._shared_access_signature import BlobSharedAccessSignature if TYPE_CHECKING: from azure.core.pipeline.transport import HttpTransport, HttpResponse # pylint: disable=ungrouped-imports from azure.core.pipeline.policies import HTTPPolicy # pylint: disable=ungrouped-imports - from .models import ContainerSasPermissions, PublicAccess + from ._models import ContainerSasPermissions, PublicAccess from datetime import datetime - from .models import ( # pylint: disable=unused-import + from ._models import ( # pylint: disable=unused-import AccessPolicy, ContentSettings, PremiumPageBlobTier) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py index cd41c59baf88..fc93ef96e217 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py @@ -6,7 +6,7 @@ # pylint: disable=no-self-use from ._shared.response_handlers import deserialize_metadata -from .models import BlobProperties, ContainerProperties +from ._models import BlobProperties, ContainerProperties def deserialize_blob_properties(response, obj, headers): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/download.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py similarity index 100% rename from sdk/storage/azure-storage-blob/azure/storage/blob/download.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/_download.py diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/lease.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py similarity index 100% rename from sdk/storage/azure-storage-blob/azure/storage/blob/lease.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py similarity index 100% rename from sdk/storage/azure-storage-blob/azure/storage/blob/models.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/_models.py diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/encryption.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/encryption.py index 25c160463fad..62607cc0cf85 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/encryption.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/encryption.py @@ -20,7 +20,7 @@ from azure.core.exceptions import HttpResponseError -from ..version import VERSION +from .._version import VERSION from . import encode_base64, decode_base64_to_bytes diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py index 5cc93d3e6a44..0f0f590a4071 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py @@ -39,7 +39,7 @@ from azure.core.pipeline.policies.base import RequestHistory from azure.core.exceptions import AzureError, ServiceRequestError, ServiceResponseError -from ..version import VERSION +from .._version import VERSION from .models import LocationMode try: diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py index 3875c8d0755d..e86f00ff7e35 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_upload_helpers.py @@ -28,7 +28,7 @@ AppendPositionAccessConditions, ModifiedAccessConditions, ) -from .models import BlobProperties, ContainerProperties +from ._models import BlobProperties, ContainerProperties if TYPE_CHECKING: from datetime import datetime # pylint: disable=unused-import diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/version.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py similarity index 100% rename from sdk/storage/azure-storage-blob/azure/storage/blob/version.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/_version.py diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/__init__.py index 659be378d406..8ab4af077ce9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/__init__.py @@ -4,10 +4,10 @@ # license information. # -------------------------------------------------------------------------- -from .blob_client_async import BlobClient -from .container_client_async import ContainerClient -from .blob_service_client_async import BlobServiceClient -from .lease_async import LeaseClient +from ._blob_client_async import BlobClient +from ._container_client_async import ContainerClient +from ._blob_service_client_async import BlobServiceClient +from ._lease_async import LeaseClient __all__ = [ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_client_async.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py index cdd6c80e513b..72d4defcf898 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py @@ -19,20 +19,20 @@ from .._generated.aio import AzureBlobStorage from .._generated.models import ModifiedAccessConditions, StorageErrorException, CpkInfo from .._deserialize import deserialize_blob_properties -from ..blob_client import BlobClient as BlobClientBase +from .._blob_client import BlobClient as BlobClientBase from ._upload_helpers import ( upload_block_blob, upload_append_blob, upload_page_blob) -from ..models import BlobType, BlobBlock -from ..lease import get_access_conditions -from .lease_async import LeaseClient -from .download_async import StorageStreamDownloader +from .._models import BlobType, BlobBlock +from .._lease import get_access_conditions +from ._lease_async import LeaseClient +from ._download_async import StorageStreamDownloader if TYPE_CHECKING: from datetime import datetime from azure.core.pipeline.policies import HTTPPolicy - from ..models import ( # pylint: disable=unused-import + from .._models import ( # pylint: disable=unused-import ContainerProperties, BlobProperties, BlobSasPermissions, 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 similarity index 98% rename from sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py index ac2942cad0d0..98776c557c31 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 @@ -22,19 +22,19 @@ from .._shared.response_handlers import parse_to_internal_user_delegation_key from .._generated.aio import AzureBlobStorage from .._generated.models import StorageErrorException, StorageServiceProperties, KeyInfo -from ..blob_service_client import BlobServiceClient as BlobServiceClientBase -from .container_client_async import ContainerClient -from .blob_client_async import BlobClient -from ..models import ContainerProperties -from .models import ContainerPropertiesPaged +from .._blob_service_client import BlobServiceClient as BlobServiceClientBase +from ._container_client_async import ContainerClient +from ._blob_client_async import BlobClient +from .._models import ContainerProperties +from ._models import ContainerPropertiesPaged if TYPE_CHECKING: from datetime import datetime from azure.core.pipeline.transport import HttpTransport from azure.core.pipeline.policies import HTTPPolicy from .._shared.models import AccountSasPermissions, ResourceTypes - from .lease_async import LeaseClient - from ..models import ( + from ._lease_async import LeaseClient + from .._models import ( BlobProperties, Logging, Metrics, 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 similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/aio/container_client_async.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py index 684034ed93ff..d124411af757 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 @@ -29,19 +29,19 @@ StorageErrorException, SignedIdentifier) from .._deserialize import deserialize_container_properties -from ..container_client import ContainerClient as ContainerClientBase -from ..lease import get_access_conditions -from ..models import ContainerProperties, BlobProperties, BlobType # pylint: disable=unused-import -from .models import BlobPropertiesPaged, BlobPrefix -from .lease_async import LeaseClient -from .blob_client_async import BlobClient +from .._container_client import ContainerClient as ContainerClientBase +from .._lease import get_access_conditions +from .._models import ContainerProperties, BlobProperties, BlobType # pylint: disable=unused-import +from ._models import BlobPropertiesPaged, BlobPrefix +from ._lease_async import LeaseClient +from ._blob_client_async import BlobClient if TYPE_CHECKING: from azure.core.pipeline.transport import HttpTransport from azure.core.pipeline.policies import HTTPPolicy - from ..models import ContainerSasPermissions, PublicAccess + from .._models import ContainerSasPermissions, PublicAccess from datetime import datetime - from ..models import ( # pylint: disable=unused-import + from .._models import ( # pylint: disable=unused-import AccessPolicy, ContentSettings, StandardBlobTier, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/download_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/aio/download_async.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py index d9025f59367e..fe0110241e99 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/download_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py @@ -14,7 +14,7 @@ from .._shared.request_handlers import validate_and_format_range_headers from .._shared.response_handlers import process_storage_error, parse_length_from_content_range from .._deserialize import get_page_ranges_result -from ..download import process_range_and_offset +from .._download import process_range_and_offset async def process_content(data, start_offset, end_offset, encryption): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/lease_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/aio/lease_async.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py index bfca10c9ec33..593d4fe27f8e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/lease_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_lease_async.py @@ -16,7 +16,7 @@ StorageErrorException, ModifiedAccessConditions, LeaseAccessConditions) -from ..lease import LeaseClient as LeaseClientBase +from .._lease import LeaseClient as LeaseClientBase if TYPE_CHECKING: from datetime import datetime diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_models.py similarity index 99% rename from sdk/storage/azure-storage-blob/azure/storage/blob/aio/models.py rename to sdk/storage/azure-storage-blob/azure/storage/blob/aio/_models.py index 0a7cf719cd91..312802255d70 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_models.py @@ -10,7 +10,7 @@ from azure.core.async_paging import AsyncPageIterator, AsyncItemPaged -from ..models import BlobProperties, ContainerProperties +from .._models import BlobProperties, ContainerProperties from .._shared.response_handlers import return_context_and_deserialized, process_storage_error from .._shared.models import DictMixin diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py b/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py index 7a2a8bef9259..ec4df203df53 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_encryption.py @@ -25,7 +25,7 @@ _generate_AES_CBC_cipher, _ERROR_OBJECT_INVALID, ) -from azure.storage.blob.blob_client import _ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION +from azure.storage.blob._blob_client import _ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION from cryptography.hazmat.primitives.padding import PKCS7 from azure.storage.blob import ( diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py index 1fa610d800db..146232669154 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_encryption_async.py @@ -29,7 +29,7 @@ _generate_AES_CBC_cipher, _ERROR_OBJECT_INVALID, ) -from azure.storage.blob.blob_client import _ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION +from azure.storage.blob._blob_client import _ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION from cryptography.hazmat.primitives.padding import PKCS7 from azure.storage.blob import BlobType diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py index e6343afafd2b..2c1dd2cffb98 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_storage_account_async.py @@ -19,7 +19,7 @@ BlobClient, ) -from azure.storage.blob.models import ( +from azure.storage.blob import ( StandardBlobTier ) diff --git a/sdk/storage/azure-storage-blob/tests/test_cpk.py b/sdk/storage/azure-storage-blob/tests/test_cpk.py index 4ddbb845d7f6..8f82bf0d715b 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk.py @@ -13,8 +13,10 @@ BlobServiceClient, BlobType, BlobBlock, + CustomerProvidedEncryptionKey, + BlobSasPermissions ) -from azure.storage.blob.models import CustomerProvidedEncryptionKey, BlobSasPermissions + from testcase import ( StorageTestCase, TestMode, diff --git a/sdk/storage/azure-storage-blob/tests/test_cpk_async.py b/sdk/storage/azure-storage-blob/tests/test_cpk_async.py index d91f12f2348a..7624161be092 100644 --- a/sdk/storage/azure-storage-blob/tests/test_cpk_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_cpk_async.py @@ -12,9 +12,14 @@ from azure.core.exceptions import HttpResponseError from azure.core.pipeline.transport import AioHttpTransport from multidict import CIMultiDict, CIMultiDictProxy -from azure.storage.blob import BlobType, BlobBlock +from azure.storage.blob import ( + BlobType, + BlobBlock, + CustomerProvidedEncryptionKey, + BlobSasPermissions +) from azure.storage.blob.aio import BlobServiceClient -from azure.storage.blob.models import CustomerProvidedEncryptionKey, BlobSasPermissions + from testcase import ( StorageTestCase, TestMode, diff --git a/sdk/storage/azure-storage-blob/tests/test_retry_async.py b/sdk/storage/azure-storage-blob/tests/test_retry_async.py index 27d1503564d9..bb0fa2e73c3c 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry_async.py @@ -17,8 +17,12 @@ from azure.core.pipeline.transport import AioHttpTransport from multidict import CIMultiDict, CIMultiDictProxy -from azure.storage.blob import LocationMode -from azure.storage.blob._shared.policies_async import LinearRetry, ExponentialRetry +from azure.storage.blob import ( + LocationMode, + LinearRetry, + ExponentialRetry +) + from azure.storage.blob.aio import ( BlobServiceClient, ContainerClient, From 51c2915cc3ee630c1449063172d7bc9ab7e7dbde Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 10:39:00 -0700 Subject: [PATCH 02/14] files internal --- sdk/storage/azure-storage-blob/setup.py | 2 +- .../azure/storage/file/__init__.py | 12 ++++++------ .../azure/storage/file/_deserialize.py | 2 +- .../{directory_client.py => _directory_client.py} | 6 +++--- .../storage/file/{download.py => _download.py} | 0 .../file/{file_client.py => _file_client.py} | 6 +++--- ...e_service_client.py => _file_service_client.py} | 6 +++--- .../azure/storage/file/{models.py => _models.py} | 2 +- .../file/{share_client.py => _share_client.py} | 6 +++--- .../azure/storage/file/_shared/encryption.py | 2 +- .../azure/storage/file/_shared/policies.py | 2 +- .../azure/storage/file/{version.py => _version.py} | 0 .../azure/storage/file/aio/__init__.py | 8 ++++---- ..._client_async.py => _directory_client_async.py} | 8 ++++---- .../aio/{download_async.py => _download_async.py} | 2 +- ...{file_client_async.py => _file_client_async.py} | 8 ++++---- ...ient_async.py => _file_service_client_async.py} | 8 ++++---- .../storage/file/aio/{models.py => _models.py} | 2 +- ...hare_client_async.py => _share_client_async.py} | 8 ++++---- sdk/storage/azure-storage-file/setup.py | 2 +- .../azure-storage-file/tests/test_handle.py | 10 ++++++---- sdk/storage/azure-storage-file/tests/test_share.py | 14 +++++++++----- 22 files changed, 61 insertions(+), 55 deletions(-) rename sdk/storage/azure-storage-file/azure/storage/file/{directory_client.py => _directory_client.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/{download.py => _download.py} (100%) rename sdk/storage/azure-storage-file/azure/storage/file/{file_client.py => _file_client.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/{file_service_client.py => _file_service_client.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/{models.py => _models.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/{share_client.py => _share_client.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/{version.py => _version.py} (100%) rename sdk/storage/azure-storage-file/azure/storage/file/aio/{directory_client_async.py => _directory_client_async.py} (98%) rename sdk/storage/azure-storage-file/azure/storage/file/aio/{download_async.py => _download_async.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/aio/{file_client_async.py => _file_client_async.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/aio/{file_service_client_async.py => _file_service_client_async.py} (98%) rename sdk/storage/azure-storage-file/azure/storage/file/aio/{models.py => _models.py} (99%) rename sdk/storage/azure-storage-file/azure/storage/file/aio/{share_client_async.py => _share_client_async.py} (99%) diff --git a/sdk/storage/azure-storage-blob/setup.py b/sdk/storage/azure-storage-blob/setup.py index 63becf5ff97b..1f2840e2a373 100644 --- a/sdk/storage/azure-storage-blob/setup.py +++ b/sdk/storage/azure-storage-blob/setup.py @@ -53,7 +53,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/sdk/storage/azure-storage-file/azure/storage/file/__init__.py b/sdk/storage/azure-storage-file/azure/storage/file/__init__.py index 83382a9e6486..6b2200375c4d 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/__init__.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/__init__.py @@ -4,18 +4,18 @@ # license information. # -------------------------------------------------------------------------- -from .version import VERSION -from .file_client import FileClient -from .directory_client import DirectoryClient -from .share_client import ShareClient -from .file_service_client import FileServiceClient +from ._version import VERSION +from ._file_client import FileClient +from ._directory_client import DirectoryClient +from ._share_client import ShareClient +from ._file_service_client import FileServiceClient from ._shared.policies import ExponentialRetry, LinearRetry from ._shared.models import( LocationMode, ResourceTypes, AccountSasPermissions, StorageErrorCode) -from .models import ( +from ._models import ( ShareProperties, DirectoryProperties, Handle, diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_deserialize.py b/sdk/storage/azure-storage-file/azure/storage/file/_deserialize.py index e566c394298e..5475e6d14e0d 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_deserialize.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_deserialize.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- -from .models import ShareProperties, DirectoryProperties, FileProperties +from ._models import ShareProperties, DirectoryProperties, FileProperties from ._shared.response_handlers import deserialize_metadata diff --git a/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/directory_client.py rename to sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py index 8b0e73b3c004..f6085e10597f 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py @@ -30,11 +30,11 @@ from ._parser import _get_file_permission, _datetime_to_str from ._deserialize import deserialize_directory_properties from ._polling import CloseHandles -from .file_client import FileClient -from .models import DirectoryPropertiesPaged, HandlesPaged, NTFSAttributes # pylint: disable=unused-import +from ._file_client import FileClient +from ._models import DirectoryPropertiesPaged, HandlesPaged, NTFSAttributes # pylint: disable=unused-import if TYPE_CHECKING: - from .models import ShareProperties, DirectoryProperties, ContentSettings + from ._models import ShareProperties, DirectoryProperties, ContentSettings from ._generated.models import HandleItem diff --git a/sdk/storage/azure-storage-file/azure/storage/file/download.py b/sdk/storage/azure-storage-file/azure/storage/file/_download.py similarity index 100% rename from sdk/storage/azure-storage-file/azure/storage/file/download.py rename to sdk/storage/azure-storage-file/azure/storage/file/_download.py diff --git a/sdk/storage/azure-storage-file/azure/storage/file/file_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_file_client.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/file_client.py rename to sdk/storage/azure-storage-file/azure/storage/file/_file_client.py index 9af4d7a859e5..b019bd433fb3 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/file_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_file_client.py @@ -33,13 +33,13 @@ from ._parser import _get_file_permission, _datetime_to_str from ._deserialize import deserialize_file_properties, deserialize_file_stream from ._polling import CloseHandles -from .models import HandlesPaged, NTFSAttributes # pylint: disable=unused-import +from ._models import HandlesPaged, NTFSAttributes # pylint: disable=unused-import from ._shared_access_signature import FileSharedAccessSignature -from .download import StorageStreamDownloader +from ._download import StorageStreamDownloader if TYPE_CHECKING: from datetime import datetime - from .models import ShareProperties, FileSasPermissions, ContentSettings, FileProperties + from ._models import ShareProperties, FileSasPermissions, ContentSettings, FileProperties from ._generated.models import HandleItem diff --git a/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_file_service_client.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py rename to sdk/storage/azure-storage-file/azure/storage/file/_file_service_client.py index e349527fa0f4..0d5db19720ae 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_file_service_client.py @@ -24,13 +24,13 @@ from ._generated import AzureFileStorage from ._generated.models import StorageErrorException, StorageServiceProperties from ._generated.version import VERSION -from .share_client import ShareClient -from .models import SharePropertiesPaged +from ._share_client import ShareClient +from ._models import SharePropertiesPaged if TYPE_CHECKING: from datetime import datetime from ._shared.models import ResourceTypes, AccountSasPermissions - from .models import Metrics, CorsRule, ShareProperties + from ._models import Metrics, CorsRule, ShareProperties class FileServiceClient(StorageAccountHostsMixin): diff --git a/sdk/storage/azure-storage-file/azure/storage/file/models.py b/sdk/storage/azure-storage-file/azure/storage/file/_models.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/models.py rename to sdk/storage/azure-storage-file/azure/storage/file/_models.py index de65f213a916..bf99c6dee92e 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/models.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_models.py @@ -7,7 +7,7 @@ # pylint: disable=super-init-not-called, too-many-lines from azure.core.paging import PageIterator -from azure.storage.file._parser import _parse_datetime_from_str +from ._parser import _parse_datetime_from_str from ._shared.response_handlers import return_context_and_deserialized, process_storage_error from ._shared.models import DictMixin, get_enum_value from ._generated.models import StorageErrorException diff --git a/sdk/storage/azure-storage-file/azure/storage/file/share_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/share_client.py rename to sdk/storage/azure-storage-file/azure/storage/file/_share_client.py index 29618ef0cf7a..ef797e86acf1 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/share_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py @@ -29,12 +29,12 @@ DeleteSnapshotsOptionType, SharePermission) from ._deserialize import deserialize_share_properties, deserialize_permission_key, deserialize_permission -from .directory_client import DirectoryClient -from .file_client import FileClient +from ._directory_client import DirectoryClient +from ._file_client import FileClient from ._shared_access_signature import FileSharedAccessSignature if TYPE_CHECKING: - from .models import ShareProperties, AccessPolicy, ShareSasPermissions + from ._models import ShareProperties, AccessPolicy, ShareSasPermissions class ShareClient(StorageAccountHostsMixin): diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/encryption.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/encryption.py index 25c160463fad..62607cc0cf85 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/encryption.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/encryption.py @@ -20,7 +20,7 @@ from azure.core.exceptions import HttpResponseError -from ..version import VERSION +from .._version import VERSION from . import encode_base64, decode_base64_to_bytes diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/policies.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/policies.py index 5cc93d3e6a44..0f0f590a4071 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/policies.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/policies.py @@ -39,7 +39,7 @@ from azure.core.pipeline.policies.base import RequestHistory from azure.core.exceptions import AzureError, ServiceRequestError, ServiceResponseError -from ..version import VERSION +from .._version import VERSION from .models import LocationMode try: diff --git a/sdk/storage/azure-storage-file/azure/storage/file/version.py b/sdk/storage/azure-storage-file/azure/storage/file/_version.py similarity index 100% rename from sdk/storage/azure-storage-file/azure/storage/file/version.py rename to sdk/storage/azure-storage-file/azure/storage/file/_version.py diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/__init__.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/__init__.py index 9ba6e4a802c0..4e4af3a9a02b 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/__init__.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/__init__.py @@ -4,10 +4,10 @@ # license information. # -------------------------------------------------------------------------- -from .file_client_async import FileClient -from .directory_client_async import DirectoryClient -from .share_client_async import ShareClient -from .file_service_client_async import FileServiceClient +from ._file_client_async import FileClient +from ._directory_client_async import DirectoryClient +from ._share_client_async import ShareClient +from ._file_service_client_async import FileServiceClient __all__ = [ diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py similarity index 98% rename from sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py rename to sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py index 63021bca89bc..cd82d43cb275 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py @@ -25,13 +25,13 @@ from .._shared.request_handlers import add_metadata_headers from .._shared.response_handlers import return_response_headers, process_storage_error from .._deserialize import deserialize_directory_properties -from ..directory_client import DirectoryClient as DirectoryClientBase +from .._directory_client import DirectoryClient as DirectoryClientBase from ._polling_async import CloseHandlesAsync -from .file_client_async import FileClient -from .models import DirectoryPropertiesPaged, HandlesPaged +from ._file_client_async import FileClient +from ._models import DirectoryPropertiesPaged, HandlesPaged if TYPE_CHECKING: - from ..models import ShareProperties, DirectoryProperties, ContentSettings, NTFSAttributes + from .._models import ShareProperties, DirectoryProperties, ContentSettings, NTFSAttributes from .._generated.models import HandleItem diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/download_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_download_async.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/aio/download_async.py rename to sdk/storage/azure-storage-file/azure/storage/file/aio/_download_async.py index 12abb1acf9dc..19a0cc61a75d 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/download_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_download_async.py @@ -13,7 +13,7 @@ from .._shared.encryption import decrypt_blob from .._shared.request_handlers import validate_and_format_range_headers from .._shared.response_handlers import process_storage_error, parse_length_from_content_range -from ..download import process_range_and_offset +from .._download import process_range_and_offset class _AsyncChunkDownloader(object): # pylint: disable=too-many-instance-attributes 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 similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py rename to sdk/storage/azure-storage-file/azure/storage/file/aio/_file_client_async.py index 9c1130ad284a..eceff5dc25fa 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 @@ -26,14 +26,14 @@ from .._shared.request_handlers import add_metadata_headers, get_length from .._shared.response_handlers import return_response_headers, process_storage_error from .._deserialize import deserialize_file_properties, deserialize_file_stream -from ..file_client import FileClient as FileClientBase +from .._file_client import FileClient as FileClientBase from ._polling_async import CloseHandlesAsync -from .models import HandlesPaged -from .download_async import StorageStreamDownloader +from ._models import HandlesPaged +from ._download_async import StorageStreamDownloader if TYPE_CHECKING: from datetime import datetime - from ..models import ShareProperties, ContentSettings, FileProperties, NTFSAttributes + from .._models import ShareProperties, ContentSettings, FileProperties, NTFSAttributes from .._generated.models import HandleItem diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_file_service_client_async.py similarity index 98% rename from sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py rename to sdk/storage/azure-storage-file/azure/storage/file/aio/_file_service_client_async.py index c043a030f4a3..4eb8aaa98ad0 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_file_service_client_async.py @@ -20,14 +20,14 @@ from .._generated.aio import AzureFileStorage from .._generated.models import StorageErrorException, StorageServiceProperties from .._generated.version import VERSION -from ..file_service_client import FileServiceClient as FileServiceClientBase -from .share_client_async import ShareClient -from .models import SharePropertiesPaged +from .._file_service_client import FileServiceClient as FileServiceClientBase +from ._share_client_async import ShareClient +from ._models import SharePropertiesPaged if TYPE_CHECKING: from datetime import datetime from .._shared.models import ResourceTypes, AccountSasPermissions - from ..models import Metrics, CorsRule, ShareProperties + from .._models import Metrics, CorsRule, ShareProperties class FileServiceClient(AsyncStorageAccountHostsMixin, FileServiceClientBase): diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/models.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_models.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/aio/models.py rename to sdk/storage/azure-storage-file/azure/storage/file/aio/_models.py index e5419a5d9135..49b3d36ee309 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/models.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_models.py @@ -11,7 +11,7 @@ from .._shared.response_handlers import return_context_and_deserialized, process_storage_error from .._generated.models import StorageErrorException from .._generated.models import DirectoryItem -from ..models import Handle, ShareProperties +from .._models import Handle, ShareProperties def _wrap_item(item): diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/share_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_share_client_async.py similarity index 99% rename from sdk/storage/azure-storage-file/azure/storage/file/aio/share_client_async.py rename to sdk/storage/azure-storage-file/azure/storage/file/aio/_share_client_async.py index b5e5ce453024..61eab97bb5ca 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/share_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_share_client_async.py @@ -25,12 +25,12 @@ SignedIdentifier, DeleteSnapshotsOptionType) from .._deserialize import deserialize_share_properties, deserialize_permission -from ..share_client import ShareClient as ShareClientBase -from .directory_client_async import DirectoryClient -from .file_client_async import FileClient +from .._share_client import ShareClient as ShareClientBase +from ._directory_client_async import DirectoryClient +from ._file_client_async import FileClient if TYPE_CHECKING: - from ..models import ShareProperties, AccessPolicy + from .._models import ShareProperties, AccessPolicy class ShareClient(AsyncStorageAccountHostsMixin, ShareClientBase): diff --git a/sdk/storage/azure-storage-file/setup.py b/sdk/storage/azure-storage-file/setup.py index 24ce7e90317c..46cc22477463 100644 --- a/sdk/storage/azure-storage-file/setup.py +++ b/sdk/storage/azure-storage-file/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/sdk/storage/azure-storage-file/tests/test_handle.py b/sdk/storage/azure-storage-file/tests/test_handle.py index 220e71d679c2..f7ddda001956 100644 --- a/sdk/storage/azure-storage-file/tests/test_handle.py +++ b/sdk/storage/azure-storage-file/tests/test_handle.py @@ -13,10 +13,12 @@ ResourceNotFoundError, ResourceExistsError) -from azure.storage.file.file_service_client import FileServiceClient -from azure.storage.file.directory_client import DirectoryClient -from azure.storage.file.file_client import FileClient -from azure.storage.file.share_client import ShareClient +from azure.storage.file import ( + FileServiceClient, + DirectoryClient, + FileClient, + ShareClient +) from filetestcase import ( FileTestCase, record, diff --git a/sdk/storage/azure-storage-file/tests/test_share.py b/sdk/storage/azure-storage-file/tests/test_share.py index 53f6063e2e13..b0f01712602e 100644 --- a/sdk/storage/azure-storage-file/tests/test_share.py +++ b/sdk/storage/azure-storage-file/tests/test_share.py @@ -15,11 +15,15 @@ ResourceNotFoundError, ResourceExistsError) -from azure.storage.file.models import AccessPolicy, ShareSasPermissions -from azure.storage.file.file_service_client import FileServiceClient -from azure.storage.file.directory_client import DirectoryClient -from azure.storage.file.file_client import FileClient -from azure.storage.file.share_client import ShareClient +from azure.storage.file import ( + AccessPolicy, + ShareSasPermissions, + FileServiceClient, + DirectoryClient, + FileClient, + ShareClient +) + from azure.storage.file._generated.models import DeleteSnapshotsOptionType, ListSharesIncludeType from filetestcase import ( FileTestCase, From 1d222266b0e3c8b0ba0b82624f20559552c77254 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 11:00:07 -0700 Subject: [PATCH 03/14] queues internal --- .../azure-storage-queue/azure/storage/queue/__init__.py | 8 ++++---- .../azure/storage/queue/_deserialize.py | 2 +- .../azure/storage/queue/{models.py => _models.py} | 0 .../storage/queue/{queue_client.py => _queue_client.py} | 4 ++-- .../{queue_service_client.py => _queue_service_client.py} | 6 +++--- .../azure/storage/queue/_shared/encryption.py | 2 +- .../azure/storage/queue/_shared/models.py | 6 +++--- .../azure/storage/queue/_shared/policies.py | 2 +- .../azure/storage/queue/{version.py => _version.py} | 0 .../azure/storage/queue/aio/__init__.py | 4 ++-- .../azure/storage/queue/aio/{models.py => _models.py} | 2 +- .../aio/{queue_client_async.py => _queue_client_async.py} | 8 ++++---- ...ice_client_async.py => _queue_service_client_async.py} | 8 ++++---- sdk/storage/azure-storage-queue/setup.py | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) rename sdk/storage/azure-storage-queue/azure/storage/queue/{models.py => _models.py} (100%) rename sdk/storage/azure-storage-queue/azure/storage/queue/{queue_client.py => _queue_client.py} (99%) rename sdk/storage/azure-storage-queue/azure/storage/queue/{queue_service_client.py => _queue_service_client.py} (99%) rename sdk/storage/azure-storage-queue/azure/storage/queue/{version.py => _version.py} (100%) rename sdk/storage/azure-storage-queue/azure/storage/queue/aio/{models.py => _models.py} (98%) rename sdk/storage/azure-storage-queue/azure/storage/queue/aio/{queue_client_async.py => _queue_client_async.py} (99%) rename sdk/storage/azure-storage-queue/azure/storage/queue/aio/{queue_service_client_async.py => _queue_service_client_async.py} (98%) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/__init__.py index 127e8f946ba2..ae810936c0ca 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/__init__.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/__init__.py @@ -4,9 +4,9 @@ # license information. # -------------------------------------------------------------------------- -from .version import VERSION -from .queue_client import QueueClient -from .queue_service_client import QueueServiceClient +from ._version import VERSION +from ._queue_client import QueueClient +from ._queue_service_client import QueueServiceClient from ._shared.policies import ExponentialRetry, LinearRetry from ._shared.models import( LocationMode, @@ -24,7 +24,7 @@ NoEncodePolicy, NoDecodePolicy ) -from .models import ( +from ._models import ( QueueMessage, QueueProperties, QueueSasPermissions, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py index 3137faa0aaa4..893e2558accf 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py @@ -8,7 +8,7 @@ from azure.core.exceptions import ResourceExistsError from ._shared.models import StorageErrorCode -from .models import QueueProperties +from ._models import QueueProperties def deserialize_metadata(response, obj, headers): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py similarity index 100% rename from sdk/storage/azure-storage-queue/azure/storage/queue/models.py rename to sdk/storage/azure-storage-queue/azure/storage/queue/_models.py 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 similarity index 99% rename from sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py rename to sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py index ea8411414352..2c964a19cf96 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 @@ -31,12 +31,12 @@ from ._generated.models import QueueMessage as GenQueueMessage from ._shared_access_signature import QueueSharedAccessSignature -from .models import QueueMessage, AccessPolicy, MessagesPaged +from ._models import QueueMessage, AccessPolicy, MessagesPaged if TYPE_CHECKING: from datetime import datetime from azure.core.pipeline.policies import HTTPPolicy - from .models import QueueSasPermissions, QueueProperties + from ._models import QueueSasPermissions, QueueProperties class QueueClient(StorageAccountHostsMixin): 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 similarity index 99% rename from sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py rename to sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py index 86f6ea6c6d67..7d71e7981cc9 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 @@ -22,15 +22,15 @@ from ._generated import AzureQueueStorage from ._generated.models import StorageServiceProperties, StorageErrorException -from .models import QueuePropertiesPaged -from .queue_client import QueueClient +from ._models import QueuePropertiesPaged +from ._queue_client import QueueClient if TYPE_CHECKING: from datetime import datetime from azure.core import Configuration from azure.core.pipeline.policies import HTTPPolicy from ._shared.models import AccountSasPermissions, ResourceTypes - from .models import ( + from ._models import ( QueueProperties, Logging, Metrics, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py index 25c160463fad..62607cc0cf85 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/encryption.py @@ -20,7 +20,7 @@ from azure.core.exceptions import HttpResponseError -from ..version import VERSION +from .._version import VERSION from . import encode_base64, decode_base64_to_bytes diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py index b8078927e0de..a0be70fd6c64 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/models.py @@ -330,11 +330,11 @@ class Services(object): """Specifies the services accessible with the account SAS. :param bool blob: - Access for the `~azure.storage.blob.blob_service_client.BlobServiceClient` + Access for the `~azure.storage.blob.BlobServiceClient` :param bool queue: - Access for the `~azure.storage.queue.queue_service_client.QueueServiceClient` + Access for the `~azure.storage.queue.QueueServiceClient` :param bool file: - Access for the `~azure.storage.file.file_service_client.FileServiceClient` + Access for the `~azure.storage.file.FileServiceClient` """ def __init__(self, blob=False, queue=False, file=False): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py index 5cc93d3e6a44..0f0f590a4071 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py @@ -39,7 +39,7 @@ from azure.core.pipeline.policies.base import RequestHistory from azure.core.exceptions import AzureError, ServiceRequestError, ServiceResponseError -from ..version import VERSION +from .._version import VERSION from .models import LocationMode try: diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/version.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py similarity index 100% rename from sdk/storage/azure-storage-queue/azure/storage/queue/version.py rename to sdk/storage/azure-storage-queue/azure/storage/queue/_version.py diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/__init__.py index 3a817ac4988d..15781aefaf2e 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/__init__.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/__init__.py @@ -4,8 +4,8 @@ # license information. # -------------------------------------------------------------------------- -from .queue_client_async import QueueClient -from .queue_service_client_async import QueueServiceClient +from ._queue_client_async import QueueClient +from ._queue_service_client_async import QueueServiceClient __all__ = [ 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 similarity index 98% rename from sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py rename to sdk/storage/azure-storage-queue/azure/storage/queue/aio/_models.py index 4fa12459f6ce..1886411aec77 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 @@ -12,7 +12,7 @@ process_storage_error, return_context_and_deserialized) from .._generated.models import StorageErrorException -from ..models import QueueMessage, QueueProperties +from .._models import QueueMessage, QueueProperties class MessagesPaged(AsyncPageIterator): 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 similarity index 99% rename from sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py rename to sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py index 7a52c524ba33..abad5ccac5f9 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 @@ -41,16 +41,16 @@ from .._generated.models import StorageErrorException, SignedIdentifier from .._generated.models import QueueMessage as GenQueueMessage -from ..models import QueueMessage, AccessPolicy -from .models import MessagesPaged +from .._models import QueueMessage, AccessPolicy +from ._models import MessagesPaged from .._shared.policies_async import ExponentialRetry -from ..queue_client import QueueClient as QueueClientBase +from .._queue_client import QueueClient as QueueClientBase if TYPE_CHECKING: from datetime import datetime from azure.core.pipeline.policies import HTTPPolicy - from ..models import QueueSasPermissions, QueueProperties + from .._models import QueueSasPermissions, QueueProperties class QueueClient(AsyncStorageAccountHostsMixin, QueueClientBase): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py similarity index 98% rename from sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py rename to sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py index ee7835eb5044..0731d82e69ee 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py @@ -18,21 +18,21 @@ from azure.core.tracing.decorator_async import distributed_trace_async from .._shared.policies_async import ExponentialRetry -from ..queue_service_client import QueueServiceClient as QueueServiceClientBase +from .._queue_service_client import QueueServiceClient as QueueServiceClientBase from .._shared.models import LocationMode from .._shared.base_client_async import AsyncStorageAccountHostsMixin from .._shared.response_handlers import process_storage_error from .._generated.aio import AzureQueueStorage from .._generated.models import StorageServiceProperties, StorageErrorException -from .models import QueuePropertiesPaged -from .queue_client_async import QueueClient +from ._models import QueuePropertiesPaged +from ._queue_client_async import QueueClient if TYPE_CHECKING: from datetime import datetime from azure.core import Configuration from azure.core.pipeline.policies import HTTPPolicy - from ..models import ( + from .._models import ( QueueProperties, Logging, Metrics, diff --git a/sdk/storage/azure-storage-queue/setup.py b/sdk/storage/azure-storage-queue/setup.py index 0a71c9ad7af8..94d01b04a765 100644 --- a/sdk/storage/azure-storage-queue/setup.py +++ b/sdk/storage/azure-storage-queue/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', # type: ignore fd.read(), re.MULTILINE).group(1) From c80e91fc876c6c41b2870dbe952587b029face47 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 11:17:23 -0700 Subject: [PATCH 04/14] some fixes to docstrings --- .../azure/storage/blob/_shared/models.py | 6 +++--- .../azure/storage/blob/aio/_blob_service_client_async.py | 2 +- .../azure/storage/file/_directory_client.py | 4 ++-- .../azure/storage/file/_share_client.py | 2 +- .../azure/storage/file/_shared/models.py | 6 +++--- .../azure/storage/file/aio/_directory_client_async.py | 8 ++++---- .../azure-storage-queue/azure/storage/queue/_models.py | 4 ++-- .../azure/storage/queue/_queue_service_client.py | 6 +++--- .../storage/queue/aio/_queue_service_client_async.py | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py index 80c4d22a6b2f..2814f0356974 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/models.py @@ -331,11 +331,11 @@ class Services(object): """Specifies the services accessible with the account SAS. :param bool blob: - Access for the `~azure.storage.blob.blob_service_client.BlobServiceClient` + Access for the `~azure.storage.blob.BlobServiceClient` :param bool queue: - Access for the `~azure.storage.queue.queue_service_client.QueueServiceClient` + Access for the `~azure.storage.queue.QueueServiceClient` :param bool file: - Access for the `~azure.storage.file.file_service_client.FileServiceClient` + Access for the `~azure.storage.file.FileServiceClient` """ def __init__(self, blob=False, queue=False, file=False): 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 98776c557c31..b96bf3c3b459 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 @@ -472,7 +472,7 @@ def get_container_client(self, container): The container that the blob is in. :type container: str or ~azure.storage.blob.ContainerProperties :returns: A ContainerClient. - :rtype: ~azure.core.blob.aio.ContainerClient + :rtype: ~azure.storage.blob.aio.ContainerClient .. admonition:: Example: diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py index f6085e10597f..f0b0ed804abd 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py @@ -231,7 +231,7 @@ def get_subdirectory_client(self, directory_name, **kwargs): :param str directory_name: The name of the subdirectory. :returns: A Directory Client. - :rtype: ~azure.storage.file.directory_client.DirectoryClient + :rtype: ~azure.storage.file.DirectoryClient .. admonition:: Example: @@ -533,7 +533,7 @@ def create_subdirectory( :keyword int timeout: The timeout parameter is expressed in seconds. :returns: DirectoryClient - :rtype: ~azure.storage.file.directory_client.DirectoryClient + :rtype: ~azure.storage.file.DirectoryClient .. admonition:: Example: diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py index ef797e86acf1..d8a71da3c4dc 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py @@ -745,7 +745,7 @@ def create_directory(self, directory_name, **kwargs): :keyword int timeout: The timeout parameter is expressed in seconds. :returns: DirectoryClient - :rtype: ~azure.storage.file.directory_client.DirectoryClient + :rtype: ~azure.storage.file.DirectoryClient """ directory = self.get_directory_client(directory_name) kwargs.setdefault('merge_span', True) diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/models.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/models.py index 943842ced4c2..a88b25e6351e 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/models.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/models.py @@ -330,11 +330,11 @@ class Services(object): """Specifies the services accessible with the account SAS. :param bool blob: - Access for the `~azure.storage.blob.blob_service_client.BlobServiceClient` + Access for the `~azure.storage.blob.BlobServiceClient` :param bool queue: - Access for the `~azure.storage.queue.queue_service_client.QueueServiceClient` + Access for the `~azure.storage.queue.QueueServiceClient` :param bool file: - Access for the `~azure.storage.file.file_service_client.FileServiceClient` + Access for the `~azure.storage.file.FileServiceClient` """ def __init__(self, blob=False, queue=False, file=False): diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py index cd82d43cb275..e7daf353737e 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py @@ -108,7 +108,7 @@ def get_file_client(self, file_name, **kwargs): :param file_name: The name of the file. :returns: A File Client. - :rtype: ~azure.storage.file.file_client.FileClient + :rtype: ~azure.storage.file.FileClient """ if self.directory_path: file_name = self.directory_path.rstrip('/') + "/" + file_name @@ -126,7 +126,7 @@ def get_subdirectory_client(self, directory_name, **kwargs): :param str directory_name: The name of the subdirectory. :returns: A Directory Client. - :rtype: ~azure.storage.file.aio.directory_client_async.DirectoryClient + :rtype: ~azure.storage.file.aio.DirectoryClient .. admonition:: Example: @@ -427,7 +427,7 @@ async def create_subdirectory( :keyword int timeout: The timeout parameter is expressed in seconds. :returns: DirectoryClient - :rtype: ~azure.storage.file.aio.directory_client_async.DirectoryClient + :rtype: ~azure.storage.file.aio.DirectoryClient .. admonition:: Example: @@ -507,7 +507,7 @@ async def upload_file( :keyword str encoding: Defaults to UTF-8. :returns: FileClient - :rtype: ~azure.storage.file.aio.file_client_async.FileClient + :rtype: ~azure.storage.file.aio.FileClient .. admonition:: Example: 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 87a3992de8c8..b5f7f12bbfe6 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_models.py @@ -333,9 +333,9 @@ def _extract_data_cb(self, get_next_return): class QueueSasPermissions(object): """QueueSasPermissions class to be used with - :func:`~azure.storage.queue.queue_client.QueueClient.generate_shared_access_signature` + :func:`~azure.storage.queue.QueueClient.generate_shared_access_signature` method and for the AccessPolicies used with - :func:`~azure.storage.queue.queue_client.QueueClient.set_queue_access_policy`. + :func:`~azure.storage.queue.QueueClient.set_queue_access_policy`. :param bool read: Read metadata and properties, including message count. Peek at messages. 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 7d71e7981cc9..b8fd56e53366 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 @@ -346,7 +346,7 @@ def list_queues( calls to the service in which case the timeout value specified will be applied to each individual call. :returns: An iterable (auto-paging) of QueueProperties. - :rtype: ~azure.core.paging.ItemPaged[~azure.core.queue.models.QueueProperties] + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.queue.QueueProperties] .. admonition:: Example: @@ -456,8 +456,8 @@ def get_queue_client(self, queue, **kwargs): The queue. This can either be the name of the queue, or an instance of QueueProperties. :type queue: str or ~azure.storage.queue.QueueProperties - :returns: A :class:`~azure.core.queue.queue_client.QueueClient` object. - :rtype: ~azure.core.queue.queue_client.QueueClient + :returns: A :class:`~azure.storage.queue.QueueClient` object. + :rtype: ~azure.storage.queue.QueueClient .. admonition:: Example: diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py index 0731d82e69ee..ea84e9541169 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py @@ -246,7 +246,7 @@ def list_queues( calls to the service in which case the timeout value specified will be applied to each individual call. :returns: An iterable (auto-paging) of QueueProperties. - :rtype: ~azure.core.paging.AsyncItemPaged[~azure.core.queue.models.QueueProperties] + :rtype: ~azure.core.paging.AsyncItemPaged[~azure.storage.queue.QueueProperties] .. admonition:: Example: @@ -356,7 +356,7 @@ def get_queue_client(self, queue, **kwargs): The queue. This can either be the name of the queue, or an instance of QueueProperties. :type queue: str or ~azure.storage.queue.QueueProperties - :returns: A :class:`~azure.core.queue.queue_client.QueueClient` object. + :returns: A :class:`~azure.storage.queue.aio.QueueClient` object. :rtype: ~azure.storage.queue.aio.QueueClient .. admonition:: Example: From 18d3e12395d2e5d1cdb7330566963d96c3d29cb2 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 11:53:05 -0700 Subject: [PATCH 05/14] update history.md --- sdk/storage/azure-storage-blob/HISTORY.md | 2 ++ sdk/storage/azure-storage-file/HISTORY.md | 2 ++ sdk/storage/azure-storage-queue/HISTORY.md | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-blob/HISTORY.md b/sdk/storage/azure-storage-blob/HISTORY.md index e7da37f03795..cc5cda69b10f 100644 --- a/sdk/storage/azure-storage-blob/HISTORY.md +++ b/sdk/storage/azure-storage-blob/HISTORY.md @@ -8,6 +8,8 @@ - NoRetry policy has been removed. Use keyword argument `retry_total=0` for no retries. - Removed types that were accidentally exposed from two modules. Only `BlobServiceClient`, `ContainerClient`, `BlobClient` and `LeaseClient` should be imported from azure.storage.blob.aio +- Client and model files have been renamed to be internal. Users should import from the top level modules: +`azure.storage.blob` and `azure.storage.blob.aio` only. **New features** diff --git a/sdk/storage/azure-storage-file/HISTORY.md b/sdk/storage/azure-storage-file/HISTORY.md index 4887eb95b418..34d28ba88a19 100644 --- a/sdk/storage/azure-storage-file/HISTORY.md +++ b/sdk/storage/azure-storage-file/HISTORY.md @@ -21,6 +21,8 @@ To use a directory_url, the method `from_directory_url` must be used. - `max_concurrency` - `validate_content` - `timeout` etc. +- Client and model files have been renamed to be internal. Users should import from the top level modules: +`azure.storage.file` and `azure.storage.file.aio` only. **New features** diff --git a/sdk/storage/azure-storage-queue/HISTORY.md b/sdk/storage/azure-storage-queue/HISTORY.md index f2aa3e62e82a..e822a8965346 100644 --- a/sdk/storage/azure-storage-queue/HISTORY.md +++ b/sdk/storage/azure-storage-queue/HISTORY.md @@ -18,7 +18,8 @@ should be imported from azure.storage.queue.aio - `timeout` etc. - `QueueMessage` has had its parameters renamed from `insertion_time`, `time_next_visible`, `expiration_time` to `inserted_on`, `next_visible_on`, `expires_on`, respectively. - +- Client and model files have been renamed to be internal. Users should import from the top level modules: +`azure.storage.queue` and `azure.storage.queue.aio` only. **New features** From 2c6288c031257dd4f811e18393a08b3cd1d56a46 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 13:54:00 -0700 Subject: [PATCH 06/14] fix async test import --- sdk/storage/azure-storage-blob/tests/test_retry_async.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sdk/storage/azure-storage-blob/tests/test_retry_async.py b/sdk/storage/azure-storage-blob/tests/test_retry_async.py index bb0fa2e73c3c..27d1503564d9 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry_async.py @@ -17,12 +17,8 @@ from azure.core.pipeline.transport import AioHttpTransport from multidict import CIMultiDict, CIMultiDictProxy -from azure.storage.blob import ( - LocationMode, - LinearRetry, - ExponentialRetry -) - +from azure.storage.blob import LocationMode +from azure.storage.blob._shared.policies_async import LinearRetry, ExponentialRetry from azure.storage.blob.aio import ( BlobServiceClient, ContainerClient, From e4b5077f4a8ed2949db80991e30123dccdedbfe7 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 15:45:55 -0700 Subject: [PATCH 07/14] some file mypy fixes --- .../azure/storage/file/_directory_client.py | 18 ++++---- .../azure/storage/file/_file_client.py | 46 +++++++++---------- .../azure/storage/file/_share_client.py | 17 +++---- .../azure/storage/file/_shared/base_client.py | 2 +- .../storage/file/_shared/base_client_async.py | 1 + .../file/aio/_directory_client_async.py | 8 ++-- .../storage/file/aio/_file_client_async.py | 22 ++++----- .../storage/file/aio/_share_client_async.py | 12 ++--- 8 files changed, 66 insertions(+), 60 deletions(-) diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py index f0b0ed804abd..e1aedd85e5eb 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_directory_client.py @@ -34,6 +34,7 @@ from ._models import DirectoryPropertiesPaged, HandlesPaged, NTFSAttributes # pylint: disable=unused-import if TYPE_CHECKING: + from datetime import datetime from ._models import ShareProperties, DirectoryProperties, ContentSettings from ._generated.models import HandleItem @@ -178,10 +179,10 @@ def _format_url(self, hostname): @classmethod def from_connection_string( cls, conn_str, # type: str - share_name=None, # type: str - directory_path=None, # type: Optional[str] - credential=None, # type: Optional[Any] - **kwargs # type: Any + share_name, # type: str + directory_path, # type: str + credential=None, # type: Optional[Any] + **kwargs # type: Any ): # type: (...) -> DirectoryClient """Create DirectoryClient from a Connection String. @@ -249,7 +250,7 @@ def get_subdirectory_client(self, directory_name, **kwargs): _location_mode=self._location_mode, **kwargs) @distributed_trace - def create_directory(self, **kwargs): # type: ignore + def create_directory(self, **kwargs): # type: (Any) -> Dict[str, Any] """Creates a new directory under the directory referenced by the client. @@ -285,7 +286,7 @@ def create_directory(self, **kwargs): # type: ignore @distributed_trace def delete_directory(self, **kwargs): - # type: (Optional[int], **Any) -> None + # type: (**Any) -> None """Marks the directory for deletion. The directory is later deleted during garbage collection. @@ -437,7 +438,7 @@ def get_directory_properties(self, **kwargs): return response # type: ignore @distributed_trace - def set_directory_metadata(self, metadata, **kwargs): # type: ignore + def set_directory_metadata(self, metadata, **kwargs): # type: (Dict[str, Any], Any) -> Dict[str, Any] """Sets the metadata for the directory. @@ -471,7 +472,8 @@ def set_http_headers(self, file_attributes="none", # type: Union[str, NTFSAttri file_last_write_time="preserve", # type: Union[str, datetime] file_permission=None, # type: Optional[str] permission_key=None, # type: Optional[str] - **kwargs): # type: ignore + **kwargs # type: Any + ): # type: (...) -> Dict[str, Any] """Sets HTTP headers on the directory. diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_file_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_file_client.py index b019bd433fb3..506e24feeea6 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_file_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_file_client.py @@ -39,7 +39,7 @@ if TYPE_CHECKING: from datetime import datetime - from ._models import ShareProperties, FileSasPermissions, ContentSettings, FileProperties + from ._models import ShareProperties, FileSasPermissions, ContentSettings, FileProperties, Handle from ._generated.models import HandleItem @@ -228,11 +228,11 @@ def _format_url(self, hostname): @classmethod def from_connection_string( cls, conn_str, # type: str - share_name=None, # type: str - file_path=None, # type: Optional[str] + share_name, # type: str + file_path, # type: str snapshot=None, # type: Optional[Union[str, Dict[str, Any]]] credential=None, # type: Optional[Any] - **kwargs # type: Any + **kwargs # type: Any ): # type: (...) -> FileClient """Create FileClient from a Connection String. @@ -617,7 +617,7 @@ def start_copy_from_url( process_storage_error(error) def abort_copy(self, copy_id, **kwargs): - # type: (Union[str, FileProperties], Any) -> Dict[str, Any] + # type: (Union[str, FileProperties], Any) -> None """Abort an ongoing copy operation. This will leave a destination file with zero length and full metadata. @@ -761,9 +761,9 @@ def set_http_headers(self, content_settings, # type: ContentSettings file_last_write_time="preserve", # type: Union[str, datetime] file_permission=None, # type: Optional[str] permission_key=None, # type: Optional[str] - **kwargs # Any - ): # type: ignore - # type: (ContentSettings, Optional[int], Optional[Any]) -> Dict[str, Any] + **kwargs # type: Any + ): + # type: (...) -> Dict[str, Any] """Sets HTTP headers on the file. :param ~azure.storage.file.ContentSettings content_settings: @@ -822,8 +822,8 @@ def set_http_headers(self, content_settings, # type: ContentSettings process_storage_error(error) @distributed_trace - def set_file_metadata(self, metadata=None, **kwargs): # type: ignore - #type: (Optional[Dict[str, Any]], Any) -> Dict[str, Any] + def set_file_metadata(self, metadata=None, **kwargs): + # type: (Optional[Dict[str, Any]], Any) -> Dict[str, Any] """Sets user-defined metadata for the specified file as one or more name-value pairs. @@ -915,7 +915,7 @@ def _upload_range_from_url_options(source_url, # type: str range_start, # type: int range_end, # type: int source_range_start, # type: int - **kwargs + **kwargs # type: Any ): # type: (...) -> Dict[str, Any] @@ -937,11 +937,11 @@ def _upload_range_from_url_options(source_url, # type: str return options @distributed_trace - def upload_range_from_url(self, source_url, # type: str - range_start, # type: int - range_end, # type: int - source_range_start, # type: int - **kwargs # type: Any + def upload_range_from_url(self, source_url, + range_start, + range_end, + source_range_start, + **kwargs ): # type: (str, int, int, int, **Any) -> Dict[str, Any] ''' @@ -987,12 +987,12 @@ def upload_range_from_url(self, source_url, # type: str process_storage_error(error) @distributed_trace - def get_ranges( # type: ignore - self, start_range=None, # type: Optional[int] - end_range=None, # type: Optional[int] - **kwargs + def get_ranges( # type: ignore + self, start_range=None, # type: Optional[int] + end_range=None, # type: Optional[int] + **kwargs # type: Any ): - # type: (...) -> List[dict[str, int]] + # type: (...) -> List[Dict[str, int]] """Returns the list of valid ranges of a file. :param int start_range: @@ -1074,7 +1074,7 @@ def clear_range( # type: ignore process_storage_error(error) @distributed_trace - def resize_file(self, size, **kwargs): # type: ignore + def resize_file(self, size, **kwargs): # type: (int, Any) -> Dict[str, Any] """Resizes a file to the specified size. @@ -1101,7 +1101,7 @@ def resize_file(self, size, **kwargs): # type: ignore @distributed_trace def list_handles(self, **kwargs): - # type: (int, Any) -> ItemPaged[Handle] + # type: (Any) -> ItemPaged[Handle] """Lists handles for file. :keyword int timeout: diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py b/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py index d8a71da3c4dc..b825be414963 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_share_client.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- from typing import ( # pylint: disable=unused-import - Optional, Union, Dict, Any, TYPE_CHECKING + Optional, Union, Dict, Any, Iterable, TYPE_CHECKING ) try: from urllib.parse import urlparse, quote, unquote @@ -34,6 +34,7 @@ from ._shared_access_signature import FileSharedAccessSignature if TYPE_CHECKING: + from datetime import datetime from ._models import ShareProperties, AccessPolicy, ShareSasPermissions @@ -318,7 +319,7 @@ def get_file_client(self, file_path): _pipeline=self._pipeline, _location_mode=self._location_mode) @distributed_trace - def create_share(self, **kwargs): # type: ignore + def create_share(self, **kwargs): # type: (Any) -> Dict[str, Any] """Creates a new Share under the account. If a share with the same name already exists, the operation fails. @@ -477,7 +478,7 @@ def get_share_properties(self, **kwargs): return props # type: ignore @distributed_trace - def set_share_quota(self, quota, **kwargs): # type: ignore + def set_share_quota(self, quota, **kwargs): # type: (int, Any) -> Dict[str, Any] """Sets the quota for the share. @@ -509,7 +510,7 @@ def set_share_quota(self, quota, **kwargs): # type: ignore process_storage_error(error) @distributed_trace - def set_share_metadata(self, metadata, **kwargs): # type: ignore + def set_share_metadata(self, metadata, **kwargs): # type: (Dict[str, Any], Any) -> Dict[str, Any] """Sets the metadata for the share. @@ -571,7 +572,7 @@ def get_share_access_policy(self, **kwargs): } @distributed_trace - def set_share_access_policy(self, signed_identifiers, **kwargs): # type: ignore + def set_share_access_policy(self, signed_identifiers, **kwargs): # type: (Dict[str, AccessPolicy], Any) -> Dict[str, str] """Sets the permissions for the share, or stored access policies that may be used with Shared Access Signatures. The permissions @@ -609,7 +610,7 @@ def set_share_access_policy(self, signed_identifiers, **kwargs): # type: ignore process_storage_error(error) @distributed_trace - def get_share_stats(self, **kwargs): # type: ignore + def get_share_stats(self, **kwargs): # type: (Any) -> int """Gets the approximate size of the data stored on the share in bytes. @@ -631,13 +632,13 @@ def get_share_stats(self, **kwargs): # type: ignore process_storage_error(error) @distributed_trace - def list_directories_and_files( # type: ignore + def list_directories_and_files( self, directory_name=None, # type: Optional[str] name_starts_with=None, # type: Optional[str] marker=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable[dict[str,str]] + # type: (...) -> Iterable[Dict[str,str]] """Lists the directories and files under the share. :param str directory_name: 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 f784ac130cf9..665cf862a646 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 @@ -28,7 +28,7 @@ from azure.core import Configuration from azure.core.exceptions import HttpResponseError from azure.core.pipeline import Pipeline -from azure.core.pipeline.transport import RequestsTransport +from azure.core.pipeline.transport import RequestsTransport, HttpRequest # pylint: disable=unused-import from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy from azure.core.pipeline.policies import RedirectPolicy, ContentDecodePolicy, BearerTokenCredentialPolicy, ProxyPolicy diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py index bdcaba15d86f..d1bdbc7bd1b3 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py @@ -34,6 +34,7 @@ if TYPE_CHECKING: from azure.core.pipeline import Pipeline + from azure.core.pipeline.transport import HttpRequest from azure.core import Configuration _LOGGER = logging.getLogger(__name__) diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py index e7daf353737e..5625fdbf8964 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_directory_client_async.py @@ -31,6 +31,7 @@ from ._models import DirectoryPropertiesPaged, HandlesPaged if TYPE_CHECKING: + from datetime import datetime from .._models import ShareProperties, DirectoryProperties, ContentSettings, NTFSAttributes from .._generated.models import HandleItem @@ -144,7 +145,7 @@ def get_subdirectory_client(self, directory_name, **kwargs): _pipeline=self._pipeline, _location_mode=self._location_mode, loop=self._loop, **kwargs) @distributed_trace_async - async def create_directory(self, **kwargs): # type: ignore + async def create_directory(self, **kwargs): # type: (Any) -> Dict[str, Any] """Creates a new directory under the directory referenced by the client. @@ -330,7 +331,7 @@ async def get_directory_properties(self, **kwargs): return response # type: ignore @distributed_trace_async - async def set_directory_metadata(self, metadata, **kwargs): # type: ignore + async def set_directory_metadata(self, metadata, **kwargs): # type: (Dict[str, Any], Any) -> Dict[str, Any] """Sets the metadata for the directory. @@ -364,7 +365,8 @@ async def set_http_headers(self, file_attributes="none", # type: Union[str, NTF file_last_write_time="preserve", # type: Union[str, datetime] file_permission=None, # type: Optional[str] permission_key=None, # type: Optional[str] - **kwargs): # type: ignore + **kwargs # type: Any + ): # type: (...) -> Dict[str, Any] """Sets HTTP headers on the directory. 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 eceff5dc25fa..4db9acbcadea 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 @@ -400,7 +400,7 @@ async def start_copy_from_url( @distributed_trace_async async def abort_copy(self, copy_id, **kwargs): - # type: (Union[str, FileProperties], Any) -> Dict[str, Any] + # type: (Union[str, FileProperties], Any) -> None """Abort an ongoing copy operation. This will leave a destination file with zero length and full metadata. @@ -542,9 +542,9 @@ async def set_http_headers(self, content_settings, # type: ContentSettings file_last_write_time="preserve", # type: Union[str, datetime] file_permission=None, # type: Optional[str] permission_key=None, # type: Optional[str] - **kwargs # Any - ): # type: ignore - # type: (ContentSettings, Optional[int], Optional[Any]) -> Dict[str, Any] + **kwargs # type: Any + ): + # type: (...) -> Dict[str, Any] """Sets HTTP headers on the file. :param ~azure.storage.file.ContentSettings content_settings: @@ -692,11 +692,11 @@ async def upload_range( # type: ignore process_storage_error(error) @distributed_trace_async - async def upload_range_from_url(self, source_url, # type: str - range_start, # type: int - range_end, # type: int - source_range_start, # type: int - **kwargs # type: Any + async def upload_range_from_url(self, source_url, + range_start, + range_end, + source_range_start, + **kwargs ): # type: (str, int, int, int, **Any) -> Dict[str, Any] ''' @@ -749,7 +749,7 @@ async def get_ranges( # type: ignore end_range=None, # type: Optional[int] **kwargs ): - # type: (...) -> List[dict[str, int]] + # type: (...) -> List[Dict[str, int]] """Returns the list of valid ranges of a file. :param int start_range: @@ -831,7 +831,7 @@ async def clear_range( # type: ignore process_storage_error(error) @distributed_trace_async - async def resize_file(self, size, **kwargs): # type: ignore + async def resize_file(self, size, **kwargs): # type: (int, Any) -> Dict[str, Any] """Resizes a file to the specified size. diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/_share_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/_share_client_async.py index 61eab97bb5ca..54153a7abfa2 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/_share_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/_share_client_async.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- from typing import ( # pylint: disable=unused-import - Optional, Union, Dict, Any, TYPE_CHECKING + Optional, Union, Dict, Any, Iterable, TYPE_CHECKING ) from azure.core.tracing.decorator import distributed_trace @@ -282,7 +282,7 @@ async def get_share_properties(self, **kwargs): return props # type: ignore @distributed_trace_async - async def set_share_quota(self, quota, **kwargs): # type: ignore + async def set_share_quota(self, quota, **kwargs): # type: (int, Any) -> Dict[str, Any] """Sets the quota for the share. @@ -314,7 +314,7 @@ async def set_share_quota(self, quota, **kwargs): # type: ignore process_storage_error(error) @distributed_trace_async - async def set_share_metadata(self, metadata, **kwargs): # type: ignore + async def set_share_metadata(self, metadata, **kwargs): # type: (Dict[str, Any], Any) -> Dict[str, Any] """Sets the metadata for the share. @@ -376,7 +376,7 @@ async def get_share_access_policy(self, **kwargs): } @distributed_trace_async - async def set_share_access_policy(self, signed_identifiers, **kwargs): # type: ignore + async def set_share_access_policy(self, signed_identifiers, **kwargs): # type: (Dict[str, AccessPolicy], Any) -> Dict[str, str] """Sets the permissions for the share, or stored access policies that may be used with Shared Access Signatures. The permissions @@ -415,7 +415,7 @@ async def set_share_access_policy(self, signed_identifiers, **kwargs): # type: i process_storage_error(error) @distributed_trace_async - async def get_share_stats(self, **kwargs): # type: ignore + async def get_share_stats(self, **kwargs): # type: (Any) -> int """Gets the approximate size of the data stored on the share in bytes. @@ -443,7 +443,7 @@ def list_directories_and_files( # type: ignore marker=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> Iterable[dict[str,str]] + # type: (...) -> Iterable[Dict[str,str]] """Lists the directories and files under the share. :param str directory_name: From ca89e707791cc0d646dcd717451d3dcd7f3d5b33 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 16:04:04 -0700 Subject: [PATCH 08/14] some queue mypy fixes --- .../azure/storage/queue/_queue_client.py | 12 ++++---- .../storage/queue/_shared/base_client.py | 2 +- .../queue/_shared/base_client_async.py | 1 + .../storage/queue/aio/_queue_client_async.py | 30 +++++++++---------- 4 files changed, 23 insertions(+), 22 deletions(-) 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 714d7fdb22ec..60b867c858a2 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 @@ -117,7 +117,7 @@ def __init__( @classmethod def from_queue_url(cls, queue_url, credential=None, **kwargs): - # type: (str, Optional[Any], Any) -> None + # type: (str, Optional[Any], Any) -> QueueClient """A client to interact with a specific Queue. :param str queue_url: The full URI to the queue, including SAS token if used. @@ -558,8 +558,8 @@ def send_message( # type: ignore process_storage_error(error) @distributed_trace - def receive_messages(self, **kwargs): # type: ignore - # type: (Optional[Any]) -> ItemPaged[Message] + def receive_messages(self, **kwargs): + # type: (Optional[Any]) -> ItemPaged[QueueMessage] """Removes one or more messages from the front of the queue. When a message is retrieved from the queue, the response includes the message @@ -587,7 +587,7 @@ def receive_messages(self, **kwargs): # type: ignore The server timeout, expressed in seconds. :return: Returns a message iterator of dict-like Message objects. - :rtype: ~azure.core.paging.ItemPaged[~azure.storage.queue.Message] + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.queue.QueueMessage] .. admonition:: Example: @@ -618,7 +618,7 @@ def receive_messages(self, **kwargs): # type: ignore process_storage_error(error) @distributed_trace - def update_message(self, message, pop_receipt=None, content=None, **kwargs): # type: ignore + def update_message(self, message, pop_receipt=None, content=None, **kwargs): # type: (Any, Optional[str], Optional[Any], Any) -> QueueMessage """Updates the visibility timeout of a message. You can also use this operation to update the contents of a message. @@ -714,7 +714,7 @@ def update_message(self, message, pop_receipt=None, content=None, **kwargs): # t process_storage_error(error) @distributed_trace - def peek_messages(self, max_messages=None, **kwargs): # type: ignore + def peek_messages(self, max_messages=None, **kwargs): # type: (Optional[int], Optional[Any]) -> List[QueueMessage] """Retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. 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 f784ac130cf9..665cf862a646 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 @@ -28,7 +28,7 @@ from azure.core import Configuration from azure.core.exceptions import HttpResponseError from azure.core.pipeline import Pipeline -from azure.core.pipeline.transport import RequestsTransport +from azure.core.pipeline.transport import RequestsTransport, HttpRequest # pylint: disable=unused-import from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy from azure.core.pipeline.policies import RedirectPolicy, ContentDecodePolicy, BearerTokenCredentialPolicy, ProxyPolicy diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py index bdcaba15d86f..d1bdbc7bd1b3 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py @@ -34,6 +34,7 @@ if TYPE_CHECKING: from azure.core.pipeline import Pipeline + from azure.core.pipeline.transport import HttpRequest from azure.core import Configuration _LOGGER = logging.getLogger(__name__) 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 d4fba1238413..906a0513c1be 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 @@ -118,7 +118,7 @@ def __init__( self._loop = loop @distributed_trace_async - async def create_queue(self, **kwargs): # type: ignore + async def create_queue(self, **kwargs): # type: (Optional[Any]) -> None """Creates a new queue in the storage account. @@ -157,7 +157,7 @@ async def create_queue(self, **kwargs): # type: ignore process_storage_error(error) @distributed_trace_async - async def delete_queue(self, **kwargs): # type: ignore + async def delete_queue(self, **kwargs): # type: (Optional[Any]) -> None """Deletes the specified queue and any messages it contains. @@ -189,7 +189,7 @@ async def delete_queue(self, **kwargs): # type: ignore process_storage_error(error) @distributed_trace_async - async def get_queue_properties(self, **kwargs): # type: ignore + async def get_queue_properties(self, **kwargs): # type: (Optional[Any]) -> QueueProperties """Returns all user-defined metadata for the specified queue. @@ -220,7 +220,7 @@ async def get_queue_properties(self, **kwargs): # type: ignore return response # type: ignore @distributed_trace_async - async def set_queue_metadata(self, metadata=None, **kwargs): # type: ignore + async def set_queue_metadata(self, metadata=None, **kwargs): # type: (Optional[Dict[str, Any]], Optional[Any]) -> None """Sets user-defined metadata on the specified queue. @@ -253,7 +253,7 @@ async def set_queue_metadata(self, metadata=None, **kwargs): # type: ignore process_storage_error(error) @distributed_trace_async - async def get_queue_access_policy(self, **kwargs): # type: ignore + async def get_queue_access_policy(self, **kwargs): # type: (Optional[Any]) -> Dict[str, Any] """Returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. @@ -273,8 +273,8 @@ async def get_queue_access_policy(self, **kwargs): # type: ignore return {s.id: s.access_policy or AccessPolicy() for s in identifiers} @distributed_trace_async - async def set_queue_access_policy(self, signed_identifiers, **kwargs): # type: ignore - # type: (Dict[str, AccessPolicy], Optional[int], Optional[Any]) -> None + async def set_queue_access_policy(self, signed_identifiers, **kwargs): + # type: (Dict[str, AccessPolicy], Optional[Any]) -> None """Sets stored access policies for the queue that may be used with Shared Access Signatures. @@ -406,8 +406,8 @@ async def send_message( # type: ignore process_storage_error(error) @distributed_trace - def receive_messages(self, **kwargs): # type: ignore - # type: (Optional[Any]) -> AsyncItemPaged[Message] + def receive_messages(self, **kwargs): + # type: (Optional[Any]) -> AsyncItemPaged[QueueMessage] """Removes one or more messages from the front of the queue. When a message is retrieved from the queue, the response includes the message @@ -435,7 +435,7 @@ def receive_messages(self, **kwargs): # type: ignore The server timeout, expressed in seconds. :return: Returns a message iterator of dict-like Message objects. - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.queue.Message] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.queue.QueueMessage] .. admonition:: Example: @@ -470,11 +470,11 @@ def receive_messages(self, **kwargs): # type: ignore async def update_message( self, message, - pop_receipt=None, # type: ignore + pop_receipt=None, content=None, **kwargs ): - # type: (Any, int, Optional[str], Optional[Any], Optional[int], Any) -> QueueMessage + # type: (Any, int, Optional[str], Optional[Any], Any) -> QueueMessage """Updates the visibility timeout of a message. You can also use this operation to update the contents of a message. @@ -569,7 +569,7 @@ async def update_message( process_storage_error(error) @distributed_trace_async - async def peek_messages(self, max_messages=None, **kwargs): # type: ignore + async def peek_messages(self, max_messages=None, **kwargs): # type: (Optional[int], Optional[Any]) -> List[QueueMessage] """Retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. @@ -626,7 +626,7 @@ async def peek_messages(self, max_messages=None, **kwargs): # type: ignore process_storage_error(error) @distributed_trace_async - async def clear_messages(self, **kwargs): # type: ignore + async def clear_messages(self, **kwargs): # type: (Optional[Any]) -> None """Deletes all messages from the specified queue. @@ -649,7 +649,7 @@ async def clear_messages(self, **kwargs): # type: ignore process_storage_error(error) @distributed_trace_async - async def delete_message(self, message, pop_receipt=None, **kwargs): # type: ignore + async def delete_message(self, message, pop_receipt=None, **kwargs): # type: (Any, Optional[str], Any) -> None """Deletes the specified message. From 288bdb7e2658e60579817ffc6ffd1f2e3ae2c449 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 17:35:16 -0700 Subject: [PATCH 09/14] some blob mypy fixes --- .../azure/storage/blob/__init__.py | 4 ++-- .../azure/storage/blob/_blob_client.py | 20 ++++++++++--------- .../storage/blob/_blob_service_client.py | 8 ++++---- .../azure/storage/blob/_container_client.py | 3 ++- .../azure/storage/blob/_deserialize.py | 10 +++++++++- .../azure/storage/blob/_lease.py | 2 +- .../azure/storage/blob/_shared/base_client.py | 2 +- .../storage/blob/aio/_blob_client_async.py | 12 +++++------ .../blob/aio/_blob_service_client_async.py | 12 +++++------ .../blob/aio/_container_client_async.py | 6 +++--- 10 files changed, 45 insertions(+), 34 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py index 099f8d73c8df..d38827c2467a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/__init__.py @@ -6,7 +6,7 @@ import os -from typing import Union, Iterable, AnyStr, IO, Any # pylint: disable=unused-import +from typing import Union, Iterable, AnyStr, IO, Any, Dict # pylint: disable=unused-import from ._version import VERSION from ._blob_client import BlobClient from ._container_client import ContainerClient @@ -100,7 +100,7 @@ def upload_blob_to_url( encoding='UTF-8', # type: str credential=None, # type: Any **kwargs): - # type: (...) -> dict[str, Any] + # type: (...) -> Dict[str, Any] """Upload data to a given URL The data will be uploaded as a block blob. 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 06886cb0af30..6b170dac119e 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 @@ -592,7 +592,7 @@ def upload_blob( # pylint: disable=too-many-locals return upload_append_blob(**options) def _download_blob_options(self, offset=None, length=None, **kwargs): - # type: (Optional[int], Optional[int], bool, **Any) -> Dict[str, Any] + # type: (Optional[int], Optional[int], **Any) -> Dict[str, Any] if self.require_encryption and not self.key_encryption_key: raise ValueError("Encryption required but no key was provided.") if length is not None and offset is None: @@ -636,7 +636,7 @@ def _download_blob_options(self, offset=None, length=None, **kwargs): @distributed_trace def download_blob(self, offset=None, length=None, **kwargs): - # type: (Optional[int], Optional[int], bool, **Any) -> Iterable[bytes] + # type: (Optional[int], Optional[int], **Any) -> Iterable[bytes] """Downloads a blob to a stream with automatic chunking. :param int offset: @@ -1901,7 +1901,7 @@ def stage_block_from_url( process_storage_error(error) def _get_block_list_result(self, blocks): - # type: (BlockList) -> Tuple(List[BlobBlock], List[BlobBlock]) + # type: (BlockList) -> Tuple[List[BlobBlock], List[BlobBlock]] committed = [] # type: List uncommitted = [] # type: List if blocks.committed_blocks: @@ -2080,7 +2080,7 @@ def commit_block_list( # type: ignore @distributed_trace def set_premium_page_blob_tier(self, premium_page_blob_tier, **kwargs): - # type: (Union[str, PremiumPageBlobTier], Optional[int], Optional[Union[LeaseClient, str]], **Any) -> None + # type: (Union[str, PremiumPageBlobTier], **Any) -> None """Sets the page blob tiers on the blob. This API is only supported for page blobs on premium accounts. :param premium_page_blob_tier: @@ -2123,6 +2123,8 @@ def _get_page_ranges_options( # type: ignore if_unmodified_since=kwargs.pop('if_unmodified_since', None), if_match=kwargs.pop('if_match', None), if_none_match=kwargs.pop('if_none_match', None)) + if length is not None and offset is None: + raise ValueError("Offset value must not be None if length is set.") if length is not None: length = offset + length - 1 # Reformat to an inclusive range index page_range, _ = validate_and_format_range_headers( @@ -2152,7 +2154,7 @@ def get_page_ranges( # type: ignore previous_snapshot_diff=None, # type: Optional[Union[str, Dict[str, Any]]] **kwargs ): - # type: (...) -> Tuple(List[Dict[str, int]], List[Dict[str, int]]) + # type: (...) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]] """Returns the list of valid page ranges for a Page Blob or snapshot of a page blob. @@ -2920,8 +2922,8 @@ def append_block( # type: ignore def _append_block_from_url_options( # type: ignore self, copy_source_url, # type: str - source_offset=None, # type Optional[int] - source_length=None, # type Optional[int] + source_offset=None, # type: Optional[int] + source_length=None, # type: Optional[int] **kwargs ): # type: (...) -> Dict[str, Any] @@ -2986,8 +2988,8 @@ def _append_block_from_url_options( # type: ignore @distributed_trace def append_block_from_url(self, copy_source_url, # type: str - source_offset=None, # type Optional[int] - source_length=None, # type Optional[int] + source_offset=None, # type: Optional[int] + source_length=None, # type: Optional[int] **kwargs): # type: (...) -> Dict[str, Union[str, datetime, int]] """ 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 8c8f1c4dd6f3..6f44f64a7cf6 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 @@ -235,7 +235,7 @@ def get_user_delegation_key(self, key_start_time, # type: datetime key_expiry_time, # type: datetime **kwargs # type: Any ): - # type: (datetime, datetime, Optional[int]) -> UserDelegationKey + # type: (...) -> UserDelegationKey """ Obtain a user delegation key for the purpose of signing SAS tokens. A token credential must be present on the service object for this request to succeed. @@ -261,8 +261,8 @@ def get_user_delegation_key(self, key_start_time, # type: datetime return parse_to_internal_user_delegation_key(user_delegation_key) # type: ignore @distributed_trace - def get_account_information(self, **kwargs): # type: ignore - # type: (Optional[int]) -> Dict[str, str] + def get_account_information(self, **kwargs): + # type: (Any) -> Dict[str, str] """Gets information related to the storage account. The information can also be retrieved if the user has a SAS to a container or blob. @@ -286,7 +286,7 @@ def get_account_information(self, **kwargs): # type: ignore process_storage_error(error) @distributed_trace - def get_service_stats(self, **kwargs): # type: ignore + def get_service_stats(self, **kwargs): # type: (**Any) -> Dict[str, Any] """Retrieves statistics related to replication for the Blob service. 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 4784e9ea043d..6e1c6b10cb54 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 @@ -53,6 +53,7 @@ from ._models import ( # pylint: disable=unused-import AccessPolicy, ContentSettings, + StandardBlobTier, PremiumPageBlobTier) @@ -489,7 +490,7 @@ def acquire_lease( return lease @distributed_trace - def get_account_information(self, **kwargs): # type: ignore + def get_account_information(self, **kwargs): # type: (**Any) -> Dict[str, str] """Gets information related to the storage account. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py index fc93ef96e217..4f3e468da42d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py @@ -5,9 +5,17 @@ # -------------------------------------------------------------------------- # pylint: disable=no-self-use +from typing import ( # pylint: disable=unused-import + Tuple, Dict, List, + TYPE_CHECKING +) + from ._shared.response_handlers import deserialize_metadata from ._models import BlobProperties, ContainerProperties +if TYPE_CHECKING: + from azure.storage.blob._generated.models import PageList + def deserialize_blob_properties(response, obj, headers): metadata = deserialize_metadata(response, obj, headers) @@ -39,7 +47,7 @@ def deserialize_container_properties(response, obj, headers): def get_page_ranges_result(ranges): - # type: (PageList) -> Tuple(List[Dict[str, int]], List[Dict[str, int]]) + # type: (PageList) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]] page_range = [] # type: ignore clear_range = [] # type: List if ranges.page_range: diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py index 0ed9d8aa05f0..e1af4b84fe38 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_lease.py @@ -80,7 +80,7 @@ def __exit__(self, *args): @distributed_trace def acquire(self, lease_duration=-1, **kwargs): - # type: (int, Optional[int], **Any) -> None + # type: (int, **Any) -> None """Requests a new lease. If the container does not have an active lease, the Blob service creates a 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 91205c8f3fdb..1722c2efdbb4 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 @@ -28,7 +28,7 @@ from azure.core import Configuration from azure.core.exceptions import HttpResponseError from azure.core.pipeline import Pipeline -from azure.core.pipeline.transport import RequestsTransport +from azure.core.pipeline.transport import RequestsTransport, HttpRequest # pylint: disable=unused-import from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy from azure.core.pipeline.policies import RedirectPolicy, ContentDecodePolicy, BearerTokenCredentialPolicy, ProxyPolicy diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py index 72d4defcf898..afbfbf743dde 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py @@ -968,7 +968,7 @@ async def abort_copy(self, copy_id, **kwargs): @distributed_trace_async async def acquire_lease(self, lease_duration=-1, lease_id=None, **kwargs): - # type: (int, Optional[str], Optional[int], Any) -> LeaseClient + # type: (int, Optional[str], Any) -> LeaseClient """Requests a new lease. If the blob does not have an active lease, the Blob @@ -1266,7 +1266,7 @@ async def commit_block_list( # type: ignore @distributed_trace_async async def set_premium_page_blob_tier(self, premium_page_blob_tier, **kwargs): - # type: (Union[str, PremiumPageBlobTier], Optional[int], Optional[Union[LeaseClient, str]], **Any) -> None + # type: (Union[str, PremiumPageBlobTier], **Any) -> None """Sets the page blob tiers on the blob. This API is only supported for page blobs on premium accounts. :param premium_page_blob_tier: @@ -1303,7 +1303,7 @@ async def get_page_ranges( # type: ignore previous_snapshot_diff=None, # type: Optional[Union[str, Dict[str, Any]]] **kwargs ): - # type: (...) -> List[dict[str, int]] + # type: (...) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]] """Returns the list of valid page ranges for a Page Blob or snapshot of a page blob. @@ -1661,7 +1661,7 @@ async def upload_pages_from_url(self, source_url, # type: str @distributed_trace_async async def clear_page(self, offset, length, **kwargs): - # type: (int, int) -> Dict[str, Union[str, datetime]] + # type: (int, int, Any) -> Dict[str, Union[str, datetime]] """Clears a range of pages. :param int offset: @@ -1804,8 +1804,8 @@ async def append_block( # type: ignore @distributed_trace_async() async def append_block_from_url(self, copy_source_url, # type: str - source_offset=None, # type Optional[int] - source_length=None, # type Optional[int] + source_offset=None, # type: Optional[int] + source_length=None, # type: Optional[int] **kwargs): # type: (...) -> Dict[str, Union[str, datetime, int]] """ 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 449eeb9e8162..e9b7d671f1c5 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 @@ -32,7 +32,7 @@ from datetime import datetime from azure.core.pipeline.transport import HttpTransport from azure.core.pipeline.policies import HTTPPolicy - from .._shared.models import AccountSasPermissions, ResourceTypes + from .._shared.models import AccountSasPermissions, ResourceTypes, UserDelegationKey from ._lease_async import LeaseClient from .._models import ( BlobProperties, @@ -41,7 +41,7 @@ RetentionPolicy, StaticWebsite, CorsRule, - PublicAccess + PublicAccess, ) @@ -117,7 +117,7 @@ async def get_user_delegation_key(self, key_start_time, # type: datetime key_expiry_time, # type: datetime **kwargs # type: Any ): - # type: (datetime, datetime, Optional[int]) -> UserDelegationKey + # type: (...) -> UserDelegationKey """ Obtain a user delegation key for the purpose of signing SAS tokens. A token credential must be present on the service object for this request to succeed. @@ -143,8 +143,8 @@ async def get_user_delegation_key(self, key_start_time, # type: datetime return parse_to_internal_user_delegation_key(user_delegation_key) # type: ignore @distributed_trace_async - async def get_account_information(self, **kwargs): # type: ignore - # type: (Optional[int]) -> Dict[str, str] + async def get_account_information(self, **kwargs): + # type: (Any) -> Dict[str, str] """Gets information related to the storage account. The information can also be retrieved if the user has a SAS to a container or blob. @@ -168,7 +168,7 @@ async def get_account_information(self, **kwargs): # type: ignore process_storage_error(error) @distributed_trace_async - async def get_service_stats(self, **kwargs): # type: ignore + async def get_service_stats(self, **kwargs): # type: (Any) -> Dict[str, Any] """Retrieves statistics related to replication for the Blob service. 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 d124411af757..fa0a2d6c04e6 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 @@ -103,7 +103,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase): """ def __init__( self, account_url, # type: str - container_name=None, # type: str + container_name, # type: str credential=None, # type: Optional[Any] **kwargs # type: Any ): @@ -280,7 +280,7 @@ async def acquire_lease( return lease @distributed_trace_async - async def get_account_information(self, **kwargs): # type: ignore + async def get_account_information(self, **kwargs): # type: (**Any) -> Dict[str, str] """Gets information related to the storage account. @@ -920,7 +920,7 @@ async def set_standard_blob_tier_blobs( @distributed_trace async def set_premium_page_blob_tier_blobs( self, - premium_page_blob_tier: Union[str, 'PremiumPageBlobTier'], + premium_page_blob_tier: Union[str, PremiumPageBlobTier], *blobs: Union[str, BlobProperties], **kwargs ) -> AsyncIterator[AsyncHttpResponse]: From 4b52ff65824478dd1be4841e35db69397a575b17 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 16 Oct 2019 18:08:47 -0700 Subject: [PATCH 10/14] fix mistake in type annot --- .../azure/storage/blob/aio/_container_client_async.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fa0a2d6c04e6..8a8cbe2f9f20 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 @@ -920,7 +920,7 @@ async def set_standard_blob_tier_blobs( @distributed_trace async def set_premium_page_blob_tier_blobs( self, - premium_page_blob_tier: Union[str, PremiumPageBlobTier], + premium_page_blob_tier: Union[str, 'PremiumPageBlobTier'], *blobs: Union[str, BlobProperties], **kwargs ) -> AsyncIterator[AsyncHttpResponse]: From 6aeb8c096f4cc7a7707cf6dda6e0e755b46ed84f Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 17 Oct 2019 09:00:50 -0700 Subject: [PATCH 11/14] history edits --- sdk/storage/azure-storage-blob/HISTORY.md | 2 +- sdk/storage/azure-storage-file/HISTORY.md | 2 +- sdk/storage/azure-storage-queue/HISTORY.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/storage/azure-storage-blob/HISTORY.md b/sdk/storage/azure-storage-blob/HISTORY.md index aef4dd583a6a..9d6cf0879b45 100644 --- a/sdk/storage/azure-storage-blob/HISTORY.md +++ b/sdk/storage/azure-storage-blob/HISTORY.md @@ -9,7 +9,7 @@ - Removed types that were accidentally exposed from two modules. Only `BlobServiceClient`, `ContainerClient`, `BlobClient` and `LeaseClient` should be imported from azure.storage.blob.aio - `Logging` has been renamed to `BlobAnalyticsLogging`. -- Client and model files have been renamed to be internal. Users should import from the top level modules: +- Client and model files have been made internal. Users should import from the top level modules: `azure.storage.blob` and `azure.storage.blob.aio` only. **New features** diff --git a/sdk/storage/azure-storage-file/HISTORY.md b/sdk/storage/azure-storage-file/HISTORY.md index 34d28ba88a19..00b8cdce2118 100644 --- a/sdk/storage/azure-storage-file/HISTORY.md +++ b/sdk/storage/azure-storage-file/HISTORY.md @@ -21,7 +21,7 @@ To use a directory_url, the method `from_directory_url` must be used. - `max_concurrency` - `validate_content` - `timeout` etc. -- Client and model files have been renamed to be internal. Users should import from the top level modules: +- Client and model files have been made internal. Users should import from the top level modules: `azure.storage.file` and `azure.storage.file.aio` only. diff --git a/sdk/storage/azure-storage-queue/HISTORY.md b/sdk/storage/azure-storage-queue/HISTORY.md index 3cc4953b0681..956c252d12b2 100644 --- a/sdk/storage/azure-storage-queue/HISTORY.md +++ b/sdk/storage/azure-storage-queue/HISTORY.md @@ -20,7 +20,7 @@ should be imported from azure.storage.queue.aio to `inserted_on`, `next_visible_on`, `expires_on`, respectively. - `Logging` has been renamed to `QueueAnalyticsLogging`. - `enqueue_message` is now called `send_message`. -- Client and model files have been renamed to be internal. Users should import from the top level modules: +- Client and model files have been made internal. Users should import from the top level modules: `azure.storage.queue` and `azure.storage.queue.aio` only. **New features** From 748fbd68d918e644a1c99bad4b7654b2ea244614 Mon Sep 17 00:00:00 2001 From: antisch Date: Mon, 21 Oct 2019 10:59:30 -0700 Subject: [PATCH 12/14] Merge fix --- .../azure/storage/file/_shared/base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 93c3bec18b27..ff5b28b69c4a 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 @@ -25,7 +25,7 @@ import six -from azure.core.configuration import Configuration +from azure.core import Configuration from azure.core.exceptions import HttpResponseError from azure.core.pipeline import Pipeline from azure.core.pipeline.transport import RequestsTransport, HttpTransport # pylint: disable=unused-import From b1c79d733c52ea22181f9d81ced19634e53260fc Mon Sep 17 00:00:00 2001 From: antisch Date: Mon, 21 Oct 2019 11:33:12 -0700 Subject: [PATCH 13/14] Revert "Merge fix" This reverts commit 748fbd68d918e644a1c99bad4b7654b2ea244614. --- .../azure/storage/file/_shared/base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ff5b28b69c4a..93c3bec18b27 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 @@ -25,7 +25,7 @@ import six -from azure.core import Configuration +from azure.core.configuration import Configuration from azure.core.exceptions import HttpResponseError from azure.core.pipeline import Pipeline from azure.core.pipeline.transport import RequestsTransport, HttpTransport # pylint: disable=unused-import From f7081f665221ba80d488b9402c5d4950e44bb500 Mon Sep 17 00:00:00 2001 From: antisch Date: Mon, 21 Oct 2019 12:37:02 -0700 Subject: [PATCH 14/14] Better merge fix --- .../azure/storage/file/_shared/base_client_async.py | 2 +- .../azure/storage/queue/_shared/base_client_async.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py index 8b9187f25b87..872145e073bd 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/_shared/base_client_async.py @@ -37,7 +37,7 @@ if TYPE_CHECKING: from azure.core.pipeline import Pipeline from azure.core.pipeline.transport import HttpRequest - from azure.core import Configuration + from azure.core.configuration import Configuration _LOGGER = logging.getLogger(__name__) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py index 8b9187f25b87..872145e073bd 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py @@ -37,7 +37,7 @@ if TYPE_CHECKING: from azure.core.pipeline import Pipeline from azure.core.pipeline.transport import HttpRequest - from azure.core import Configuration + from azure.core.configuration import Configuration _LOGGER = logging.getLogger(__name__)