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.
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
Run mypy in azure-keyvault-secrets CI #20507
Run mypy in azure-keyvault-secrets CI #20507
Changes from 11 commits
e0e2e0c
0863a5d
622efd0
1c95057
251393a
2f028b7
fcad93a
e5c5670
2e2629e
91c34d6
aff13b0
c7678e3
8d90691
3c99736
968ab6b
71c65ed
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
content_type
,tags
, and possibly other properties should technically be optional as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Here is ignoring the errors that expect
attributes
andid
to be optional while we don't want to set them withNone
. Same in _from_secret_bundle().There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True -- I just mean that I'm surprised mypy doesn't complain despite the
content_type
property on line 62, for example, not being listed as possiblyNone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a case where the type checking gets a little confusing. A SecretBundle can have a
None
value
, which is why thisOptional[str]
type makes sense -- but also, SecretSetParameters requires a non-None
value. We have to send over SecretSetParameters to create a secret in the first place, meaning that -- in theory -- any secret we get back and turn into a KeyVaultSecret should have a value forvalue
. I don't know what to do about this yet, but I'm thinking aloud a bit about why this is awkward.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does SecretBundle have a None value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't in any real scenario I've seen (and I doubt it ever would), but its type signature leaves the possibility open.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then this introduces one question that happened several times in mypy ci:
when swagger defines a property to be optional while we think there's no chance to be None, should we ignore mypy error in this case?