azure-storage-blob 12.25.1__py3-none-any.whl → 12.26.0__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 (64) 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 +1 -1
  10. azure/storage/blob/_generated/_configuration.py +2 -2
  11. azure/storage/blob/_generated/_serialization.py +3 -3
  12. azure/storage/blob/_generated/aio/_azure_blob_storage.py +1 -1
  13. azure/storage/blob/_generated/aio/_configuration.py +2 -2
  14. azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +5 -4
  15. azure/storage/blob/_generated/aio/operations/_blob_operations.py +5 -25
  16. azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +9 -7
  17. azure/storage/blob/_generated/aio/operations/_container_operations.py +1 -19
  18. azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +5 -10
  19. azure/storage/blob/_generated/aio/operations/_service_operations.py +1 -8
  20. azure/storage/blob/_generated/models/__init__.py +2 -0
  21. azure/storage/blob/_generated/models/_azure_blob_storage_enums.py +6 -0
  22. azure/storage/blob/_generated/operations/_append_blob_operations.py +12 -9
  23. azure/storage/blob/_generated/operations/_blob_operations.py +32 -49
  24. azure/storage/blob/_generated/operations/_block_blob_operations.py +21 -13
  25. azure/storage/blob/_generated/operations/_container_operations.py +19 -37
  26. azure/storage/blob/_generated/operations/_page_blob_operations.py +17 -19
  27. azure/storage/blob/_generated/operations/_service_operations.py +9 -17
  28. azure/storage/blob/_lease.py +1 -0
  29. azure/storage/blob/_quick_query_helper.py +20 -24
  30. azure/storage/blob/_serialize.py +1 -0
  31. azure/storage/blob/_shared/__init__.py +7 -7
  32. azure/storage/blob/_shared/authentication.py +49 -32
  33. azure/storage/blob/_shared/avro/avro_io.py +44 -42
  34. azure/storage/blob/_shared/avro/avro_io_async.py +42 -41
  35. azure/storage/blob/_shared/avro/datafile.py +24 -21
  36. azure/storage/blob/_shared/avro/datafile_async.py +15 -15
  37. azure/storage/blob/_shared/avro/schema.py +196 -217
  38. azure/storage/blob/_shared/base_client.py +82 -59
  39. azure/storage/blob/_shared/base_client_async.py +58 -51
  40. azure/storage/blob/_shared/constants.py +1 -1
  41. azure/storage/blob/_shared/models.py +93 -92
  42. azure/storage/blob/_shared/parser.py +3 -3
  43. azure/storage/blob/_shared/policies.py +176 -145
  44. azure/storage/blob/_shared/policies_async.py +58 -69
  45. azure/storage/blob/_shared/request_handlers.py +50 -45
  46. azure/storage/blob/_shared/response_handlers.py +49 -45
  47. azure/storage/blob/_shared/shared_access_signature.py +67 -71
  48. azure/storage/blob/_shared/uploads.py +56 -49
  49. azure/storage/blob/_shared/uploads_async.py +70 -58
  50. azure/storage/blob/_shared_access_signature.py +3 -1
  51. azure/storage/blob/_version.py +1 -1
  52. azure/storage/blob/aio/__init__.py +3 -2
  53. azure/storage/blob/aio/_blob_client_async.py +241 -44
  54. azure/storage/blob/aio/_blob_service_client_async.py +13 -11
  55. azure/storage/blob/aio/_container_client_async.py +28 -25
  56. azure/storage/blob/aio/_download_async.py +15 -11
  57. azure/storage/blob/aio/_lease_async.py +1 -0
  58. azure/storage/blob/aio/_quick_query_helper_async.py +194 -0
  59. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/METADATA +1 -1
  60. azure_storage_blob-12.26.0.dist-info/RECORD +85 -0
  61. azure_storage_blob-12.25.1.dist-info/RECORD +0 -84
  62. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/LICENSE +0 -0
  63. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/WHEEL +0 -0
  64. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/top_level.txt +0 -0
@@ -22,6 +22,7 @@ def get_enum_value(value):
22
22
 
23
23
 
24
24
  class StorageErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
25
+ """Error codes returned by the service."""
25
26
 
26
27
  # Generic storage values
