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.
- azure/storage/blob/__init__.py +19 -18
- azure/storage/blob/_blob_client.py +470 -1555
- azure/storage/blob/_blob_client_helpers.py +1242 -0
- azure/storage/blob/_blob_service_client.py +93 -112
- azure/storage/blob/_blob_service_client_helpers.py +27 -0
- azure/storage/blob/_container_client.py +176 -377
- azure/storage/blob/_container_client_helpers.py +266 -0
- azure/storage/blob/_deserialize.py +68 -44
- azure/storage/blob/_download.py +375 -241
- azure/storage/blob/_encryption.py +14 -7
- azure/storage/blob/_generated/_azure_blob_storage.py +2 -1
- azure/storage/blob/_generated/_serialization.py +2 -0
- azure/storage/blob/_generated/aio/_azure_blob_storage.py +2 -1
- azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +1 -7
- azure/storage/blob/_generated/aio/operations/_blob_operations.py +21 -47
- azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +2 -10
- azure/storage/blob/_generated/aio/operations/_container_operations.py +13 -26
- azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +3 -14
- azure/storage/blob/_generated/aio/operations/_service_operations.py +14 -17
- azure/storage/blob/_generated/operations/_append_blob_operations.py +1 -7
- azure/storage/blob/_generated/operations/_blob_operations.py +21 -47
- azure/storage/blob/_generated/operations/_block_blob_operations.py +2 -10
- azure/storage/blob/_generated/operations/_container_operations.py +13 -26
- azure/storage/blob/_generated/operations/_page_blob_operations.py +3 -14
- azure/storage/blob/_generated/operations/_service_operations.py +14 -17
- azure/storage/blob/_generated/py.typed +1 -0
- azure/storage/blob/_lease.py +52 -63
- azure/storage/blob/_list_blobs_helper.py +129 -135
- azure/storage/blob/_models.py +480 -277
- azure/storage/blob/_quick_query_helper.py +30 -31
- azure/storage/blob/_serialize.py +39 -56
- azure/storage/blob/_shared/avro/datafile.py +1 -1
- azure/storage/blob/_shared/avro/datafile_async.py +1 -1
- azure/storage/blob/_shared/base_client.py +3 -1
- azure/storage/blob/_shared/base_client_async.py +1 -1
- azure/storage/blob/_shared/policies.py +16 -15
- azure/storage/blob/_shared/policies_async.py +21 -6
- azure/storage/blob/_shared/response_handlers.py +6 -2
- azure/storage/blob/_shared/shared_access_signature.py +21 -3
- azure/storage/blob/_shared/uploads.py +1 -1
- azure/storage/blob/_shared/uploads_async.py +1 -1
- azure/storage/blob/_shared_access_signature.py +110 -52
- azure/storage/blob/_upload_helpers.py +75 -68
- azure/storage/blob/_version.py +1 -1
- azure/storage/blob/aio/__init__.py +19 -11
- azure/storage/blob/aio/_blob_client_async.py +554 -301
- azure/storage/blob/aio/_blob_service_client_async.py +148 -97
- azure/storage/blob/aio/_container_client_async.py +289 -140
- azure/storage/blob/aio/_download_async.py +485 -337
- azure/storage/blob/aio/_lease_async.py +61 -60
- azure/storage/blob/aio/_list_blobs_helper.py +94 -96
- azure/storage/blob/aio/_models.py +60 -38
- azure/storage/blob/aio/_upload_helpers.py +75 -66
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/METADATA +7 -7
- azure_storage_blob-12.23.0.dist-info/RECORD +84 -0
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/WHEEL +1 -1
- azure/storage/blob/_generated/_vendor.py +0 -16
- azure_storage_blob-12.21.0b1.dist-info/RECORD +0 -81
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/LICENSE +0 -0
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/top_level.txt +0 -0
azure/storage/blob/__init__.py
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import os
|
9
9
|
|
10
|
-
from typing import
|
10
|
+
from typing import Any, AnyStr, cast, Dict, IO, Iterable, Optional, Union, TYPE_CHECKING
|
11
11
|
from ._version import VERSION
|
12
12
|
from ._blob_client import BlobClient
|
13
13
|
from ._container_client import ContainerClient
|
@@ -18,7 +18,7 @@ from ._quick_query_helper import BlobQueryReader
|
|
18
18
|
from ._shared_access_signature import generate_account_sas, generate_container_sas, generate_blob_sas
|
19
19
|
from ._shared.policies import ExponentialRetry, LinearRetry
|
20
20
|
from ._shared.response_handlers import PartialBatchErrorException
|
21
|
-
from ._shared.models import(
|
21
|
+
from ._shared.models import (
|
22
22
|
LocationMode,
|
23
23
|
ResourceTypes,
|
24
24
|
AccountSasPermissions,
|
@@ -26,9 +26,7 @@ from ._shared.models import(
|
|
26
26
|
UserDelegationKey,
|
27
27
|
Services
|
28
28
|
)
|
29
|
-
from ._generated.models import
|
30
|
-
RehydratePriority,
|
31
|
-
)
|
29
|
+
from ._generated.models import RehydratePriority
|
32
30
|
from ._models import (
|
33
31
|
BlobType,
|
34
32
|
BlockState,
|
@@ -67,15 +65,18 @@ from ._models import (
|
|
67
65
|
)
|
68
66
|
from ._list_blobs_helper import BlobPrefix
|
69
67
|
|
68
|
+
if TYPE_CHECKING:
|
69
|
+
from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential, TokenCredential
|
70
|
+
|
70
71
|
__version__ = VERSION
|
71
72
|
|
72
73
|
|
73
74
|
def upload_blob_to_url(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
blob_url: str,
|
76
|
+
data: Union[Iterable[AnyStr], IO[AnyStr]],
|
77
|
+
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "TokenCredential"]] = None, # pylint: disable=line-too-long
|
78
|
+
**kwargs: Any
|
79
|
+
) -> Dict[str, Any]:
|
79
80
|
"""Upload data to a given URL
|
80
81
|
|
81
82
|
The data will be uploaded as a block blob.
|
@@ -125,10 +126,10 @@ def upload_blob_to_url(
|
|
125
126
|
:rtype: dict(str, Any)
|
126
127
|
"""
|
127
128
|
with BlobClient.from_blob_url(blob_url, credential=credential) as client:
|
128
|
-
return client.upload_blob(data=data, blob_type=BlobType.
|
129
|
+
return cast(BlobClient, client).upload_blob(data=data, blob_type=BlobType.BLOCKBLOB, **kwargs)
|
129
130
|
|
130
131
|
|
131
|
-
def _download_to_stream(client, handle, **kwargs):
|
132
|
+
def _download_to_stream(client: BlobClient, handle: IO[bytes], **kwargs: Any) -> None:
|
132
133
|
"""
|
133
134
|
Download data to specified open file-handle.
|
134
135
|
|
@@ -140,11 +141,11 @@ def _download_to_stream(client, handle, **kwargs):
|
|
140
141
|
|
141
142
|
|
142
143
|
def download_blob_from_url(
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
144
|
+
blob_url: str,
|
145
|
+
output: Union[str, IO[bytes]],
|
146
|
+
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "TokenCredential"]] = None, # pylint: disable=line-too-long
|
147
|
+
**kwargs: Any
|
148
|
+
) -> None:
|
148
149
|
"""Download the contents of a blob to a local file or stream.
|
149
150
|
|
150
151
|
:param str blob_url:
|
@@ -194,7 +195,7 @@ def download_blob_from_url(
|
|
194
195
|
overwrite = kwargs.pop('overwrite', False)
|
195
196
|
with BlobClient.from_blob_url(blob_url, credential=credential) as client:
|
196
197
|
if hasattr(output, 'write'):
|
197
|
-
_download_to_stream(client, output, **kwargs)
|
198
|
+
_download_to_stream(client, cast(IO[bytes], output), **kwargs)
|
198
199
|
else:
|
199
200
|
if not overwrite and os.path.isfile(output):
|
200
201
|
raise ValueError(f"The file '{output}' already exists.")
|