2323
2424from .._shared .request_handlers import validate_and_format_range_headers
2525from .._shared .response_handlers import parse_length_from_content_range , process_storage_error
26+ from .._shared .constants import DEFAULT_MAX_CONCURRENCY
2627from .._deserialize import deserialize_blob_properties , get_page_ranges_result
2728from .._download import process_range_and_offset , _ChunkDownloader
2829from .._encryption import (
@@ -239,7 +240,7 @@ def __init__(
239240 end_range : Optional [int ] = None ,
240241 validate_content : bool = None , # type: ignore [assignment]
241242 encryption_options : Dict [str , Any ] = None , # type: ignore [assignment]
242- max_concurrency : int = 1 ,
243+ max_concurrency : Optional [ int ] = None ,
243244 name : str = None , # type: ignore [assignment]
244245 container : str = None , # type: ignore [assignment]
245246 encoding : Optional [str ] = None ,
@@ -254,7 +255,7 @@ def __init__(
254255 self ._config = config
255256 self ._start_range = start_range
256257 self ._end_range = end_range
257- self ._max_concurrency = max_concurrency
258+ self ._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
258259 self ._encoding = encoding
259260 self ._validate_content = validate_content
260261 self ._encryption_options = encryption_options or {}
@@ -808,7 +809,7 @@ async def _check_and_report_progress(self):
808809 if self ._progress_hook and self ._current_content_offset == len (self ._current_content ):
809810 await self ._progress_hook (self ._download_offset , self .size )
810811
811- async def content_as_bytes (self , max_concurrency = 1 ):
812+ async def content_as_bytes (self , max_concurrency = None ):
812813 """DEPRECATED: Download the contents of this file.
813814
814815 This operation is blocking until all data is downloaded.
@@ -828,10 +829,10 @@ async def content_as_bytes(self, max_concurrency=1):
828829 raise ValueError ("Stream has been partially read in text mode. "
829830 "content_as_bytes is not supported in text mode." )
830831
831- self ._max_concurrency = max_concurrency
832+ self ._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
832833 return await self .readall ()
833834
834- async def content_as_text (self , max_concurrency = 1 , encoding = "UTF-8" ):
835+ async def content_as_text (self , max_concurrency = None , encoding = "UTF-8" ):
835836 """DEPRECATED: Download the contents of this blob, and decode as text.
836837
837838 This operation is blocking until all data is downloaded.
@@ -853,11 +854,11 @@ async def content_as_text(self, max_concurrency=1, encoding="UTF-8"):
853854 raise ValueError ("Stream has been partially read in text mode. "
854855 "content_as_text is not supported in text mode." )
855856
856- self ._max_concurrency = max_concurrency
857+ self ._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
857858 self ._encoding = encoding
858859 return await self .readall ()
859860
860- async def download_to_stream (self , stream , max_concurrency = 1 ):
861+ async def download_to_stream (self , stream , max_concurrency = None ):
861862 """DEPRECATED: Download the contents of this blob to a stream.
862863
863864 This method is deprecated, use func:`readinto` instead.
@@ -879,6 +880,6 @@ async def download_to_stream(self, stream, max_concurrency=1):
879880 raise ValueError ("Stream has been partially read in text mode. "
880881 "download_to_stream is not supported in text mode." )
881882
882- self ._max_concurrency = max_concurrency
883+ self ._max_concurrency = max_concurrency if max_concurrency is not None else DEFAULT_MAX_CONCURRENCY
883884 await self .readinto (stream )
884885 return self .properties
0 commit comments