27
28
  ACCOUNT_ALREADY_EXISTS = "AccountAlreadyExists"
@@ -172,26 +173,26 @@ class StorageErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
172
173
  CONTAINER_QUOTA_DOWNGRADE_NOT_ALLOWED = "ContainerQuotaDowngradeNotAllowed"
173
174
 
174
175
  # DataLake values
175
- CONTENT_LENGTH_MUST_BE_ZERO = 'ContentLengthMustBeZero'
176
- PATH_ALREADY_EXISTS = 'PathAlreadyExists'
177
- INVALID_FLUSH_POSITION = 'InvalidFlushPosition'
178
- INVALID_PROPERTY_NAME = 'InvalidPropertyName'
179
- INVALID_SOURCE_URI = 'InvalidSourceUri'
180
- UNSUPPORTED_REST_VERSION = 'UnsupportedRestVersion'
181
- FILE_SYSTEM_NOT_FOUND = 'FilesystemNotFound'
182
- PATH_NOT_FOUND = 'PathNotFound'
183
- RENAME_DESTINATION_PARENT_PATH_NOT_FOUND = 'RenameDestinationParentPathNotFound'
184
- SOURCE_PATH_NOT_FOUND = 'SourcePathNotFound'
185
- DESTINATION_PATH_IS_BEING_DELETED = 'DestinationPathIsBeingDeleted'
186
- FILE_SYSTEM_ALREADY_EXISTS = 'FilesystemAlreadyExists'
187
- FILE_SYSTEM_BEING_DELETED = 'FilesystemBeingDeleted'
188
- INVALID_DESTINATION_PATH = 'InvalidDestinationPath'
189
- INVALID_RENAME_SOURCE_PATH = 'InvalidRenameSourcePath'
190
- INVALID_SOURCE_OR_DESTINATION_RESOURCE_TYPE = 'InvalidSourceOrDestinationResourceType'
191
- LEASE_IS_ALREADY_BROKEN = 'LeaseIsAlreadyBroken'
192
- LEASE_NAME_MISMATCH = 'LeaseNameMismatch'
193
- PATH_CONFLICT = 'PathConflict'
194
- SOURCE_PATH_IS_BEING_DELETED = 'SourcePathIsBeingDeleted'
176
+ CONTENT_LENGTH_MUST_BE_ZERO = "ContentLengthMustBeZero"
177
+ PATH_ALREADY_EXISTS = "PathAlreadyExists"
178
+ INVALID_FLUSH_POSITION = "InvalidFlushPosition"
179
+ INVALID_PROPERTY_NAME = "InvalidPropertyName"
180
+ INVALID_SOURCE_URI = "InvalidSourceUri"
181
+ UNSUPPORTED_REST_VERSION = "UnsupportedRestVersion"
182
+ FILE_SYSTEM_NOT_FOUND = "FilesystemNotFound"
183
+ PATH_NOT_FOUND = "PathNotFound"
184
+ RENAME_DESTINATION_PARENT_PATH_NOT_FOUND = "RenameDestinationParentPathNotFound"
185
+ SOURCE_PATH_NOT_FOUND = "SourcePathNotFound"
186
+ DESTINATION_PATH_IS_BEING_DELETED = "DestinationPathIsBeingDeleted"
187
+ FILE_SYSTEM_ALREADY_EXISTS = "FilesystemAlreadyExists"
188
+ FILE_SYSTEM_BEING_DELETED = "FilesystemBeingDeleted"
189
+ INVALID_DESTINATION_PATH = "InvalidDestinationPath"
190
+ INVALID_RENAME_SOURCE_PATH = "InvalidRenameSourcePath"
191
+ INVALID_SOURCE_OR_DESTINATION_RESOURCE_TYPE = "InvalidSourceOrDestinationResourceType"
192
+ LEASE_IS_ALREADY_BROKEN = "LeaseIsAlreadyBroken"
193
+ LEASE_NAME_MISMATCH = "LeaseNameMismatch"
194
+ PATH_CONFLICT = "PathConflict"
195
+ SOURCE_PATH_IS_BEING_DELETED = "SourcePathIsBeingDeleted"
195
196
 
196
197
 
197
198
  class DictMixin(object):
@@ -222,7 +223,7 @@ class DictMixin(object):
222
223
  return not self.__eq__(other)
