Skip to content

Commit ce47473

Browse files
authored
[1.1.0] Add file share v2022_11_02 (#59)
* add file share v2022_11_02 * remove file share v2021_06_08 * upgrade version
1 parent 27bdc3a commit ce47473

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3539
-3673
lines changed

Diff for: README.rst

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Handles multi-API versions of Azure Storage Data Plane originally from https://g
1717

1818
Change Log
1919
----------
20+
1.1.0
21+
++++++
22+
* fileshare: Support v2022-11-02(12.12.0b1) and remove v2021-06-08
23+
2024
1.0.0
2125
++++++
2226
* storageV1:

Diff for: azure/multiapi/storagev2/fileshare/v2021_06_08/_generated/models/_models.py

-1,517
This file was deleted.

Diff for: azure/multiapi/storagev2/fileshare/v2021_06_08/_shared/encryption.py

-542
This file was deleted.

Diff for: azure/multiapi/storagev2/fileshare/v2021_06_08/_shared/parser.py

-20
This file was deleted.

Diff for: azure/multiapi/storagev2/fileshare/v2021_06_08/__init__.py renamed to azure/multiapi/storagev2/fileshare/v2022_11_02/__init__.py

+20-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Licensed under the MIT License. See License.txt in the project root for
44
# license information.
55
# --------------------------------------------------------------------------
6+
import warnings
67

78
from ._version import VERSION
89
from ._file_client import ShareFileClient
@@ -35,10 +36,7 @@
3536
ContentSettings,
3637
NTFSAttributes)
3738
from ._generated.models import (
38-
HandleItem,
39-
ShareAccessTier
40-
)
41-
from ._generated.models import (
39+
ShareAccessTier,
4240
ShareRootSquash
4341
)
4442

@@ -74,9 +72,26 @@
7472
'ContentSettings',
7573
'Handle',
7674
'NTFSAttributes',
77-
'HandleItem',
7875
'ShareRootSquash',
7976
'generate_account_sas',
8077
'generate_share_sas',
8178
'generate_file_sas'
8279
]
80+
81+
82+
def __getattr__(name):
83+
"""
84+
This function is added to deal with HandleItem which is a generated model that
85+
was mistakenly added to the module exports. It has been removed import and __all__
86+
to prevent it from showing in intellisense/docs but we handle it here to prevent
87+
breaking any existing code which may have imported it.
88+
"""
89+
if name == 'HandleItem':
90+
from ._generated.models import HandleItem
91+
warnings.warn(
92+
"HandleItem is deprecated and should not be used. Use Handle instead.",
93+
DeprecationWarning
94+
)
95+
return HandleItem
96+
97+
raise AttributeError(f"module 'azure.storage.fileshare' has no attribute {name}")

Diff for: azure/multiapi/storagev2/fileshare/v2021_06_08/_directory_client.py renamed to azure/multiapi/storagev2/fileshare/v2022_11_02/_directory_client.py

+149-71
Large diffs are not rendered by default.

Diff for: azure/multiapi/storagev2/fileshare/v2021_06_08/_download.py renamed to azure/multiapi/storagev2/fileshare/v2022_11_02/_download.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class StorageStreamDownloader(object): # pylint: disable=too-many-instance-attr
201201
The properties of the file being downloaded. If only a range of the data is being
202202
downloaded, this will be reflected in the properties.
203203
:ivar int size:
204-
The size of the total data in the stream. This will be the byte range if speficied,
204+
The size of the total data in the stream. This will be the byte range if specified,
205205
otherwise the total size of the file.
206206
"""
207207

@@ -311,7 +311,7 @@ def _initial_request(self):
311311
# Parse the total file size and adjust the download size if ranges
312312
# were specified
313313
self._file_size = parse_length_from_content_range(response.properties.content_range)
314-
if not self._file_size:
314+
if self._file_size is None:
315315
raise ValueError("Required Content-Range response header is missing or malformed.")
316316

317317
if self._end_range is not None:
@@ -323,7 +323,7 @@ def _initial_request(self):
323323
self.size = self._file_size
324324

325325
except HttpResponseError as error:
326-
if self._start_range is None and error.response.status_code == 416:
326+
if self._start_range is None and error.response and error.response.status_code == 416:
327327
# Get range will fail on an empty file. If the user did not
328328
# request a range, do a regular get request in order to get
329329
# any properties.
@@ -398,10 +398,12 @@ def readall(self):
398398
return data
399399

400400
def content_as_bytes(self, max_concurrency=1):
401-
"""Download the contents of this file.
401+
"""DEPRECATED: Download the contents of this file.
402402
403403
This operation is blocking until all data is downloaded.
404404
405+
This method is deprecated, use func:`readall` instead.
406+
405407
:keyword int max_concurrency:
406408
The number of parallel connections with which to download.
407409
:rtype: bytes
@@ -414,10 +416,12 @@ def content_as_bytes(self, max_concurrency=1):
414416
return self.readall()
415417

416418
def content_as_text(self, max_concurrency=1, encoding="UTF-8"):
417-
"""Download the contents of this file, and decode as text.
419+
"""DEPRECATED: Download the contents of this file, and decode as text.
418420
419421
This operation is blocking until all data is downloaded.
420422
423+
This method is deprecated, use func:`readall` instead.
424+
421425
:keyword int max_concurrency:
422426
The number of parallel connections with which to download.
423427
:param str encoding:
@@ -495,7 +499,9 @@ def readinto(self, stream):
495499
return self.size
496500

497501
def download_to_stream(self, stream, max_concurrency=1):
498-
"""Download the contents of this file to a stream.
502+
"""DEPRECATED: Download the contents of this file to a stream.
503+
504+
This method is deprecated, use func:`readinto` instead.
499505
500506
:param stream:
501507
The stream to download to. This can be an open file-handle,

0 commit comments

Comments
 (0)