From 5340f3882dfdcf85c7c173d80ad6c6a3ab9c2403 Mon Sep 17 00:00:00 2001 From: Jacob Lauzon <96087589+jalauzon-msft@users.noreply.github.com> Date: Thu, 16 Feb 2023 13:18:48 -0800 Subject: [PATCH] [Storage] Document deprecated methods on StorageStreamDownloader (#28867) --- .../azure/storage/blob/_download.py | 12 +++++++++--- .../azure/storage/blob/aio/_download_async.py | 12 +++++++++--- .../azure/storage/fileshare/_download.py | 12 +++++++++--- .../azure/storage/fileshare/aio/_download_async.py | 10 ++++++++-- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py index 36465f64ebaf..e7b77526a26b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_download.py @@ -662,10 +662,12 @@ def readall(self) -> T: return data def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -678,10 +680,12 @@ def content_as_bytes(self, max_concurrency=1): return self.readall() def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this blob, and decode as text. + """DEPRECATED: Download the contents of this blob, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -773,7 +777,9 @@ def readinto(self, stream: IO[T]) -> int: return remaining_size def download_to_stream(self, stream, max_concurrency=1): - """Download the contents of this blob to a stream. + """DEPRECATED: Download the contents of this blob to a stream. + + This method is deprecated, use func:`readinto` instead. :param stream: The stream to download to. This can be an open file-handle, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py index f6f90e487041..eb3bd645d42d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py @@ -568,10 +568,12 @@ async def readall(self) -> T: return data async def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -584,10 +586,12 @@ async def content_as_bytes(self, max_concurrency=1): return await self.readall() async def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this blob, and decode as text. + """DEPRECATED: Download the contents of this blob, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :param int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -698,7 +702,9 @@ async def readinto(self, stream: IO[T]) -> int: return remaining_size async def download_to_stream(self, stream, max_concurrency=1): - """Download the contents of this blob to a stream. + """DEPRECATED: Download the contents of this blob to a stream. + + This method is deprecated, use func:`readinto` instead. :param stream: The stream to download to. This can be an open file-handle, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py index 94a0e25ec773..080b8a83ef4e 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py @@ -398,10 +398,12 @@ def readall(self): return data def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -414,10 +416,12 @@ def content_as_bytes(self, max_concurrency=1): return self.readall() def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this file, and decode as text. + """DEPRECATED: Download the contents of this file, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -495,7 +499,9 @@ def readinto(self, stream): return self.size def download_to_stream(self, stream, max_concurrency=1): - """Download the contents of this file to a stream. + """DEPRECATED: Download the contents of this file to a stream. + + This method is deprecated, use func:`readinto` instead. :param stream: The stream to download to. This can be an open file-handle, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py index ffcddb2e7843..9feae5ff9935 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py @@ -350,10 +350,12 @@ async def readall(self): return data async def content_as_bytes(self, max_concurrency=1): - """Download the contents of this file. + """DEPRECATED: Download the contents of this file. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :rtype: bytes @@ -366,10 +368,12 @@ async def content_as_bytes(self, max_concurrency=1): return await self.readall() async def content_as_text(self, max_concurrency=1, encoding="UTF-8"): - """Download the contents of this file, and decode as text. + """DEPRECATED: Download the contents of this file, and decode as text. This operation is blocking until all data is downloaded. + This method is deprecated, use func:`readall` instead. + :keyword int max_concurrency: The number of parallel connections with which to download. :param str encoding: @@ -458,6 +462,8 @@ async def readinto(self, stream): async def download_to_stream(self, stream, max_concurrency=1): """Download the contents of this file to a stream. + This method is deprecated, use func:`readinto` instead. + :param stream: The stream to download to. This can be an open file-handle, or any writable stream. The stream must be seekable if the download