Skip to content

Enable Mypy to check that enum match is exhaustive #50

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

Closed
wants to merge 1 commit into from
Closed

Enable Mypy to check that enum match is exhaustive #50

wants to merge 1 commit into from

Conversation

ysangkok
Copy link

Fixes #49

@dgpv
Copy link

dgpv commented Oct 13, 2020

Thanks for the code. I've decided to take it up a notch and make assert_never into a function exported from bitcointx.util. I've also changed some typing code in psbt, and the use of TypeVar allowed to uncover a few wrinkles, like using == instead of is for checking the enums.

My code is at #51

@dgpv
Copy link

dgpv commented Oct 13, 2020

Using TypeVar there to turn read_psbt_keymap into a generic function allowed to avoid asserting assert isinstance(key_type, PSBT_InKeyType) explicitly

@ysangkok
Copy link
Author

Good, that is better

@ysangkok ysangkok closed this Oct 13, 2020
@ysangkok ysangkok deleted the mypy-check-exhaustive-enum branch October 13, 2020 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants