azure-storage-blob 12.25.1__py3-none-any.whl → 12.27.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. azure/storage/blob/__init__.py +3 -2
  2. azure/storage/blob/_blob_client.py +94 -41
  3. azure/storage/blob/_blob_client_helpers.py +19 -4
  4. azure/storage/blob/_blob_service_client.py +16 -13
  5. azure/storage/blob/_container_client.py +25 -22
  6. azure/storage/blob/_deserialize.py +1 -1
  7. azure/storage/blob/_download.py +7 -7
  8. azure/storage/blob/_encryption.py +177 -184
  9. azure/storage/blob/_generated/_azure_blob_storage.py +3 -2
  10. azure/storage/blob/_generated/_configuration.py +2 -2
  11. azure/storage/blob/_generated/_utils/__init__.py +6 -0
  12. azure/storage/blob/_generated/{_serialization.py → _utils/serialization.py} +7 -25
  13. azure/storage/blob/_generated/aio/_azure_blob_storage.py +3 -2
  14. azure/storage/blob/_generated/aio/_configuration.py +2 -2
  15. azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +11 -14
  16. azure/storage/blob/_generated/aio/operations/_blob_operations.py +40 -64
  17. azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +18 -20
  18. azure/storage/blob/_generated/aio/operations/_container_operations.py +21 -43
  19. azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +18 -27
  20. azure/storage/blob/_generated/aio/operations/_service_operations.py +11 -22
  21. azure/storage/blob/_generated/models/__init__.py +2 -0
  22. azure/storage/blob/_generated/models/_azure_blob_storage_enums.py +6 -0
  23. azure/storage/blob/_generated/models/_models_py3.py +30 -9
  24. azure/storage/blob/_generated/operations/_append_blob_operations.py +19 -20
  25. azure/storage/blob/_generated/operations/_blob_operations.py +68 -89
  26. azure/storage/blob/_generated/operations/_block_blob_operations.py +31 -27
  27. azure/storage/blob/_generated/operations/_container_operations.py +40 -62
  28. azure/storage/blob/_generated/operations/_page_blob_operations.py +31 -37
  29. azure/storage/blob/_generated/operations/_service_operations.py +20 -32
  30. azure/storage/blob/_lease.py +1 -0
  31. azure/storage/blob/_list_blobs_helper.py +1 -1
  32. azure/storage/blob/_quick_query_helper.py +20 -24
  33. azure/storage/blob/_serialize.py +2 -0
  34. azure/storage/blob/_shared/__init__.py +7 -7
  35. azure/storage/blob/_shared/authentication.py +49 -32
  36. azure/storage/blob/_shared/avro/avro_io.py +44 -42
  37. azure/storage/blob/_shared/avro/avro_io_async.py +42 -41
  38. azure/storage/blob/_shared/avro/datafile.py +24 -21
  39. azure/storage/blob/_shared/avro/datafile_async.py +15 -15
  40. azure/storage/blob/_shared/avro/schema.py +196 -217
  41. azure/storage/blob/_shared/base_client.py +82 -59
  42. azure/storage/blob/_shared/base_client_async.py +58 -51
  43. azure/storage/blob/_shared/constants.py +1 -1
  44. azure/storage/blob/_shared/models.py +94 -92
  45. azure/storage/blob/_shared/parser.py +3 -3
  46. azure/storage/blob/_shared/policies.py +186 -147
  47. azure/storage/blob/_shared/policies_async.py +53 -65
  48. azure/storage/blob/_shared/request_handlers.py +50 -45
  49. azure/storage/blob/_shared/response_handlers.py +54 -45
  50. azure/storage/blob/_shared/shared_access_signature.py +67 -71
  51. azure/storage/blob/_shared/uploads.py +56 -49
  52. azure/storage/blob/_shared/uploads_async.py +70 -58
  53. azure/storage/blob/_shared_access_signature.py +3 -1
  54. azure/storage/blob/_version.py +1 -1
  55. azure/storage/blob/aio/__init__.py +3 -2
  56. azure/storage/blob/aio/_blob_client_async.py +241 -44
  57. azure/storage/blob/aio/_blob_service_client_async.py +13 -11
  58. azure/storage/blob/aio/_container_client_async.py +28 -25
  59. azure/storage/blob/aio/_download_async.py +7 -7
  60. azure/storage/blob/aio/_lease_async.py +1 -0
  61. azure/storage/blob/aio/_quick_query_helper_async.py +194 -0
  62. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/METADATA +4 -5
  63. azure_storage_blob-12.27.0b1.dist-info/RECORD +86 -0
  64. azure_storage_blob-12.25.1.dist-info/RECORD +0 -84
  65. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/LICENSE +0 -0
  66. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/WHEEL +0 -0
  67. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/top_level.txt +0 -0
@@ -145,7 +145,7 @@ class BlobServiceClient( # type: ignore [misc]
145
145
 
146
146
  :param str hostname:
147
147
  The hostname of the current location mode.
148
- :returns: A formatted endpoint URL including current location mode hostname.
148
+ :return: A formatted endpoint URL including current location mode hostname.
149
149
  :rtype: str
150
150
  """
151
151
  return f"{self.scheme}://{hostname}/{self._query_str}"
@@ -177,7 +177,7 @@ class BlobServiceClient( # type: ignore [misc]
177
177
  :keyword str audience: The audience to use when requesting tokens for Azure Active Directory
178
178
  authentication. Only has an effect when credential is of type TokenCredential. The value could be
179
179
  https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
180
- :returns: A Blob service client.
180
+ :return: A Blob service client.
181
181
  :rtype: ~azure.storage.blob.BlobServiceClient
182
182
 
183
183
  .. admonition:: Example:
@@ -235,7 +235,7 @@ class BlobServiceClient( # type: ignore [misc]
235
235
  The information can also be retrieved if the user has a SAS to a container or blob.
236
236
  The keys in the returned dictionary include 'sku_name' and 'account_kind'.
237
237
 
238
- :returns: A dict of account information (SKU and account type).
238
+ :return: A dict of account information (SKU and account type).
239
239
  :rtype: dict(str, str)
240
240
 
241
241
  .. admonition:: Example:
@@ -309,7 +309,7 @@ class BlobServiceClient( # type: ignore [misc]
309
309
  This value is not tracked or validated on the client. To configure client-side network timesouts
310
310
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
311
311
  #other-client--per-operation-configuration>`__.
312
- :returns: An object containing blob service properties such as
312
+ :return: An object containing blob service properties such as
313
313
  analytics logging, hour/minute metrics, cors rules, etc.
314
314
  :rtype: Dict[str, Any]
315
315
 
@@ -379,6 +379,7 @@ class BlobServiceClient( # type: ignore [misc]
379
379
  This value is not tracked or validated on the client. To configure client-side network timesouts
380
380
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
381
381
  #other-client--per-operation-configuration>`__.
382
+ :return: None
382
383
  :rtype: None
383
384
 
384
385
  .. admonition:: Example:
@@ -443,7 +444,7 @@ class BlobServiceClient( # type: ignore [misc]
443
444
  This value is not tracked or validated on the client. To configure client-side network timesouts
444
445
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
445
446
  #other-client--per-operation-configuration>`__.
446
- :returns: An iterable (auto-paging) of ContainerProperties.
447
+ :return: An iterable (auto-paging) of ContainerProperties.
447
448
  :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.ContainerProperties]
448
449
 
449
450
  .. admonition:: Example:
@@ -496,7 +497,7 @@ class BlobServiceClient( # type: ignore [misc]
496
497
  This value is not tracked or validated on the client. To configure client-side network timesouts
497
498
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
498
499
  #other-client--per-operation-configuration>`__.
499
- :returns: An iterable (auto-paging) response of BlobProperties.
500
+ :return: An iterable (auto-paging) response of BlobProperties.
500
501
  :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.FilteredBlob]
501
502
  """
502
503
 
@@ -545,7 +546,7 @@ class BlobServiceClient( # type: ignore [misc]
545
546
  This value is not tracked or validated on the client. To configure client-side network timesouts
546
547
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
547
548
  #other-client--per-operation-configuration>`__.
548
- :returns: A container client to interact with the newly created container.
549
+ :return: A container client to interact with the newly created container.
549
550
  :rtype: ~azure.storage.blob.aio.ContainerClient
550
551
 
551
552
  .. admonition:: Example:
@@ -607,6 +608,7 @@ class BlobServiceClient( # type: ignore [misc]
607
608
  This value is not tracked or validated on the client. To configure client-side network timesouts
608
609
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
609
610
  #other-client--per-operation-configuration>`__.
611
+ :return: None
610
612
  :rtype: None
611
613
 
612
614
  .. admonition:: Example:
@@ -646,7 +648,7 @@ class BlobServiceClient( # type: ignore [misc]
646
648
  This value is not tracked or validated on the client. To configure client-side network timesouts
647
649
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
648
650
  #other-client--per-operation-configuration>`__.
649
- :returns: A container client for the renamed container.
651
+ :return: A container client for the renamed container.
650
652
  :rtype: ~azure.storage.blob.ContainerClient
651
653
  """
652
654
  renamed_container = self.get_container_client(new_name)
@@ -685,7 +687,7 @@ class BlobServiceClient( # type: ignore [misc]
685
687
  This value is not tracked or validated on the client. To configure client-side network timesouts
686
688
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
687
689
  #other-client--per-operation-configuration>`__.
688
- :returns: The recovered soft-deleted ContainerClient.
690
+ :return: The recovered soft-deleted ContainerClient.
689
691
  :rtype: ~azure.storage.blob.aio.ContainerClient
690
692
  """
691
693
  new_name = kwargs.pop('new_name', None)
@@ -709,7 +711,7 @@ class BlobServiceClient( # type: ignore [misc]
709
711
  The container. This can either be the name of the container,
710
712
  or an instance of ContainerProperties.
711
713
  :type container: str or ~azure.storage.blob.ContainerProperties
712
- :returns: A ContainerClient.
714
+ :return: A ContainerClient.
713
715
  :rtype: ~azure.storage.blob.aio.ContainerClient
714
716
 
715
717
  .. admonition:: Example:
@@ -760,7 +762,7 @@ class BlobServiceClient( # type: ignore [misc]
760
762
  :type snapshot: str or dict(str, Any)
761
763
  :keyword str version_id: The version id parameter is an opaque DateTime value that, when present,
762
764
  specifies the version of the blob to operate on.
763
- :returns: A BlobClient.
765
+ :return: A BlobClient.
764
766
  :rtype: ~azure.storage.blob.aio.BlobClient
765
767
 
766
768
  .. admonition:: Example:
@@ -186,7 +186,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
186
186
  :keyword str audience: The audience to use when requesting tokens for Azure Active Directory
187
187
  authentication. Only has an effect when credential is of type TokenCredential. The value could be
188
188
  https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
189
- :returns: A container client.
189
+ :return: A container client.
190
190
  :rtype: ~azure.storage.blob.ContainerClient
191
191
  """
192
192
  try:
@@ -239,7 +239,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
239
239
  :keyword str audience: The audience to use when requesting tokens for Azure Active Directory
240
240
  authentication. Only has an effect when credential is of type TokenCredential. The value could be
241
241
  https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
242
- :returns: A container client.
242
+ :return: A container client.
243
243
  :rtype: ~azure.storage.blob.ContainerClient
244
244
 
245
245
  .. admonition:: Example:
@@ -286,7 +286,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
286
286
  This value is not tracked or validated on the client. To configure client-side network timesouts
287
287
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
288
288
  #other-client--per-operation-configuration>`__.
289
- :returns: A dictionary of response headers.
289
+ :return: A dictionary of response headers.
290
290
  :rtype: Dict[str, Union[str, datetime]]
291
291
 
292
292
  .. admonition:: Example:
@@ -331,7 +331,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
331
331
  This value is not tracked or validated on the client. To configure client-side network timesouts
332
332
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
333
333
  #other-client--per-operation-configuration>`__.
334
- :returns: The renamed container.
334
+ :return: The renamed container.
335
335
  :rtype: ~azure.storage.blob.ContainerClient
336
336
  """
337
337
  lease = kwargs.pop('lease', None)
@@ -385,6 +385,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
385
385
  This value is not tracked or validated on the client. To configure client-side network timesouts
386
386
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
387
387
  #other-client--per-operation-configuration>`__.
388
+ :return: None
388
389
  :rtype: None
389
390
 
390
391
  .. admonition:: Example:
@@ -451,7 +452,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
451
452
  This value is not tracked or validated on the client. To configure client-side network timesouts
452
453
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
453
454
  #other-client--per-operation-configuration>`__.
454
- :returns: A BlobLeaseClient object, that can be run in a context manager.
455
+ :return: A BlobLeaseClient object, that can be run in a context manager.
455
456
  :rtype: ~azure.storage.blob.aio.BlobLeaseClient
456
457
 
457
458
  .. admonition:: Example:
@@ -476,7 +477,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
476
477
  The information can also be retrieved if the user has a SAS to a container or blob.
477
478
  The keys in the returned dictionary include 'sku_name' and 'account_kind'.
478
479
 
479
- :returns: A dict of account information (SKU and account type).
480
+ :return: A dict of account information (SKU and account type).
480
481
  :rtype: dict(str, str)
481
482
  """
482
483
  try:
@@ -536,7 +537,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
536
537
  This value is not tracked or validated on the client. To configure client-side network timesouts
537
538
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
538
539
  #other-client--per-operation-configuration>`__.
539
- :returns: boolean
540
+ :return: boolean
540
541
  :rtype: bool
541
542
  """
542
543
  try:
@@ -578,7 +579,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
578
579
  This value is not tracked or validated on the client. To configure client-side network timesouts
579
580
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
580
581
  #other-client--per-operation-configuration>`__.
581
- :returns: Container-updated property dict (Etag and last modified).
582
+ :return: Container-updated property dict (Etag and last modified).
582
583
  :rtype: Dict[str, Union[str, datetime]]
583
584
 
584
585
  .. admonition:: Example:
@@ -613,7 +614,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
613
614
 
614
615
  Defaults to current container's credentials.
615
616
 
616
- :returns: A BlobServiceClient.
617
+ :return: A BlobServiceClient.
617
618
  :rtype: ~azure.storage.blob.BlobServiceClient
618
619
 
619
620
  .. admonition:: Example:
@@ -656,7 +657,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
656
657
  This value is not tracked or validated on the client. To configure client-side network timesouts
657
658
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
658
659
  #other-client--per-operation-configuration>`__.
659
- :returns: Access policy information in a dict.
660
+ :return: Access policy information in a dict.
660
661
  :rtype: dict[str, Any]
661
662
 
662
663
  .. admonition:: Example:
@@ -723,7 +724,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
723
724
  This value is not tracked or validated on the client. To configure client-side network timesouts
724
725
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
725
726
  #other-client--per-operation-configuration>`__.
726
- :returns: Container-updated property dict (Etag and last modified).
727
+ :return: Container-updated property dict (Etag and last modified).
727
728
  :rtype: dict[str, str or ~datetime.datetime]
728
729
 
729
730
  .. admonition:: Example:
@@ -787,7 +788,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
787
788
  This value is not tracked or validated on the client. To configure client-side network timesouts
788
789
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
789
790
  #other-client--per-operation-configuration>`__.
790
- :returns: An iterable (auto-paging) response of BlobProperties.
791
+ :return: An iterable (auto-paging) response of BlobProperties.
791
792
  :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties]
792
793
 
793
794
  .. admonition:: Example:
@@ -840,7 +841,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
840
841
  This value is not tracked or validated on the client. To configure client-side network timesouts
841
842
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
842
843
  #other-client--per-operation-configuration>`__.
843
- :returns: An iterable (auto-paging) response of blob names as strings.
844
+ :return: An iterable (auto-paging) response of blob names as strings.
844
845
  :rtype: ~azure.core.async_paging.AsyncItemPaged[str]
845
846
  """
846
847
  if kwargs.pop('prefix', None):
@@ -873,7 +874,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
873
874
  include: Optional[Union[List[str], str]] = None,
874
875
  delimiter: str = "/",
875
876
  **kwargs: Any
876
- ) -> AsyncItemPaged[BlobProperties]:
877
+ ) -> AsyncItemPaged[Union[BlobProperties, BlobPrefix]]:
877
878
  """Returns a generator to list the blobs under the specified container.
878
879
  The generator will lazily follow the continuation tokens returned by
879
880
  the service. This operation will list blobs in accordance with a hierarchy,
@@ -898,8 +899,9 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
898
899
  This value is not tracked or validated on the client. To configure client-side network timesouts
899
900
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
900
901
  #other-client--per-operation-configuration>`__.
901
- :returns: An iterable (auto-paging) response of BlobProperties.
902
- :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties]
902
+ :return: An iterable (auto-paging) response of BlobProperties.
903
+ :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties or
904
+ ~azure.storage.blob.aio.BlobPrefix]
903
905
  """
904
906
  if kwargs.pop('prefix', None):
905
907
  raise ValueError("Passing 'prefix' has no effect on filtering, " +
@@ -944,7 +946,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
944
946
  This value is not tracked or validated on the client. To configure client-side network timesouts
945
947
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
946
948
  #other-client--per-operation-configuration>`__.
947
- :returns: An iterable (auto-paging) response of FilteredBlob.
949
+ :return: An iterable (auto-paging) response of FilteredBlob.
948
950
  :rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.BlobProperties]
949
951
  """
950
952
  results_per_page = kwargs.pop('results_per_page', None)
@@ -1071,7 +1073,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1071
1073
  function(current: int, total: Optional[int]) where current is the number of bytes transferred
1072
1074
  so far, and total is the size of the blob or None if the size is unknown.
1073
1075
  :paramtype progress_hook: Callable[[int, Optional[int]], Awaitable[None]]
1074
- :returns: A BlobClient to interact with the newly uploaded blob.
1076
+ :return: A BlobClient to interact with the newly uploaded blob.
1075
1077
  :rtype: ~azure.storage.blob.aio.BlobClient
1076
1078
 
1077
1079
  .. admonition:: Example:
@@ -1121,7 +1123,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1121
1123
  and retains the blob or snapshot for specified number of days.
1122
1124
  After specified number of days, blob's data is removed from the service during garbage collection.
1123
1125
  Soft deleted blobs or snapshots are accessible through :func:`list_blobs()` specifying `include=["deleted"]`
1124
- Soft-deleted blob or snapshot can be restored using :func:`~azure.storage.blob.aio.BlobClient.undelete()`
1126
+ Soft-deleted blob or snapshot can be restored using :func:`~azure.storage.blob.aio.BlobClient.undelete_blob()`
1125
1127
 
1126
1128
  :param str blob: The blob with which to interact.
1127
1129
  :param str delete_snapshots:
@@ -1169,6 +1171,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1169
1171
  This value is not tracked or validated on the client. To configure client-side network timesouts
1170
1172
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1171
1173
  #other-client--per-operation-configuration>`__.
1174
+ :return: None
1172
1175
  :rtype: None
1173
1176
  """
1174
1177
  if isinstance(blob, BlobProperties):
@@ -1295,7 +1298,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1295
1298
  the timeout will apply to each call individually.
1296
1299
  multiple calls to the Azure service and the timeout will apply to
1297
1300
  each call individually.
1298
- :returns: A streaming object. (StorageStreamDownloader)
1301
+ :return: A streaming object. (StorageStreamDownloader)
1299
1302
  :rtype: ~azure.storage.blob.aio.StorageStreamDownloader
1300
1303
  """
1301
1304
  if isinstance(blob, BlobProperties):
@@ -1327,7 +1330,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1327
1330
  and retains the blobs or snapshots for specified number of days.
1328
1331
  After specified number of days, blobs' data is removed from the service during garbage collection.
1329
1332
  Soft deleted blobs or snapshots are accessible through :func:`list_blobs()` specifying `include=["deleted"]`
1330
- Soft-deleted blobs or snapshots can be restored using :func:`~azure.storage.blob.aio.BlobClient.undelete()`
1333
+ Soft-deleted blobs or snapshots can be restored using :func:`~azure.storage.blob.aio.BlobClient.undelete_blob()`
1331
1334
 
1332
1335
  The maximum number of blobs that can be deleted in a single request is 256.
1333
1336
 
@@ -1393,7 +1396,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1393
1396
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1394
1397
  #other-client--per-operation-configuration>`__.
1395
1398
  :return: An async iterator of responses, one for each blob in order
1396
- :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse]
1399
+ :rtype: AsyncIterator[~azure.core.pipeline.transport.AsyncHttpResponse]
1397
1400
 
1398
1401
  .. admonition:: Example:
1399
1402
 
@@ -1485,7 +1488,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1485
1488
  is raised even if there is a single operation failure. For optimal performance,
1486
1489
  this should be set to False.
1487
1490
  :return: An async iterator of responses, one for each blob in order
1488
- :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse]
1491
+ :rtype: AsyncIterator[~azure.core.pipeline.transport.AsyncHttpResponse]
1489
1492
  """
1490
1493
  if self._is_localhost:
1491
1494
  kwargs['url_prepend'] = self.account_name
@@ -1546,7 +1549,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1546
1549
  is raised even if there is a single operation failure. For optimal performance,
1547
1550
  this should be set to False.
1548
1551
  :return: An async iterator of responses, one for each blob in order
1549
- :rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse]
1552
+ :rtype: AsyncIterator[~azure.core.pipeline.transport.AsyncHttpResponse]
1550
1553
  """
1551
1554
  if self._is_localhost:
1552
1555
  kwargs['url_prepend'] = self.account_name
@@ -1577,7 +1580,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
1577
1580
  or the response returned from :func:`~BlobClient.create_snapshot()`.
1578
1581
  :keyword str version_id: The version id parameter is an opaque DateTime value that, when present,
1579
1582
  specifies the version of the blob to operate on.
1580
- :returns: A BlobClient.
1583
+ :return: A BlobClient.
1581
1584
  :rtype: ~azure.storage.blob.aio.BlobClient
1582
1585
 
1583
1586
  .. admonition:: Example:
@@ -449,7 +449,7 @@ class StorageStreamDownloader(Generic[T]): # pylint: disable=too-many-instance-
449
449
 
450
450
  NOTE: If the stream has been partially read, some data may be re-downloaded by the iterator.
451
451
 
452
- :returns: An async iterator of the chunks in the download stream.
452
+ :return: An async iterator of the chunks in the download stream.
453
453
  :rtype: AsyncIterator[bytes]
454
454
 
455
455
  .. admonition:: Example:
@@ -523,7 +523,7 @@ class StorageStreamDownloader(Generic[T]): # pylint: disable=too-many-instance-
523
523
  The number of chars to download from the stream. Leave unspecified
524
524
  or set negative to download all chars. Note, this can only be used
525
525
  when encoding is specified on `download_blob`.
526
- :returns:
526
+ :return:
527
527
  The requested data as bytes or a string if encoding was specified. If
528
528
  the return value is empty, there is no more data to read.
529
529
  :rtype: T
@@ -676,7 +676,7 @@ class StorageStreamDownloader(Generic[T]): # pylint: disable=too-many-instance-
676
676
  Read the entire contents of this blob.
677
677
  This operation is blocking until all data is downloaded.
678
678
 
679
- :returns: The requested data as bytes or a string if encoding was specified.
679
+ :return: The requested data as bytes or a string if encoding was specified.
680
680
  :rtype: T
681
681
  """
682
682
  return await self.read()
@@ -688,7 +688,7 @@ class StorageStreamDownloader(Generic[T]): # pylint: disable=too-many-instance-
688
688
  The stream to download to. This can be an open file-handle,
689
689
  or any writable stream. The stream must be seekable if the download
690
690
  uses more than one parallel connection.
691
- :returns: The number of bytes read.
691
+ :return: The number of bytes read.
692
692
  :rtype: int
693
693
  """
694
694
  if self._text_mode:
@@ -805,7 +805,7 @@ class StorageStreamDownloader(Generic[T]): # pylint: disable=too-many-instance-
805
805
 
806
806
  :param int max_concurrency:
807
807
  The number of parallel connections with which to download.
808
- :returns: The contents of the file as bytes.
808
+ :return: The contents of the file as bytes.
809
809
  :rtype: bytes
810
810
  """
811
811
  warnings.warn(
@@ -830,7 +830,7 @@ class StorageStreamDownloader(Generic[T]): # pylint: disable=too-many-instance-
830
830
  The number of parallel connections with which to download.
831
831
  :param str encoding:
832
832
  Test encoding to decode the downloaded bytes. Default is UTF-8.
833
- :returns: The content of the file as a str.
833
+ :return: The content of the file as a str.
834
834
  :rtype: str
835
835
  """
836
836
  warnings.warn(
@@ -856,7 +856,7 @@ class StorageStreamDownloader(Generic[T]): # pylint: disable=too-many-instance-
856
856
  uses more than one parallel connection.
857
857
  :param int max_concurrency:
858
858
  The number of parallel connections with which to download.
859
- :returns: The properties of the downloaded blob.
859
+ :return: The properties of the downloaded blob.
860
860
  :rtype: Any
861
861
  """
862
862
  warnings.warn(
@@ -107,6 +107,7 @@ class BlobLeaseClient(): # pylint: disable=client-accepts-api-version-keyword
107
107
  This value is not tracked or validated on the client. To configure client-side network timesouts
108
108
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
109
109
  #other-client--per-operation-configuration>`__.
110
+ :return: None
110
111
  :rtype: None
111
112
  """
112
113
  mod_conditions = get_modify_conditions(kwargs)
@@ -0,0 +1,194 @@
1
+ # -------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for
4
+ # license information.
5
+ # --------------------------------------------------------------------------
6
+
7
+ from io import BytesIO
8
+ from typing import (
9
+ Any, AsyncGenerator, AsyncIterable, Dict, IO, Optional, Type,
10
+ TYPE_CHECKING
11
+ )
12
+
13
+ from .._shared.avro.avro_io_async import AsyncDatumReader
14
+ from .._shared.avro.datafile_async import AsyncDataFileReader
15
+
16
+ if TYPE_CHECKING:
17
+ from .._models import BlobQueryError
18
+
19
+
20
+ class BlobQueryReader: # pylint: disable=too-many-instance-attributes
21
+ """A streaming object to read query results."""
22
+
23
+ name: str
24
+ """The name of the blob being queried."""
25
+ container: str
26
+ """The name of the container where the blob is."""
27
+ response_headers: Dict[str, Any]
28
+ """The response headers of the quick query request."""
29
+ record_delimiter: str
30
+ """The delimiter used to separate lines, or records with the data. The `records`
31
+ method will return these lines via a generator."""
32
+
33
+ def __init__(
34
+ self, name: str = None, # type: ignore [assignment]
35
+ container: str = None, # type: ignore [assignment]
36
+ errors: Any = None,
37
+ record_delimiter: str = '\n',
38
+ encoding: Optional[str] = None,
39
+ headers: Dict[str, Any] = None, # type: ignore [assignment]
40
+ response: Any = None,
41
+ error_cls: Type["BlobQueryError"] = None, # type: ignore [assignment]
42
+ ) -> None:
43
+ self.name = name
44
+ self.container = container
45
+ self.response_headers = headers
46
+ self.record_delimiter = record_delimiter
47
+ self._size = 0
48
+ self._bytes_processed = 0
49
+ self._errors = errors
50
+ self._encoding = encoding
51
+ self._parsed_results = AsyncDataFileReader(QuickQueryStreamer(response), AsyncDatumReader())
52
+ self._error_cls = error_cls
53
+
54
+ async def _setup(self):
55
+ self._parsed_results = await self._parsed_results.init()
56
+ first_result = await self._parsed_results.__anext__()
57
+ self._first_result = self._process_record(first_result) # pylint: disable=attribute-defined-outside-init
58
+
59
+ def __len__(self) -> int:
60
+ return self._size
61
+
62
+ def _process_record(self, result: Dict[str, Any]) -> Optional[bytes]:
63
+ self._size = result.get('totalBytes', self._size)
64
+ self._bytes_processed = result.get('bytesScanned', self._bytes_processed)
65
+ if 'data' in result:
66
+ return result.get('data')
67
+ if 'fatal' in result:
68
+ error = self._error_cls(
69
+ error=result['name'],
70
+ is_fatal=result['fatal'],
71
+ description=result['description'],
72
+ position=result['position']
73
+ )
74
+ if self._errors:
75
+ self._errors(error)
76
+ return None
77
+
78
+ async def _aiter_stream(self) -> AsyncGenerator[bytes, None]:
79
+ if self._first_result is not None:
80
+ yield self._first_result
81
+ async for next_result in self._parsed_results:
82
+ processed_result = self._process_record(next_result)
83
+ if processed_result is not None:
84
+ yield processed_result
85
+
86
+ async def readall(self) -> bytes:
87
+ """Return all query results.
88
+
89
+ This operation is blocking until all data is downloaded.
90
+
91
+ :return: The query results.
92
+ :rtype: bytes
93
+ """
94
+ stream = BytesIO()
95
+ await self.readinto(stream)
96
+ data = stream.getvalue()
97
+ if self._encoding:
98
+ return data.decode(self._encoding) # type: ignore [return-value]
99
+ return data
100
+
101
+ async def readinto(self, stream: IO) -> None:
102
+ """Download the query result to a stream.
103
+
104
+ :param IO stream:
105
+ The stream to download to. This can be an open file-handle,
106
+ or any writable stream.
107
+ :return: None
108
+ """
109
+ async for record in self._aiter_stream():
110
+ stream.write(record)
111
+
112
+ async def records(self) -> AsyncIterable[bytes]:
113
+ """Returns a record generator for the query result.
114
+
115
+ Records will be returned line by line.
116
+
117
+ :return: A record generator for the query result.
118
+ :rtype: AsyncIterable[bytes]
119
+ """
120
+ delimiter = self.record_delimiter.encode('utf-8')
121
+ async for record_chunk in self._aiter_stream():
122
+ for record in record_chunk.split(delimiter):
123
+ if self._encoding:
124
+ yield record.decode(self._encoding) # type: ignore [misc]
125
+ else:
126
+ yield record
127
+
128
+
129
+ class QuickQueryStreamer:
130
+ """File-like streaming iterator."""
131
+
132
+ def __init__(self, generator):
133
+ self.generator = generator
134
+ self.iterator = generator.__aiter__()
135
+ self._buf = b""
136
+ self._point = 0
137
+ self._download_offset = 0
138
+ self._buf_start = 0
139
+ self.file_length = None
140
+
141
+ def __len__(self):
142
+ return self.file_length
143
+
144
+ def __aiter__(self):
145
+ return self.iterator
146
+
147
+ @staticmethod
148
+ def seekable():
149
+ return True
150
+
151
+ async def __anext__(self):
152
+ next_part = await self.iterator.__anext__()
153
+ self._download_offset += len(next_part)
154
+ return next_part
155
+
156
+ def tell(self):
157
+ return self._point
158
+
159
+ async def seek(self, offset, whence=0):
160
+ if whence == 0:
161
+ self._point = offset
162
+ elif whence == 1:
163
+ self._point += offset
164
+ else:
165
+ raise ValueError("whence must be 0 or 1")
166
+ if self._point < 0: # pylint: disable=consider-using-max-builtin
167
+ self._point = 0
168
+
169
+ async def read(self, size):
170
+ try:
171
+ # keep reading from the generator until the buffer of this stream has enough data to read
172
+ while self._point + size > self._download_offset:
173
+ self._buf += await self.__anext__()
174
+ except StopAsyncIteration:
175
+ self.file_length = self._download_offset
176
+
177
+ start_point = self._point
178
+
179
+ # EOF
180
+ self._point = min(self._point + size, self._download_offset)
181
+
182
+ relative_start = start_point - self._buf_start
183
+ if relative_start < 0:
184
+ raise ValueError("Buffer has dumped too much data")
185
+ relative_end = relative_start + size
186
+ data = self._buf[relative_start:relative_end]
187
+
188
+ # dump the extra data in buffer
189
+ # buffer start--------------------16bytes----current read position
190
+ dumped_size = max(relative_end - 16 - relative_start, 0)
191
+ self._buf_start += dumped_size
192
+ self._buf = self._buf[dumped_size:]
193
+
194
+ return data
@@ -1,23 +1,22 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: azure-storage-blob
3
- Version: 12.25.1
3
+ Version: 12.27.0b1
4
4
  Summary: Microsoft Azure Blob Storage Client Library for Python
5
5
  Home-page: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
6
6
  Author: Microsoft Corporation
7
7
  Author-email: ascl@microsoft.com
8
8
  License: MIT License
9
9
  Keywords: azure,azure sdk
10
- Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Development Status :: 4 - Beta
11
11
  Classifier: Programming Language :: Python
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
13
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.8
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
18
  Classifier: License :: OSI Approved :: MIT License
20
- Requires-Python: >=3.8
19
+ Requires-Python: >=3.9
21
20
  Description-Content-Type: text/markdown
22
21
  License-File: LICENSE
23
22
  Requires-Dist: azure-core>=1.30.0
@@ -49,7 +48,7 @@ Blob storage is ideal for:
49
48
  ## Getting started
50
49
 
51
50
  ### Prerequisites
52
- * Python 3.8 or later is required to use this package. For more details, please read our page on [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy).
51
+ * Python 3.9 or later is required to use this package. For more details, please read our page on [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy).
53
52
  * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an
54
53
  [Azure storage account](https://learn.microsoft.com/azure/storage/common/storage-account-overview) to use this package.
55
54