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