Skip to content

Commit 4739b70

Browse files
[Storage] Removed docstrings from Blob's helper files + slight _shared matchings (#36595)
1 parent 2530f8f commit 4739b70

File tree

15 files changed

+27
-566
lines changed

15 files changed

+27
-566
lines changed

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client_helpers.py

Lines changed: 2 additions & 390 deletions
Large diffs are not rendered by default.

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client_helpers.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313

1414

1515
def _parse_url(account_url: str) -> Tuple["ParseResult", Any]:
16-
"""Performs initial input validation and returns the parsed URL and SAS token.
17-
18-
:param str account_url: The URL to the storage account.
19-
:returns: The parsed URL and SAS token.
20-
:rtype: Tuple[ParseResult, Any]
21-
"""
2216
try:
2317
if not account_url.lower().startswith('http'):
2418
account_url = "https://" + account_url

sdk/storage/azure-storage-blob/azure/storage/blob/_container_client_helpers.py

Lines changed: 1 addition & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,7 @@
2121
from ._models import PremiumPageBlobTier, StandardBlobTier
2222

2323

24-
def _parse_url(
25-
account_url: str,
26-
container_name: str,
27-
) -> Tuple["ParseResult", Any]:
28-
"""Performs initial input validation and returns the parsed URL and SAS token.
29-
:param str account_url: The URL to the storage account.
30-
:param str container_name: The name of the container.
31-
:returns: The parsed URL and SAS token.
32-
:rtype: Tuple[ParseResult, Any]
33-
"""
24+
def _parse_url(account_url: str, container_name: str) -> Tuple["ParseResult", Any]:
3425
try:
3526
if not account_url.lower().startswith('http'):
3627
account_url = "https://" + account_url
@@ -47,19 +38,6 @@ def _parse_url(
4738
return parsed_url, sas_token
4839

4940
def _format_url(container_name: Union[bytes, str], hostname: str, scheme: str, query_str: str) -> str:
50-
"""Format the endpoint URL according to the current location mode hostname.
51-
52-
:param Union[bytes, str] container_name:
53-
The name of the container.
54-
:param str hostname:
55-
The current location mode hostname.
56-
:param str scheme:
57-
The scheme for the current location mode hostname.
58-
:param str query_str:
59-
The query string of the endpoint URL being formatted.
60-
:returns: The formatted endpoint URL according to the specified location mode hostname.
61-
:rtype: str
62-
"""
6341
if isinstance(container_name, str):
6442
container_name = container_name.encode('UTF-8')
6543
return f"{scheme}://{hostname}/{quote(container_name)}{query_str}"
@@ -75,27 +53,6 @@ def _generate_delete_blobs_subrequest_options(
7553
modified_access_conditions: Optional["ModifiedAccessConditions"] = None,
7654
**kwargs
7755
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
78-
"""Creates a dictionary containing the options for a delete blob sub-request operation.
79-
80-
:param AzureBlobStorage client:
81-
The generated Blob Storage client.
82-
:param Optional[str] snapshot:
83-
The snapshot data of the blob.
84-
:param Optional[str] version_id:
85-
The version id parameter is a value that, when present, specifies the version of the blob to delete.
86-
:param Optional[str] delete_snapshots:
87-
Required if the blob has associated snapshots. Values include:
88-
- "only": Deletes only the blobs snapshots.
89-
- "include": Deletes the blob along with all snapshots.
90-
:param lease_access_conditions:
91-
The access conditions associated with the lease.
92-
:type lease_access_conditions: Optional[LeaseAccessConditions]
93-
:param modified_access_conditions:
94-
The modified access conditions associated with the lease.
95-
:type modified_access_conditions: Optional[LeaseAccessConditions]
96-
:returns: A dictionary containing the delete blobs sub-request options.
97-
:rtype: Tuple[Dict[str, Any], Dict[str, Any]]
98-
"""
9956
lease_id = None
10057
if lease_access_conditions is not None:
10158
lease_id = lease_access_conditions.lease_id
@@ -157,46 +114,6 @@ def _generate_delete_blobs_options(
157114
*blobs: Union[str, Dict[str, Any], BlobProperties],
158115
**kwargs: Any
159116
) -> Tuple[List[HttpRequest], Dict[str, Any]]:
160-
"""Creates a dictionary containing the options for a delete blob operation.
161-
162-
:param str query_str:
163-
The query string of the endpoint URL.
164-
:param str container_name:
165-
The name of the container.
166-
:param AzureBlobStorage client:
167-
The generated Blob Storage client.
168-
:param blobs:
169-
The blobs to delete. This can be a single blob, or multiple values can
170-
be supplied, where each value is either the name of the blob (str) or BlobProperties.
171-
172-
.. note::
173-
When the blob type is dict, here's a list of keys, value rules.
174-
175-
blob name:
176-
key: 'name', value type: str
177-
snapshot you want to delete:
178-
key: 'snapshot', value type: str
179-
version id:
180-
key: 'version_id', value type: str
181-
whether to delete snapshots when deleting blob:
182-
key: 'delete_snapshots', value: 'include' or 'only'
183-
if the blob modified or not:
184-
key: 'if_modified_since', 'if_unmodified_since', value type: datetime
185-
etag:
186-
key: 'etag', value type: str
187-
match the etag or not:
188-
key: 'match_condition', value type: MatchConditions
189-
tags match condition:
190-
key: 'if_tags_match_condition', value type: str
191-
lease:
192-
key: 'lease_id', value type: Union[str, LeaseClient]
193-
timeout for subrequest:
194-
key: 'timeout', value type: int
195-
196-
:type blobs: Union[str, Dict[str, Any], BlobProperties]
197-
:returns: A tuple containing the list of HttpRequests and the delete blobs options.
198-
:rtype: Tuple[List[HttpRequest], Dict[str, Any]]
199-
"""
200117
timeout = kwargs.pop('timeout', None)
201118
raise_on_any_failure = kwargs.pop('raise_on_any_failure', True)
202119
delete_snapshots = kwargs.pop('delete_snapshots', None)
@@ -259,25 +176,6 @@ def _generate_set_tiers_subrequest_options(
259176
lease_access_conditions: Optional["LeaseAccessConditions"] = None,
260177
**kwargs: Any
261178
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
262-
"""Creates a dictionary containing the options for a set tiers sub-request operation.
263-
264-
:param AzureBlobStorage client:
265-
The generated Blob Storage client.
266-
:param tier:
267-
Indicates the tier to be set on the blobs.
268-
:type tier: Optional[Union["PremiumPageBlobTier", "StandardBlobTier", str]]
269-
:param Optional[str] snapshot:
270-
The snapshot data of the blob.
271-
:param Optional[str] version_id:
272-
The version id parameter is a value that, when present, specifies the version of the blob to delete.
273-
:param Optional[RehydratePriority] rehydrate_priority:
274-
Indicates the priority with which to rehydrate an archived blob.
275-
:param lease_access_conditions:
276-
The access conditions associated with the lease.
277-
:type lease_access_conditions: Optional[LeaseAccessConditions]
278-
:returns: A dictionary containing the set tiers sub-request options.
279-
:rtype: Dict[str, Any]
280-
"""
281179
if not tier:
282180
raise ValueError("A blob tier must be specified")
283181
if snapshot and version_id:
@@ -321,49 +219,6 @@ def _generate_set_tiers_options(
321219
*blobs: Union[str, Dict[str, Any], BlobProperties],
322220
**kwargs: Any
323221
) -> Tuple[List[HttpRequest], Dict[str, Any]]:
324-
"""Creates a dictionary containing the options for a set tiers operation.
325-
326-
:param str query_str:
327-
The query string of the endpoint URL.
328-
:param str container_name:
329-
The name of the container.
330-
:param blob_tier:
331-
Indicates the tier to be set on the blobs.
332-
:type blob_tier: Optional[Union["PremiumPageBlobTier", "StandardBlobTier", str]]
333-
:param AzureBlobStorage client:
334-
The generated Blob Storage client.
335-
:param blobs:
336-
The blobs to delete. This can be a single blob, or multiple values can
337-
be supplied, where each value is either the name of the blob (str) or BlobProperties.
338-
339-
.. note::
340-
When the blob type is dict, here's a list of keys, value rules.
341-
342-
blob name:
343-
key: 'name', value type: str
344-
snapshot you want to delete:
345-
key: 'snapshot', value type: str
346-
version id:
347-
key: 'version_id', value type: str
348-
whether to delete snapshots when deleting blob:
349-
key: 'delete_snapshots', value: 'include' or 'only'
350-
if the blob modified or not:
351-
key: 'if_modified_since', 'if_unmodified_since', value type: datetime
352-
etag:
353-
key: 'etag', value type: str
354-
match the etag or not:
355-
key: 'match_condition', value type: MatchConditions
356-
tags match condition:
357-
key: 'if_tags_match_condition', value type: str
358-
lease:
359-
key: 'lease_id', value type: Union[str, LeaseClient]
360-
timeout for subrequest:
361-
key: 'timeout', value type: int
362-
363-
:type blobs: Union[str, Dict[str, Any], BlobProperties]
364-
:returns: A tuple containing the list of HttpRequests and the set tiers options.
365-
:rtype: Tuple[List[HttpRequest], Dict[str, Any]]
366-
"""
367222
timeout = kwargs.pop('timeout', None)
368223
raise_on_any_failure = kwargs.pop('raise_on_any_failure', True)
369224
rehydrate_priority = kwargs.pop('rehydrate_priority', None)

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from time import time
1515
from typing import Any, Dict, Optional, TYPE_CHECKING
1616
from urllib.parse import (
17-
parse_qsl,
18-
urlencode,
19-
urlparse,
20-
urlunparse,
17+
parse_qsl,
18+
urlencode,
19+
urlparse,
20+
urlunparse,
2121
)
2222
from wsgiref.handlers import format_date_time
2323

@@ -28,7 +28,7 @@
2828
HTTPPolicy,
2929
NetworkTraceLoggingPolicy,
3030
RequestHistory,
31-
SansIOHTTPPolicy,
31+
SansIOHTTPPolicy
3232
)
3333

3434
from .authentication import StorageHttpChallenge

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818
from azure.core.pipeline.policies import ContentDecodePolicy
1919

20-
from .models import StorageErrorCode, UserDelegationKey, get_enum_value
20+
from .models import get_enum_value, StorageErrorCode, UserDelegationKey
2121
from .parser import _to_utc_datetime
2222

2323

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/uploads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from azure.core.tracing.common import with_current_context
1414

15-
from . import encode_base64, url_quote
15+
from .import encode_base64, url_quote
1616
from .request_handlers import get_length
1717
from .response_handlers import return_response_headers
1818

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/uploads_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from math import ceil
1414
from typing import AsyncGenerator, Union
1515

16-
from . import encode_base64, url_quote
16+
from .import encode_base64, url_quote
1717
from .request_handlers import get_length
1818
from .response_handlers import return_response_headers
1919
from .uploads import SubStream, IterStreamer # pylint: disable=unused-import

sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from time import time
1515
from typing import Any, Dict, Optional, TYPE_CHECKING
1616
from urllib.parse import (
17-
parse_qsl,
18-
urlencode,
19-
urlparse,
20-
urlunparse,
17+
parse_qsl,
18+
urlencode,
19+
urlparse,
20+
urlunparse,
2121
)
2222
from wsgiref.handlers import format_date_time
2323

@@ -28,7 +28,7 @@
2828
HTTPPolicy,
2929
NetworkTraceLoggingPolicy,
3030
RequestHistory,
31-
SansIOHTTPPolicy,
31+
SansIOHTTPPolicy
3232
)
3333

3434
from .authentication import StorageHttpChallenge

sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818
from azure.core.pipeline.policies import ContentDecodePolicy
1919

20-
from .models import StorageErrorCode, UserDelegationKey, get_enum_value
20+
from .models import get_enum_value, StorageErrorCode, UserDelegationKey
2121
from .parser import _to_utc_datetime
2222

2323

sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/uploads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from azure.core.tracing.common import with_current_context
1414

15-
from . import encode_base64, url_quote
15+
from .import encode_base64, url_quote
1616
from .request_handlers import get_length
1717
from .response_handlers import return_response_headers
1818

0 commit comments

Comments
 (0)