Skip to content

Commit

Permalink
Add __hash__ for Role
Browse files Browse the repository at this point in the history
  • Loading branch information
benjello committed Oct 2, 2023
1 parent f7d979d commit b3503d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions openfisca_core/entities/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def __eq__(self, other: object) -> bool:

return self.entity == other.entity and self.key == other.key

def __hash__(self):
return hash(f"{self.entity.key}_{self.key}")

def __repr__(self) -> str:
return f"Role({self.key})"

Expand Down

0 comments on commit b3503d8

Please sign in to comment.