Skip to content

Fix doc issues and run black #41336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-file-share/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from ._version import VERSION
from ._file_client import ShareFileClient
from ._directory_client import ShareDirectoryClient
from ._download import StorageStreamDownloader
from ._share_client import ShareClient
from ._share_service_client import ShareServiceClient
from ._lease import ShareLeaseClient
Expand Down Expand Up @@ -38,48 +39,46 @@
ContentSettings,
NTFSAttributes,
)
from ._generated.models import (
ShareAccessTier,
ShareRootSquash
)
from ._generated.models import ShareAccessTier, ShareRootSquash

__version__ = VERSION


__all__ = [
'ShareFileClient',
'ShareDirectoryClient',
'ShareClient',
'ShareServiceClient',
'ShareLeaseClient',
'ExponentialRetry',
'LinearRetry',
'LocationMode',
'ResourceTypes',
'AccountSasPermissions',
'StorageErrorCode',
'Metrics',
'RetentionPolicy',
'CorsRule',
'ShareSmbSettings',
'ShareAccessTier',
'SmbMultichannel',
'ShareProtocolSettings',
'AccessPolicy',
'FileSasPermissions',
'ShareSasPermissions',
'ShareProtocols',
'ShareProperties',
'DirectoryProperties',
'FileProperties',
'ContentSettings',
'Handle',
'NTFSAttributes',
'ShareRootSquash',
'generate_account_sas',
'generate_share_sas',
'generate_file_sas',
'Services'
"ShareFileClient",
"ShareDirectoryClient",
"ShareClient",
"ShareServiceClient",
"ShareLeaseClient",
"ExponentialRetry",
"LinearRetry",
"LocationMode",
"ResourceTypes",
"AccountSasPermissions",
"StorageErrorCode",
"Metrics",
"RetentionPolicy",
"CorsRule",
"ShareSmbSettings",
"ShareAccessTier",
"SmbMultichannel",
"ShareProtocolSettings",
"AccessPolicy",
"FileSasPermissions",
"ShareSasPermissions",
"ShareProtocols",
"ShareProperties",
"DirectoryProperties",
"FileProperties",
"ContentSettings",
"Handle",
"NTFSAttributes",
"ShareRootSquash",
"generate_account_sas",
"generate_share_sas",
"generate_file_sas",
"Services",
"StorageStreamDownloader",
]


Expand All @@ -88,12 +87,10 @@
# to prevent it from showing in intellisense/docs but we handle it here to prevent
# breaking any existing code which may have imported it.
def __getattr__(name):
if name == 'HandleItem':
if name == "HandleItem":
from ._generated.models import HandleItem
warnings.warn(
"HandleItem is deprecated and should not be used. Use Handle instead.",
DeprecationWarning
)

warnings.warn("HandleItem is deprecated and should not be used. Use Handle instead.", DeprecationWarning)
return HandleItem

raise AttributeError(f"module 'azure.storage.fileshare' has no attribute {name}")
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------_
from typing import (
Any, cast, Dict, List, Optional, Tuple,
TYPE_CHECKING
)
from typing import Any, cast, Dict, List, Optional, Tuple, TYPE_CHECKING

from ._generated.models import ShareFileRangeList
from ._models import DirectoryProperties, FileProperties, ShareProperties
Expand All @@ -19,67 +16,58 @@

def deserialize_share_properties(response: "PipelineResponse", obj: Any, headers: Dict[str, Any]) -> ShareProperties:
metadata = deserialize_metadata(response, obj, headers)
share_properties = ShareProperties(
metadata=metadata,
**headers
)
share_properties = ShareProperties(metadata=metadata, **headers)
return share_properties


def deserialize_directory_properties(
response: "PipelineResponse",
obj: Any,
headers: Dict[str, Any]
response: "PipelineResponse", obj: Any, headers: Dict[str, Any]
) -> DirectoryProperties:
metadata = deserialize_metadata(response, obj, headers)
directory_properties = DirectoryProperties(
metadata=metadata,
**headers
)
directory_properties = DirectoryProperties(metadata=metadata, **headers)
return directory_properties


def deserialize_file_properties(response: "PipelineResponse", obj: Any, headers: Dict[str, Any]) -> FileProperties:
metadata = deserialize_metadata(response, obj, headers)
file_properties = FileProperties(
metadata=metadata,
**headers
)
if 'Content-Range' in headers:
if 'x-ms-content-md5' in headers:
file_properties.content_settings.content_md5 = headers['x-ms-content-md5']
file_properties = FileProperties(metadata=metadata, **headers)
if "Content-Range" in headers:
if "x-ms-content-md5" in headers:
file_properties.content_settings.content_md5 = headers["x-ms-content-md5"]
else:
file_properties.content_settings.content_md5 = None
return file_properties


def deserialize_file_stream(
response: "PipelineResponse",
obj: Any,
headers: Dict[str, Any]
response: "PipelineResponse", obj: Any, headers: Dict[str, Any]
) -> Tuple["LocationMode", Any]:
file_properties = deserialize_file_properties(response, obj, headers)
obj.properties = file_properties
return response.http_response.location_mode, obj


# Extracts out file permission
def deserialize_permission(response: "PipelineResponse", obj: Any, headers: Dict[str, Any]) -> Optional[str]: # pylint: disable=unused-argument
def deserialize_permission(
response: "PipelineResponse", obj: Any, headers: Dict[str, Any]
) -> Optional[str]: # pylint: disable=unused-argument
return cast(Optional[str], obj.permission)


# Extracts out file permission key
def deserialize_permission_key(response: "PipelineResponse", obj: Any, headers: Dict[str, Any]) -> Optional[str]: # pylint: disable=unused-argument
def deserialize_permission_key(
response: "PipelineResponse", obj: Any, headers: Dict[str, Any]
) -> Optional[str]: # pylint: disable=unused-argument
if response is None or headers is None:
return None
return cast(Optional[str], headers.get('x-ms-file-permission-key', None))
return cast(Optional[str], headers.get("x-ms-file-permission-key", None))


def get_file_ranges_result(ranges: ShareFileRangeList) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]]:
file_ranges = []
clear_ranges = []
if ranges.ranges:
file_ranges = [{'start': file_range.start, 'end': file_range.end} for file_range in ranges.ranges]
file_ranges = [{"start": file_range.start, "end": file_range.end} for file_range in ranges.ranges]
if ranges.clear_ranges:
clear_ranges = [{'start': clear_range.start, 'end': clear_range.end} for clear_range in ranges.clear_ranges]
clear_ranges = [{"start": clear_range.start, "end": clear_range.end} for clear_range in ranges.clear_ranges]
return file_ranges, clear_ranges
Loading
Loading