-
Notifications
You must be signed in to change notification settings - Fork 40
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
Models do not override __hash__ making them unusable in hashed collections #38
Comments
asqui
added a commit
to BATS/opsgenie-python-sdk
that referenced
this issue
Feb 3, 2020
...so it can be used in hashable collection. (This is a temporary patch to work around issue opsgenie#38)
asqui
added a commit
to BATS/opsgenie-python-sdk
that referenced
this issue
Feb 3, 2020
* add-__hash__-to-models-opsgenie#38: Define __hash__ for Responders model ...so it can be used in hashable collection. (This is a temporary patch to work around issue opsgenie#38)
asqui
added a commit
to BATS/opsgenie-python-sdk
that referenced
this issue
Feb 3, 2020
* add-__hash__-to-models-opsgenie#38: Define __hash__ for Responders model
asqui
added a commit
to BATS/opsgenie-python-sdk
that referenced
this issue
Feb 3, 2020
...so it can be used in hashable collection. (This is a temporary patch to work around issue opsgenie#38)
The fix for this is quite simple (see example here: BATS@5fceef1) and it would be good if this could be fixed here so that I don't need to maintain a separate fork with the workaround for this issue... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Models such as
Responders
define the__eq__()
and__ne__()
methods appropriately, but not__hash__()
.From the Python documentation:
The practical consequence of this is that
set((Responders(type='team', name='foo'))) != set((Responders(type='team', name='foo')))
which is quite confusing!I suspect that this may be a bug coming from the Open Api Generator, but I am not familiar with the generator implementation and its use so am raising this bug here in the first instance.
The text was updated successfully, but these errors were encountered: