azure-storage-blob 12.20.0__py3-none-any.whl → 12.21.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.
- azure/storage/blob/_blob_client.py +53 -48
- azure/storage/blob/_blob_service_client.py +11 -11
- azure/storage/blob/_container_client.py +22 -20
- azure/storage/blob/_download.py +277 -167
- azure/storage/blob/_generated/_azure_blob_storage.py +1 -1
- azure/storage/blob/_generated/_configuration.py +2 -2
- azure/storage/blob/_generated/_patch.py +2 -0
- azure/storage/blob/_generated/_serialization.py +1 -1
- azure/storage/blob/_generated/aio/_azure_blob_storage.py +1 -1
- azure/storage/blob/_generated/aio/_configuration.py +2 -2
- azure/storage/blob/_generated/aio/_patch.py +2 -0
- azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +10 -5
- azure/storage/blob/_generated/aio/operations/_blob_operations.py +45 -26
- azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +12 -7
- azure/storage/blob/_generated/aio/operations/_container_operations.py +39 -20
- azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +15 -10
- azure/storage/blob/_generated/aio/operations/_patch.py +3 -0
- azure/storage/blob/_generated/aio/operations/_service_operations.py +28 -10
- azure/storage/blob/_generated/models/_patch.py +3 -0
- azure/storage/blob/_generated/operations/_append_blob_operations.py +14 -9
- azure/storage/blob/_generated/operations/_blob_operations.py +76 -51
- azure/storage/blob/_generated/operations/_block_blob_operations.py +18 -13
- azure/storage/blob/_generated/operations/_container_operations.py +64 -39
- azure/storage/blob/_generated/operations/_page_blob_operations.py +24 -19
- azure/storage/blob/_generated/operations/_patch.py +3 -0
- azure/storage/blob/_generated/operations/_service_operations.py +43 -19
- azure/storage/blob/_generated/py.typed +1 -0
- azure/storage/blob/_lease.py +5 -5
- azure/storage/blob/_models.py +1 -1
- azure/storage/blob/_serialize.py +1 -0
- azure/storage/blob/_shared/authentication.py +62 -4
- azure/storage/blob/_shared/base_client.py +1 -1
- azure/storage/blob/_shared/base_client_async.py +3 -2
- azure/storage/blob/_version.py +1 -1
- azure/storage/blob/aio/_blob_client_async.py +49 -46
- azure/storage/blob/aio/_blob_service_client_async.py +10 -10
- azure/storage/blob/aio/_container_client_async.py +22 -19
- azure/storage/blob/aio/_download_async.py +317 -209
- azure/storage/blob/aio/_lease_async.py +5 -5
- {azure_storage_blob-12.20.0.dist-info → azure_storage_blob-12.21.0.dist-info}/METADATA +6 -6
- {azure_storage_blob-12.20.0.dist-info → azure_storage_blob-12.21.0.dist-info}/RECORD +44 -43
- {azure_storage_blob-12.20.0.dist-info → azure_storage_blob-12.21.0.dist-info}/WHEEL +1 -1
- {azure_storage_blob-12.20.0.dist-info → azure_storage_blob-12.21.0.dist-info}/LICENSE +0 -0
- {azure_storage_blob-12.20.0.dist-info → azure_storage_blob-12.21.0.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,8 @@
|
|
6
6
|
# Code generated by Microsoft (R) AutoRest Code Generator.
|
7
7
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
8
8
|
# --------------------------------------------------------------------------
|
9
|
-
|
9
|
+
import sys
|
10
|
+
from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, Type, TypeVar, Union
|
10
11
|
|
11
12
|
from azure.core.exceptions import (
|
12
13
|
ClientAuthenticationError,
|
@@ -26,6 +27,10 @@ from .. import models as _models
|
|
26
27
|
from .._serialization import Serializer
|
27
28
|
from .._vendor import _convert_request
|
28
29
|
|
30
|
+
if sys.version_info >= (3, 9):
|
31
|
+
from collections.abc import MutableMapping
|
32
|
+
else:
|
33
|
+
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
|
29
34
|
T = TypeVar("T")
|
30
35
|
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
31
36
|
|
@@ -42,7 +47,7 @@ def build_set_properties_request(
|
|
42
47
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
43
48
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
44
49
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
45
|
-
version: Literal["
|
50
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
46
51
|
accept = _headers.pop("Accept", "application/xml")
|
47
52
|
|
48
53
|
# Construct URL
|
@@ -78,7 +83,7 @@ def build_get_properties_request(
|
|
78
83
|
|
79
84
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
80
85
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
81
|
-
version: Literal["
|
86
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
82
87
|
accept = _headers.pop("Accept", "application/xml")
|
83
88
|
|
84
89
|
# Construct URL
|
@@ -112,7 +117,7 @@ def build_get_statistics_request(
|
|
112
117
|
|
113
118
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
114
119
|
comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats"))
|
115
|
-
version: Literal["
|
120
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
116
121
|
accept = _headers.pop("Accept", "application/xml")
|
117
122
|
|
118
123
|
# Construct URL
|
@@ -153,7 +158,7 @@ def build_list_containers_segment_request(
|
|
153
158
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
154
159
|
|
155
160
|
comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list"))
|
156
|
-
version: Literal["
|
161
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
157
162
|
accept = _headers.pop("Accept", "application/xml")
|
158
163
|
|
159
164
|
# Construct URL
|
@@ -195,7 +200,7 @@ def build_get_user_delegation_key_request(
|
|
195
200
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
196
201
|
comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey"))
|
197
202
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
198
|
-
version: Literal["
|
203
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
199
204
|
accept = _headers.pop("Accept", "application/xml")
|
200
205
|
|
201
206
|
# Construct URL
|
@@ -223,13 +228,15 @@ def build_get_user_delegation_key_request(
|
|
223
228
|
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs)
|
224
229
|
|
225
230
|
|
226
|
-
def build_get_account_info_request(
|
231
|
+
def build_get_account_info_request(
|
232
|
+
url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any
|
233
|
+
) -> HttpRequest:
|
227
234
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
228
235
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
229
236
|
|
230
237
|
restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account"))
|
231
238
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
232
|
-
version: Literal["
|
239
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
233
240
|
accept = _headers.pop("Accept", "application/xml")
|
234
241
|
|
235
242
|
# Construct URL
|
@@ -243,9 +250,13 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest:
|
|
243
250
|
# Construct parameters
|
244
251
|
_params["restype"] = _SERIALIZER.query("restype", restype, "str")
|
245
252
|
_params["comp"] = _SERIALIZER.query("comp", comp, "str")
|
253
|
+
if timeout is not None:
|
254
|
+
_params["timeout"] = _SERIALIZER.query("timeout", timeout, "int", minimum=0)
|
246
255
|
|
247
256
|
# Construct headers
|
248
257
|
_headers["x-ms-version"] = _SERIALIZER.header("version", version, "str")
|
258
|
+
if request_id_parameter is not None:
|
259
|
+
_headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str")
|
249
260
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
250
261
|
|
251
262
|
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
@@ -265,7 +276,7 @@ def build_submit_batch_request(
|
|
265
276
|
|
266
277
|
comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch"))
|
267
278
|
multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None))
|
268
|
-
version: Literal["
|
279
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
269
280
|
accept = _headers.pop("Accept", "application/xml")
|
270
281
|
|
271
282
|
# Construct URL
|
@@ -308,7 +319,7 @@ def build_filter_blobs_request(
|
|
308
319
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
309
320
|
|
310
321
|
comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs"))
|
311
|
-
version: Literal["
|
322
|
+
version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04"))
|
312
323
|
accept = _headers.pop("Accept", "application/xml")
|
313
324
|
|
314
325
|
# Construct URL
|
@@ -386,7 +397,7 @@ class ServiceOperations:
|
|
386
397
|
:rtype: None
|
387
398
|
:raises ~azure.core.exceptions.HttpResponseError:
|
388
399
|
"""
|
389
|
-
error_map = {
|
400
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
390
401
|
401: ClientAuthenticationError,
|
391
402
|
404: ResourceNotFoundError,
|
392
403
|
409: ResourceExistsError,
|
@@ -461,7 +472,7 @@ class ServiceOperations:
|
|
461
472
|
:rtype: ~azure.storage.blob.models.StorageServiceProperties
|
462
473
|
:raises ~azure.core.exceptions.HttpResponseError:
|
463
474
|
"""
|
464
|
-
error_map = {
|
475
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
465
476
|
401: ClientAuthenticationError,
|
466
477
|
404: ResourceNotFoundError,
|
467
478
|
409: ResourceExistsError,
|
@@ -536,7 +547,7 @@ class ServiceOperations:
|
|
536
547
|
:rtype: ~azure.storage.blob.models.StorageServiceStats
|
537
548
|
:raises ~azure.core.exceptions.HttpResponseError:
|
538
549
|
"""
|
539
|
-
error_map = {
|
550
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
540
551
|
401: ClientAuthenticationError,
|
541
552
|
404: ResourceNotFoundError,
|
542
553
|
409: ResourceExistsError,
|
@@ -638,7 +649,7 @@ class ServiceOperations:
|
|
638
649
|
:rtype: ~azure.storage.blob.models.ListContainersSegmentResponse
|
639
650
|
:raises ~azure.core.exceptions.HttpResponseError:
|
640
651
|
"""
|
641
|
-
error_map = {
|
652
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
642
653
|
401: ClientAuthenticationError,
|
643
654
|
404: ResourceNotFoundError,
|
644
655
|
409: ResourceExistsError,
|
@@ -720,7 +731,7 @@ class ServiceOperations:
|
|
720
731
|
:rtype: ~azure.storage.blob.models.UserDelegationKey
|
721
732
|
:raises ~azure.core.exceptions.HttpResponseError:
|
722
733
|
"""
|
723
|
-
error_map = {
|
734
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
724
735
|
401: ClientAuthenticationError,
|
725
736
|
404: ResourceNotFoundError,
|
726
737
|
409: ResourceExistsError,
|
@@ -781,14 +792,25 @@ class ServiceOperations:
|
|
781
792
|
return deserialized # type: ignore
|
782
793
|
|
783
794
|
@distributed_trace
|
784
|
-
def get_account_info(
|
795
|
+
def get_account_info( # pylint: disable=inconsistent-return-statements
|
796
|
+
self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any
|
797
|
+
) -> None:
|
785
798
|
"""Returns the sku name and account kind.
|
786
799
|
|
800
|
+
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
801
|
+
:code:`<a
|
802
|
+
href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting
|
803
|
+
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
804
|
+
:type timeout: int
|
805
|
+
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
806
|
+
limit that is recorded in the analytics logs when storage analytics logging is enabled. Default
|
807
|
+
value is None.
|
808
|
+
:type request_id_parameter: str
|
787
809
|
:return: None or the result of cls(response)
|
788
810
|
:rtype: None
|
789
811
|
:raises ~azure.core.exceptions.HttpResponseError:
|
790
812
|
"""
|
791
|
-
error_map = {
|
813
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
792
814
|
401: ClientAuthenticationError,
|
793
815
|
404: ResourceNotFoundError,
|
794
816
|
409: ResourceExistsError,
|
@@ -805,6 +827,8 @@ class ServiceOperations:
|
|
805
827
|
|
806
828
|
_request = build_get_account_info_request(
|
807
829
|
url=self._config.url,
|
830
|
+
timeout=timeout,
|
831
|
+
request_id_parameter=request_id_parameter,
|
808
832
|
restype=restype,
|
809
833
|
comp=comp,
|
810
834
|
version=self._config.version,
|
@@ -868,7 +892,7 @@ class ServiceOperations:
|
|
868
892
|
:rtype: Iterator[bytes]
|
869
893
|
:raises ~azure.core.exceptions.HttpResponseError:
|
870
894
|
"""
|
871
|
-
error_map = {
|
895
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
872
896
|
401: ClientAuthenticationError,
|
873
897
|
404: ResourceNotFoundError,
|
874
898
|
409: ResourceExistsError,
|
@@ -974,7 +998,7 @@ class ServiceOperations:
|
|
974
998
|
:rtype: ~azure.storage.blob.models.FilterBlobSegment
|
975
999
|
:raises ~azure.core.exceptions.HttpResponseError:
|
976
1000
|
"""
|
977
|
-
error_map = {
|
1001
|
+
error_map: MutableMapping[int, Type[HttpResponseError]] = {
|
978
1002
|
401: ClientAuthenticationError,
|
979
1003
|
404: ResourceNotFoundError,
|
980
1004
|
409: ResourceExistsError,
|
@@ -0,0 +1 @@
|
|
1
|
+
# Marker file for PEP 561.
|
azure/storage/blob/_lease.py
CHANGED
@@ -108,7 +108,7 @@ class BlobLeaseClient(object): # pylint: disable=client-accepts-api-version-key
|
|
108
108
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
109
109
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
110
110
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
111
|
-
#other-client--per-operation-configuration>`
|
111
|
+
#other-client--per-operation-configuration>`__.
|
112
112
|
:rtype: None
|
113
113
|
"""
|
114
114
|
mod_conditions = get_modify_conditions(kwargs)
|
@@ -165,7 +165,7 @@ class BlobLeaseClient(object): # pylint: disable=client-accepts-api-version-key
|
|
165
165
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
166
166
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
167
167
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
168
|
-
#other-client--per-operation-configuration>`
|
168
|
+
#other-client--per-operation-configuration>`__.
|
169
169
|
:return: None
|
170
170
|
"""
|
171
171
|
mod_conditions = get_modify_conditions(kwargs)
|
@@ -219,7 +219,7 @@ class BlobLeaseClient(object): # pylint: disable=client-accepts-api-version-key
|
|
219
219
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
220
220
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
221
221
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
222
|
-
#other-client--per-operation-configuration>`
|
222
|
+
#other-client--per-operation-configuration>`__.
|
223
223
|
:return: None
|
224
224
|
"""
|
225
225
|
mod_conditions = get_modify_conditions(kwargs)
|
@@ -272,7 +272,7 @@ class BlobLeaseClient(object): # pylint: disable=client-accepts-api-version-key
|
|
272
272
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
273
273
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
274
274
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
275
|
-
#other-client--per-operation-configuration>`
|
275
|
+
#other-client--per-operation-configuration>`__.
|
276
276
|
:return: None
|
277
277
|
"""
|
278
278
|
mod_conditions = get_modify_conditions(kwargs)
|
@@ -335,7 +335,7 @@ class BlobLeaseClient(object): # pylint: disable=client-accepts-api-version-key
|
|
335
335
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
336
336
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
337
337
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
338
|
-
#other-client--per-operation-configuration>`
|
338
|
+
#other-client--per-operation-configuration>`__.
|
339
339
|
:return: Approximate time remaining in the lease period, in seconds.
|
340
340
|
:rtype: int
|
341
341
|
"""
|
azure/storage/blob/_models.py
CHANGED
@@ -1064,7 +1064,7 @@ class ContainerEncryptionScope(object):
|
|
1064
1064
|
class DelimitedJsonDialect(DictMixin):
|
1065
1065
|
"""Defines the input or output JSON serialization for a blob data query.
|
1066
1066
|
|
1067
|
-
:keyword str delimiter: The line separator character, default value is '
|
1067
|
+
:keyword str delimiter: The line separator character, default value is '\\\\n'.
|
1068
1068
|
"""
|
1069
1069
|
|
1070
1070
|
def __init__(self, **kwargs):
|
azure/storage/blob/_serialize.py
CHANGED
@@ -8,6 +8,7 @@ import logging
|
|
8
8
|
import re
|
9
9
|
from typing import List, Tuple
|
10
10
|
from urllib.parse import unquote, urlparse
|
11
|
+
from functools import cmp_to_key
|
11
12
|
|
12
13
|
try:
|
13
14
|
from yarl import URL
|
@@ -27,6 +28,66 @@ from . import sign_string
|
|
27
28
|
logger = logging.getLogger(__name__)
|
28
29
|
|
29
30
|
|
31
|
+
table_lv0 = [
|
32
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
33
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
34
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, 0x723, 0x725,
|
35
|
+
0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e,
|
36
|
+
0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
37
|
+
0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51,
|
38
|
+
0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9,
|
39
|
+
0x0, 0x0, 0x0, 0x743, 0x744, 0x748, 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25,
|
40
|
+
0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99,
|
41
|
+
0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c, 0x0, 0x750, 0x0,
|
42
|
+
]
|
43
|
+
|
44
|
+
table_lv4 = [
|
45
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
46
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
47
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0,
|
48
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
49
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
50
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
51
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
52
|
+
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
53
|
+
]
|
54
|
+
|
55
|
+
def compare(lhs: str, rhs: str) -> int: # pylint:disable=too-many-return-statements
|
56
|
+
tables = [table_lv0, table_lv4]
|
57
|
+
curr_level, i, j, n = 0, 0, 0, len(tables)
|
58
|
+
lhs_len = len(lhs)
|
59
|
+
rhs_len = len(rhs)
|
60
|
+
while curr_level < n:
|
61
|
+
if curr_level == (n - 1) and i != j:
|
62
|
+
if i > j:
|
63
|
+
return -1
|
64
|
+
if i < j:
|
65
|
+
return 1
|
66
|
+
return 0
|
67
|
+
|
68
|
+
w1 = tables[curr_level][ord(lhs[i])] if i < lhs_len else 0x1
|
69
|
+
w2 = tables[curr_level][ord(rhs[j])] if j < rhs_len else 0x1
|
70
|
+
|
71
|
+
if w1 == 0x1 and w2 == 0x1:
|
72
|
+
i = 0
|
73
|
+
j = 0
|
74
|
+
curr_level += 1
|
75
|
+
elif w1 == w2:
|
76
|
+
i += 1
|
77
|
+
j += 1
|
78
|
+
elif w1 == 0:
|
79
|
+
i += 1
|
80
|
+
elif w2 == 0:
|
81
|
+
j += 1
|
82
|
+
else:
|
83
|
+
if w1 < w2:
|
84
|
+
return -1
|
85
|
+
if w1 > w2:
|
86
|
+
return 1
|
87
|
+
return 0
|
88
|
+
return 0
|
89
|
+
|
90
|
+
|
30
91
|
# wraps a given exception with the desired exception type
|
31
92
|
def _wrap_exception(ex, desired_type):
|
32
93
|
msg = ""
|
@@ -36,8 +97,6 @@ def _wrap_exception(ex, desired_type):
|
|
36
97
|
|
37
98
|
# This method attempts to emulate the sorting done by the service
|
38
99
|
def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str, str]]:
|
39
|
-
# Define the custom alphabet for weights
|
40
|
-
custom_weights = "-!#$%&*.^_|~+\"\'(),/`~0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz{}"
|
41
100
|
|
42
101
|
# Build dict of tuples and list of keys
|
43
102
|
header_dict = {}
|
@@ -46,9 +105,8 @@ def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str
|
|
46
105
|
header_dict[k] = v
|
47
106
|
header_keys.append(k)
|
48
107
|
|
49
|
-
# Sort according to custom defined weights
|
50
108
|
try:
|
51
|
-
header_keys = sorted(header_keys, key=
|
109
|
+
header_keys = sorted(header_keys, key=cmp_to_key(compare))
|
52
110
|
except ValueError as exc:
|
53
111
|
raise ValueError("Illegal character encountered when sorting headers.") from exc
|
54
112
|
|
@@ -231,7 +231,7 @@ class StorageAccountHostsMixin(object): # pylint: disable=too-many-instance-att
|
|
231
231
|
audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE
|
232
232
|
else:
|
233
233
|
audience = STORAGE_OAUTH_SCOPE
|
234
|
-
self._credential_policy = StorageBearerTokenCredentialPolicy(credential, audience)
|
234
|
+
self._credential_policy = StorageBearerTokenCredentialPolicy(cast(TokenCredential, credential), audience)
|
235
235
|
elif isinstance(credential, SharedKeyCredentialPolicy):
|
236
236
|
self._credential_policy = credential
|
237
237
|
elif isinstance(credential, AzureSasCredential):
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# mypy: disable-error-code="attr-defined"
|
7
7
|
|
8
8
|
import logging
|
9
|
-
from typing import Any, Dict, Optional, Tuple, TYPE_CHECKING, Union
|
9
|
+
from typing import Any, cast, Dict, Optional, Tuple, TYPE_CHECKING, Union
|
10
10
|
|
11
11
|
from azure.core.async_paging import AsyncList
|
12
12
|
from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
|
@@ -104,7 +104,8 @@ class AsyncStorageAccountHostsMixin(object):
|
|
104
104
|
audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE
|
105
105
|
else:
|
106
106
|
audience = STORAGE_OAUTH_SCOPE
|
107
|
-
self._credential_policy = AsyncStorageBearerTokenCredentialPolicy(
|
107
|
+
self._credential_policy = AsyncStorageBearerTokenCredentialPolicy(
|
108
|
+
cast(AsyncTokenCredential, credential), audience)
|
108
109
|
elif isinstance(credential, SharedKeyCredentialPolicy):
|
109
110
|
self._credential_policy = credential
|
110
111
|
elif isinstance(credential, AzureSasCredential):
|
azure/storage/blob/_version.py
CHANGED