Skip to content
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

Mypy: Syntax errors #20157

Closed
Dreamsorcerer opened this issue Aug 9, 2021 · 7 comments
Closed

Mypy: Syntax errors #20157

Dreamsorcerer opened this issue Aug 9, 2021 · 7 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@Dreamsorcerer
Copy link

Dreamsorcerer commented Aug 9, 2021

By mistake, we started using the prerelease version 12.9.0b1 of azure-storage-blob in our CI.

This resulted in these syntax errors from mypy:

/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_serialize.py:46: error: Type signature has too few arguments [syntax]
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_serialize.py:129: error: Type signature has too few arguments [syntax]
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_blob_client.py:1408: error: Type signature has too few arguments [syntax]
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_blob_client.py:1448: error: Type signature has too few arguments [syntax]

If you check the code at those locations, they are obviously wrong as the number of arguments in the type annotation does not match the number of arguments in the definition.

To avoid these mistakes in future, I'd suggest using the common-practice inline annotations, which would make it impossible to make this mistake:

def get_modify_conditions(kwargs: Dict[str, object]) -> ModifiedAccessConditions:
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 9, 2021
@swathipil swathipil added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Aug 9, 2021
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Aug 9, 2021
@swathipil swathipil added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Aug 9, 2021
@swathipil
Copy link
Member

@Dreamsorcerer, thanks for the suggestion! Directing it to the right people, so they can address this!

@amishra-dev
Copy link

Thanks for reporting this @Dreamsorcerer (Sam). We are tracking this work as a part of #20083

@amishra-dev amishra-dev added feature-request This issue requires a new behavior in the product in order be resolved. and removed bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Aug 15, 2021
@rnestler
Copy link
Contributor

I fixed some of the type annotations in #20084

@Dreamsorcerer
Copy link
Author

As another suggestion, it would be a good idea to actually setup mypy as a CI check. I can review PRs or answer questions relating to this if help is needed (I've setup several other projects before).

@lmazuel lmazuel added the Service Attention Workflow: This issue is responsible by Azure service team. label Sep 10, 2021
@ghost
Copy link

ghost commented Sep 10, 2021

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

Issue Details

By mistake, we started using the prerelease version 12.9.0b1 of azure-storage-blob in our CI.

This resulted in these syntax errors from mypy:

/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_serialize.py:46: error: Type signature has too few arguments [syntax]
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_serialize.py:129: error: Type signature has too few arguments [syntax]
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_blob_client.py:1408: error: Type signature has too few arguments [syntax]
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/azure_storage_blob-12.9.0b1-py3.8.egg/azure/storage/blob/_blob_client.py:1448: error: Type signature has too few arguments [syntax]

If you check the code at those locations, they are obviously wrong as the number of arguments in the type annotation does not match the number of arguments in the definition.

To avoid these mistakes in future, I'd suggest using the common-practice inline annotations, which would make it impossible to make this mistake:

def get_modify_conditions(kwargs: Dict[str, object]) -> ModifiedAccessConditions:
Author: Dreamsorcerer
Assignees: xiafu-msft
Labels:

feature-request, Storage, Service Attention, Client, customer-reported, needs-team-attention

Milestone: -

@dimbleby
Copy link
Member

Broken typing is now released at 12.9.0

@jalauzon-msft
Copy link
Member

Hi all, sorry for the long delay getting these fixed. I believe these have been addressed in #22741 and #23098 and will be part of our next release of 12.10.

azure-sdk pushed a commit to azure-sdk/azure-sdk-for-python that referenced this issue Aug 10, 2022
change the name of a new enumeration in storage's latest api-version (Azure#20157)

* change the name of a new enumeration

* revert changes in python readme

* add directive to mitigate go sdk breaking change

Co-authored-by: Chenjie Shi <tadelesh.shi@live.cn>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request This issue requires a new behavior in the product in order be resolved. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

9 participants