Repository navigation
Fix mypy error on master - #5865
Merged
Merged
Conversation
tanujkhattar
requested review from
a team,
cduck,
verult,
vtomole and
wcourtney
as code owners
September 7, 2022 22:37
pavoljuhas
reviewed
Sep 7, 2022
pavoljuhas
requested changes
Sep 7, 2022
pavoljuhas
left a comment
Collaborator
There was a problem hiding this comment.
I think we can just drop the .value attribute.
Contributor
|
Automerge cancelled: A status check is failing. |
rht
pushed a commit
to rht/Cirq
that referenced
this pull request
May 1, 2023
* Fix mypy error on master * Remove .value * Remove unused import
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.
mypy tests on master are currently failing. See https://github.com/quantumlib/Cirq/runs/8237862866?check_suite_focus=true
This PR fixes the failing test.
google/api_core/exceptions defines
code: Union[None, int]. Seehttps://github.com/googleapis/python-api-core/blob/fe617c205918a3e4dfddeb06123e70540898032e/google/api_core/exceptions.py#L119
However, the derived classes can assign an enum to
code. Seehttps://github.com/googleapis/python-api-core/blob/fe617c205918a3e4dfddeb06123e70540898032e/google/api_core/exceptions.py#L222
This PR assumes that
codecan beUnion[None, int, enum.Enum]and handles the 3 cases appropriately, thus getting rid of the mypy error.