223
224
 
224
225
  def __str__(self):
225
- return str({k: v for k, v in self.__dict__.items() if not k.startswith('_')})
226
+ return str({k: v for k, v in self.__dict__.items() if not k.startswith("_")})
226
227
 
227
228
  def __contains__(self, key):
228
229
  return key in self.__dict__
@@ -234,13 +235,13 @@ class DictMixin(object):
234
235
  return self.__dict__.update(*args, **kwargs)
235
236
 
236
237
  def keys(self):
237
- return [k for k in self.__dict__ if not k.startswith('_')]
238
+ return [k for k in self.__dict__ if not k.startswith("_")]
238
239
 
239
240
  def values(self):
240
- return [v for k, v in self.__dict__.items() if not k.startswith('_')]
241
+ return [v for k, v in self.__dict__.items() if not k.startswith("_")]
241
242
 
242
243
  def items(self):
243
- return [(k, v) for k, v in self.__dict__.items() if not k.startswith('_')]
244
+ return [(k, v) for k, v in self.__dict__.items() if not k.startswith("_")]
244
245
 
245
246
  def get(self, key, default=None):
246
247
  if key in self.__dict__:
@@ -255,8 +256,8 @@ class LocationMode(object):
255
256
  must use PRIMARY.
256
257
  """
257
258
 
258
- PRIMARY = 'primary' #: Requests should be sent to the primary location.
259
- SECONDARY = 'secondary' #: Requests should be sent to the secondary location, if possible.
259
+ PRIMARY = "primary" #: Requests should be sent to the primary location.
260
+ SECONDARY = "secondary" #: Requests should be sent to the secondary location, if possible.
260
261
 
261
262
 
262
263
  class ResourceTypes(object):
@@ -281,17 +282,12 @@ class ResourceTypes(object):
281
282
  _str: str
282
283
 
283
284
  def __init__(
284
- self,
285
- service: bool = False,
286
- container: bool = False,
287
- object: bool = False # pylint: disable=redefined-builtin
285
+ self, service: bool = False, container: bool = False, object: bool = False # pylint: disable=redefined-builtin
288
286
  ) -> None:
289
287
  self.service = service
290
288
  self.container = container
291
289
  self.object = object
292
- self._str = (('s' if self.service else '') +
293
- ('c' if self.container else '') +
294
- ('o' if self.object else ''))
290
+ self._str = ("s" if self.service else "") + ("c" if self.container else "") + ("o" if self.object else "")
295
291
 
296
292
  def __str__(self):
297
293
  return self._str
@@ -309,9 +305,9 @@ class ResourceTypes(object):
309
305
  :return: A ResourceTypes object
310
306
  :rtype: ~azure.storage.blob.ResourceTypes
311
307
  """
312
- res_service = 's' in string
313
- res_container = 'c' in string
314
- res_object = 'o' in string
308
+ res_service = "s" in string
309
+ res_container = "c" in string
310
+ res_object = "o" in string
315
311
 
316
312
  parsed = cls(res_service, res_container, res_object)
317
313
  parsed._str = string
@@ -392,29 +388,30 @@ class AccountSasPermissions(object):
392
388
  self.write = write
393
389
  self.delete = delete
394
390
  self.delete_previous_version = delete_previous_version
395
- self.permanent_delete = kwargs.pop('permanent_delete', False)
391
+ self.permanent_delete = kwargs.pop("permanent_delete", False)
396
392
  self.list = list
397
393
  self.add = add
398
394
  self.create = create
399
395
  self.update = update
400
396
  self.process = process
