-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Concentrated hash and eq inside TrelloBase to avoid repetition
- Loading branch information
Juan Christian
committed
Apr 23, 2017
1 parent
46e468c
commit 60af41b
Showing
9 changed files
with
429 additions
and
463 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
class TrelloBase(object): | ||
def __init__(self): | ||
self.id = None | ||
|
||
def __hash__(self): | ||
class_name = type(self).__name__ | ||
return hash(class_name) ^ hash(self.id) | ||
|
||
def __eq__(self, other): | ||
if isinstance(other, type(self)): | ||
return hash(self) == hash(other) | ||
raise NotImplementedError |
Oops, something went wrong.