Fix typing contract for max_concurrency in File Share client#45637
Merged
nateprewitt merged 2 commits intoAzure:mainfrom Mar 11, 2026
Merged
Fix typing contract for max_concurrency in File Share client#45637nateprewitt merged 2 commits intoAzure:mainfrom
nateprewitt merged 2 commits intoAzure:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the File Share client typing contract and runtime behavior so max_concurrency can be passed as None (meaning “use the SDK default”), matching the pattern established in related storage SDK typing work.
Changes:
- Update sync/async
ShareFileClientstubs to typemax_concurrencyasOptional[int] = Nonefor upload and download APIs. - Add
DEFAULT_MAX_CONCURRENCYand use it when callers passmax_concurrency=None(including deprecated download helpers). - Add sync/async tests validating that
max_concurrency=Nonedoes not raise and operations succeed.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/storage/azure-storage-file-share/tests/test_file.py | Adds coverage for max_concurrency=None on sync upload/download. |
| sdk/storage/azure-storage-file-share/tests/test_file_async.py | Adds coverage for max_concurrency=None on async upload/download. |
| sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.pyi | Updates typing contract for max_concurrency to Optional[int] = None. |
| sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.pyi | Updates typing contract for max_concurrency to Optional[int] = None. |
| sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py | Treats max_concurrency=None as “use default” via DEFAULT_MAX_CONCURRENCY. |
| sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py | Async equivalent handling for max_concurrency=None. |
| sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py | Downloader paths accept None and substitute the default. |
| sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py | Async downloader paths accept None and substitute the default. |
| sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/constants.py | Introduces DEFAULT_MAX_CONCURRENCY = 1. |
| sdk/storage/azure-storage-file-share/assets.json | Updates the assets tag pointer. |
Comments suppressed due to low confidence (2)
sdk/storage/azure-storage-file-share/azure/storage/fileshare/_download.py:406
max_concurrencynow supportsNone(fallback toDEFAULT_MAX_CONCURRENCY), but the docstrings below still declare:param int max_concurrency:. Please update the docstring to indicateOptional[int]and explain theNonebehavior.
def content_as_bytes(self, max_concurrency=None):
"""DEPRECATED: Download the contents of this file.
This operation is blocking until all data is downloaded.
sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_download_async.py:366
- These deprecated helpers now accept
max_concurrency=None(fallback toDEFAULT_MAX_CONCURRENCY), but the docstrings still specify:param int max_concurrency:. Please update the parameter docs to reflectOptional[int]and theNonebehavior.
async def content_as_bytes(self, max_concurrency=None):
"""DEPRECATED: Download the contents of this file.
This operation is blocking until all data is downloaded.
sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py
Show resolved
Hide resolved
sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py
Show resolved
Hide resolved
jalauzon-msft
approved these changes
Mar 11, 2026
sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/constants.py
Show resolved
Hide resolved
weirongw23-msft
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PR 3/3 for typing changes started in #45598. This will fix the remaining pieces from the File Share client.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines