|
24 | 24 | AccountSasPermissions, |
25 | 25 | StorageErrorCode, |
26 | 26 | UserDelegationKey, |
27 | | - Services |
| 27 | + Services, |
28 | 28 | ) |
29 | 29 | from ._generated.models import RehydratePriority |
30 | 30 | from ._models import ( |
|
74 | 74 | def upload_blob_to_url( |
75 | 75 | blob_url: str, |
76 | 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 |
| 77 | + credential: Optional[ |
| 78 | + Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "TokenCredential"] |
| 79 | + ] = None, |
| 80 | + **kwargs: Any, |
79 | 81 | ) -> Dict[str, Any]: |
80 | 82 | """Upload data to a given URL |
81 | 83 |
|
@@ -143,8 +145,10 @@ def _download_to_stream(client: BlobClient, handle: IO[bytes], **kwargs: Any) -> |
143 | 145 | def download_blob_from_url( |
144 | 146 | blob_url: str, |
145 | 147 | 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 | + credential: Optional[ |
| 149 | + Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "TokenCredential"] |
| 150 | + ] = None, |
| 151 | + **kwargs: Any, |
148 | 152 | ) -> None: |
149 | 153 | """Download the contents of a blob to a local file or stream. |
150 | 154 |
|
@@ -193,72 +197,72 @@ def download_blob_from_url( |
193 | 197 | :return: None |
194 | 198 | :rtype: None |
195 | 199 | """ |
196 | | - overwrite = kwargs.pop('overwrite', False) |
197 | | - with BlobClient.from_blob_url(blob_url, credential=credential) as client: # pylint: disable=not-context-manager |
198 | | - if hasattr(output, 'write'): |
| 200 | + overwrite = kwargs.pop("overwrite", False) |
| 201 | + with BlobClient.from_blob_url(blob_url, credential=credential) as client: # pylint: disable=not-context-manager |
| 202 | + if hasattr(output, "write"): |
199 | 203 | _download_to_stream(client, cast(IO[bytes], output), **kwargs) |
200 | 204 | else: |
201 | 205 | if not overwrite and os.path.isfile(output): |
202 | 206 | raise ValueError(f"The file '{output}' already exists.") |
203 | | - with open(output, 'wb') as file_handle: |
| 207 | + with open(output, "wb") as file_handle: |
204 | 208 | _download_to_stream(client, file_handle, **kwargs) |
205 | 209 |
|
206 | 210 |
|
207 | 211 | __all__ = [ |
208 | | - 'upload_blob_to_url', |
209 | | - 'download_blob_from_url', |
210 | | - 'BlobServiceClient', |
211 | | - 'ContainerClient', |
212 | | - 'BlobClient', |
213 | | - 'BlobType', |
214 | | - 'BlobLeaseClient', |
215 | | - 'StorageErrorCode', |
216 | | - 'UserDelegationKey', |
217 | | - 'ExponentialRetry', |
218 | | - 'LinearRetry', |
219 | | - 'LocationMode', |
220 | | - 'BlockState', |
221 | | - 'StandardBlobTier', |
222 | | - 'PremiumPageBlobTier', |
223 | | - 'SequenceNumberAction', |
224 | | - 'BlobImmutabilityPolicyMode', |
225 | | - 'ImmutabilityPolicy', |
226 | | - 'PublicAccess', |
227 | | - 'BlobAnalyticsLogging', |
228 | | - 'Metrics', |
229 | | - 'RetentionPolicy', |
230 | | - 'StaticWebsite', |
231 | | - 'CorsRule', |
232 | | - 'ContainerProperties', |
233 | | - 'BlobProperties', |
234 | | - 'BlobPrefix', |
235 | | - 'FilteredBlob', |
236 | | - 'LeaseProperties', |
237 | | - 'ContentSettings', |
238 | | - 'CopyProperties', |
239 | | - 'BlobBlock', |
240 | | - 'PageRange', |
241 | | - 'AccessPolicy', |
242 | | - 'QuickQueryDialect', |
243 | | - 'ContainerSasPermissions', |
244 | | - 'BlobSasPermissions', |
245 | | - 'ResourceTypes', |
246 | | - 'AccountSasPermissions', |
247 | | - 'StorageStreamDownloader', |
248 | | - 'CustomerProvidedEncryptionKey', |
249 | | - 'RehydratePriority', |
250 | | - 'generate_account_sas', |
251 | | - 'generate_container_sas', |
252 | | - 'generate_blob_sas', |
253 | | - 'PartialBatchErrorException', |
254 | | - 'ContainerEncryptionScope', |
255 | | - 'BlobQueryError', |
256 | | - 'DelimitedJsonDialect', |
257 | | - 'DelimitedTextDialect', |
258 | | - 'ArrowDialect', |
259 | | - 'ArrowType', |
260 | | - 'BlobQueryReader', |
261 | | - 'ObjectReplicationPolicy', |
262 | | - 'ObjectReplicationRule', |
263 | | - 'Services', |
| 212 | + "upload_blob_to_url", |
| 213 | + "download_blob_from_url", |
| 214 | + "BlobServiceClient", |
| 215 | + "ContainerClient", |
| 216 | + "BlobClient", |
| 217 | + "BlobType", |
| 218 | + "BlobLeaseClient", |
| 219 | + "StorageErrorCode", |
| 220 | + "UserDelegationKey", |
| 221 | + "ExponentialRetry", |
| 222 | + "LinearRetry", |
| 223 | + "LocationMode", |
| 224 | + "BlockState", |
| 225 | + "StandardBlobTier", |
| 226 | + "PremiumPageBlobTier", |
| 227 | + "SequenceNumberAction", |
| 228 | + "BlobImmutabilityPolicyMode", |
| 229 | + "ImmutabilityPolicy", |
| 230 | + "PublicAccess", |
| 231 | + "BlobAnalyticsLogging", |
| 232 | + "Metrics", |
| 233 | + "RetentionPolicy", |
| 234 | + "StaticWebsite", |
| 235 | + "CorsRule", |
| 236 | + "ContainerProperties", |
| 237 | + "BlobProperties", |
| 238 | + "BlobPrefix", |
| 239 | + "FilteredBlob", |
| 240 | + "LeaseProperties", |
| 241 | + "ContentSettings", |
| 242 | + "CopyProperties", |
| 243 | + "BlobBlock", |
| 244 | + "PageRange", |
| 245 | + "AccessPolicy", |
| 246 | + "QuickQueryDialect", |
| 247 | + "ContainerSasPermissions", |
| 248 | + "BlobSasPermissions", |
| 249 | + "ResourceTypes", |
| 250 | + "AccountSasPermissions", |
| 251 | + "StorageStreamDownloader", |
| 252 | + "CustomerProvidedEncryptionKey", |
| 253 | + "RehydratePriority", |
| 254 | + "generate_account_sas", |
| 255 | + "generate_container_sas", |
| 256 | + "generate_blob_sas", |
| 257 | + "PartialBatchErrorException", |
| 258 | + "ContainerEncryptionScope", |
| 259 | + "BlobQueryError", |
| 260 | + "DelimitedJsonDialect", |
| 261 | + "DelimitedTextDialect", |
| 262 | + "ArrowDialect", |
| 263 | + "ArrowType", |
| 264 | + "BlobQueryReader", |
| 265 | + "ObjectReplicationPolicy", |
| 266 | + "ObjectReplicationRule", |
| 267 | + "Services", |
264 | 268 | ] |
0 commit comments