From 413ff16ef19ca924f06aeb88686d28c3059cf17c Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Thu, 3 Oct 2019 15:40:18 -0700 Subject: [PATCH 1/2] Fix batch docstrings --- .../blob/aio/container_client_async.py | 20 ++++++++++--------- .../azure/storage/blob/container_client.py | 15 ++++++++------ 2 files changed, 20 insertions(+), 15 deletions(-) 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 b4611d3a29d6..21a605184cdf 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 @@ -780,13 +780,12 @@ async def delete_blob( @distributed_trace_async async def delete_blobs( # pylint: disable=arguments-differ - self, *blobs, # type: Union[str, BlobProperties] - delete_snapshots=None, # type: Optional[str] - lease=None, # type: Optional[Union[str, LeaseClient]] - timeout=None, # type: Optional[int] + self, *blobs: Union[str, BlobProperties], + delete_snapshots: Optional[str]=None, + lease: Optional[Union[str, LeaseClient]]=None, + timeout: Optional[int]=None, **kwargs - ): - # type: (...) -> None + ) -> AsyncIterator[AsyncHttpResponse]: """Marks the specified blobs or snapshots for deletion. The blob is later deleted during garbage collection. @@ -838,7 +837,8 @@ async def delete_blobs( # pylint: disable=arguments-differ operation if it does exist. :param int timeout: The timeout parameter is expressed in seconds. - :rtype: None + :return: An async iterator of responses, one for each blob in order + :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse] """ options = BlobClient._generic_delete_blob_options( # pylint: disable=protected-access delete_snapshots=delete_snapshots, @@ -892,7 +892,8 @@ async def set_standard_blob_tier_blobs( Required if the blob has an active lease. Value can be a LeaseClient object or the lease ID as a string. :type lease: ~azure.storage.blob.lease.LeaseClient or str - :rtype: None + :return: An async iterator of responses, one for each blob in order + :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse] """ access_conditions = get_access_conditions(kwargs.pop('lease', None)) if standard_blob_tier is None: @@ -944,7 +945,8 @@ async def set_premium_page_blob_tier_blobs( Required if the blob has an active lease. Value can be a LeaseClient object or the lease ID as a string. :type lease: ~azure.storage.blob.lease.LeaseClient or str - :rtype: None + :return: An async iterator of responses, one for each blob in order + :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse] """ access_conditions = get_access_conditions(kwargs.pop('lease', None)) if premium_page_blob_tier is None: 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 a4f176c35685..5e8e7e285d6b 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 @@ -7,7 +7,7 @@ import functools from typing import ( # pylint: disable=unused-import - Union, Optional, Any, Iterable, AnyStr, Dict, List, Tuple, IO, + Union, Optional, Any, Iterable, AnyStr, Dict, List, Tuple, IO, Iterator, TYPE_CHECKING ) @@ -46,7 +46,7 @@ from ._shared_access_signature import BlobSharedAccessSignature if TYPE_CHECKING: - from azure.core.pipeline.transport import HttpTransport # pylint: disable=ungrouped-imports + 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 ContainerPermissions, PublicAccess from datetime import datetime @@ -1016,7 +1016,7 @@ def _generate_delete_blobs_options( @distributed_trace def delete_blobs(self, *blobs, **kwargs): - # type: (...) -> None + # type: (...) -> Iterator[HttpResponse] """Marks the specified blobs or snapshots for deletion. The blob is later deleted during garbage collection. @@ -1067,7 +1067,8 @@ def delete_blobs(self, *blobs, **kwargs): operation if it does exist. :param int timeout: The timeout parameter is expressed in seconds. - :rtype: None + :return: An iterator of responses, one for each blob in order + :rtype: iterator[~azure.core.pipeline.transport.HttpResponse] """ options = BlobClient._generic_delete_blob_options( # pylint: disable=protected-access **kwargs @@ -1152,7 +1153,8 @@ def set_standard_blob_tier_blobs( Required if the blob has an active lease. Value can be a LeaseClient object or the lease ID as a string. :type lease: ~azure.storage.blob.lease.LeaseClient or str - :rtype: None + :return: An iterator of responses, one for each blob in order + :rtype: iterator[~azure.core.pipeline.transport.HttpResponse] """ access_conditions = get_access_conditions(kwargs.pop('lease', None)) if standard_blob_tier is None: @@ -1205,7 +1207,8 @@ def set_premium_page_blob_tier_blobs( Required if the blob has an active lease. Value can be a LeaseClient object or the lease ID as a string. :type lease: ~azure.storage.blob.lease.LeaseClient or str - :rtype: None + :return: An iterator of responses, one for each blob in order + :rtype: iterator[~azure.core.pipeline.transport.HttpResponse] """ access_conditions = get_access_conditions(kwargs.pop('lease', None)) if premium_page_blob_tier is None: From abf9aa08bea7d5eaa43b8e9856578911beb0d7c1 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Thu, 3 Oct 2019 16:32:21 -0700 Subject: [PATCH 2/2] pylint --- .../azure/storage/blob/aio/container_client_async.py | 6 +++--- sdk/storage/azure-storage-blob/azure/storage/blob/models.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 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 21a605184cdf..e47f40e02931 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 @@ -781,9 +781,9 @@ async def delete_blob( @distributed_trace_async async def delete_blobs( # pylint: disable=arguments-differ self, *blobs: Union[str, BlobProperties], - delete_snapshots: Optional[str]=None, - lease: Optional[Union[str, LeaseClient]]=None, - timeout: Optional[int]=None, + delete_snapshots: Optional[str] = None, + lease: Optional[Union[str, LeaseClient]] = None, + timeout: Optional[int] = None, **kwargs ) -> AsyncIterator[AsyncHttpResponse]: """Marks the specified blobs or snapshots for deletion. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/models.py index 807441996650..fbc9909f0d60 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/models.py @@ -260,8 +260,8 @@ class ContainerProperties(DictMixin): :param dict metadata: A dict with name-value pairs to associate with the container as metadata. - Returned ``ContainerProperties`` instances expose these values through a - dictionary interface, for example: ``container_props["last_modified"]``. + Returned ``ContainerProperties`` instances expose these values through a + dictionary interface, for example: ``container_props["last_modified"]``. Additionally, the container name is available as ``container_props["name"]``. """