401
- self.tag = kwargs.pop('tag', False)
402
- self.filter_by_tags = kwargs.pop('filter_by_tags', False)
403
- self.set_immutability_policy = kwargs.pop('set_immutability_policy', False)
404
- self._str = (('r' if self.read else '') +
405
- ('w' if self.write else '') +
406
- ('d' if self.delete else '') +
407
- ('x' if self.delete_previous_version else '') +
408
- ('y' if self.permanent_delete else '') +
409
- ('l' if self.list else '') +
410
- ('a' if self.add else '') +
411
- ('c' if self.create else '') +
412
- ('u' if self.update else '') +
413
- ('p' if self.process else '') +
414
- ('f' if self.filter_by_tags else '') +
415
- ('t' if self.tag else '') +
416
- ('i' if self.set_immutability_policy else '')
417
- )
397
+ self.tag = kwargs.pop("tag", False)
398
+ self.filter_by_tags = kwargs.pop("filter_by_tags", False)
399
+ self.set_immutability_policy = kwargs.pop("set_immutability_policy", False)
400
+ self._str = (
401
+ ("r" if self.read else "")
402
+ + ("w" if self.write else "")
403
+ + ("d" if self.delete else "")
404
+ + ("x" if self.delete_previous_version else "")
405
+ + ("y" if self.permanent_delete else "")
406
+ + ("l" if self.list else "")
407
+ + ("a" if self.add else "")
408
+ + ("c" if self.create else "")
409
+ + ("u" if self.update else "")
410
+ + ("p" if self.process else "")
411
+ + ("f" if self.filter_by_tags else "")
412
+ + ("t" if self.tag else "")
413
+ + ("i" if self.set_immutability_policy else "")
414
+ )
418
415
 
419
416
  def __str__(self):
420
417
  return self._str
@@ -432,23 +429,34 @@ class AccountSasPermissions(object):
432
429
  :return: An AccountSasPermissions object
433
430
  :rtype: ~azure.storage.blob.AccountSasPermissions
434
431
  """
435
- p_read = 'r' in permission
436
- p_write = 'w' in permission
437
- p_delete = 'd' in permission
438
- p_delete_previous_version = 'x' in permission
439
- p_permanent_delete = 'y' in permission
440
- p_list = 'l' in permission
441
- p_add = 'a' in permission
442
- p_create = 'c' in permission
443
- p_update = 'u' in permission
444
- p_process = 'p' in permission
445
- p_tag = 't' in permission
446
- p_filter_by_tags = 'f' in permission
447
- p_set_immutability_policy = 'i' in permission
448
- parsed = cls(read=p_read, write=p_write, delete=p_delete, delete_previous_version=p_delete_previous_version,
449
- list=p_list, add=p_add, create=p_create, update=p_update, process=p_process, tag=p_tag,
450
- filter_by_tags=p_filter_by_tags, set_immutability_policy=p_set_immutability_policy,
451
- permanent_delete=p_permanent_delete)
432
+ p_read = "r" in permission
433
+ p_write = "w" in permission
434
+ p_delete = "d" in permission
435
+ p_delete_previous_version = "x" in permission
436
+ p_permanent_delete = "y" in permission
437
+ p_list = "l" in permission
438
+ p_add = "a" in permission
439
+ p_create = "c" in permission
440
+ p_update = "u" in permission
441
+ p_process = "p" in permission
442
+ p_tag = "t" in permission
443
+ p_filter_by_tags = "f" in permission
444
+ p_set_immutability_policy = "i" in permission
445
+ parsed = cls(
446
+ read=p_read,
447
+ write=p_write,
448
+ delete=p_delete,
449
+ delete_previous_version=p_delete_previous_version,
450
+ list=p_list,
451
+ add=p_add,
452
+ create=p_create,
453
+ update=p_update,
454
+ process=p_process,
455
+ tag=p_tag,
456
+ filter_by_tags=p_filter_by_tags,
457
+ set_immutability_policy=p_set_immutability_policy,
458
+ permanent_delete=p_permanent_delete,
459
+ )
452
460
 
453
461
  return parsed
454
462
 
@@ -464,18 +472,11 @@ class Services(object):
464
472
  Access for the `~azure.storage.fileshare.ShareServiceClient`. Default is False.
465
473
  """
466
474
 
467
- def __init__(
468
- self, *,
469
- blob: bool = False,
470
- queue: bool = False,
471
- fileshare: bool = False
472
- ) -> None:
475
+ def __init__(self, *, blob: bool = False, queue: bool = False, fileshare: bool = False) -> None:
473
476
  self.blob = blob
474
477
  self.queue = queue
475
478
  self.fileshare = fileshare
476
- self._str = (('b' if self.blob else '') +
477
- ('q' if self.queue else '') +
478
- ('f' if self.fileshare else ''))
479
+ self._str = ("b" if self.blob else "") + ("q" if self.queue else "") + ("f" if self.fileshare else "")
479
480
 
480
481
  def __str__(self):
481
482
  return self._str
@@ -493,9 +494,9 @@ class Services(object):
493
494
  :return: A Services object
494
495
  :rtype: ~azure.storage.blob.Services
495
496
  """
496
- res_blob = 'b' in string
497
- res_queue = 'q' in string
498
- res_file = 'f' in string
497
+ res_blob = "b" in string
498
+ res_queue = "q" in string
499
+ res_file = "f" in string
499
500
 
500
501
  parsed = cls(blob=res_blob, queue=res_queue, fileshare=res_file)
501
502
  parsed._str = string
@@ -573,13 +574,13 @@ class StorageConfiguration(Configuration):
573
574
 
574
575
  def __init__(self, **kwargs):
575
576
  super(StorageConfiguration, self).__init__(**kwargs)
576
- self.max_single_put_size = kwargs.pop('max_single_put_size', 64 * 1024 * 1024)
577
+ self.max_single_put_size = kwargs.pop("max_single_put_size", 64 * 1024 * 1024)
577
578
  self.copy_polling_interval = 15
578
- self.max_block_size = kwargs.pop('max_block_size', 4 * 1024 * 1024)
579
- self.min_large_block_upload_threshold = kwargs.get('min_large_block_upload_threshold', 4 * 1024 * 1024 + 1)
580
- self.use_byte_buffer = kwargs.pop('use_byte_buffer', False)
581
- self.max_page_size = kwargs.pop('max_page_size', 4 * 1024 * 1024)
582
- self.min_large_chunk_upload_threshold = kwargs.pop('min_large_chunk_upload_threshold', 100 * 1024 * 1024 + 1)
583
- self.max_single_get_size = kwargs.pop('max_single_get_size', 32 * 1024 * 1024)
584
- self.max_chunk_get_size = kwargs.pop('max_chunk_get_size', 4 * 1024 * 1024)
585
- self.max_range_size = kwargs.pop('max_range_size', 4 * 1024 * 1024)
579
+ self.max_block_size = kwargs.pop("max_block_size", 4 * 1024 * 1024)
580
+ self.min_large_block_upload_threshold = kwargs.get("min_large_block_upload_threshold", 4 * 1024 * 1024 + 1)
581
+ self.use_byte_buffer = kwargs.pop("use_byte_buffer", False)
582
+ self.max_page_size = kwargs.pop("max_page_size", 4 * 1024 * 1024)
583
+ self.min_large_chunk_upload_threshold = kwargs.pop("min_large_chunk_upload_threshold", 100 * 1024 * 1024 + 1)
584
+ self.max_single_get_size = kwargs.pop("max_single_get_size", 32 * 1024 * 1024)
585
+ self.max_chunk_get_size = kwargs.pop("max_chunk_get_size", 4 * 1024 * 1024)
586
+ self.max_range_size = kwargs.pop("max_range_size", 4 * 1024 * 1024)
@@ -12,14 +12,14 @@ HUNDREDS_OF_NANOSECONDS = 10000000
12
12
 
13
13
 
14
14
  def _to_utc_datetime(value: datetime) -> str:
15
- return value.strftime('%Y-%m-%dT%H:%M:%SZ')
15
+ return value.strftime("%Y-%m-%dT%H:%M:%SZ")
16
16
 
17
17
 
18
18
  def _rfc_1123_to_datetime(rfc_1123: str) -> Optional[datetime]:
19
19
  """Converts an RFC 1123 date string to a UTC datetime.
20
20
 
21
21
  :param str rfc_1123: The time and date in RFC 1123 format.
22
- :returns: The time and date in UTC datetime format.
22
+ :return: The time and date in UTC datetime format.
23
23
  :rtype: datetime
24
24
  """
25
25
  if not rfc_1123:
@@ -33,7 +33,7 @@ def _filetime_to_datetime(filetime: str) -> Optional[datetime]:
33
33
  If parsing MS Filetime fails, tries RFC 1123 as backup.
34
34
 
35
35
  :param str filetime: The time and date in MS filetime format.
36
- :returns: The time and date in UTC datetime format.
36
+ :return: The time and date in UTC datetime format.
37
37
  :rtype: datetime
38
38
  """
39
39
  if not filetime: