Skip to content

Commit fc4327f

Browse files
[Storage] Blobs Typing API View Feedback (#36654)
1 parent 782a4a4 commit fc4327f

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ def stage_block_from_url(
20432043
def get_block_list(
20442044
self, block_list_type: str = "committed",
20452045
**kwargs: Any
2046-
) -> Tuple[List[Optional[BlobBlock]], List[Optional[BlobBlock]]]:
2046+
) -> Tuple[List[BlobBlock], List[BlobBlock]]:
20472047
"""The Get Block List operation retrieves the list of blocks that have
20482048
been uploaded as part of a block blob.
20492049
@@ -2067,7 +2067,7 @@ def get_block_list(
20672067
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
20682068
#other-client--per-operation-configuration>`__.
20692069
:returns: A tuple of two lists - committed and uncommitted blocks
2070-
:rtype: Tuple[List[Optional[BlobBlock]], List[Optional[BlobBlock]]]
2070+
:rtype: Tuple[List[BlobBlock], List[BlobBlock]]
20712071
"""
20722072
access_conditions = get_access_conditions(kwargs.pop('lease', None))
20732073
mod_conditions = get_modify_conditions(kwargs)
@@ -2286,7 +2286,7 @@ def set_blob_tags(self, tags: Optional[Dict[str, str]] = None, **kwargs: Any) ->
22862286
process_storage_error(error)
22872287

22882288
@distributed_trace
2289-
def get_blob_tags(self, **kwargs: Any) -> Optional[Dict[str, str]]:
2289+
def get_blob_tags(self, **kwargs: Any) -> Dict[str, str]:
22902290
"""The Get Tags operation enables users to get tags on a blob or specific blob version, or snapshot.
22912291
22922292
.. versionadded:: 12.4.0
@@ -2309,13 +2309,13 @@ def get_blob_tags(self, **kwargs: Any) -> Optional[Dict[str, str]]:
23092309
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
23102310
#other-client--per-operation-configuration>`__.
23112311
:returns: Key value pairs of blob tags.
2312-
:rtype: Optional[Dict[str, str]]
2312+
:rtype: Dict[str, str]
23132313
"""
23142314
version_id = get_version_id(self.version_id, kwargs)
23152315
options = _get_blob_tags_options(version_id=version_id, snapshot=self.snapshot, **kwargs)
23162316
try:
23172317
_, tags = self._client.blob.get_tags(**options)
2318-
return parse_tags(tags)
2318+
return cast(Dict[str, str], parse_tags(tags))
23192319
except HttpResponseError as error:
23202320
process_storage_error(error)
23212321

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def _stage_block_from_url_options(
757757
options.update(kwargs)
758758
return options
759759

760-
def _get_block_list_result(blocks: BlockList) -> Tuple[List[Optional[BlobBlock]], List[Optional[BlobBlock]]]:
760+
def _get_block_list_result(blocks: BlockList) -> Tuple[List[BlobBlock], List[BlobBlock]]:
761761
committed = []
762762
uncommitted = []
763763
if blocks.committed_blocks:

sdk/storage/azure-storage-blob/azure/storage/blob/_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,13 +775,13 @@ class BlobBlock(DictMixin):
775775
"""Block id."""
776776
state: BlockState
777777
"""Block state."""
778-
size: Optional[int]
778+
size: int
779779
"""Block size."""
780780

781781
def __init__(self, block_id: str, state: BlockState = BlockState.LATEST) -> None:
782782
self.id = block_id
783783
self.state = state
784-
self.size = None
784+
self.size = None # type: ignore [assignment]
785785

786786
@classmethod
787787
def _from_generated(cls, generated):

sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ async def stage_block_from_url(
19421942
async def get_block_list(
19431943
self, block_list_type: str = "committed",
19441944
**kwargs: Any
1945-
) -> Tuple[List[Optional[BlobBlock]], List[Optional[BlobBlock]]]:
1945+
) -> Tuple[List[BlobBlock], List[BlobBlock]]:
19461946
"""The Get Block List operation retrieves the list of blocks that have
19471947
been uploaded as part of a block blob.
19481948
@@ -1967,7 +1967,7 @@ async def get_block_list(
19671967
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
19681968
#other-client--per-operation-configuration>`__.
19691969
:returns: A tuple of two lists - committed and uncommitted blocks
1970-
:rtype: tuple(list(~azure.storage.blob.BlobBlock), list(~azure.storage.blob.BlobBlock))
1970+
:rtype: Tuple[List[BlobBlock], List[BlobBlock]]
19711971
"""
19721972
access_conditions = get_access_conditions(kwargs.pop('lease', None))
19731973
mod_conditions = get_modify_conditions(kwargs)
@@ -2187,7 +2187,7 @@ async def set_blob_tags(self, tags: Optional[Dict[str, str]] = None, **kwargs: A
21872187
process_storage_error(error)
21882188

21892189
@distributed_trace_async
2190-
async def get_blob_tags(self, **kwargs: Any) -> Optional[Dict[str, str]]:
2190+
async def get_blob_tags(self, **kwargs: Any) -> Dict[str, str]:
21912191
"""The Get Tags operation enables users to get tags on a blob or specific blob version, but not snapshot.
21922192
21932193
.. versionadded:: 12.4.0
@@ -2216,7 +2216,7 @@ async def get_blob_tags(self, **kwargs: Any) -> Optional[Dict[str, str]]:
22162216
options = _get_blob_tags_options(version_id=version_id, snapshot=self.snapshot, **kwargs)
22172217
try:
22182218
_, tags = await self._client.blob.get_tags(**options)
2219-
return parse_tags(tags) # pylint: disable=protected-access
2219+
return cast(Dict[str, str], parse_tags(tags)) # pylint: disable=protected-access
22202220
except HttpResponseError as error:
22212221
process_storage_error(error)
22222222

0 commit comments

Comments
 (0)