Conversation
[ty](https://docs.astral.sh/ty/) is a modern replacement of mypy written in Rust. Even though it is still in Beta, it is almost ready for production. Therefore, there is nothing blocking us from giving it a chance. JIRA: TRIVIAL risk: low
| with open(local_target_path, "wb") as download_file: | ||
| download_file.write(blob_client.download_blob().readall()) | ||
| blob_data = blob_client.download_blob().readall() | ||
| if isinstance(blob_data, bytes): |
There was a problem hiding this comment.
Should we fail explicitly if this does not hold? Or would assert isinstance(blob_data, bytes) be better?
There was a problem hiding this comment.
The condition might not be necessary. IDE shows that blob_data is a bytes object.
There was a problem hiding this comment.
Changed to assert. Let's wait for @benkeanna to confirm the behaviour.
There was a problem hiding this comment.
Yes, the readall should return bytes, but ty needs the isinstance or assert to be happy. @benkeanna do you have a preference here?
There was a problem hiding this comment.
I would trust the Azure lib to return bytes and do a cast as @janmatzek suggests to satisfy the type checker
There was a problem hiding this comment.
I would be for now :)
Or we can do this
def read_blob_bytes(client: BlobClient) -> bytes:
return client.download_blob().readall()No cast, and the helper has an explicit return type.
There was a problem hiding this comment.
Okay, let's keep the cast and change it later.
There was a problem hiding this comment.
I enabled auto-merge.
JIRA: TRIVIAL risk: low

ty is a modern replacement of mypy written in Rust. Even though it is still in Beta, it is almost ready for production. Therefore, there is nothing blocking us from giving it a chance.
Before:

After:

JIRA: TRIVIAL
risk: low