azure-storage-blob 12.21.0b1__py3-none-any.whl → 12.23.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 (60) hide show
  1. azure/storage/blob/__init__.py +19 -18
  2. azure/storage/blob/_blob_client.py +470 -1555
  3. azure/storage/blob/_blob_client_helpers.py +1242 -0
  4. azure/storage/blob/_blob_service_client.py +93 -112
  5. azure/storage/blob/_blob_service_client_helpers.py +27 -0
  6. azure/storage/blob/_container_client.py +176 -377
  7. azure/storage/blob/_container_client_helpers.py +266 -0
  8. azure/storage/blob/_deserialize.py +68 -44
  9. azure/storage/blob/_download.py +375 -241
  10. azure/storage/blob/_encryption.py +14 -7
  11. azure/storage/blob/_generated/_azure_blob_storage.py +2 -1
  12. azure/storage/blob/_generated/_serialization.py +2 -0
  13. azure/storage/blob/_generated/aio/_azure_blob_storage.py +2 -1
  14. azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +1 -7
  15. azure/storage/blob/_generated/aio/operations/_blob_operations.py +21 -47
  16. azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +2 -10
  17. azure/storage/blob/_generated/aio/operations/_container_operations.py +13 -26
  18. azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +3 -14
  19. azure/storage/blob/_generated/aio/operations/_service_operations.py +14 -17
  20. azure/storage/blob/_generated/operations/_append_blob_operations.py +1 -7
  21. azure/storage/blob/_generated/operations/_blob_operations.py +21 -47
  22. azure/storage/blob/_generated/operations/_block_blob_operations.py +2 -10
  23. azure/storage/blob/_generated/operations/_container_operations.py +13 -26
  24. azure/storage/blob/_generated/operations/_page_blob_operations.py +3 -14
  25. azure/storage/blob/_generated/operations/_service_operations.py +14 -17
  26. azure/storage/blob/_generated/py.typed +1 -0
  27. azure/storage/blob/_lease.py +52 -63
  28. azure/storage/blob/_list_blobs_helper.py +129 -135
  29. azure/storage/blob/_models.py +480 -277
  30. azure/storage/blob/_quick_query_helper.py +30 -31
  31. azure/storage/blob/_serialize.py +39 -56
  32. azure/storage/blob/_shared/avro/datafile.py +1 -1
  33. azure/storage/blob/_shared/avro/datafile_async.py +1 -1
  34. azure/storage/blob/_shared/base_client.py +3 -1
  35. azure/storage/blob/_shared/base_client_async.py +1 -1
  36. azure/storage/blob/_shared/policies.py +16 -15
  37. azure/storage/blob/_shared/policies_async.py +21 -6
  38. azure/storage/blob/_shared/response_handlers.py +6 -2
  39. azure/storage/blob/_shared/shared_access_signature.py +21 -3
  40. azure/storage/blob/_shared/uploads.py +1 -1
  41. azure/storage/blob/_shared/uploads_async.py +1 -1
  42. azure/storage/blob/_shared_access_signature.py +110 -52
  43. azure/storage/blob/_upload_helpers.py +75 -68
  44. azure/storage/blob/_version.py +1 -1
  45. azure/storage/blob/aio/__init__.py +19 -11
  46. azure/storage/blob/aio/_blob_client_async.py +554 -301
  47. azure/storage/blob/aio/_blob_service_client_async.py +148 -97
  48. azure/storage/blob/aio/_container_client_async.py +289 -140
  49. azure/storage/blob/aio/_download_async.py +485 -337
  50. azure/storage/blob/aio/_lease_async.py +61 -60
  51. azure/storage/blob/aio/_list_blobs_helper.py +94 -96
  52. azure/storage/blob/aio/_models.py +60 -38
  53. azure/storage/blob/aio/_upload_helpers.py +75 -66
  54. {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/METADATA +7 -7
  55. azure_storage_blob-12.23.0.dist-info/RECORD +84 -0
  56. {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/WHEEL +1 -1
  57. azure/storage/blob/_generated/_vendor.py +0 -16
  58. azure_storage_blob-12.21.0b1.dist-info/RECORD +0 -81
  59. {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/LICENSE +0 -0
  60. {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@
7
7
  # pylint: disable=super-init-not-called, too-many-lines
8
8
 
9
9
  from enum import Enum
10
- from typing import Dict, List, Optional, TYPE_CHECKING
10
+ from typing import Any, Callable, Dict, List, Optional, Union, TYPE_CHECKING
11
11
 
12
12
  from azure.core import CaseInsensitiveEnumMeta
13
13
  from azure.core.paging import PageIterator
@@ -16,23 +16,29 @@ from azure.core.exceptions import HttpResponseError
16
16
  from ._shared import decode_base64_to_bytes
17
17
  from ._shared.response_handlers import return_context_and_deserialized, process_storage_error
18
18
  from ._shared.models import DictMixin, get_enum_value
19
+ from ._generated.models import AccessPolicy as GenAccessPolicy
19
20
  from ._generated.models import ArrowField
21
+ from ._generated.models import CorsRule as GeneratedCorsRule
20
22
  from ._generated.models import Logging as GeneratedLogging
21
23
  from ._generated.models import Metrics as GeneratedMetrics
22
24
  from ._generated.models import RetentionPolicy as GeneratedRetentionPolicy
23
25
  from ._generated.models import StaticWebsite as GeneratedStaticWebsite
24
- from ._generated.models import CorsRule as GeneratedCorsRule
25
- from ._generated.models import AccessPolicy as GenAccessPolicy
26
26
 
27
27
  if TYPE_CHECKING:
28
28
  from datetime import datetime
29
+ from ._generated.models import PageList
29
30
 
30
31
  # Parse a generated PageList into a single list of PageRange sorted by start.
31
- def parse_page_list(page_list):
32
+ def parse_page_list(page_list: "PageList") -> List["PageRange"]:
32
33
 
33
34
  page_ranges = page_list.page_range
34
35
  clear_ranges = page_list.clear_range
35
36
 
37
+ if page_ranges is None:
38
+ raise ValueError("PageList's 'page_range' is malformed or None.")
39
+ if clear_ranges is None:
40
+ raise ValueError("PageList's 'clear_ranges' is malformed or None.")
41
+
36
42
  ranges = []
37
43
  p_i, c_i = 0, 0
38
44
 
@@ -42,18 +48,18 @@ def parse_page_list(page_list):
42
48
 
43
49
  if p.start < c.start:
44
50
  ranges.append(
45
- PageRange(p.start, p.end, cleared=False)
51
+ PageRange(start=p.start, end=p.end, cleared=False)
46
52
  )
47
53
  p_i += 1
48
54
  else:
49
55
  ranges.append(
50
- PageRange(c.start, c.end, cleared=True)
56
+ PageRange(start=c.start, end=c.end, cleared=True)
51
57
  )
52
58
  c_i += 1
53
59
 
54
60
  # Grab remaining elements in either list
55
- ranges += [PageRange(r.start, r.end, cleared=False) for r in page_ranges[p_i:]]
56
- ranges += [PageRange(r.start, r.end, cleared=True) for r in clear_ranges[c_i:]]
61
+ ranges += [PageRange(start=r.start, end=r.end, cleared=False) for r in page_ranges[p_i:]]
62
+ ranges += [PageRange(start=r.start, end=r.end, cleared=True) for r in clear_ranges[c_i:]]
57
63
 
58
64
  return ranges
59
65
 
@@ -168,6 +174,37 @@ class BlobImmutabilityPolicyMode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
168
174
  MUTABLE = "Mutable"
169
175
 
170
176
 
177
+ class RetentionPolicy(GeneratedRetentionPolicy):
178
+ """The retention policy which determines how long the associated data should
179
+ persist.
180
+
181
+ :param bool enabled:
182
+ Indicates whether a retention policy is enabled for the storage service.
183
+ The default value is False.
184
+ :param Optional[int] days:
185
+ Indicates the number of days that metrics or logging or
186
+ soft-deleted data should be retained. All data older than this value will
187
+ be deleted. If enabled=True, the number of days must be specified.
188
+ """
189
+
190
+ enabled: bool = False
191
+ days: Optional[int] = None
192
+
193
+ def __init__(self, enabled: bool = False, days: Optional[int] = None) -> None:
194
+ super(RetentionPolicy, self).__init__(enabled=enabled, days=days, allow_permanent_delete=None)
195
+ if self.enabled and (self.days is None):
196
+ raise ValueError("If policy is enabled, 'days' must be specified.")
197
+
198
+ @classmethod
199
+ def _from_generated(cls, generated):
200
+ if not generated:
201
+ return cls()
202
+ return cls(
203
+ enabled=generated.enabled,
204
+ days=generated.days,
205
+ )
206
+
207
+
171
208
  class BlobAnalyticsLogging(GeneratedLogging):
172
209
  """Azure Analytics Logging settings.
173
210
 
@@ -184,7 +221,18 @@ class BlobAnalyticsLogging(GeneratedLogging):
184
221
  policy will be disabled by default.
185
222
  """
186
223
 
187
- def __init__(self, **kwargs):
224
+ version: str = '1.0'
225
+ """The version of Storage Analytics to configure."""
226
+ delete: bool = False
227
+ """Indicates whether all delete requests should be logged."""
228
+ read: bool = False
229
+ """Indicates whether all read requests should be logged."""
230
+ write: bool = False
231
+ """Indicates whether all write requests should be logged."""
232
+ retention_policy: RetentionPolicy = RetentionPolicy()
233
+ """Determines how long the associated data should persist."""
234
+
235
+ def __init__(self, **kwargs: Any) -> None:
188
236
  self.version = kwargs.get('version', '1.0')
189
237
  self.delete = kwargs.get('delete', False)
190
238
  self.read = kwargs.get('read', False)
@@ -220,7 +268,16 @@ class Metrics(GeneratedMetrics):
220
268
  policy will be disabled by default.
221
269
  """
222
270
 
223
- def __init__(self, **kwargs):
271
+ version: str = '1.0'
272
+ """The version of Storage Analytics to configure."""
273
+ enabled: bool = False
274
+ """Indicates whether metrics are enabled for the Blob service."""
275
+ include_apis: Optional[bool]
276
+ """Indicates whether metrics should generate summary statistics for called API operations."""
277
+ retention_policy: RetentionPolicy = RetentionPolicy()
278
+ """Determines how long the associated data should persist."""
279
+
280
+ def __init__(self, **kwargs: Any) -> None:
224
281
  self.version = kwargs.get('version', '1.0')
225
282
  self.enabled = kwargs.get('enabled', False)
226
283
  self.include_apis = kwargs.get('include_apis')
@@ -238,34 +295,6 @@ class Metrics(GeneratedMetrics):
238
295
  )
239
296
 
240
297
 
241
- class RetentionPolicy(GeneratedRetentionPolicy):
242
- """The retention policy which determines how long the associated data should
243
- persist.
244
-
245
- :param bool enabled:
246
- Indicates whether a retention policy is enabled for the storage service.
247
- The default value is False.
248
- :param int days:
249
- Indicates the number of days that metrics or logging or
250
- soft-deleted data should be retained. All data older than this value will
251
- be deleted. If enabled=True, the number of days must be specified.
252
- """
253
-
254
- def __init__(self, enabled=False, days=None):
255
- super(RetentionPolicy, self).__init__(enabled=enabled, days=days, allow_permanent_delete=None)
256
- if self.enabled and (self.days is None):
257
- raise ValueError("If policy is enabled, 'days' must be specified.")
258
-
259
- @classmethod
260
- def _from_generated(cls, generated):
261
- if not generated:
262
- return cls()
263
- return cls(
264
- enabled=generated.enabled,
265
- days=generated.days,
266
- )
267
-
268
-
269
298
  class StaticWebsite(GeneratedStaticWebsite):
270
299
  """The properties that enable an account to host a static website.
271
300
 
@@ -280,7 +309,16 @@ class StaticWebsite(GeneratedStaticWebsite):
280
309
  Absolute path of the default index page.
281
310
  """
282
311
 
283
- def __init__(self, **kwargs):
312
+ enabled: bool = False
313
+ """Indicates whether this account is hosting a static website."""
314
+ index_document: Optional[str]
315
+ """The default name of the index page under each directory."""
316
+ error_document404_path: Optional[str]
317
+ """The absolute path of the custom 404 page."""
318
+ default_index_document_path: Optional[str]
319
+ """Absolute path of the default index page."""
320
+
321
+ def __init__(self, **kwargs: Any) -> None:
284
322
  self.enabled = kwargs.get('enabled', False)
285
323
  if self.enabled:
286
324
  self.index_document = kwargs.get('index_document')
@@ -331,13 +369,45 @@ class CorsRule(GeneratedCorsRule):
331
369
  preflight response.
332
370
  """
333
371
 
334
- def __init__(self, allowed_origins, allowed_methods, **kwargs):
372
+ allowed_origins: str
373
+ """The comma-delimited string representation of the list of origin domains that will be allowed via
374
+ CORS, or "*" to allow all domains."""
375
+ allowed_methods: str
376
+ """The comma-delimited string representation of the list HTTP methods that are allowed to be executed
377
+ by the origin."""
378
+ exposed_headers: str
379
+ """The comma-delimited string representation of the list of response headers to expose to CORS clients."""
380
+ allowed_headers: str
381
+ """The comma-delimited string representation of the list of headers allowed to be part of the cross-origin
382
+ request."""
383
+ max_age_in_seconds: int
384
+ """The number of seconds that the client/browser should cache a pre-flight response."""
385
+
386
+ def __init__(self, allowed_origins: List[str], allowed_methods: List[str], **kwargs: Any) -> None:
335
387
  self.allowed_origins = ','.join(allowed_origins)
336
388
  self.allowed_methods = ','.join(allowed_methods)
337
389
  self.allowed_headers = ','.join(kwargs.get('allowed_headers', []))
338
390
  self.exposed_headers = ','.join(kwargs.get('exposed_headers', []))
339
391
  self.max_age_in_seconds = kwargs.get('max_age_in_seconds', 0)
340
392
 
393
+ @staticmethod
394
+ def _to_generated(rules: Optional[List["CorsRule"]]) -> Optional[List[GeneratedCorsRule]]:
395
+ if rules is None:
396
+ return rules
397
+
398
+ generated_cors_list = []
399
+ for cors_rule in rules:
400
+ generated_cors = GeneratedCorsRule(
401
+ allowed_origins=cors_rule.allowed_origins,
402
+ allowed_methods=cors_rule.allowed_methods,
403
+ allowed_headers=cors_rule.allowed_headers,
404
+ exposed_headers=cors_rule.exposed_headers,
405
+ max_age_in_seconds=cors_rule.max_age_in_seconds
406
+ )
407
+ generated_cors_list.append(generated_cors)
408
+
409
+ return generated_cors_list
410
+
341
411
  @classmethod
342
412
  def _from_generated(cls, generated):
343
413
  return cls(
@@ -354,52 +424,46 @@ class ContainerProperties(DictMixin):
354
424
 
355
425
  Returned ``ContainerProperties`` instances expose these values through a
356
426
  dictionary interface, for example: ``container_props["last_modified"]``.
357
- Additionally, the container name is available as ``container_props["name"]``.
358
-
359
- :ivar str name:
360
- Name of the container.
361
- :ivar ~datetime.datetime last_modified:
362
- A datetime object representing the last time the container was modified.
363
- :ivar str etag:
364
- The ETag contains a value that you can use to perform operations
365
- conditionally.
366
- :ivar ~azure.storage.blob.LeaseProperties lease:
367
- Stores all the lease information for the container.
368
- :ivar str public_access: Specifies whether data in the container may be accessed
369
- publicly and the level of access.
370
- :ivar bool has_immutability_policy:
371
- Represents whether the container has an immutability policy.
372
- :ivar bool has_legal_hold:
373
- Represents whether the container has a legal hold.
374
- :ivar bool immutable_storage_with_versioning_enabled:
375
- Represents whether immutable storage with versioning enabled on the container.
376
-
377
- .. versionadded:: 12.10.0
378
- This was introduced in API version '2020-10-02'.
379
-
380
- :ivar dict metadata: A dict with name-value pairs to associate with the
381
- container as metadata.
382
- :ivar ~azure.storage.blob.ContainerEncryptionScope encryption_scope:
383
- The default encryption scope configuration for the container.
384
- :ivar bool deleted:
385
- Whether this container was deleted.
386
- :ivar str version:
387
- The version of a deleted container.
388
- """
427
+ Additionally, the container name is available as ``container_props["name"]``."""
389
428
 
390
- def __init__(self, **kwargs):
391
- self.name = None
392
- self.last_modified = kwargs.get('Last-Modified')
393
- self.etag = kwargs.get('ETag')
429
+ name: str
430
+ """Name of the container."""
431
+ last_modified: "datetime"
432
+ """A datetime object representing the last time the container was modified."""
433
+ etag: str
434
+ """The ETag contains a value that you can use to perform operations conditionally."""
435
+ lease: "LeaseProperties"
436
+ """Stores all the lease information for the container."""
437
+ public_access: Optional[str]
438
+ """Specifies whether data in the container may be accessed publicly and the level of access."""
439
+ has_immutability_policy: bool
440
+ """Represents whether the container has an immutability policy."""
441
+ has_legal_hold: bool
442
+ """Represents whether the container has a legal hold."""
443
+ immutable_storage_with_versioning_enabled: bool
444
+ """Represents whether immutable storage with versioning enabled on the container."""
445
+ metadata: Dict[str, Any]
446
+ """A dict with name-value pairs to associate with the container as metadata."""
447
+ encryption_scope: Optional["ContainerEncryptionScope"]
448
+ """The default encryption scope configuration for the container."""
449
+ deleted: Optional[bool]
450
+ """Whether this container was deleted."""
451
+ version: Optional[str]
452
+ """The version of a deleted container."""
453
+
454
+ def __init__(self, **kwargs: Any) -> None:
455
+ self.name = None # type: ignore [assignment]
456
+ self.last_modified = kwargs.get('Last-Modified') # type: ignore [assignment]
457
+ self.etag = kwargs.get('ETag') # type: ignore [assignment]
394
458
  self.lease = LeaseProperties(**kwargs)
395
459
  self.public_access = kwargs.get('x-ms-blob-public-access')
396
- self.has_immutability_policy = kwargs.get('x-ms-has-immutability-policy')
460
+ self.has_immutability_policy = kwargs.get('x-ms-has-immutability-policy') # type: ignore [assignment]
397
461
  self.deleted = None
398
462
  self.version = None
399
- self.has_legal_hold = kwargs.get('x-ms-has-legal-hold')
400
- self.metadata = kwargs.get('metadata')
463
+ self.has_legal_hold = kwargs.get('x-ms-has-legal-hold') # type: ignore [assignment]
464
+ self.metadata = kwargs.get('metadata') # type: ignore [assignment]
401
465
  self.encryption_scope = None
402
- self.immutable_storage_with_versioning_enabled = kwargs.get('x-ms-immutable-storage-with-versioning-enabled') # pylint: disable=name-too-long
466
+ self.immutable_storage_with_versioning_enabled = kwargs.get('x-ms-immutable-storage-with-versioning-enabled') # type: ignore [assignment] # pylint: disable=name-too-long
403
467
  default_encryption_scope = kwargs.get('x-ms-default-encryption-scope')
404
468
  if default_encryption_scope:
405
469
  self.encryption_scope = ContainerEncryptionScope(
@@ -428,24 +492,34 @@ class ContainerProperties(DictMixin):
428
492
  class ContainerPropertiesPaged(PageIterator):
429
493
  """An Iterable of Container properties.
430
494
 
431
- :ivar str service_endpoint: The service URL.
432
- :ivar str prefix: A container name prefix being used to filter the list.
433
- :ivar str marker: The continuation token of the current page of results.
434
- :ivar int results_per_page: The maximum number of results retrieved per API call.
435
- :ivar str continuation_token: The continuation token to retrieve the next page of results.
436
- :ivar str location_mode: The location mode being used to list results. The available
437
- options include "primary" and "secondary".
438
- :ivar current_page: The current page of listed results.
439
- :vartype current_page: list(~azure.storage.blob.ContainerProperties)
440
-
441
- :param callable command: Function to retrieve the next page of items.
442
- :param str prefix: Filters the results to return only containers whose names
495
+ :param Callable command: Function to retrieve the next page of items.
496
+ :param Optional[str] prefix: Filters the results to return only containers whose names
443
497
  begin with the specified prefix.
444
- :param int results_per_page: The maximum number of container names to retrieve per
445
- call.
446
- :param str continuation_token: An opaque continuation token.
498
+ :param Optional[int] results_per_page: The maximum number of container names to retrieve per call.
499
+ :param Optional[str] continuation_token: An opaque continuation token.
447
500
  """
448
- def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None):
501
+
502
+ service_endpoint: Optional[str]
503
+ """The service URL."""
504
+ prefix: Optional[str]
505
+ """A container name prefix being used to filter the list."""
506
+ marker: Optional[str]
507
+ """The continuation token of the current page of results."""
508
+ results_per_page: Optional[int]
509
+ """The maximum number of results retrieved per API call."""
510
+ continuation_token: Optional[str]
511
+ """The continuation token to retrieve the next page of results."""
512
+ location_mode: Optional[str]
513
+ """The location mode being used to list results."""
514
+ current_page: List["ContainerProperties"]
515
+ """The current page of listed results."""
516
+
517
+ def __init__(
518
+ self, command: Callable,
519
+ prefix: Optional[str] = None,
520
+ results_per_page: Optional[int] = None,
521
+ continuation_token: Optional[str] = None
522
+ ) -> None:
449
523
  super(ContainerPropertiesPaged, self).__init__(
450
524
  get_next=self._get_next_cb,
451
525
  extract_data=self._extract_data_cb,
@@ -498,7 +572,12 @@ class ImmutabilityPolicy(DictMixin):
498
572
  "Mutable" can only be returned by service, don't set to "Mutable".
499
573
  """
500
574
 
501
- def __init__(self, **kwargs):
575
+ expiry_time: Optional["datetime"] = None
576
+ """Specifies the date time when the blobs immutability policy is set to expire."""
577
+ policy_mode: Optional[str] = None
578
+ """Specifies the immutability policy mode to set on the blob."""
579
+
580
+ def __init__(self, **kwargs: Any) -> None:
502
581
  self.expiry_time = kwargs.pop('expiry_time', None)
503
582
  self.policy_mode = kwargs.pop('policy_mode', None)
504
583
 
@@ -511,33 +590,32 @@ class ImmutabilityPolicy(DictMixin):
511
590
 
512
591
 
513
592
  class FilteredBlob(DictMixin):
514
- """Blob info from a Filter Blobs API call.
515
-
516
- :ivar name: Blob name
517
- :type name: str
518
- :ivar container_name: Container name.
519
- :type container_name: str
520
- :ivar tags: Key value pairs of blob tags.
521
- :type tags: Dict[str, str]
522
- """
523
- def __init__(self, **kwargs):
593
+ """Blob info from a Filter Blobs API call."""
594
+
595
+ name: str
596
+ """Blob name"""
597
+ container_name: Optional[str]
598
+ """Container name."""
599
+ tags: Optional[Dict[str, str]]
600
+ """Key value pairs of blob tags."""
601
+
602
+ def __init__(self, **kwargs: Any) -> None:
524
603
  self.name = kwargs.get('name', None)
525
604
  self.container_name = kwargs.get('container_name', None)
526
605
  self.tags = kwargs.get('tags', None)
527
606
 
528
607
 
529
608
  class LeaseProperties(DictMixin):
530
- """Blob Lease Properties.
531
-
532
- :ivar str status:
533
- The lease status of the blob. Possible values: locked|unlocked
534
- :ivar str state:
535
- Lease state of the blob. Possible values: available|leased|expired|breaking|broken
536
- :ivar str duration:
537
- When a blob is leased, specifies whether the lease is of infinite or fixed duration.
538
- """
609
+ """Blob Lease Properties."""
539
610
 
540
- def __init__(self, **kwargs):
611
+ status: str
612
+ """The lease status of the blob. Possible values: locked|unlocked"""
613
+ state: str
614
+ """Lease state of the blob. Possible values: available|leased|expired|breaking|broken"""
615
+ duration: Optional[str]
616
+ """When a blob is leased, specifies whether the lease is of infinite or fixed duration."""
617
+
618
+ def __init__(self, **kwargs: Any) -> None:
541
619
  self.status = get_enum_value(kwargs.get('x-ms-lease-status'))
542
620
  self.state = get_enum_value(kwargs.get('x-ms-lease-state'))
543
621
  self.duration = get_enum_value(kwargs.get('x-ms-lease-duration'))
@@ -554,33 +632,51 @@ class LeaseProperties(DictMixin):
554
632
  class ContentSettings(DictMixin):
555
633
  """The content settings of a blob.
556
634
 
557
- :param str content_type:
635
+ :param Optional[str] content_type:
558
636
  The content type specified for the blob. If no content type was
559
637
  specified, the default content type is application/octet-stream.
560
- :param str content_encoding:
638
+ :param Optional[str] content_encoding:
561
639
  If the content_encoding has previously been set
562
640
  for the blob, that value is stored.
563
- :param str content_language:
641
+ :param Optional[str] content_language:
564
642
  If the content_language has previously been set
565
643
  for the blob, that value is stored.
566
- :param str content_disposition:
644
+ :param Optional[str] content_disposition:
567
645
  content_disposition conveys additional information about how to
568
646
  process the response payload, and also can be used to attach
569
647
  additional metadata. If content_disposition has previously been set
570
648
  for the blob, that value is stored.
571
- :param str cache_control:
649
+ :param Optional[str] cache_control:
572
650
  If the cache_control has previously been set for
573
651
  the blob, that value is stored.
574
- :param bytearray content_md5:
652
+ :param Optional[bytearray] content_md5:
575
653
  If the content_md5 has been set for the blob, this response
576
654
  header is stored so that the client can check for message content
577
655
  integrity.
578
656
  """
579
657
 
658
+ content_type: Optional[str] = None
659
+ """The content type specified for the blob."""
660
+ content_encoding: Optional[str] = None
661
+ """The content encoding specified for the blob."""
662
+ content_language: Optional[str] = None
663
+ """The content language specified for the blob."""
664
+ content_disposition: Optional[str] = None
665
+ """The content disposition specified for the blob."""
666
+ cache_control: Optional[str] = None
667
+ """The cache control specified for the blob."""
668
+ content_md5: Optional[bytearray] = None
669
+ """The content md5 specified for the blob."""
670
+
580
671
  def __init__(
581
- self, content_type=None, content_encoding=None,
582
- content_language=None, content_disposition=None,
583
- cache_control=None, content_md5=None, **kwargs):
672
+ self, content_type: Optional[str] = None,
673
+ content_encoding: Optional[str] = None,
674
+ content_language: Optional[str] = None,
675
+ content_disposition: Optional[str] = None,
676
+ cache_control: Optional[str] = None,
677
+ content_md5: Optional[bytearray] = None,
678
+ **kwargs: Any
679
+ ) -> None:
584
680
 
585
681
  self.content_type = content_type or kwargs.get('Content-Type')
586
682
  self.content_encoding = content_encoding or kwargs.get('Content-Encoding')
@@ -607,46 +703,42 @@ class CopyProperties(DictMixin):
607
703
  These properties will be `None` if this blob has never been the destination
608
704
  in a Copy Blob operation, or if this blob has been modified after a concluded
609
705
  Copy Blob operation, for example, using Set Blob Properties, Upload Blob, or Commit Block List.
706
+ """
610
707
 
611
- :ivar str id:
612
- String identifier for the last attempted Copy Blob operation where this blob
613
- was the destination blob.
614
- :ivar str source:
615
- URL up to 2 KB in length that specifies the source blob used in the last attempted
616
- Copy Blob operation where this blob was the destination blob.
617
- :ivar str status:
618
- State of the copy operation identified by Copy ID, with these values:
619
- success:
620
- Copy completed successfully.
621
- pending:
622
- Copy is in progress. Check copy_status_description if intermittent,
623
- non-fatal errors impede copy progress but don't cause failure.
624
- aborted:
625
- Copy was ended by Abort Copy Blob.
626
- failed:
627
- Copy failed. See copy_status_description for failure details.
628
- :ivar str progress:
629
- Contains the number of bytes copied and the total bytes in the source in the last
708
+ id: Optional[str]
709
+ """String identifier for the last attempted Copy Blob operation where this blob
710
+ was the destination blob."""
711
+ source: Optional[str]
712
+ """URL up to 2 KB in length that specifies the source blob used in the last attempted
713
+ Copy Blob operation where this blob was the destination blob."""
714
+ status: Optional[str]
715
+ """State of the copy operation identified by Copy ID, with these values:
716
+ success: Copy completed successfully.
717
+ pending: Copy is in progress. Check copy_status_description if intermittent, non-fatal errors impede copy progress
718
+ but don't cause failure.
719
+ aborted: Copy was ended by Abort Copy Blob.
720
+ failed: Copy failed. See copy_status_description for failure details."""
721
+ progress: Optional[str]
722
+ """Contains the number of bytes copied and the total bytes in the source in the last
630
723
  attempted Copy Blob operation where this blob was the destination blob. Can show
631
- between 0 and Content-Length bytes copied.
632
- :ivar ~datetime.datetime completion_time:
633
- Conclusion time of the last attempted Copy Blob operation where this blob was the
724
+ between 0 and Content-Length bytes copied."""
725
+ completion_time: Optional["datetime"]
726
+ """Conclusion time of the last attempted Copy Blob operation where this blob was the
634
727
  destination blob. This value can specify the time of a completed, aborted, or
635
- failed copy attempt.
636
- :ivar str status_description:
637
- Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal
638
- or non-fatal copy operation failure.
639
- :ivar bool incremental_copy:
640
- Copies the snapshot of the source page blob to a destination page blob.
728
+ failed copy attempt."""
729
+ status_description: Optional[str]
730
+ """Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal
731
+ or non-fatal copy operation failure."""
732
+ incremental_copy: Optional[bool]
733
+ """Copies the snapshot of the source page blob to a destination page blob.
641
734
  The snapshot is copied such that only the differential changes between
642
- the previously copied snapshot are transferred to the destination
643
- :ivar ~datetime.datetime destination_snapshot:
644
- Included if the blob is incremental copy blob or incremental copy snapshot,
735
+ the previously copied snapshot are transferred to the destination."""
736
+ destination_snapshot: Optional["datetime"]
737
+ """Included if the blob is incremental copy blob or incremental copy snapshot,
645
738
  if x-ms-copy-status is success. Snapshot time of the last successful
646
- incremental copy snapshot for this blob.
647
- """
739
+ incremental copy snapshot for this blob."""
648
740
 
649
- def __init__(self, **kwargs):
741
+ def __init__(self, **kwargs: Any) -> None:
650
742
  self.id = kwargs.get('x-ms-copy-id')
651
743
  self.source = kwargs.get('x-ms-copy-source')
652
744
  self.status = get_enum_value(kwargs.get('x-ms-copy-status'))
@@ -675,16 +767,21 @@ class BlobBlock(DictMixin):
675
767
 
676
768
  :param str block_id:
677
769
  Block id.
678
- :param str state:
679
- Block state. Possible values: committed|uncommitted
680
- :ivar int size:
681
- Block size in bytes.
770
+ :param BlockState state:
771
+ Block state. Possible values: BlockState.COMMITTED | BlockState.UNCOMMITTED
682
772
  """
683
773
 
684
- def __init__(self, block_id, state=BlockState.Latest):
774
+ block_id: str
775
+ """Block id."""
776
+ state: BlockState
777
+ """Block state."""
778
+ size: int
779
+ """Block size."""
780
+
781
+ def __init__(self, block_id: str, state: BlockState = BlockState.LATEST) -> None:
685
782
  self.id = block_id
686
783
  self.state = state
687
- self.size = None
784
+ self.size = None # type: ignore [assignment]
688
785
 
689
786
  @classmethod
690
787
  def _from_generated(cls, generated):
@@ -708,11 +805,16 @@ class PageRange(DictMixin):
708
805
  Start of page range in bytes.
709
806
  :param int end:
710
807
  End of page range in bytes.
711
- :ivar bool cleared:
712
- Whether the range has been cleared.
713
808
  """
714
809
 
715
- def __init__(self, start=None, end=None, *, cleared=False):
810
+ start: Optional[int] = None
811
+ """Start of page range in bytes."""
812
+ end: Optional[int] = None
813
+ """End of page range in bytes."""
814
+ cleared: bool
815
+ """Whether the range has been cleared."""
816
+
817
+ def __init__(self, start: Optional[int] = None, end: Optional[int] = None, *, cleared: bool = False) -> None:
716
818
  self.start = start
717
819
  self.end = end
718
820
  self.cleared = cleared
@@ -754,54 +856,6 @@ class PageRangePaged(PageIterator):
754
856
  return parse_page_list(response)
755
857
 
756
858
 
757
- class AccessPolicy(GenAccessPolicy):
758
- """Access Policy class used by the set and get access policy methods in each service.
759
-
760
- A stored access policy can specify the start time, expiry time, and
761
- permissions for the Shared Access Signatures with which it's associated.
762
- Depending on how you want to control access to your resource, you can
763
- specify all of these parameters within the stored access policy, and omit
764
- them from the URL for the Shared Access Signature. Doing so permits you to
765
- modify the associated signature's behavior at any time, as well as to revoke
766
- it. Or you can specify one or more of the access policy parameters within
767
- the stored access policy, and the others on the URL. Finally, you can
768
- specify all of the parameters on the URL. In this case, you can use the
769
- stored access policy to revoke the signature, but not to modify its behavior.
770
-
771
- Together the Shared Access Signature and the stored access policy must
772
- include all fields required to authenticate the signature. If any required
773
- fields are missing, the request will fail. Likewise, if a field is specified
774
- both in the Shared Access Signature URL and in the stored access policy, the
775
- request will fail with status code 400 (Bad Request).
776
-
777
- :param permission:
778
- The permissions associated with the shared access signature. The
779
- user is restricted to operations allowed by the permissions.
780
- Required unless an id is given referencing a stored access policy
781
- which contains this field. This field must be omitted if it has been
782
- specified in an associated stored access policy.
783
- :type permission: str or ~azure.storage.blob.ContainerSasPermissions
784
- :param expiry:
785
- The time at which the shared access signature becomes invalid.
786
- Required unless an id is given referencing a stored access policy
787
- which contains this field. This field must be omitted if it has
788
- been specified in an associated stored access policy. Azure will always
789
- convert values to UTC. If a date is passed in without timezone info, it
790
- is assumed to be UTC.
791
- :type expiry: ~datetime.datetime or str
792
- :param start:
793
- The time at which the shared access signature becomes valid. If
794
- omitted, start time for this call is assumed to be the time when the
795
- storage service receives the request. The provided datetime will always
796
- be interpreted as UTC.
797
- :type start: ~datetime.datetime or str
798
- """
799
- def __init__(self, permission=None, expiry=None, start=None):
800
- self.start = start
801
- self.expiry = expiry
802
- self.permission = permission
803
-
804
-
805
859
  class ContainerSasPermissions(object):
806
860
  """ContainerSasPermissions class to be used with the
807
861
  :func:`~azure.storage.blob.generate_container_sas` function and
@@ -844,8 +898,43 @@ class ContainerSasPermissions(object):
844
898
  To enable operations related to set/delete immutability policy.
845
899
  To get immutability policy, you just need read permission.
846
900
  """
847
- def __init__(self, read=False, write=False, delete=False,
848
- list=False, delete_previous_version=False, tag=False, **kwargs): # pylint: disable=redefined-builtin
901
+
902
+ read: bool = False
903
+ """The read permission for container SAS."""
904
+ write: bool = False
905
+ """The write permission for container SAS."""
906
+ delete: bool = False
907
+ """The delete permission for container SAS."""
908
+ delete_previous_version: bool = False
909
+ """Permission to delete previous blob version for versioning enabled
910
+ storage accounts."""
911
+ list: bool = False
912
+ """The list permission for container SAS."""
913
+ tag: bool = False
914
+ """Set or get tags on the blobs in the container."""
915
+ add: Optional[bool]
916
+ """Add a block to an append blob."""
917
+ create: Optional[bool]
918
+ """Write a new blob, snapshot a blob, or copy a blob to a new blob."""
919
+ permanent_delete: Optional[bool]
920
+ """To enable permanent delete on the blob is permitted."""
921
+ move: Optional[bool]
922
+ """Move a blob or a directory and its contents to a new location."""
923
+ execute: Optional[bool]
924
+ """Get the system properties and, if the hierarchical namespace is enabled for the storage account,
925
+ get the POSIX ACL of a blob."""
926
+ set_immutability_policy: Optional[bool]
927
+ """To get immutability policy, you just need read permission."""
928
+
929
+ def __init__(
930
+ self, read: bool = False,
931
+ write: bool = False,
932
+ delete: bool = False,
933
+ list: bool = False,
934
+ delete_previous_version: bool = False,
935
+ tag: bool = False,
936
+ **kwargs: Any
937
+ ) -> None: # pylint: disable=redefined-builtin
849
938
  self.read = read
850
939
  self.add = kwargs.pop('add', False)
851
940
  self.create = kwargs.pop('create', False)
@@ -877,7 +966,7 @@ class ContainerSasPermissions(object):
877
966
  return self._str
878
967
 
879
968
  @classmethod
880
- def from_string(cls, permission):
969
+ def from_string(cls, permission: str) -> "ContainerSasPermissions":
881
970
  """Create a ContainerSasPermissions from a string.
882
971
 
883
972
  To specify read, write, delete, or list permissions you need only to
@@ -910,6 +999,68 @@ class ContainerSasPermissions(object):
910
999
  return parsed
911
1000
 
912
1001
 
1002
+ class AccessPolicy(GenAccessPolicy):
1003
+ """Access Policy class used by the set and get access policy methods in each service.
1004
+
1005
+ A stored access policy can specify the start time, expiry time, and
1006
+ permissions for the Shared Access Signatures with which it's associated.
1007
+ Depending on how you want to control access to your resource, you can
1008
+ specify all of these parameters within the stored access policy, and omit
1009
+ them from the URL for the Shared Access Signature. Doing so permits you to
1010
+ modify the associated signature's behavior at any time, as well as to revoke
1011
+ it. Or you can specify one or more of the access policy parameters within
1012
+ the stored access policy, and the others on the URL. Finally, you can
1013
+ specify all of the parameters on the URL. In this case, you can use the
1014
+ stored access policy to revoke the signature, but not to modify its behavior.
1015
+
1016
+ Together the Shared Access Signature and the stored access policy must
1017
+ include all fields required to authenticate the signature. If any required
1018
+ fields are missing, the request will fail. Likewise, if a field is specified
1019
+ both in the Shared Access Signature URL and in the stored access policy, the
1020
+ request will fail with status code 400 (Bad Request).
1021
+
1022
+ :param permission:
1023
+ The permissions associated with the shared access signature. The
1024
+ user is restricted to operations allowed by the permissions.
1025
+ Required unless an id is given referencing a stored access policy
1026
+ which contains this field. This field must be omitted if it has been
1027
+ specified in an associated stored access policy.
1028
+ :type permission: Optional[Union[ContainerSasPermissions, str]]
1029
+ :param expiry:
1030
+ The time at which the shared access signature becomes invalid.
1031
+ Required unless an id is given referencing a stored access policy
1032
+ which contains this field. This field must be omitted if it has
1033
+ been specified in an associated stored access policy. Azure will always
1034
+ convert values to UTC. If a date is passed in without timezone info, it
1035
+ is assumed to be UTC.
1036
+ :paramtype expiry: Optional[Union[str, datetime]]
1037
+ :param start:
1038
+ The time at which the shared access signature becomes valid. If
1039
+ omitted, start time for this call is assumed to be the time when the
1040
+ storage service receives the request. Azure will always convert values
1041
+ to UTC. If a date is passed in without timezone info, it is assumed to
1042
+ be UTC.
1043
+ :paramtype start: Optional[Union[str, datetime]]
1044
+ """
1045
+
1046
+ permission: Optional[Union[ContainerSasPermissions, str]] # type: ignore [assignment]
1047
+ """The permissions associated with the shared access signature. The user is restricted to
1048
+ operations allowed by the permissions."""
1049
+ expiry: Optional[Union["datetime", str]] # type: ignore [assignment]
1050
+ """The time at which the shared access signature becomes invalid."""
1051
+ start: Optional[Union["datetime", str]] # type: ignore [assignment]
1052
+ """The time at which the shared access signature becomes valid."""
1053
+
1054
+ def __init__(
1055
+ self, permission: Optional[Union["ContainerSasPermissions", str]] = None,
1056
+ expiry: Optional[Union[str, "datetime"]] = None,
1057
+ start: Optional[Union[str, "datetime"]] = None
1058
+ ) -> None:
1059
+ self.start = start
1060
+ self.expiry = expiry
1061
+ self.permission = permission
1062
+
1063
+
913
1064
  class BlobSasPermissions(object):
914
1065
  """BlobSasPermissions class to be used with the
915
1066
  :func:`~azure.storage.blob.generate_blob_sas` function.
@@ -942,8 +1093,42 @@ class BlobSasPermissions(object):
942
1093
  To enable operations related to set/delete immutability policy.
943
1094
  To get immutability policy, you just need read permission.
944
1095
  """
945
- def __init__(self, read=False, add=False, create=False, write=False,
946
- delete=False, delete_previous_version=False, tag=False, **kwargs):
1096
+
1097
+ read: bool = False
1098
+ """The read permission for Blob SAS."""
1099
+ add: Optional[bool]
1100
+ """The add permission for Blob SAS."""
1101
+ create: Optional[bool]
1102
+ """Write a new blob, snapshot a blob, or copy a blob to a new blob."""
1103
+ write: bool = False
1104
+ """The write permission for Blob SAS."""
1105
+ delete: bool = False
1106
+ """The delete permission for Blob SAS."""
1107
+ delete_previous_version: bool = False
1108
+ """Permission to delete previous blob version for versioning enabled
1109
+ storage accounts."""
1110
+ tag: bool = False
1111
+ """Set or get tags on the blobs in the Blob."""
1112
+ permanent_delete: Optional[bool]
1113
+ """To enable permanent delete on the blob is permitted."""
1114
+ move: Optional[bool]
1115
+ """Move a blob or a directory and its contents to a new location."""
1116
+ execute: Optional[bool]
1117
+ """Get the system properties and, if the hierarchical namespace is enabled for the storage account,
1118
+ get the POSIX ACL of a blob."""
1119
+ set_immutability_policy: Optional[bool]
1120
+ """To get immutability policy, you just need read permission."""
1121
+
1122
+ def __init__(
1123
+ self, read: bool = False,
1124
+ add: bool = False,
1125
+ create: bool = False,
1126
+ write: bool = False,
1127
+ delete: bool = False,
1128
+ delete_previous_version: bool = False,
1129
+ tag: bool = False,
1130
+ **kwargs: Any
1131
+ ) -> None:
947
1132
  self.read = read
948
1133
  self.add = add
949
1134
  self.create = create
@@ -971,7 +1156,7 @@ class BlobSasPermissions(object):
971
1156
  return self._str
972
1157
 
973
1158
  @classmethod
974
- def from_string(cls, permission):
1159
+ def from_string(cls, permission: str) -> "BlobSasPermissions":
975
1160
  """Create a BlobSasPermissions from a string.
976
1161
 
977
1162
  To specify read, add, create, write, or delete permissions you need only to
@@ -1021,10 +1206,16 @@ class CustomerProvidedEncryptionKey(object):
1021
1206
  Base64-encoded AES-256 encryption key value.
1022
1207
  :param str key_hash:
1023
1208
  Base64-encoded SHA256 of the encryption key.
1024
- :ivar str algorithm:
1025
- Specifies the algorithm to use when encrypting data using the given key. Must be AES256.
1026
1209
  """
1027
- def __init__(self, key_value, key_hash):
1210
+
1211
+ key_value: str
1212
+ """Base64-encoded AES-256 encryption key value."""
1213
+ key_hash: str
1214
+ """Base64-encoded SHA256 of the encryption key."""
1215
+ algorithm: str
1216
+ """Specifies the algorithm to use when encrypting data using the given key. Must be AES256."""
1217
+
1218
+ def __init__(self, key_value: str, key_hash: str) -> None:
1028
1219
  self.key_value = key_value
1029
1220
  self.key_hash = key_hash
1030
1221
  self.algorithm = 'AES256'
@@ -1046,7 +1237,14 @@ class ContainerEncryptionScope(object):
1046
1237
  set on the container. Default value is false.
1047
1238
  """
1048
1239
 
1049
- def __init__(self, default_encryption_scope, **kwargs):
1240
+ default_encryption_scope: str
1241
+ """Specifies the default encryption scope to set on the container and use for
1242
+ all future writes."""
1243
+ prevent_encryption_scope_override: bool
1244
+ """If true, prevents any request from specifying a different encryption scope than the scope
1245
+ set on the container."""
1246
+
1247
+ def __init__(self, default_encryption_scope: str, **kwargs: Any) -> None:
1050
1248
  self.default_encryption_scope = default_encryption_scope
1051
1249
  self.prevent_encryption_scope_override = kwargs.get('prevent_encryption_scope_override', False)
1052
1250
 
@@ -1064,10 +1262,10 @@ class ContainerEncryptionScope(object):
1064
1262
  class DelimitedJsonDialect(DictMixin):
1065
1263
  """Defines the input or output JSON serialization for a blob data query.
1066
1264
 
1067
- :keyword str delimiter: The line separator character, default value is '\n'
1265
+ :keyword str delimiter: The line separator character, default value is '\\\\n'.
1068
1266
  """
1069
1267
 
1070
- def __init__(self, **kwargs):
1268
+ def __init__(self, **kwargs: Any) -> None:
1071
1269
  self.delimiter = kwargs.pop('delimiter', '\n')
1072
1270
 
1073
1271
 
@@ -1087,7 +1285,8 @@ class DelimitedTextDialect(DictMixin):
1087
1285
  data will be returned inclusive of the first line. If set to True, the data will be returned exclusive
1088
1286
  of the first line.
1089
1287
  """
1090
- def __init__(self, **kwargs):
1288
+
1289
+ def __init__(self, **kwargs: Any) -> None:
1091
1290
  self.delimiter = kwargs.pop('delimiter', ',')
1092
1291
  self.quotechar = kwargs.pop('quotechar', '"')
1093
1292
  self.lineterminator = kwargs.pop('lineterminator', '\n')
@@ -1105,7 +1304,8 @@ class ArrowDialect(ArrowField):
1105
1304
  :keyword int precision: The precision of the field.
1106
1305
  :keyword int scale: The scale of the field.
1107
1306
  """
1108
- def __init__(self, type, **kwargs): # pylint: disable=redefined-builtin
1307
+
1308
+ def __init__(self, type, **kwargs: Any) -> None: # pylint: disable=redefined-builtin
1109
1309
  super(ArrowDialect, self).__init__(type=type, **kwargs)
1110
1310
 
1111
1311
 
@@ -1119,19 +1319,31 @@ class ArrowType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1119
1319
  DECIMAL = 'decimal'
1120
1320
 
1121
1321
 
1322
+ class ObjectReplicationRule(DictMixin):
1323
+ """Policy id and rule ids applied to a blob."""
1324
+
1325
+ rule_id: str
1326
+ """Rule id."""
1327
+ status: str
1328
+ """The status of the rule. It could be "Complete" or "Failed" """
1329
+
1330
+ def __init__(self, **kwargs: Any) -> None:
1331
+ self.rule_id = kwargs.pop('rule_id', None) # type: ignore [assignment]
1332
+ self.status = kwargs.pop('status', None) # type: ignore [assignment]
1333
+
1334
+
1122
1335
  class ObjectReplicationPolicy(DictMixin):
1123
- """Policy id and rule ids applied to a blob.
1336
+ """Policy id and rule ids applied to a blob."""
1124
1337
 
1125
- :ivar str policy_id:
1126
- Policy id for the blob. A replication policy gets created (policy id) when creating a source/destination pair.
1127
- :ivar list(~azure.storage.blob.ObjectReplicationRule) rules:
1128
- Within each policy there may be multiple replication rules.
1129
- e.g. rule 1= src/container/.pdf to dst/container2/; rule2 = src/container1/.jpg to dst/container3
1130
- """
1338
+ policy_id: str
1339
+ """Policy id for the blob. A replication policy gets created (policy id) when creating a source/destination pair."""
1340
+ rules: List[ObjectReplicationRule]
1341
+ """Within each policy there may be multiple replication rules.
1342
+ e.g. rule 1= src/container/.pdf to dst/container2/; rule2 = src/container1/.jpg to dst/container3"""
1131
1343
 
1132
- def __init__(self, **kwargs):
1133
- self.policy_id = kwargs.pop('policy_id', None)
1134
- self.rules = kwargs.pop('rules', None)
1344
+ def __init__(self, **kwargs: Any) -> None:
1345
+ self.policy_id = kwargs.pop('policy_id', None) # type: ignore [assignment]
1346
+ self.rules = kwargs.pop('rules', [])
1135
1347
 
1136
1348
 
1137
1349
  class BlobProperties(DictMixin):
@@ -1225,23 +1437,23 @@ class BlobProperties(DictMixin):
1225
1437
  """Specified if a legal hold should be set on the blob.
1226
1438
  Currently this parameter of upload_blob() API is for BlockBlob only."""
1227
1439
 
1228
- def __init__(self, **kwargs):
1229
- self.name = kwargs.get('name')
1230
- self.container = None
1440
+ def __init__(self, **kwargs: Any) -> None:
1441
+ self.name = kwargs.get('name') # type: ignore [assignment]
1442
+ self.container = None # type: ignore [assignment]
1231
1443
  self.snapshot = kwargs.get('x-ms-snapshot')
1232
1444
  self.version_id = kwargs.get('x-ms-version-id')
1233
1445
  self.is_current_version = kwargs.get('x-ms-is-current-version')
1234
- self.blob_type = BlobType(kwargs['x-ms-blob-type']) if kwargs.get('x-ms-blob-type') else None
1235
- self.metadata = kwargs.get('metadata')
1446
+ self.blob_type = BlobType(kwargs['x-ms-blob-type']) if kwargs.get('x-ms-blob-type') else None # type: ignore [assignment] # pylint: disable=line-too-long
1447
+ self.metadata = kwargs.get('metadata') # type: ignore [assignment]
1236
1448
  self.encrypted_metadata = kwargs.get('encrypted_metadata')
1237
- self.last_modified = kwargs.get('Last-Modified')
1238
- self.etag = kwargs.get('ETag')
1239
- self.size = kwargs.get('Content-Length')
1449
+ self.last_modified = kwargs.get('Last-Modified') # type: ignore [assignment]
1450
+ self.etag = kwargs.get('ETag') # type: ignore [assignment]
1451
+ self.size = kwargs.get('Content-Length') # type: ignore [assignment]
1240
1452
  self.content_range = kwargs.get('Content-Range')
1241
1453
  self.append_blob_committed_block_count = kwargs.get('x-ms-blob-committed-block-count')
1242
1454
  self.is_append_blob_sealed = kwargs.get('x-ms-blob-sealed')
1243
1455
  self.page_blob_sequence_number = kwargs.get('x-ms-blob-sequence-number')
1244
- self.server_encrypted = kwargs.get('x-ms-server-encrypted')
1456
+ self.server_encrypted = kwargs.get('x-ms-server-encrypted') # type: ignore [assignment]
1245
1457
  self.copy = CopyProperties(**kwargs)
1246
1458
  self.content_settings = ContentSettings(**kwargs)
1247
1459
  self.lease = LeaseProperties(**kwargs)
@@ -1252,7 +1464,7 @@ class BlobProperties(DictMixin):
1252
1464
  self.deleted = False
1253
1465
  self.deleted_time = None
1254
1466
  self.remaining_retention_days = None
1255
- self.creation_time = kwargs.get('x-ms-creation-time')
1467
+ self.creation_time = kwargs.get('x-ms-creation-time') # type: ignore [assignment]
1256
1468
  self.archive_status = kwargs.get('x-ms-archive-status')
1257
1469
  self.encryption_key_sha256 = kwargs.get('x-ms-encryption-key-sha256')
1258
1470
  self.encryption_scope = kwargs.get('x-ms-encryption-scope')
@@ -1268,35 +1480,26 @@ class BlobProperties(DictMixin):
1268
1480
  self.has_versions_only = None
1269
1481
 
1270
1482
 
1271
- class ObjectReplicationRule(DictMixin):
1272
- """Policy id and rule ids applied to a blob.
1273
-
1274
- :ivar str rule_id:
1275
- Rule id.
1276
- :ivar str status:
1277
- The status of the rule. It could be "Complete" or "Failed"
1278
- """
1279
-
1280
- def __init__(self, **kwargs):
1281
- self.rule_id = kwargs.pop('rule_id', None)
1282
- self.status = kwargs.pop('status', None)
1283
-
1284
-
1285
1483
  class BlobQueryError(object):
1286
- """The error happened during quick query operation.
1484
+ """The error happened during quick query operation."""
1287
1485
 
1288
- :ivar str error:
1289
- The name of the error.
1290
- :ivar bool is_fatal:
1291
- If true, this error prevents further query processing. More result data may be returned,
1486
+ error: Optional[str]
1487
+ """The name of the error."""
1488
+ is_fatal: bool
1489
+ """If true, this error prevents further query processing. More result data may be returned,
1292
1490
  but there is no guarantee that all of the original data will be processed.
1293
- If false, this error does not prevent further query processing.
1294
- :ivar str description:
1295
- A description of the error.
1296
- :ivar int position:
1297
- The blob offset at which the error occurred.
1298
- """
1299
- def __init__(self, error=None, is_fatal=False, description=None, position=None):
1491
+ If false, this error does not prevent further query processing."""
1492
+ description: Optional[str]
1493
+ """A description of the error."""
1494
+ position: Optional[int]
1495
+ """The blob offset at which the error occurred."""
1496
+
1497
+ def __init__(
1498
+ self, error: Optional[str] = None,
1499
+ is_fatal: bool = False,
1500
+ description: Optional[str] = None,
1501
+ position: Optional[int] = None
1502
+ ) -> None:
1300
1503
  self.error = error
1301
1504
  self.is_fatal = is_fatal
1302
1505
  self.description = description