Implement hash for CompletableGithubObject (#1922)

Since CompletableGithubObject already uses its URL attribute to
implement equality, extend it to also use that attribute for hashing.

Fixes #1826
This commit is contained in:
Steve Kowalik
2021-04-26 14:24:00 +10:00
committed by GitHub
parent e4168109dd
commit 4faff23ce9
2 changed files with 5 additions and 4 deletions
+3
View File
@@ -286,6 +286,9 @@ class CompletableGithubObject(GithubObject):
def __eq__(self, other):
return other.__class__ is self.__class__ and other._url.value == self._url.value
def __hash__(self):
return hash(self._url.value)
def __ne__(self, other):
return not self == other